summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-08-08 10:26:03 +0200
committerOlivier Goffart <ogoffart@woboq.com>2014-08-11 16:49:01 +0200
commitc2badc7423b63824902d1f44a4b804de3335c20b (patch)
tree0884d6c433be6cf8dc0188fc2a369601b31a24ca /tests/auto
parent5a882d035977a6b512f0ae033df48494209ac1b1 (diff)
Fix disconnect()ing from signals declared in a base class
Fix disconnection from pointer to member signal that belongs to the base class, but whose type is a pointer to a member of the derived class. Commit 9cc106d9d7d951fcf30f4b0f8606afa6b50892ec fixed connect, so apply the same fix in disconnect [ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member signal that belongs in the base class but whose type is explicitly given as a pointer to a member in the derived class Task-number: QTBUG-40638 Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 1c0a495116..46f034ac84 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6169,6 +6169,18 @@ void tst_QObject::connectBase()
QCOMPARE( r1.count_slot1, 1 );
QCOMPARE( r1.count_slot2, 1 );
QCOMPARE( r1.count_slot3, 1 );
+
+ QVERIFY( QObject::disconnect( &sub, &SubSender::signal1 , &r1, &ReceiverObject::slot1 ) );
+ QVERIFY( QObject::disconnect( &sub, static_cast<void (SenderObject::*)()>(&SubSender::signal2) , &r1, &ReceiverObject::slot2 ) );
+ QVERIFY( QObject::disconnect( &sub, static_cast<void (SubSender::*)()>(&SubSender::signal3) , &r1, &ReceiverObject::slot3 ) );
+
+ sub.emitSignal1();
+ sub.emitSignal2();
+ sub.emitSignal3();
+
+ QCOMPARE( r1.count_slot1, 1 );
+ QCOMPARE( r1.count_slot2, 1 );
+ QCOMPARE( r1.count_slot3, 1 );
}
struct QmlReceiver : public QtPrivate::QSlotObjectBase