summaryrefslogtreecommitdiffstats
path: root/tests/auto/qobject
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-03 11:59:05 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:46:42 +1000
commit982405f2d0f233872d83579893f07699810050bf (patch)
treeb3d2e00f4b331bec027e4f48956e19036293a0a1 /tests/auto/qobject
parentd0d393d86f3cc0300fe6329733b409e713263cb3 (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 (cherry picked from commit 7bd6ca895e5fa4de197d9d7bf2e7b578c01c3c2a)
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 4b926e450e..b0835617b0 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();
}