From 2d48082e322ae1600985491fe15528dd48a5c604 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 28 Mar 2018 12:01:34 +0200 Subject: QmlProfiler test: Keep recording until we receive the needed events We can apparently catch the engine at a point where it has already registered but not compiled anything. Change-Id: I09cd7fefe731a61a6f2095e125516ecf57c602cb Reviewed-by: Simon Hausmann --- .../qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index f2b44a4d95..562804bc45 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -753,11 +753,24 @@ void tst_QQmlProfilerService::memory() QVERIFY(smallItems > 5); } +static bool hasCompileEvents(const QVector &types) +{ + for (const QQmlProfilerEventType &type : types) { + if (type.message() == QQmlProfilerDefinitions::MaximumMessage + && type.rangeType() == QQmlProfilerDefinitions::Compiling) + return true; + } + return false; +} + void tst_QQmlProfilerService::compile() { - connect(true, "test.qml"); + // Flush interval so that we actually get the events before we stop recording. + connect(true, "test.qml", true, 100); - QTRY_VERIFY(m_client->numLoadedEventTypes() > 0); + // We need to check specifically for compile events as we can otherwise stop recording after the + // StartTrace has arrived, but before it compiles anything. + QTRY_VERIFY(hasCompileEvents(m_client->types)); m_client->client->setRecording(false); checkTraceReceived(); -- cgit v1.2.3