diff options
Diffstat (limited to 'src/silx/gui/widgets/test')
-rw-r--r-- | src/silx/gui/widgets/test/__init__.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_boxlayoutdockwidget.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_elidedlabel.py | 32 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_flowlayout.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_framebrowser.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_hierarchicaltableview.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_legendiconwidget.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_periodictable.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_printpreview.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_rangeslider.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_tablewidget.py | 1 | ||||
-rw-r--r-- | src/silx/gui/widgets/test/test_threadpoolpushbutton.py | 1 |
12 files changed, 27 insertions, 16 deletions
diff --git a/src/silx/gui/widgets/test/__init__.py b/src/silx/gui/widgets/test/__init__.py index 243dbc7..03af6f2 100644 --- a/src/silx/gui/widgets/test/__init__.py +++ b/src/silx/gui/widgets/test/__init__.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2020 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_boxlayoutdockwidget.py b/src/silx/gui/widgets/test/test_boxlayoutdockwidget.py index 5df8df9..dd0ddf4 100644 --- a/src/silx/gui/widgets/test/test_boxlayoutdockwidget.py +++ b/src/silx/gui/widgets/test/test_boxlayoutdockwidget.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2018 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_elidedlabel.py b/src/silx/gui/widgets/test/test_elidedlabel.py index 693e43c..d7e2cdc 100644 --- a/src/silx/gui/widgets/test/test_elidedlabel.py +++ b/src/silx/gui/widgets/test/test_elidedlabel.py @@ -1,7 +1,6 @@ -# coding: utf-8 # /*########################################################################## # -# Copyright (c) 2020 European Synchrotron Radiation Facility +# Copyright (c) 2020-2022 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 @@ -27,8 +26,6 @@ __license__ = "MIT" __date__ = "08/06/2020" -import unittest - from silx.gui import qt from silx.gui.widgets.ElidedLabel import ElidedLabel from silx.gui.utils import testutils @@ -47,11 +44,18 @@ class TestElidedLabel(testutils.TestCaseQt): del self.label self.qapp.processEvents() + def testQLabelApi(self): + """Test overrided API from QLabel""" + self.label.setText("a") + assert self.label.text() == "a" + self.label.setToolTip("b") + assert self.label.toolTip() == "b" + def testElidedValue(self): """Test elided text""" raw = "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm" self.label.setText(raw) - self.label.setFixedWidth(30) + self.label.setFixedWidth(40) displayedText = qt.QLabel.text(self.label) self.assertNotEqual(raw, displayedText) self.assertIn("…", displayedText) @@ -98,3 +102,21 @@ class TestElidedLabel(testutils.TestCaseQt): displayedTooltip = qt.QLabel.toolTip(self.label) self.assertNotIn(raw1, displayedTooltip) self.assertIn(raw2, displayedTooltip) + + def testTooltip(self): + """Test tooltip when elided""" + self.label.setToolTip("Fooo") + assert self.label.toolTip() == "Fooo" + displayedTooltip = qt.QLabel.toolTip(self.label) + assert displayedTooltip == "Fooo" + + def testElidedTextAndTooltip(self): + """Test tooltip when elided""" + raw1 = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn" + self.label.setText(raw1) + self.label.setFixedWidth(30) + self.label.setToolTip("Fooo") + displayedTooltip = qt.QLabel.toolTip(self.label) + assert self.label.toolTip() == "Fooo" + assert "Fooo" in displayedTooltip + assert raw1 in displayedTooltip diff --git a/src/silx/gui/widgets/test/test_flowlayout.py b/src/silx/gui/widgets/test/test_flowlayout.py index 85d7cfe..07f6697 100644 --- a/src/silx/gui/widgets/test/test_flowlayout.py +++ b/src/silx/gui/widgets/test/test_flowlayout.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2018 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_framebrowser.py b/src/silx/gui/widgets/test/test_framebrowser.py index 8233622..7fa621b 100644 --- a/src/silx/gui/widgets/test/test_framebrowser.py +++ b/src/silx/gui/widgets/test/test_framebrowser.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2018 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_hierarchicaltableview.py b/src/silx/gui/widgets/test/test_hierarchicaltableview.py index 302086a..8f6a2a0 100644 --- a/src/silx/gui/widgets/test/test_hierarchicaltableview.py +++ b/src/silx/gui/widgets/test/test_hierarchicaltableview.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016-2021 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_legendiconwidget.py b/src/silx/gui/widgets/test/test_legendiconwidget.py index fe320f6..cfebc62 100644 --- a/src/silx/gui/widgets/test/test_legendiconwidget.py +++ b/src/silx/gui/widgets/test/test_legendiconwidget.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2020 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_periodictable.py b/src/silx/gui/widgets/test/test_periodictable.py index de9e1af..f687e36 100644 --- a/src/silx/gui/widgets/test/test_periodictable.py +++ b/src/silx/gui/widgets/test/test_periodictable.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016-2017 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_printpreview.py b/src/silx/gui/widgets/test/test_printpreview.py index 8602666..b703d63 100644 --- a/src/silx/gui/widgets/test/test_printpreview.py +++ b/src/silx/gui/widgets/test/test_printpreview.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2017 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_rangeslider.py b/src/silx/gui/widgets/test/test_rangeslider.py index f829857..6ed50af 100644 --- a/src/silx/gui/widgets/test/test_rangeslider.py +++ b/src/silx/gui/widgets/test/test_rangeslider.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2018 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_tablewidget.py b/src/silx/gui/widgets/test/test_tablewidget.py index 09122ca..9b1e53f 100644 --- a/src/silx/gui/widgets/test/test_tablewidget.py +++ b/src/silx/gui/widgets/test/test_tablewidget.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016 European Synchrotron Radiation Facility diff --git a/src/silx/gui/widgets/test/test_threadpoolpushbutton.py b/src/silx/gui/widgets/test/test_threadpoolpushbutton.py index 3808be0..a3eca33 100644 --- a/src/silx/gui/widgets/test/test_threadpoolpushbutton.py +++ b/src/silx/gui/widgets/test/test_threadpoolpushbutton.py @@ -1,4 +1,3 @@ -# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016-2021 European Synchrotron Radiation Facility |