From a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= Date: Tue, 28 May 2019 08:16:16 +0200 Subject: New upstream version 0.10.1+dfsg --- silx/gui/plot/test/testPlotWidget.py | 61 +++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'silx/gui/plot/test/testPlotWidget.py') diff --git a/silx/gui/plot/test/testPlotWidget.py b/silx/gui/plot/test/testPlotWidget.py index 857b9bc..9d7c093 100644 --- a/silx/gui/plot/test/testPlotWidget.py +++ b/silx/gui/plot/test/testPlotWidget.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2018 European Synchrotron Radiation Facility +# Copyright (c) 2016-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,7 @@ __authors__ = ["T. Vincent"] __license__ = "MIT" -__date__ = "21/09/2018" +__date__ = "03/01/2019" import unittest @@ -36,8 +36,6 @@ import numpy from silx.utils.testutils import ParametricTestCase, parameterize from silx.gui.utils.testutils import SignalListener from silx.gui.utils.testutils import TestCaseQt -from silx.utils import testutils -from silx.utils import deprecation from silx.test.utils import test_options @@ -184,6 +182,39 @@ class TestPlotWidget(PlotWidgetTestCase, ParametricTestCase): self.assertTrue(numpy.all(numpy.equal(items[4].getPosition()[0], marker_x))) self.assertEqual(items[5].getType(), 'rectangle') + def testBackGroundColors(self): + self.plot.setVisible(True) + self.qWaitForWindowExposed(self.plot) + self.qapp.processEvents() + + # Custom the full background + color = self.plot.getBackgroundColor() + self.assertTrue(color.isValid()) + self.assertEqual(color, qt.QColor(255, 255, 255)) + self.plot.setBackgroundColor("red") + color = self.plot.getBackgroundColor() + self.assertTrue(color.isValid()) + self.qapp.processEvents() + + # Custom the data background + color = self.plot.getDataBackgroundColor() + self.assertFalse(color.isValid()) + self.plot.setDataBackgroundColor("red") + color = self.plot.getDataBackgroundColor() + self.assertTrue(color.isValid()) + self.qapp.processEvents() + + # Back to default + self.plot.setBackgroundColor('white') + self.plot.setDataBackgroundColor(None) + color = self.plot.getBackgroundColor() + self.assertTrue(color.isValid()) + self.assertEqual(color, qt.QColor(255, 255, 255)) + color = self.plot.getDataBackgroundColor() + self.assertFalse(color.isValid()) + self.qapp.processEvents() + + class TestPlotImage(PlotWidgetTestCase, ParametricTestCase): """Basic tests for addImage""" @@ -881,17 +912,12 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): if getter is not None: self.assertEqual(getter(), expected) - @testutils.test_logging(deprecation.depreclog.name) def testOldPlotAxis_Logarithmic(self): """Test silx API prior to silx 0.6""" x = self.plot.getXAxis() y = self.plot.getYAxis() yright = self.plot.getYAxis(axis="right") - listener = SignalListener() - self.plot.sigSetXAxisLogarithmic.connect(listener.partial("x")) - self.plot.sigSetYAxisLogarithmic.connect(listener.partial("y")) - self.assertEqual(x.getScale(), x.LINEAR) self.assertEqual(y.getScale(), x.LINEAR) self.assertEqual(yright.getScale(), x.LINEAR) @@ -902,7 +928,6 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.getScale(), x.LINEAR) self.assertEqual(self.plot.isXAxisLogarithmic(), True) self.assertEqual(self.plot.isYAxisLogarithmic(), False) - self.assertEqual(listener.arguments(callIndex=-1), ("x", True)) self.plot.setYAxisLogarithmic(True) self.assertEqual(x.getScale(), x.LOGARITHMIC) @@ -910,7 +935,6 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.getScale(), x.LOGARITHMIC) self.assertEqual(self.plot.isXAxisLogarithmic(), True) self.assertEqual(self.plot.isYAxisLogarithmic(), True) - self.assertEqual(listener.arguments(callIndex=-1), ("y", True)) yright.setScale(yright.LINEAR) self.assertEqual(x.getScale(), x.LOGARITHMIC) @@ -918,19 +942,13 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.getScale(), x.LINEAR) self.assertEqual(self.plot.isXAxisLogarithmic(), True) self.assertEqual(self.plot.isYAxisLogarithmic(), False) - self.assertEqual(listener.arguments(callIndex=-1), ("y", False)) - @testutils.test_logging(deprecation.depreclog.name) def testOldPlotAxis_AutoScale(self): """Test silx API prior to silx 0.6""" x = self.plot.getXAxis() y = self.plot.getYAxis() yright = self.plot.getYAxis(axis="right") - listener = SignalListener() - self.plot.sigSetXAxisAutoScale.connect(listener.partial("x")) - self.plot.sigSetYAxisAutoScale.connect(listener.partial("y")) - self.assertEqual(x.isAutoScale(), True) self.assertEqual(y.isAutoScale(), True) self.assertEqual(yright.isAutoScale(), True) @@ -941,7 +959,6 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.isAutoScale(), True) self.assertEqual(self.plot.isXAxisAutoScale(), False) self.assertEqual(self.plot.isYAxisAutoScale(), True) - self.assertEqual(listener.arguments(callIndex=-1), ("x", False)) self.plot.setYAxisAutoScale(False) self.assertEqual(x.isAutoScale(), False) @@ -949,7 +966,6 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.isAutoScale(), False) self.assertEqual(self.plot.isXAxisAutoScale(), False) self.assertEqual(self.plot.isYAxisAutoScale(), False) - self.assertEqual(listener.arguments(callIndex=-1), ("y", False)) yright.setAutoScale(True) self.assertEqual(x.isAutoScale(), False) @@ -957,18 +973,13 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(yright.isAutoScale(), True) self.assertEqual(self.plot.isXAxisAutoScale(), False) self.assertEqual(self.plot.isYAxisAutoScale(), True) - self.assertEqual(listener.arguments(callIndex=-1), ("y", True)) - @testutils.test_logging(deprecation.depreclog.name) def testOldPlotAxis_Inverted(self): """Test silx API prior to silx 0.6""" x = self.plot.getXAxis() y = self.plot.getYAxis() yright = self.plot.getYAxis(axis="right") - listener = SignalListener() - self.plot.sigSetYAxisInverted.connect(listener.partial("y")) - self.assertEqual(x.isInverted(), False) self.assertEqual(y.isInverted(), False) self.assertEqual(yright.isInverted(), False) @@ -978,14 +989,12 @@ class TestPlotAxes(TestCaseQt, ParametricTestCase): self.assertEqual(y.isInverted(), True) self.assertEqual(yright.isInverted(), True) self.assertEqual(self.plot.isYAxisInverted(), True) - self.assertEqual(listener.arguments(callIndex=-1), ("y", True)) yright.setInverted(False) self.assertEqual(x.isInverted(), False) self.assertEqual(y.isInverted(), False) self.assertEqual(yright.isInverted(), False) self.assertEqual(self.plot.isYAxisInverted(), False) - self.assertEqual(listener.arguments(callIndex=-1), ("y", False)) def testLogXWithData(self): self.plot.setGraphTitle('Curve X: Log Y: Linear') -- cgit v1.2.3