summaryrefslogtreecommitdiffstats
path: root/tests/QtCore/destroysignal_test.py
blob: 1c5f986bc17d0074a03aa137dc7c7e70143a461a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from PySide.QtCore import QTimer, QObject
import sys
import unittest

class TestDestroySignal(unittest.TestCase):
    def onObjectDestroyed(self, timer):
        self.assert_(isinstance(timer, QTimer))
        self._destroyed = True

    def testSignal(self):
        self._destroyed = False
        t = QTimer()
        t.destroyed[QObject].connect(self.onObjectDestroyed)
        del t
        self.assert_(self._destroyed)

    def testWithParent(self):
        self._destroyed = False
        p = QTimer()
        t = QTimer(p)
        t.destroyed[QObject].connect(self.onObjectDestroyed)
        del p
        self.assert_(self._destroyed)

if __name__ == '__main__':
    unittest.main()