Be stricter about the number of messages when testing profiler service

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>
This commit is contained in:
Ulf Hermann 2014-01-30 18:21:18 +01:00 committed by The Qt Project
parent 539d5376bb
commit b8eaedb0dc
1 changed files with 4 additions and 1 deletions

View 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);