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

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

Added gui widget toolkit.

Line 
1from PyQt4.QtGui import QAction
2
3from .. import test
4from ..toolgrid import ToolGrid
5
6
7class TestToolGrid(test.QAppTestCase):
8    def test_tool_grid(self):
9        w = ToolGrid()
10        action_a = QAction("A", w)
11        action_b = QAction("B", w)
12        action_c = QAction("C", w)
13        action_d = QAction("D", w)
14        w.addAction(action_b)
15        w.insertAction(0, action_a)
16        w.addAction(action_c)
17        w.addAction(action_d)
18        w.removeAction(action_c)
19        w.removeAction(action_a)
20        w.insertAction(0, action_a)
21        w.setColumnCount(2)
22        w.insertAction(2, action_c)
23
24        triggered_actions = []
25
26        def p(action):
27            print action.text()
28
29        w.actionTriggered.connect(p)
30        w.actionTriggered.connect(triggered_actions.append)
31        action_a.trigger()
32
33        self.assertEqual(triggered_actions, [action_a])
34
35        w.show()
36        self.app.exec_()
Note: See TracBrowser for help on using the repository browser.