diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-03-21 13:14:12 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-03-22 10:46:16 +0000 |
commit | 4edd9a1278efdf37f366e9aa6e82f151a357ef32 (patch) | |
tree | a96c36d84cd0bb501067daed51062cb5357e578e | |
parent | 05efd222d6a541eef4c2dd587dc2c6135e8c0311 (diff) |
Fix connectNotify tests
The connectNotify signal does not get strings as argument anymore, but
rather QMetaMethod values. Thus the tests should compare agains the
methodSignatures of those QMetaMethods.
Change-Id: I21c236514b408f08481f1c31ee2b2e2c4aed4be8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | tests/QtCore/qobject_connect_notify_test.py | 5 | ||||
-rw-r--r-- | tests/signals/signal_signature_test.py | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/QtCore/qobject_connect_notify_test.py b/tests/QtCore/qobject_connect_notify_test.py index 629a79a6..50b748ca 100644 --- a/tests/QtCore/qobject_connect_notify_test.py +++ b/tests/QtCore/qobject_connect_notify_test.py @@ -69,7 +69,10 @@ class TestQObjectConnectNotify(UsesQCoreApplication): receiver = QObject() sender.connect(SIGNAL("destroyed()"), receiver, SLOT("deleteLater()")) self.assertTrue(sender.con_notified) - self.assertEqual(sender.signal, SIGNAL("destroyed()")) + # When connecting to a regular slot, and not a python callback function, QObject::connect + # will use the non-cloned method signature, so connecting to destroyed() will actually + # connect to destroyed(QObject*). + self.assertEqual(sender.signal.methodSignature(), "destroyed(QObject*)") sender.disconnect(SIGNAL("destroyed()"), receiver, SLOT("deleteLater()")) self.assertTrue(sender.dis_notified) diff --git a/tests/signals/signal_signature_test.py b/tests/signals/signal_signature_test.py index 8d60c17f..349619aa 100644 --- a/tests/signals/signal_signature_test.py +++ b/tests/signals/signal_signature_test.py @@ -52,21 +52,24 @@ class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication): sender = Obj() receiver = QObject() sender.connect(SIGNAL('destroyed()'), receiver, SLOT('deleteLater()')) - self.assertEqual(sender.signal, SIGNAL('destroyed()')) + # When connecting to a regular slot, and not a python callback function, QObject::connect + # will use the non-cloned method signature, so connectinc to destroyed() will actually + # connect to destroyed(QObject*). + self.assertEqual(sender.signal.methodSignature(), 'destroyed(QObject*)') def testOldStyleWithPythonCallback(self): sender = Obj() sender.connect(SIGNAL('destroyed()'), callback) - self.assertEqual(sender.signal, SIGNAL('destroyed()')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed()') def testNewStyle(self): sender = Obj() sender.destroyed.connect(callback) - self.assertEqual(sender.signal, SIGNAL('destroyed()')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed()') sender.destroyed[QObject].connect(callback) - self.assertEqual(sender.signal, SIGNAL('destroyed(QObject*)')) + self.assertEqual(sender.signal.methodSignature(), 'destroyed(QObject*)') if __name__ == '__main__': unittest.main() |