From 87265c7ab8743ece92262cd6b79bbba9dddd1fe1 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 1 Nov 2018 11:06:34 +0100 Subject: [PATCH] Qml Tooling: Test that trace events arrive in chronological order The QML profiler trace client should resolve any deviations from chronological order. Trace receivers should not need to deal with this. Change-Id: I9bbb387bbb5c0b7da9f2b508d228665af9f27d4c Reviewed-by: Michael Brasser --- .../qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 9d76158c5b..1783ded9d6 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -69,6 +69,9 @@ public: int numLoadedEventTypes() const override; void addEventType(const QQmlProfilerEventType &type) override; void addEvent(const QQmlProfilerEvent &event) override; + +private: + qint64 lastTimestamp = -1; }; void QQmlProfilerTestClient::startTrace(qint64 timestamp, const QList &engineIds) @@ -102,6 +105,9 @@ void QQmlProfilerTestClient::addEvent(const QQmlProfilerEvent &event) const QQmlProfilerEventType &type = types[typeIndex]; + QVERIFY(event.timestamp() >= lastTimestamp); + lastTimestamp = event.timestamp(); + switch (type.message()) { case Event: { switch (type.detailType()) {