]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Added some tests for the new features; working on the IDs again to make sure IDs...
authorjh777916 <juba.hamma@cea.fr>
Mon, 9 Oct 2023 09:15:56 +0000 (11:15 +0200)
committerjh777916 <juba.hamma@cea.fr>
Mon, 9 Oct 2023 09:15:56 +0000 (11:15 +0200)
20 files changed:
tools/CurvePlot/src/python/controller/PlotController.py
tools/CurvePlot/src/python/test/PlotTestBase.py
tools/CurvePlot/src/python/test/baselines/testAddBarplot.png [new file with mode: 0644]
tools/CurvePlot/src/python/test/baselines/testAddStemplot.png [new file with mode: 0644]
tools/CurvePlot/src/python/test/baselines/testDeleteCurrentItem_curve.png
tools/CurvePlot/src/python/test/baselines/testDeleteCurve1.png
tools/CurvePlot/src/python/test/baselines/testDeleteCurve2.png
tools/CurvePlot/src/python/test/baselines/testExtendCurve.png
tools/CurvePlot/src/python/test/baselines/testLockRepaint.png
tools/CurvePlot/src/python/test/baselines/testResetCurve.png
tools/CurvePlot/src/python/test/baselines/testSelectedBarplot.png [new file with mode: 0644]
tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve.png
tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve2.png
tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve3.png
tools/CurvePlot/src/python/test/baselines/testSetCurveMarker.png
tools/CurvePlot/src/python/test/baselines/testSettingsCurveColor.png
tools/CurvePlot/src/python/test/baselines/testSettingsCurveMarker.png
tools/CurvePlot/src/python/test/baselines/testShowAll.png [new file with mode: 0644]
tools/CurvePlot/src/python/test/baselines/testShowOnlySelected.png [new file with mode: 0644]
tools/CurvePlot/src/python/test/plot_test.py

index aa3bd46840b2ceec00b866b2231b0354417153c8..f56fe61f1e4e38f56a6ffab29a9ad7bc7ac43291 100644 (file)
@@ -703,6 +703,20 @@ class PlotController(object):
     cls.__XYViewOperation("setLegendVisible", ps_id, args, kwargs)
 
 
+  @classmethod
+  def ShowOnlySelected(cls, ps_id):
+    """ Show only the current active curve."""
+    args, kwargs = [], {}
+    cls.__XYViewOperation("showOnlySelected", ps_id, args, kwargs)
+
+
+  @classmethod
+  def ShowAll(cls, ps_id):
+    """ Show all curves.
+    """
+    args, kwargs = [], {}
+    cls.__XYViewOperation("showAll", ps_id, args, kwargs)
+
   ###
   ### More advanced functions
   ###
index f8d854f2f6d2b01569c13664bb3779a42ac7471e..a2c5377c4d8e9e5cc6cc747393929ac108ff3bcf 100644 (file)
@@ -110,6 +110,8 @@ class PlotTestBase(unittest.TestCase):
 
     # Reset some class var to make sure IDs appearing in screenshots do not depend on test seq order:
     CurveModel.START_ID = -1
+    BarModel.START_ID = -1
+    StemModel.START_ID = -1
     TableModel.START_ID = -1
     XYPlotSetModel.START_ID = -1
 
diff --git a/tools/CurvePlot/src/python/test/baselines/testAddBarplot.png b/tools/CurvePlot/src/python/test/baselines/testAddBarplot.png
new file mode 100644 (file)
index 0000000..70427b5
Binary files /dev/null and b/tools/CurvePlot/src/python/test/baselines/testAddBarplot.png differ
diff --git a/tools/CurvePlot/src/python/test/baselines/testAddStemplot.png b/tools/CurvePlot/src/python/test/baselines/testAddStemplot.png
new file mode 100644 (file)
index 0000000..b98e45e
Binary files /dev/null and b/tools/CurvePlot/src/python/test/baselines/testAddStemplot.png differ
index cad5c6413c26f96c2811737ef872914f7548010c..7829eefd224c540ab16af0e4d5bdde3e60c0ab05 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testDeleteCurrentItem_curve.png and b/tools/CurvePlot/src/python/test/baselines/testDeleteCurrentItem_curve.png differ
index 7e7d8b87deb187cd07bee1b35d673e32471ce10c..b184a7a928691e56da4dfa6ac3dd8d2f3f6b0f79 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testDeleteCurve1.png and b/tools/CurvePlot/src/python/test/baselines/testDeleteCurve1.png differ
index b184a7a928691e56da4dfa6ac3dd8d2f3f6b0f79..05e08a8f29deae10dfbcfe845b772254d96c87bb 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testDeleteCurve2.png and b/tools/CurvePlot/src/python/test/baselines/testDeleteCurve2.png differ
index 3baf88b13a9a13121a5ee7fb74aabbe9ac62068a..d28e7940f09f3c88f74b079e8066c3a753e2281e 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testExtendCurve.png and b/tools/CurvePlot/src/python/test/baselines/testExtendCurve.png differ
index 7349cb4a2f579e3a5c32d60cfe70890c2db32b5c..a4e767d1ed1e5262c913fe1aced00690e0b3eeb6 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testLockRepaint.png and b/tools/CurvePlot/src/python/test/baselines/testLockRepaint.png differ
index a590a75016bb5431cd3336d5e8e9dfc9f97414ac..779bfa5955704ec6c4053d7edbcca7ceb481d49e 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testResetCurve.png and b/tools/CurvePlot/src/python/test/baselines/testResetCurve.png differ
diff --git a/tools/CurvePlot/src/python/test/baselines/testSelectedBarplot.png b/tools/CurvePlot/src/python/test/baselines/testSelectedBarplot.png
new file mode 100644 (file)
index 0000000..f399651
Binary files /dev/null and b/tools/CurvePlot/src/python/test/baselines/testSelectedBarplot.png differ
index 1f3f9c3edff06b7a22163c54b2b8d1f0fde0b7a3..333754c0b0b13ce7484e55fa56cc26b8b8874cc2 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve.png and b/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve.png differ
index 6b3c55f0e2116e58f70291a8eb9f6d1fcc67c6a9..9cb0e294486d9aec792749c54a945ecf125d6af2 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve2.png and b/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve2.png differ
index 72af0566ccb0b1911551845172609cdea329474e..9c2c290287f5f1a20e3a392f098db37595bf9290 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve3.png and b/tools/CurvePlot/src/python/test/baselines/testSetCurrentCurve3.png differ
index 7edd9525fa61d094827aa279493809ac989a8777..816c706624d44a1d01bf374fb54d714b13a0027c 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSetCurveMarker.png and b/tools/CurvePlot/src/python/test/baselines/testSetCurveMarker.png differ
index 9694c4654a1ca163e240b969c54ebb6aace816cd..f0db9425d0573c3b36b899021717ab3ffacb8c9c 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSettingsCurveColor.png and b/tools/CurvePlot/src/python/test/baselines/testSettingsCurveColor.png differ
index 32d57616ffdb62320805e96039b67ebddf5c5296..fe56d56563f2639a0507595d7c9aafc00569a63c 100644 (file)
Binary files a/tools/CurvePlot/src/python/test/baselines/testSettingsCurveMarker.png and b/tools/CurvePlot/src/python/test/baselines/testSettingsCurveMarker.png differ
diff --git a/tools/CurvePlot/src/python/test/baselines/testShowAll.png b/tools/CurvePlot/src/python/test/baselines/testShowAll.png
new file mode 100644 (file)
index 0000000..54b91a5
Binary files /dev/null and b/tools/CurvePlot/src/python/test/baselines/testShowAll.png differ
diff --git a/tools/CurvePlot/src/python/test/baselines/testShowOnlySelected.png b/tools/CurvePlot/src/python/test/baselines/testShowOnlySelected.png
new file mode 100644 (file)
index 0000000..792d52d
Binary files /dev/null and b/tools/CurvePlot/src/python/test/baselines/testShowOnlySelected.png differ
index 34b79311ecdc41c6379cb14f43d0b0d50eab32af..9288321a8e855a2e541a1db83eb5f8bf6c512da9 100644 (file)
@@ -338,6 +338,7 @@ class PlotTest(PlotTestBase):
     cont.plotCurveFromTable(t, y_col_index=2, append=True)
     self.assertTrue(self.areScreenshotEqual(tw))
 
+  @runOnly
   def testSettingsCurveColor(self):
     tw = self.showTabWidget()
     x, y = self.generateSine()
@@ -513,7 +514,67 @@ class PlotTest(PlotTestBase):
     self.assertEqual(psID0, psID2)
     l, _ = PlotController.GetAllPlotSets()
     self.assertEqual(1, len(l))
+
+  def testAddBarplot(self):
+    import numpy as np
+    tw = self.showTabWidget()
+    barplotTicks = np.array([0., 1, 2, 4, 8, 9, 11, 14, 14.6])
+    barplotHeight = np.array([3, 2, 1.2, 7, 4, 3, 1, 4.3])
+    PlotController.AddBarPlot(barplotTicks, barplotHeight, 
+                                        x_label="Energï", y_label="Intënsîty", append=False)
+    self.assertTrue(self.areScreenshotEqual(tw))
+
+  def testAddStemplot(self):
+    x, y = self.generateSine()
+    tw = self.showTabWidget()
+    PlotController.AddStemPlot(x, y, curve_label="My stem",
+                   x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=False)
+    self.assertTrue(self.areScreenshotEqual(tw))
+
+  def testSelectedBarplot(self):
+    import numpy as np
+    tw = self.showTabWidget()
+    barplotTicks = np.array([0., 10, 20, 40, 80, 90, 110, 140, 146])
+    barplotHeight = np.array([3, 2, 1.2, 7, 4, 3, 1, 4.3])
+    crvId, psId = PlotController.AddBarPlot(barplotTicks, barplotHeight, 
+                                        x_label="Energï", y_label="Intënsîty", append=False)
+    x, y = self.generateSine()
+    PlotController.AddStemPlot(x, y, curve_label="My stem",
+                  x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=True)
+
+    PlotController.SetCurrentCurve(crvId)
+    self.assertTrue(self.areScreenshotEqual(tw))
+
+  def testShowOnlySelected(self):
+    import numpy as np
+    tw = self.showTabWidget()
+    barplotTicks = np.array([0., 10, 20, 40, 80, 90, 110, 140, 146])
+    barplotHeight = np.array([3, 2, 1.2, 7, 4, 3, 1, 4.3])
+    PlotController.AddBarPlot(barplotTicks, barplotHeight, 
+                                        x_label="Energï", y_label="Intënsîty", append=False)
+    x, y = self.generateSine()
+    crvId, psId = PlotController.AddStemPlot(x, y, curve_label="My stem",
+                  x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=True)
+
+    PlotController.SetCurrentCurve(crvId)
+    PlotController.ShowOnlySelected(psId)
+    self.assertTrue(self.areScreenshotEqual(tw))
+
+  def testShowAll(self):
+    import numpy as np
+    tw = self.showTabWidget()
+    barplotTicks = np.array([0., 10, 20, 40, 80, 90, 110, 140, 146])
+    barplotHeight = np.array([3, 2, 1.2, 7, 4, 3, 1, 4.3])
+    PlotController.AddBarPlot(barplotTicks, barplotHeight, 
+                                        x_label="Energï", y_label="Intënsîty", append=False)
+    x, y = self.generateSine()
+    crvId, psId = PlotController.AddStemPlot(x, y, curve_label="My stem",
+                  x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=True)
+
+    PlotController.SetCurrentCurve(crvId)
+    PlotController.ShowAll(psId)
+    self.assertTrue(self.areScreenshotEqual(tw))
+
 # Even if not in main:
 processDecorator(__name__)