]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
bos #17915 Enable tests for CurvePlot
authorvsr <vsr@opencascade.com>
Tue, 22 Sep 2020 10:57:18 +0000 (13:57 +0300)
committervsr <vsr@opencascade.com>
Tue, 22 Sep 2020 10:59:45 +0000 (13:59 +0300)
This reverts commit 0563bd922f2df703a0ed9dc599e81de6a76237f7.

tools/CurvePlot/src/python/test/CMakeLists.txt
tools/CurvePlot/src/python/test/PlotCurve_Standalone.py
tools/CurvePlot/src/python/test/PlotTestBase.py
tools/CurvePlot/src/python/test/plot_test.py

index e4193663bad126638e2bb3f674ecb51fd57422c2..42fe1d007074fe449679b248f8fe7ea884b0bd66 100644 (file)
@@ -23,7 +23,6 @@ SALOME_CONFIGURE_FILE(SalomePyQt_MockUp.py.in mockup/SalomePyQt_MockUp.py)
 SET(_all_SCRIPTS
     PlotCurve_Standalone.py
     plot_test.py
-    TestDesktop.py
 )
 
 SET(_test_SCRIPTS
@@ -33,7 +32,7 @@ SET(_test_SCRIPTS
 )
 
 SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}/tests)
-SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/mockup/SalomePyQt_MockUp.py ${SALOME_INSTALL_SCRIPT_PYTHON}/tests)
+SALOME_INSTALL_SCRIPTS("${_test_SCRIPTS}" ${SALOME_CURVEPLOT_INSTALL_PYTHON})
 
 INSTALL(DIRECTORY baselines DESTINATION ${SALOME_INSTALL_SCRIPT_PYTHON}/tests)
 
index 79498bbf9b662cf3f8ad7590e8280e9abc6273b2..a6966d1c53146e2cafd173618f9c91712240e2b3 100755 (executable)
@@ -22,8 +22,8 @@
 from pyqtside.QtWidgets import QApplication
 from pyqtside.QtCore import QTimer, QTranslator
 
-from TestDesktop import TestDesktop
-import SalomePyQt_MockUp
+from curveplot.TestDesktop import TestDesktop
+from curveplot.SalomePyQt_MockUp import SalomePyQt
 
 desktop = None
 
@@ -46,7 +46,7 @@ def main(args) :
     x, y = dw.width()*0.25, dw.height()*0.7
 
     desktop = TestDesktop(None)
-    sgPyQt = SalomePyQt_MockUp.SalomePyQt(desktop)
+    sgPyQt = SalomePyQt(desktop)
     sgPyQt.currentTabChanged.connect(activeViewChanged)
     desktop._sgPyQt = sgPyQt
     desktop.initialize()
index a6f45125f4b5182856b8d93732e8b9a91e1d104f..b53c13e0c443e604ece8394854898f438c895bb2 100644 (file)
@@ -81,11 +81,11 @@ class PlotTestBase(unittest.TestCase):
 
   def setUp(self):
     import sys
-    from mockup.SalomePyQt_MockUp import SalomePyQt
+    from curveplot.SalomePyQt_MockUp import SalomePyQt
     from curveplot.TableModel import TableModel
     from curveplot.CurveModel import CurveModel
     from curveplot.XYPlotSetModel import XYPlotSetModel
-    from TestDesktop import TestDesktop
+    from curveplot.TestDesktop import TestDesktop
 
     self.qpixmap = None
     self.keepDir = False
@@ -95,7 +95,7 @@ class PlotTestBase(unittest.TestCase):
       self.tmpDir = None
 
     # Minimal UI setup:
-    self.app = QApplication(sys.argv)
+    self.app = QApplication.instance() or QApplication(sys.argv)
     desktop = TestDesktop(None)
     self.sgPyQt = SalomePyQt(desktop)
     desktop._sgPyQt = self.sgPyQt
index 82db5e7755d614cbbc2aee44f1bdb1ae0af1899a..3267193323bedf1776e5a3335c24d41a2edb3e51 100644 (file)
@@ -20,7 +20,7 @@
 # Author : A. Bruneton
 #
 from curveplot import *
-from PlotTestBase import PlotTestBase, processDecorator
+from curveplot.PlotTestBase import PlotTestBase, processDecorator
 from curveplot.PlotSettings import PlotSettings
 
 from pyqtside.QtWidgets import QApplication
@@ -41,7 +41,6 @@ class PlotTest(PlotTestBase):
 
   def __init__(self, methodName):
     PlotTestBase.__init__(self, methodName)
-    
 
   ###
   ### Data generation
@@ -50,7 +49,6 @@ class PlotTest(PlotTestBase):
     import numpy as np
     x = np.arange(100)
     y = np.sin(x*alpha/np.pi)
-    print(1)
     return x, y
 
   def generateExp(self, alpha=1.0):
@@ -146,7 +144,7 @@ class PlotTest(PlotTestBase):
     x, y = self.generateSine()
     tw = self.showTabWidget()
     PlotController.AddCurve(x, y, curve_label="My curve", x_label="Lèés X (unicode!)", y_label="Et des ŷ", append=False)
-    self.assertTrue(self.areScreenshotEqual(tw), msg='Hello!')
+    self.assertTrue(self.areScreenshotEqual(tw))
 
   def testAddCurveAppend(self):
     x, y = self.generateSine()