aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui/qdynamic_signal.py
blob: 0eecb7d116bd1302cc059188211e2fa1bdd2b426 (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
28

import unittest

from PySide.QtCore import QObject
from PySide.QtGui import QInputDialog

from helper import UsesQApplication

class DynamicSignalTest(UsesQApplication):

    def cb(self, obj):
        self._called = True

    def testQDialog(self):
        dlg = QInputDialog()
        dlg.setInputMode(QInputDialog.TextInput)
        lst = dlg.children()
        self.assert_(len(lst))
        obj = lst[0]
        self._called = False
        obj.destroyed[QObject].connect(self.cb)
        obj = None
        del dlg
        self.assert_(self._called)


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