Fixed new style signal connection tests for the proper semantics.
One example to clarify: for the "destroyed(QObject* = 0)" signal, "obj.destroyed.connect(...)" connects to "destroyed()", and "obj.destroyed[QObject].connect(...)" connects to "destroyed(QObject*)". Reviewed by Lauro Moura <lauro.neto@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
154560c9c5
commit
4630f41f6a
2 changed files with 7 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from PySide.QtCore import QObject
|
||||||
from PySide.QtGui import QInputDialog
|
from PySide.QtGui import QInputDialog
|
||||||
|
|
||||||
from helper import UsesQApplication
|
from helper import UsesQApplication
|
||||||
|
|
@ -17,7 +18,7 @@ class DynamicSignalTest(UsesQApplication):
|
||||||
self.assert_(len(lst))
|
self.assert_(len(lst))
|
||||||
obj = lst[0]
|
obj = lst[0]
|
||||||
self._called = False
|
self._called = False
|
||||||
obj.destroyed.connect(self.cb)
|
obj.destroyed[QObject].connect(self.cb)
|
||||||
obj = None
|
obj = None
|
||||||
del dlg
|
del dlg
|
||||||
self.assert_(self._called)
|
self.assert_(self._called)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Obj(QObject):
|
||||||
def connectNotify(self, signal):
|
def connectNotify(self, signal):
|
||||||
self.signal = signal
|
self.signal = signal
|
||||||
|
|
||||||
def callback():
|
def callback(arg=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
|
class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
|
||||||
|
|
@ -33,7 +33,11 @@ class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
|
||||||
|
|
||||||
def testNewStyle(self):
|
def testNewStyle(self):
|
||||||
sender = Obj()
|
sender = Obj()
|
||||||
|
|
||||||
sender.destroyed.connect(callback)
|
sender.destroyed.connect(callback)
|
||||||
|
self.assertEqual(sender.signal, SIGNAL('destroyed()'))
|
||||||
|
|
||||||
|
sender.destroyed[QObject].connect(callback)
|
||||||
self.assertEqual(sender.signal, SIGNAL('destroyed(QObject*)'))
|
self.assertEqual(sender.signal, SIGNAL('destroyed(QObject*)'))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue