~ubuntu-branches/ubuntu/utopic/pyside/utopic

« back to all changes in this revision

Viewing changes to tests/signals/disconnect_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
from PySide.QtCore import *
 
3
 
 
4
class Foo(QObject):
 
5
    bar = Signal()
 
6
 
 
7
class TestDisconnect(unittest.TestCase):
 
8
    def theSlot1(self):
 
9
        self.called1 = True
 
10
 
 
11
    def theSlot2(self):
 
12
        self.called2 = True
 
13
 
 
14
    def testIt(self):
 
15
        self.called1 = False
 
16
        self.called2 = False
 
17
        f = Foo()
 
18
        f.bar.connect(self.theSlot1)
 
19
        f.bar.connect(self.theSlot2)
 
20
        f.bar.emit()
 
21
        self.assertTrue(self.called1)
 
22
        self.assertTrue(self.called2)
 
23
 
 
24
        self.called1 = False
 
25
        self.called2 = False
 
26
        f.bar.disconnect()
 
27
        f.bar.emit()
 
28
        self.assertFalse(self.called1)
 
29
        self.assertFalse(self.called2)
 
30
 
 
31
if __name__ == '__main__':
 
32
    unittest.main()