summaryrefslogtreecommitdiffstats
path: root/tests/auto/qobject
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-18 11:03:00 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-18 11:03:00 +1000
commitaabda9f5c63ec37ff1669461de6a408bb4865fda (patch)
tree5d59d83c15f75dacad3036065603e0dd0a8e7727 /tests/auto/qobject
parenteab70faca3ade07eb1a39f83a81887e42f483681 (diff)
parent6e50394c4eac9b3e91f6df7e944181cf7f54b0fe (diff)
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging: (84 commits) Reduce usage of Q_ASSERT in autotests. Fixed license header. Remove Q_ASSERT's from qsharedmemory autotest Remove Q_ASSERT's from QNetworkReply autotest Remove Q_ASSERT from QXmlStream autotest Remove Q_ASSERT's from QXmlStream autotest Remove Q_ASSERT from QItemModel autotest Remove Q_ASSERT's from QXmlStream autotest Remove Q_ASSERT from QVariant autotest Remove Q_ASSERT's from QTreeView autotest Remove Q_ASSERT from qtesselator autotest Remove unused function from qtessellator autotest Remove Q_ASSERT's from qreadwritelock autotest Remove Q_ASSERT's from QObject autotest Remove Q_ASSERT's from QObject autotest Remove Q_ASSERT's from QNetworkReply autotest Remove Q_ASSERT from qitemmodel autotest Remove Q_ASSERT's from QMutex autotest Remove Q_ASSERT from QMetaType autotest Remove Q_ASSERT's in qitemview autotest ...
Diffstat (limited to 'tests/auto/qobject')
-rw-r--r--tests/auto/qobject/signalbug.cpp9
-rw-r--r--tests/auto/qobject/tst_qobject.cpp31
2 files changed, 32 insertions, 8 deletions
diff --git a/tests/auto/qobject/signalbug.cpp b/tests/auto/qobject/signalbug.cpp
index f9c9650ef5..55ef5b3912 100644
--- a/tests/auto/qobject/signalbug.cpp
+++ b/tests/auto/qobject/signalbug.cpp
@@ -69,7 +69,8 @@ void Receiver::received ()
::Step++;
const int stepCopy = ::Step;
TRACE (stepCopy, "Receiver::received()");
- Q_ASSERT (::Step == 2 || ::Step == 4);
+ if (::Step != 2 && ::Step != 4)
+ qFatal("%s: Incorrect Step: %d (should be 2 or 4)", Q_FUNC_INFO, ::Step);
if (::Step == 2)
s->fire ();
@@ -91,7 +92,8 @@ void Disconnector::received ()
::Step++;
const int stepCopy = ::Step;
TRACE (stepCopy, "Disconnector::received()");
- Q_ASSERT (::Step == 5 || ::Step == 6);
+ if (::Step != 5 && ::Step != 6)
+ qFatal("%s: Incorrect Step: %d (should be 5 or 6)", Q_FUNC_INFO, ::Step);
fprintf (stderr, "Disconnector<%s>::received() sender=%s\n",
(const char *) objectName ().toAscii (), sender ()->metaObject()->className());
@@ -124,7 +126,8 @@ void Sender::fire ()
::Step++;
const int stepCopy = ::Step;
TRACE (stepCopy, "Sender::fire()");
- Q_ASSERT (::Step == 1 || ::Step == 3);
+ if (::Step != 1 && ::Step != 3)
+ qFatal("%s: Incorrect Step: %d (should be 1 or 3)", Q_FUNC_INFO, ::Step);
emit fired ();
TRACE (stepCopy, "ends Sender::fire()");
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 4b926e450e..a7e8d79345 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();
}
@@ -1312,14 +1330,16 @@ public:
void customEvent(QEvent *)
{
- Q_ASSERT(customEventThread == 0);
+ if (customEventThread)
+ qFatal("%s: customEventThread should be null", Q_FUNC_INFO);
customEventThread = QThread::currentThread();
emit theSignal();
}
void timerEvent(QTimerEvent *)
{
- Q_ASSERT(timerEventThread == 0);
+ if (timerEventThread)
+ qFatal("%s: timerEventThread should be null", Q_FUNC_INFO);
timerEventThread = QThread::currentThread();
emit theSignal();
}
@@ -1327,7 +1347,8 @@ public:
public slots:
void theSlot()
{
- Q_ASSERT(slotThread == 0);
+ if (slotThread)
+ qFatal("%s: slotThread should be null", Q_FUNC_INFO);
slotThread = QThread::currentThread();
emit theSignal();
}