Example #1
0
 def testColomap(self):
     dialog = self.createDialog()
     colormap = dialog.colormap()
     self.assertEqual(colormap.getNormalization(), "linear")
     colormap = Colormap(normalization=Colormap.LOGARITHM)
     dialog.setColormap(colormap)
     self.assertEqual(colormap.getNormalization(), "log")
 def testColomap(self):
     dialog = self.createDialog()
     colormap = dialog.colormap()
     self.assertEqual(colormap.getNormalization(), "linear")
     colormap = Colormap(normalization=Colormap.LOGARITHM)
     dialog.setColormap(colormap)
     self.assertEqual(colormap.getNormalization(), "log")
Example #3
0
class TestColormapDialog(TestCaseQt, ParametricTestCase):
    """Test the ColormapDialog."""
    def setUp(self):
        TestCaseQt.setUp(self)
        ParametricTestCase.setUp(self)
        self.colormap = Colormap(name='gray', vmin=10.0, vmax=20.0,
                                 normalization='linear')

        self.colormapDiag = ColormapDialog.ColormapDialog()
        self.colormapDiag.setAttribute(qt.Qt.WA_DeleteOnClose)

    def tearDown(self):
        del self.colormapDiag
        ParametricTestCase.tearDown(self)
        TestCaseQt.tearDown(self)

    def testGUIEdition(self):
        """Make sure the colormap is correctly edited and also that the
        modification are correctly updated if an other colormapdialog is
        editing the same colormap"""
        colormapDiag2 = ColormapDialog.ColormapDialog()
        colormapDiag2.setColormap(self.colormap)
        colormapDiag2.show()
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()

        self.colormapDiag._comboBoxColormap._setCurrentName('red')
        self.colormapDiag._normButtonLog.click()
        self.assertTrue(self.colormap.getName() == 'red')
        self.assertTrue(self.colormapDiag.getColormap().getName() == 'red')
        self.assertTrue(self.colormap.getNormalization() == 'log')
        self.assertTrue(self.colormap.getVMin() == 10)
        self.assertTrue(self.colormap.getVMax() == 20)
        # checked second colormap dialog
        self.assertTrue(colormapDiag2._comboBoxColormap.getCurrentName() == 'red')
        self.assertTrue(colormapDiag2._normButtonLog.isChecked())
        self.assertTrue(int(colormapDiag2._minValue.getValue()) == 10)
        self.assertTrue(int(colormapDiag2._maxValue.getValue()) == 20)
        colormapDiag2.close()

    def testGUIModalOk(self):
        """Make sure the colormap is modified if gone through accept"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(True)
        self.colormapDiag.show()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.colormapDiag._maxValue.setValue(None)
        self.mouseClick(
            widget=self.colormapDiag._buttonsModal.button(qt.QDialogButtonBox.Ok),
            button=qt.Qt.LeftButton
        )
        self.assertTrue(self.colormap.getVMin() is None)
        self.assertTrue(self.colormap.getVMax() is None)
        self.assertTrue(self.colormap.isAutoscale() is True)

    def testGUIModalCancel(self):
        """Make sure the colormap is not modified if gone through reject"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(True)
        self.colormapDiag.show()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(
            widget=self.colormapDiag._buttonsModal.button(qt.QDialogButtonBox.Cancel),
            button=qt.Qt.LeftButton
        )
        self.assertTrue(self.colormap.getVMin() is not None)

    def testGUIModalClose(self):
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(False)
        self.colormapDiag.show()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(
            widget=self.colormapDiag._buttonsNonModal.button(qt.QDialogButtonBox.Close),
            button=qt.Qt.LeftButton
        )
        self.assertTrue(self.colormap.getVMin() is None)

    def testGUIModalReset(self):
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(False)
        self.colormapDiag.show()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(
            widget=self.colormapDiag._buttonsNonModal.button(qt.QDialogButtonBox.Reset),
            button=qt.Qt.LeftButton
        )
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag.close()

    def testGUIClose(self):
        """Make sure the colormap is modify if go through reject"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.show()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.colormapDiag.close()
        self.assertTrue(self.colormap.getVMin() is None)

    def testSetColormapIsCorrect(self):
        """Make sure the interface fir the colormap when set a new colormap"""
        self.colormap.setName('red')
        self.colormapDiag.show()
        for norm in (Colormap.NORMALIZATIONS):
            for autoscale in (True, False):
                if autoscale is True:
                    self.colormap.setVRange(None, None)
                else:
                    self.colormap.setVRange(11, 101)
                self.colormap.setNormalization(norm)
                with self.subTest(colormap=self.colormap):
                    self.colormapDiag.setColormap(self.colormap)
                    self.assertTrue(
                        self.colormapDiag._normButtonLinear.isChecked() == (norm is Colormap.LINEAR))
                    self.assertTrue(
                        self.colormapDiag._comboBoxColormap.getCurrentName() == 'red')
                    self.assertTrue(
                        self.colormapDiag._minValue.isAutoChecked() == autoscale)
                    self.assertTrue(
                        self.colormapDiag._maxValue.isAutoChecked() == autoscale)
                    if autoscale is False:
                        self.assertTrue(self.colormapDiag._minValue.getValue() == 11)
                        self.assertTrue(self.colormapDiag._maxValue.getValue() == 101)
                        self.assertTrue(self.colormapDiag._minValue.isEnabled())
                        self.assertTrue(self.colormapDiag._maxValue.isEnabled())
                    else:
                        self.assertFalse(self.colormapDiag._minValue._numVal.isEnabled())
                        self.assertFalse(self.colormapDiag._maxValue._numVal.isEnabled())

    def testColormapDel(self):
        """Check behavior if the colormap has been deleted outside. For now
        we make sure the colormap is still running and nothing more"""
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()
        del self.colormap
        self.assertTrue(self.colormapDiag.getColormap() is None)
        self.colormapDiag._comboBoxColormap._setCurrentName('blue')

    def testColormapEditedOutside(self):
        """Make sure the GUI is still up to date if the colormap is modified
        outside"""
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()

        self.colormap.setName('red')
        self.assertTrue(
            self.colormapDiag._comboBoxColormap.getCurrentName() == 'red')
        self.colormap.setNormalization(Colormap.LOGARITHM)
        self.assertFalse(self.colormapDiag._normButtonLinear.isChecked())
        self.colormap.setVRange(11, 201)
        self.assertTrue(self.colormapDiag._minValue.getValue() == 11)
        self.assertTrue(self.colormapDiag._maxValue.getValue() == 201)
        self.assertTrue(self.colormapDiag._minValue._numVal.isEnabled())
        self.assertTrue(self.colormapDiag._maxValue._numVal.isEnabled())
        self.assertFalse(self.colormapDiag._minValue.isAutoChecked())
        self.assertFalse(self.colormapDiag._maxValue.isAutoChecked())
        self.colormap.setVRange(None, None)
        self.assertFalse(self.colormapDiag._minValue._numVal.isEnabled())
        self.assertFalse(self.colormapDiag._maxValue._numVal.isEnabled())
        self.assertTrue(self.colormapDiag._minValue.isAutoChecked())
        self.assertTrue(self.colormapDiag._maxValue.isAutoChecked())

    def testSetColormapScenario(self):
        """Test of a simple scenario of a colormap dialog editing several
        colormap"""
        colormap1 = Colormap(name='gray', vmin=10.0, vmax=20.0,
                             normalization='linear')
        colormap2 = Colormap(name='red', vmin=10.0, vmax=20.0,
                             normalization='log')
        colormap3 = Colormap(name='blue', vmin=None, vmax=None,
                             normalization='linear')
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.setColormap(colormap1)
        del colormap1
        self.colormapDiag.setColormap(colormap2)
        del colormap2
        self.colormapDiag.setColormap(colormap3)
        del colormap3

    def testNotPreferredColormap(self):
        """Test that the colormapEditor is able to edit a colormap which is not
        part of the 'prefered colormap'
        """
        def getFirstNotPreferredColormap():
            cms = Colormap.getSupportedColormaps()
            preferred = preferredColormaps()
            for cm in cms:
                if cm not in preferred:
                    return cm
            return None

        colormapName = getFirstNotPreferredColormap()
        assert colormapName is not None
        colormap = Colormap(name=colormapName)
        self.colormapDiag.setColormap(colormap)
        self.colormapDiag.show()
        cb = self.colormapDiag._comboBoxColormap
        self.assertTrue(cb.getCurrentName() == colormapName)
        cb.setCurrentIndex(0)
        index = cb.findLutName(colormapName)
        assert index is not 0  # if 0 then the rest of the test has no sense
        cb.setCurrentIndex(index)
        self.assertTrue(cb.getCurrentName() == colormapName)

    def testColormapEditableMode(self):
        """Test that the colormapDialog is correctly updated when changing the
        colormap editable status"""
        colormap = Colormap(normalization='linear', vmin=1.0, vmax=10.0)
        self.colormapDiag.show()
        self.colormapDiag.setColormap(colormap)
        for editable in (True, False):
            with self.subTest(editable=editable):
                colormap.setEditable(editable)
                self.assertTrue(
                    self.colormapDiag._comboBoxColormap.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._minValue.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._maxValue.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._normButtonLinear.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._normButtonLog.isEnabled() is editable)

        # Make sure the reset button is also set to enable when edition mode is
        # False
        self.colormapDiag.setModal(False)
        colormap.setEditable(True)
        self.colormapDiag._normButtonLog.click()
        resetButton = self.colormapDiag._buttonsNonModal.button(qt.QDialogButtonBox.Reset)
        self.assertTrue(resetButton.isEnabled())
        colormap.setEditable(False)
        self.assertFalse(resetButton.isEnabled())

    def testImageData(self):
        data = numpy.random.rand(5, 5)
        self.colormapDiag.setData(data)

    def testEmptyData(self):
        data = numpy.empty((10, 0))
        self.colormapDiag.setData(data)

    def testNoneData(self):
        data = numpy.random.rand(5, 5)
        self.colormapDiag.setData(data)
        self.colormapDiag.setData(None)
Example #4
0
class TestColormapDialog(TestCaseQt, ParametricTestCase):
    """Test the ColormapDialog."""
    def setUp(self):
        TestCaseQt.setUp(self)
        ParametricTestCase.setUp(self)
        self.colormap = Colormap(name='gray',
                                 vmin=10.0,
                                 vmax=20.0,
                                 normalization='linear')

        self.colormapDiag = ColormapDialog.ColormapDialog()

    def tearDown(self):
        self.qapp.processEvents()
        self.colormapDiag.close()
        self.colormapDiag.deleteLater()
        self.qapp.processEvents()
        del self.colormapDiag
        ParametricTestCase.tearDown(self)
        TestCaseQt.tearDown(self)

    def testGUIEdition(self):
        """Make sure the colormap is correctly edited and also that the
        modification are correctly updated if an other colormapdialog is
        editing the same colormap"""
        colormapDiag2 = ColormapDialog.ColormapDialog()
        colormapDiag2.setColormap(self.colormap)
        colormapDiag2.show()
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()
        self.qapp.processEvents()

        self.colormapDiag._comboBoxColormap._setCurrentName('red')
        self.colormapDiag._normButtonLog.click()
        self.assertTrue(self.colormap.getName() == 'red')
        self.assertTrue(self.colormapDiag.getColormap().getName() == 'red')
        self.assertTrue(self.colormap.getNormalization() == 'log')
        self.assertTrue(self.colormap.getVMin() == 10)
        self.assertTrue(self.colormap.getVMax() == 20)
        # checked second colormap dialog
        self.assertTrue(
            colormapDiag2._comboBoxColormap.getCurrentName() == 'red')
        self.assertTrue(colormapDiag2._normButtonLog.isChecked())
        self.assertTrue(int(colormapDiag2._minValue.getValue()) == 10)
        self.assertTrue(int(colormapDiag2._maxValue.getValue()) == 20)
        colormapDiag2.close()

    def testGUIModalOk(self):
        """Make sure the colormap is modified if gone through accept"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(True)
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.colormapDiag._maxValue.setValue(None)
        self.mouseClick(widget=self.colormapDiag._buttonsModal.button(
            qt.QDialogButtonBox.Ok),
                        button=qt.Qt.LeftButton)
        self.assertTrue(self.colormap.getVMin() is None)
        self.assertTrue(self.colormap.getVMax() is None)
        self.assertTrue(self.colormap.isAutoscale() is True)

    def testGUIModalCancel(self):
        """Make sure the colormap is not modified if gone through reject"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(True)
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(widget=self.colormapDiag._buttonsModal.button(
            qt.QDialogButtonBox.Cancel),
                        button=qt.Qt.LeftButton)
        self.assertTrue(self.colormap.getVMin() is not None)

    def testGUIModalClose(self):
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(False)
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(widget=self.colormapDiag._buttonsNonModal.button(
            qt.QDialogButtonBox.Close),
                        button=qt.Qt.LeftButton)
        self.assertTrue(self.colormap.getVMin() is None)

    def testGUIModalReset(self):
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.setModal(False)
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.mouseClick(widget=self.colormapDiag._buttonsNonModal.button(
            qt.QDialogButtonBox.Reset),
                        button=qt.Qt.LeftButton)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag.close()

    def testGUIClose(self):
        """Make sure the colormap is modify if go through reject"""
        assert self.colormap.isAutoscale() is False
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(self.colormap)
        self.assertTrue(self.colormap.getVMin() is not None)
        self.colormapDiag._minValue.setValue(None)
        self.assertTrue(self.colormap.getVMin() is None)
        self.colormapDiag.close()
        self.qapp.processEvents()
        self.assertTrue(self.colormap.getVMin() is None)

    def testSetColormapIsCorrect(self):
        """Make sure the interface fir the colormap when set a new colormap"""
        self.colormap.setName('red')
        self.colormapDiag.show()
        self.qapp.processEvents()
        for norm in (Colormap.NORMALIZATIONS):
            for autoscale in (True, False):
                if autoscale is True:
                    self.colormap.setVRange(None, None)
                else:
                    self.colormap.setVRange(11, 101)
                self.colormap.setNormalization(norm)
                with self.subTest(colormap=self.colormap):
                    self.colormapDiag.setColormap(self.colormap)
                    self.assertTrue(
                        self.colormapDiag._normButtonLinear.isChecked() == (
                            norm is Colormap.LINEAR))
                    self.assertTrue(self.colormapDiag._comboBoxColormap.
                                    getCurrentName() == 'red')
                    self.assertTrue(self.colormapDiag._minValue.isAutoChecked(
                    ) == autoscale)
                    self.assertTrue(self.colormapDiag._maxValue.isAutoChecked(
                    ) == autoscale)
                    if autoscale is False:
                        self.assertTrue(
                            self.colormapDiag._minValue.getValue() == 11)
                        self.assertTrue(
                            self.colormapDiag._maxValue.getValue() == 101)
                        self.assertTrue(
                            self.colormapDiag._minValue.isEnabled())
                        self.assertTrue(
                            self.colormapDiag._maxValue.isEnabled())
                    else:
                        self.assertFalse(
                            self.colormapDiag._minValue._numVal.isEnabled())
                        self.assertFalse(
                            self.colormapDiag._maxValue._numVal.isEnabled())

    def testColormapDel(self):
        """Check behavior if the colormap has been deleted outside. For now
        we make sure the colormap is still running and nothing more"""
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()
        self.qapp.processEvents()
        del self.colormap
        self.assertTrue(self.colormapDiag.getColormap() is None)
        self.colormapDiag._comboBoxColormap._setCurrentName('blue')

    def testColormapEditedOutside(self):
        """Make sure the GUI is still up to date if the colormap is modified
        outside"""
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.show()
        self.qapp.processEvents()

        self.colormap.setName('red')
        self.assertTrue(
            self.colormapDiag._comboBoxColormap.getCurrentName() == 'red')
        self.colormap.setNormalization(Colormap.LOGARITHM)
        self.assertFalse(self.colormapDiag._normButtonLinear.isChecked())
        self.colormap.setVRange(11, 201)
        self.assertTrue(self.colormapDiag._minValue.getValue() == 11)
        self.assertTrue(self.colormapDiag._maxValue.getValue() == 201)
        self.assertTrue(self.colormapDiag._minValue._numVal.isEnabled())
        self.assertTrue(self.colormapDiag._maxValue._numVal.isEnabled())
        self.assertFalse(self.colormapDiag._minValue.isAutoChecked())
        self.assertFalse(self.colormapDiag._maxValue.isAutoChecked())
        self.colormap.setVRange(None, None)
        self.assertFalse(self.colormapDiag._minValue._numVal.isEnabled())
        self.assertFalse(self.colormapDiag._maxValue._numVal.isEnabled())
        self.assertTrue(self.colormapDiag._minValue.isAutoChecked())
        self.assertTrue(self.colormapDiag._maxValue.isAutoChecked())

    def testSetColormapScenario(self):
        """Test of a simple scenario of a colormap dialog editing several
        colormap"""
        colormap1 = Colormap(name='gray',
                             vmin=10.0,
                             vmax=20.0,
                             normalization='linear')
        colormap2 = Colormap(name='red',
                             vmin=10.0,
                             vmax=20.0,
                             normalization='log')
        colormap3 = Colormap(name='blue',
                             vmin=None,
                             vmax=None,
                             normalization='linear')
        self.colormapDiag.setColormap(self.colormap)
        self.colormapDiag.setColormap(colormap1)
        del colormap1
        self.colormapDiag.setColormap(colormap2)
        del colormap2
        self.colormapDiag.setColormap(colormap3)
        del colormap3

    def testNotPreferredColormap(self):
        """Test that the colormapEditor is able to edit a colormap which is not
        part of the 'prefered colormap'
        """
        def getFirstNotPreferredColormap():
            cms = Colormap.getSupportedColormaps()
            preferred = preferredColormaps()
            for cm in cms:
                if cm not in preferred:
                    return cm
            return None

        colormapName = getFirstNotPreferredColormap()
        assert colormapName is not None
        colormap = Colormap(name=colormapName)
        self.colormapDiag.setColormap(colormap)
        self.colormapDiag.show()
        self.qapp.processEvents()
        cb = self.colormapDiag._comboBoxColormap
        self.assertTrue(cb.getCurrentName() == colormapName)
        cb.setCurrentIndex(0)
        index = cb.findLutName(colormapName)
        assert index is not 0  # if 0 then the rest of the test has no sense
        cb.setCurrentIndex(index)
        self.assertTrue(cb.getCurrentName() == colormapName)

    def testColormapEditableMode(self):
        """Test that the colormapDialog is correctly updated when changing the
        colormap editable status"""
        colormap = Colormap(normalization='linear', vmin=1.0, vmax=10.0)
        self.colormapDiag.show()
        self.qapp.processEvents()
        self.colormapDiag.setColormap(colormap)
        for editable in (True, False):
            with self.subTest(editable=editable):
                colormap.setEditable(editable)
                self.assertTrue(
                    self.colormapDiag._comboBoxColormap.isEnabled() is editable
                )
                self.assertTrue(
                    self.colormapDiag._minValue.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._maxValue.isEnabled() is editable)
                self.assertTrue(
                    self.colormapDiag._normButtonLinear.isEnabled() is editable
                )
                self.assertTrue(
                    self.colormapDiag._normButtonLog.isEnabled() is editable)

        # Make sure the reset button is also set to enable when edition mode is
        # False
        self.colormapDiag.setModal(False)
        colormap.setEditable(True)
        self.colormapDiag._normButtonLog.click()
        resetButton = self.colormapDiag._buttonsNonModal.button(
            qt.QDialogButtonBox.Reset)
        self.assertTrue(resetButton.isEnabled())
        colormap.setEditable(False)
        self.assertFalse(resetButton.isEnabled())

    def testImageData(self):
        data = numpy.random.rand(5, 5)
        self.colormapDiag.setData(data)

    def testEmptyData(self):
        data = numpy.empty((10, 0))
        self.colormapDiag.setData(data)

    def testNoneData(self):
        data = numpy.random.rand(5, 5)
        self.colormapDiag.setData(data)
        self.colormapDiag.setData(None)

    def testImageItem(self):
        """Check that an ImageData plot item can be used"""
        dialog = self.colormapDiag
        colormap = Colormap(name='gray', vmin=None, vmax=None)
        data = numpy.arange(3**2).reshape(3, 3)
        item = ImageData()
        item.setData(data, copy=False)

        dialog.setColormap(colormap)
        dialog.show()
        self.qapp.processEvents()
        dialog.setItem(item)
        vrange = dialog._getFiniteColormapRange()
        self.assertEqual(vrange, (0, 8))

    def testItemDel(self):
        """Check that the plot items are not hard linked to the dialog"""
        dialog = self.colormapDiag
        colormap = Colormap(name='gray', vmin=None, vmax=None)
        data = numpy.arange(3**2).reshape(3, 3)
        item = ImageData()
        item.setData(data, copy=False)

        dialog.setColormap(colormap)
        dialog.show()
        self.qapp.processEvents()
        dialog.setItem(item)
        previousRange = dialog._getFiniteColormapRange()
        del item
        vrange = dialog._getFiniteColormapRange()
        self.assertNotEqual(vrange, previousRange)

    def testDataDel(self):
        """Check that the data are not hard linked to the dialog"""
        dialog = self.colormapDiag
        colormap = Colormap(name='gray', vmin=None, vmax=None)
        data = numpy.arange(5)

        dialog.setColormap(colormap)
        dialog.show()
        self.qapp.processEvents()
        dialog.setData(data)
        previousRange = dialog._getFiniteColormapRange()
        del data
        vrange = dialog._getFiniteColormapRange()
        self.assertNotEqual(vrange, previousRange)