From: vsr Date: Tue, 22 Sep 2020 10:57:18 +0000 (+0300) Subject: bos #17915 Enable tests for CurvePlot X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4b6adfa45b7f611cc9249da83eee62552994bb0e;p=modules%2Fgui.git bos #17915 Enable tests for CurvePlot This reverts commit 0563bd922f2df703a0ed9dc599e81de6a76237f7. --- diff --git a/tools/CurvePlot/src/python/test/CMakeLists.txt b/tools/CurvePlot/src/python/test/CMakeLists.txt index e4193663b..42fe1d007 100644 --- a/tools/CurvePlot/src/python/test/CMakeLists.txt +++ b/tools/CurvePlot/src/python/test/CMakeLists.txt @@ -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) diff --git a/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py b/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py index 79498bbf9..a6966d1c5 100755 --- a/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py +++ b/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py @@ -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() diff --git a/tools/CurvePlot/src/python/test/PlotTestBase.py b/tools/CurvePlot/src/python/test/PlotTestBase.py index a6f45125f..b53c13e0c 100644 --- a/tools/CurvePlot/src/python/test/PlotTestBase.py +++ b/tools/CurvePlot/src/python/test/PlotTestBase.py @@ -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 diff --git a/tools/CurvePlot/src/python/test/plot_test.py b/tools/CurvePlot/src/python/test/plot_test.py index 82db5e775..326719332 100644 --- a/tools/CurvePlot/src/python/test/plot_test.py +++ b/tools/CurvePlot/src/python/test/plot_test.py @@ -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()