source: orange/Orange/OrangeCanvas/gui/tests/test_toolbar.py @ 11100:cf6f6744dd9b

Revision 11100:cf6f6744dd9b, 930 bytes checked in by Ales Erjavec <ales.erjavec@…>, 19 months ago (diff)

Added gui widget toolkit.

Line 
1"""
2Test for DynamicResizeToolbar
3
4"""
5import logging
6
7from PyQt4.QtGui import QAction
8
9from PyQt4.QtCore import Qt
10
11from .. import test
12from .. import toolbar
13
14
15class ToolBoxTest(test.QAppTestCase):
16
17    def test_dynamic_toolbar(self):
18        logging.basicConfig(level=logging.DEBUG)
19        self.app.setStyleSheet("QToolButton { border: 1px solid red; }")
20
21        w = toolbar.DynamicResizeToolBar(None)
22
23        w.addAction(QAction("1", w))
24        w.addAction(QAction("2", w))
25        w.addAction(QAction("A long", w))
26        actions = list(w.actions())
27
28        w.resize(100, 30)
29        w.show()
30
31        w.raise_()
32
33        w.removeAction(actions[1])
34        w.insertAction(actions[0], actions[1])
35
36        self.assertSetEqual(set(actions), set(w.actions()))
37
38        self.singleShot(2000, lambda: w.setOrientation(Qt.Vertical))
39        self.singleShot(5000, lambda: w.removeAction(actions[1]))
40
41        self.app.exec_()
Note: See TracBrowser for help on using the repository browser.