diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-28 12:01:34 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-28 11:24:42 +0000 |
commit | 2d48082e322ae1600985491fe15528dd48a5c604 (patch) | |
tree | 2c1ad0babe8988601641105c11a6639fc9c82c86 /tests | |
parent | e696a6b7bff04d1581cf59b4d96ecb5508f54169 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-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(); |