From 4edd9a1278efdf37f366e9aa6e82f151a357ef32 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 21 Mar 2017 13:14:12 +0100 Subject: 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 --- tests/QtCore/qobject_connect_notify_test.py | 5 ++++- 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() -- cgit v1.2.3