diff options
-rw-r--r-- | tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
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<QQmlProfilerEventType> &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(); |