summaryrefslogtreecommitdiff
path: root/silx/gui/plot/test/testCurvesROIWidget.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot/test/testCurvesROIWidget.py')
-rw-r--r--silx/gui/plot/test/testCurvesROIWidget.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/silx/gui/plot/test/testCurvesROIWidget.py b/silx/gui/plot/test/testCurvesROIWidget.py
index 0fd2456..7a2e3d1 100644
--- a/silx/gui/plot/test/testCurvesROIWidget.py
+++ b/silx/gui/plot/test/testCurvesROIWidget.py
@@ -24,7 +24,7 @@
# ###########################################################################*/
"""Basic tests for CurvesROIWidget"""
-__authors__ = ["T. Vincent", "P. Knobel"]
+__authors__ = ["T. Vincent", "P. Knobel", "H. Payno"]
__license__ = "MIT"
__date__ = "16/11/2017"
@@ -32,9 +32,8 @@ __date__ = "16/11/2017"
import logging
import os.path
import unittest
-
+from collections import OrderedDict
import numpy
-
from silx.gui import qt
from silx.test.utils import temp_dir
from silx.gui.test.utils import TestCaseQt
@@ -153,6 +152,25 @@ class TestCurvesROIWidget(TestCaseQt):
self.assertEqual(output["negative"]["rawcounts"],
y[selection].sum(), "Calculation failed on negative X coordinates")
+ def testDeferedInit(self):
+ x = numpy.arange(100.)
+ y = numpy.arange(100.)
+ self.plot.addCurve(x=x, y=y, legend="name", replace="True")
+ roisDefs = OrderedDict([
+ ["range1",
+ OrderedDict([["from", 20], ["to", 200], ["type", "energy"]])],
+ ["range2",
+ OrderedDict([["from", 300], ["to", 500], ["type", "energy"]])]
+ ])
+
+ roiWidget = self.plot.getCurvesRoiDockWidget().roiWidget
+ self.assertFalse(roiWidget._isInit)
+ self.plot.getCurvesRoiDockWidget().setRois(roisDefs)
+ self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))
+ self.plot.getCurvesRoiDockWidget().setVisible(True)
+ self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))
+
+
def suite():
test_suite = unittest.TestSuite()
for TestClass in (TestCurvesROIWidget,):