Be stricter about the number of messages when testing profiler service
authorUlf Hermann <ulf.hermann@digia.com>
Thu, 30 Jan 2014 17:21:18 +0000 (18:21 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 31 Jan 2014 09:10:59 +0000 (10:10 +0100)
It's better to fail a test than to crash on invalid array access later.

Change-Id: Ia3d24218eba80f362908979720657312c8c6cd67
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp

index a122846..14a6178 100644 (file)
@@ -413,7 +413,7 @@ void tst_QQmlProfilerService::pixmapCacheData()
     m_client->setTraceState(false);
 
     QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
-    QVERIFY(m_client->traceMessages.count());
+    QVERIFY(m_client->traceMessages.count() >= 20);
 
     // must start with "StartTrace"
     QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
@@ -486,6 +486,7 @@ void tst_QQmlProfilerService::profileOnExit()
     m_client->setTraceState(true);
 
     QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+    QVERIFY(m_client->traceMessages.count() >= 2);
 
     // must start with "StartTrace"
     QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
@@ -504,6 +505,7 @@ void tst_QQmlProfilerService::controlFromJS()
 
     m_client->setTraceState(false);
     QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+    QVERIFY(m_client->traceMessages.count() >= 2);
 
     // must start with "StartTrace"
     QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
@@ -526,6 +528,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
     m_client->setTraceState(false);
     QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
 
+    QVERIFY(m_client->traceMessages.count() >= 17);
     // must start with "StartTrace"
     QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
     QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);