From ad8edac53c65368f7ff269332bd66bd85e2633b4 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 29 Nov 2011 10:59:48 +0100 Subject: Remove QInternal callbacks and internal functions After commit 79f675a1e0f628bbc25345ebc1eb1f5809166c6b, the connect and disconnect callback API effectively becomes useless. Now that these callbacks cannot/do not, it makes little sense to keep the backdoors added for Qt Jambi support. Remove them for now. Should the Qt Jambi team want/need to port to Qt 5, we can re-add them, possibly designing a better API for doing so as well. Change-Id: I6209a1d647d683c979d5294b632b8c12c0f9f91c Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 73 ----------------------- 1 file changed, 73 deletions(-) (limited to 'tests/auto/corelib/global/qglobal') diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 23ec228c68..3efdbf0433 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -47,7 +47,6 @@ class tst_QGlobal: public QObject Q_OBJECT private slots: void qIsNull(); - void qInternalCallbacks(); void for_each(); void qassert(); void qtry(); @@ -71,78 +70,6 @@ void tst_QGlobal::qIsNull() QVERIFY(!::qIsNull(f)); } -struct ConnectInfo { - QObject *sender; - QObject *receiver; - QString signal, slot; - int type; - void reset() { - sender = receiver = 0; - signal = slot = QString(); - type = -1; - } -} connect_info; - -bool disconnect_callback(void **data) -{ - connect_info.sender = (QObject *)(data[0]); - connect_info.receiver = (QObject *)(data[2]); - connect_info.signal = QString::fromLatin1((const char *) data[1]); - connect_info.slot = QString::fromLatin1((const char *) data[3]); - return true; -} - -bool connect_callback(void **data) -{ - disconnect_callback(data); - connect_info.type = *(int *) data[4]; - return true; -} - -void tst_QGlobal::qInternalCallbacks() -{ - QInternal::registerCallback(QInternal::ConnectCallback, connect_callback); - QInternal::registerCallback(QInternal::DisconnectCallback, disconnect_callback); - - QObject a, b; - QString signal = QLatin1String("2mysignal(x)"); - QString slot = QLatin1String("1myslot(x)"); - - // Test that connect works as expected... - connect_info.reset(); - bool ok = QObject::connect(&a, signal.toLatin1(), &b, slot.toLatin1(), Qt::AutoConnection); - QVERIFY(!ok); // our dummy callback do not return a valid QMetaObject::Connection - QCOMPARE(&a, connect_info.sender); - QCOMPARE(&b, connect_info.receiver); - QCOMPARE(signal, connect_info.signal); - QCOMPARE(slot, connect_info.slot); - QCOMPARE((int) Qt::AutoConnection, connect_info.type); - - // Test that disconnect works as expected - connect_info.reset(); - ok = QObject::disconnect(&a, signal.toLatin1(), &b, slot.toLatin1()); - QVERIFY(ok); - QCOMPARE(&a, connect_info.sender); - QCOMPARE(&b, connect_info.receiver); - QCOMPARE(signal, connect_info.signal); - QCOMPARE(slot, connect_info.slot); - - // Unregister callbacks and verify that they are not triggered... - QInternal::unregisterCallback(QInternal::ConnectCallback, connect_callback); - QInternal::unregisterCallback(QInternal::DisconnectCallback, disconnect_callback); - - connect_info.reset(); - QTest::ignoreMessage(QtWarningMsg, "Object::connect: No such signal QObject::mysignal(x)"); - ok = QObject::connect(&a, signal.toLatin1(), &b, slot.toLatin1(), Qt::AutoConnection); - QVERIFY(!ok); - QCOMPARE(connect_info.sender, (QObject *) 0); - - QTest::ignoreMessage(QtWarningMsg, "Object::disconnect: No such signal QObject::mysignal(x)"); - ok = QObject::disconnect(&a, signal.toLatin1(), &b, slot.toLatin1()); - QVERIFY(!ok); - QCOMPARE(connect_info.sender, (QObject *) 0); -} - void tst_QGlobal::for_each() { QList list; -- cgit v1.2.3