summaryrefslogtreecommitdiff
path: root/silx/gui/plot/test/testUtilsAxis.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot/test/testUtilsAxis.py')
-rw-r--r--silx/gui/plot/test/testUtilsAxis.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/silx/gui/plot/test/testUtilsAxis.py b/silx/gui/plot/test/testUtilsAxis.py
index 6702b00..3f19dcd 100644
--- a/silx/gui/plot/test/testUtilsAxis.py
+++ b/silx/gui/plot/test/testUtilsAxis.py
@@ -26,18 +26,20 @@
__authors__ = ["V. Valls"]
__license__ = "MIT"
-__date__ = "04/08/2017"
+__date__ = "14/02/2018"
import unittest
from silx.gui.plot import PlotWidget
+from silx.gui.test.utils import TestCaseQt
from silx.gui.plot.utils.axis import SyncAxes
-class TestAxisSync(unittest.TestCase):
+class TestAxisSync(TestCaseQt):
"""Tests AxisSync class"""
def setUp(self):
+ TestCaseQt.setUp(self)
self.plot1 = PlotWidget()
self.plot2 = PlotWidget()
self.plot3 = PlotWidget()
@@ -46,6 +48,7 @@ class TestAxisSync(unittest.TestCase):
self.plot1 = None
self.plot2 = None
self.plot3 = None
+ TestCaseQt.tearDown(self)
def testMoveFirstAxis(self):
"""Test synchronization after construction"""
@@ -85,6 +88,22 @@ class TestAxisSync(unittest.TestCase):
self.assertNotEqual(self.plot2.getXAxis().getLimits(), (10, 500))
self.assertNotEqual(self.plot3.getXAxis().getLimits(), (10, 500))
+ def testAxisDestruction(self):
+ """Test synchronization when an axis disappear"""
+ _sync = SyncAxes([self.plot1.getXAxis(), self.plot2.getXAxis(), self.plot3.getXAxis()])
+
+ # Destroy the plot is possible
+ import weakref
+ plot = weakref.ref(self.plot2)
+ self.plot2 = None
+ result = self.qWaitForDestroy(plot)
+ if not result:
+ # We can't test
+ self.skipTest("Object not destroyed")
+
+ self.plot1.getXAxis().setLimits(10, 500)
+ self.assertEqual(self.plot3.getXAxis().getLimits(), (10, 500))
+
def testStop(self):
"""Test synchronization after calling stop"""
sync = SyncAxes([self.plot1.getXAxis(), self.plot2.getXAxis(), self.plot3.getXAxis()])