diff options
Diffstat (limited to 'tests/auto/qml/debugger')
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml new file mode 100644 index 000000000..18b894717 --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Rectangle { + width: 100 + height: 62 + + Timer { + running: true + repeat: true + interval: 50 + onTriggered: height = (2 * height) % 99; + } +} + diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index ec8413979..e422d3ef9 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -21,4 +21,5 @@ OTHER_FILES += \ data/scenegraphTest.qml \ data/TestImage_2x2.png \ data/signalSourceLocation.qml \ - data/javascript.qml + data/javascript.qml \ + data/timer.qml diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index f9f05964a..744830b55 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -145,10 +145,12 @@ public: QVector<QQmlProfilerData> asynchronousMessages; QVector<QQmlProfilerData> pixmapMessages; - void setTraceState(bool enabled) { + void setTraceState(bool enabled, quint32 flushInterval = 0) { QByteArray message; QDataStream stream(&message, QIODevice::WriteOnly); stream << enabled; + if (enabled && flushInterval) + stream << -1 << std::numeric_limits<quint64>::max() << flushInterval; sendMessage(message); } @@ -213,6 +215,7 @@ private slots: void controlFromJS(); void signalSourceLocation(); void javascript(); + void flushInterval(); }; #define VERIFY(type, position, expected, checks) QVERIFY(verify(type, position, expected, checks)) @@ -766,6 +769,24 @@ void tst_QQmlProfilerService::javascript() VERIFY(MessageListJavaScript, 21, expected, CheckMessageType | CheckDetailType); } +void tst_QQmlProfilerService::flushInterval() +{ + connect(true, "timer.qml"); + QVERIFY(m_client); + QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + m_client->setTraceState(true, 1); + + // Make sure we get multiple messages + QTRY_VERIFY(m_client->qmlMessages.length() > 0); + QVERIFY(m_client->qmlMessages.length() < 100); + QTRY_VERIFY(m_client->qmlMessages.length() > 100); + + m_client->setTraceState(false); + checkTraceReceived(); + checkJsHeap(); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" |