summaryrefslogtreecommitdiffstats
path: root/tests/auto/qobject
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-03 11:59:05 +1000
committerJason McDonald <jason.mcdonald@nokia.com>2011-05-04 13:30:01 +1000
commit7bd6ca895e5fa4de197d9d7bf2e7b578c01c3c2a (patch)
tree364d42292b685d9d7907eca520bcdbb468c631cc /tests/auto/qobject
parenta3b2fa3f1beffa7709c11522d4e2db9ec8f952e0 (diff)
Remove Q_ASSERT's from QObject autotest.
The Receiver class has two slots that aren't meant to get called during the test (they're there to catch broken parsing of slot names). Rather than asserting when one of them gets called, which does nothing in a release mode build, this commit makes the slots record the number of times they were called (as for the other slots in the test) and fails the test gracefully if either of those slots was called. Change-Id: Ia0393026cb96ffdc6190b5e7bd951f75d231b11e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qobject')
-rw-r--r--tests/auto/qobject/tst_qobject.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index d2307ee94f..29b07af84c 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -403,6 +403,8 @@ public:
}
void reset() {
+ called_slot10 = 0;
+ called_slot9 = 0;
called_slot8 = 0;
called_slot7 = 0;
called_slot6 = 0;
@@ -421,6 +423,8 @@ public:
int called_slot6;
int called_slot7;
int called_slot8;
+ int called_slot9;
+ int called_slot10;
bool called(int slot) {
switch (slot) {
@@ -432,6 +436,8 @@ public:
case 6: return called_slot6;
case 7: return called_slot7;
case 8: return called_slot8;
+ case 9: return called_slot9;
+ case 10: return called_slot10;
default: return false;
}
}
@@ -449,8 +455,8 @@ public slots:
void slotLoopBack() { ++called_slot8; }
protected slots:
- void o() { Q_ASSERT(0); }
- void on() { Q_ASSERT(0); }
+ void o() { ++called_slot9; }
+ void on() { ++called_slot10; }
signals:
void on_Sender_signalLoopBack();
@@ -473,6 +479,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), false);
QCOMPARE(receiver.called(8), false);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
sender.emitSignalWithParams(0);
@@ -484,6 +492,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), false);
QCOMPARE(receiver.called(8), false);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
sender.emitSignalWithParams(0, "string");
@@ -495,6 +505,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), false);
QCOMPARE(receiver.called(8), false);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
sender.emitSignalManyParams(1, 2, 3, "string", true);
@@ -506,6 +518,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), false);
QCOMPARE(receiver.called(8), false);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
sender.emitSignalManyParams2(1, 2, 3, "string", true);
@@ -517,6 +531,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), true);
QCOMPARE(receiver.called(8), false);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
sender.emitSignalLoopBack();
@@ -528,6 +544,8 @@ void tst_QObject::connectByName()
QCOMPARE(receiver.called(6), false);
QCOMPARE(receiver.called(7), false);
QCOMPARE(receiver.called(8), true);
+ QCOMPARE(receiver.called(9), false);
+ QCOMPARE(receiver.called(10), false);
receiver.reset();
}