~ubuntu-branches/ubuntu/oneiric/pyside/oneiric

« back to all changes in this revision

Viewing changes to tests/qtgui/add_action_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2010-09-27 21:01:06 UTC
  • mfrom: (1.2.1 upstream) (6.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20100927210106-m1nrq8vmd3exqb9o
Tags: 0.4.1-0ubuntu1
* New 0.4.1 upstream release. (LP: #648612)
  - Add some 0.4.1 symbols.

* Patches:
  - u_c130273_fix_py25_QtScript_property.patch
    Remove, was from upstream.
  - u_20e226b_fix_missing_qcoreapplication_arguments_method.patch
    Remove, was from upstream.
  - u_268bf77_fixed_signal_signature_parser.patch
    Remove, was from upstream.
  + libPythonVersionPostfix.patch: Refresh
  + usePySpecificShiboken.patch: Refresh
  + lessBuildVerbosity.patch: Refresh

* Bump the B-D chain versions.
* Make sure the private.py is installed in QtCore module.
* Build against Qt 4.7.
  - Add libqtwebkit-dev
  - Drop QtMultimedia module.
  - Add the QtDeclarative package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
'''Tests for QMenuBar.addAction(identifier, callback) calls'''
3
 
 
4
 
import unittest
5
 
 
6
 
from PySide.QtCore import SLOT
7
 
from PySide.QtGui import QMenuBar, QAction, QPushButton
8
 
 
9
 
from helper import UsesQApplication
10
 
 
11
 
 
12
 
class AddActionTest(UsesQApplication):
13
 
    '''QMenuBar addAction'''
14
 
 
15
 
    def tearDown(self):
16
 
        try:
17
 
            del self.called
18
 
        except AttributeError:
19
 
            pass
20
 
        super(AddActionTest, self).tearDown()
21
 
 
22
 
    def _callback(self):
23
 
        self.called = True
24
 
 
25
 
    def testBasic(self):
26
 
        '''QMenuBar.addAction(id, callback)'''
27
 
        menubar = QMenuBar()
28
 
        action = menubar.addAction("Accounts", self._callback)
29
 
        action.activate(QAction.Trigger)
30
 
        self.assert_(self.called)
31
 
 
32
 
    def testWithCppSlot(self):
33
 
        '''QMenuBar.addAction(id, object, slot)'''
34
 
        menubar = QMenuBar()
35
 
        widget = QPushButton()
36
 
        widget.setCheckable(True)
37
 
        widget.setChecked(False)
38
 
        action = menubar.addAction("Accounts", widget, SLOT("toggle()"))
39
 
        action.activate(QAction.Trigger)
40
 
        self.assert_(widget.isChecked())
41
 
 
42
 
if __name__ == '__main__':
43
 
    unittest.main()
44