From b98af3e0f3bfdc0187d7955683f90a7012a2d133 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 15 Jan 2018 13:41:01 +0100 Subject: QML Profiler: Test that only one Complete message is sent per session Task-number: QTBUG-65767 Change-Id: I0485092f9a36da73e9e86ef8216be736b6560ec1 Reviewed-by: Michael Brasser --- .../qml/debugger/qqmlprofilerservice/data/quit.qml | 40 ++++++++++++++++++++++ .../tst_qqmlprofilerservice.cpp | 26 ++++++++++++-- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml (limited to 'tests/auto/qml/debugger/qqmlprofilerservice') diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml new file mode 100644 index 0000000000..bc8c2b90ae --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +//DO NOT CHANGE + +Item { + Timer { + running: true + triggeredOnStart: true + onTriggered: Qt.quit(); + } +} + diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 323048f7d8..eb0b0c2fe2 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -195,7 +196,9 @@ private: }; ConnectResult connect(bool block, const QString &testFile, bool recordFromStart = true, - uint flushInterval = 0, bool restrictServices = true); + uint flushInterval = 0, bool restrictServices = true, + const QString &executable + = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"); void checkProcessTerminated(); void checkTraceReceived(); void checkJsHeap(); @@ -221,6 +224,7 @@ private slots: void translationBinding(); void memory(); void compile(); + void multiEngine(); private: bool m_recordFromStart = true; @@ -237,7 +241,7 @@ private: QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect( bool block, const QString &file, bool recordFromStart, uint flushInterval, - bool restrictServices) + bool restrictServices, const QString &executable) { m_recordFromStart = recordFromStart; m_flushInterval = flushInterval; @@ -245,7 +249,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect( // ### Still using qmlscene due to QTBUG-33377 return QQmlDebugTest::connect( - QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", + executable, restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(), testFile(file), block); } @@ -806,6 +810,22 @@ void tst_QQmlProfilerService::compile() QCOMPARE(rangeStage, RangeEnd); } +void tst_QQmlProfilerService::multiEngine() +{ + QCOMPARE(connect(true, "quit.qml", true, 0, false, debugJsServerPath("qqmlprofilerservice")), + ConnectSuccess); + + QSignalSpy spy(m_client->client, SIGNAL(complete(qint64))); + + checkTraceReceived(); + checkJsHeap(); + + QTRY_COMPARE(m_process->state(), QProcess::NotRunning); + QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); + + QCOMPARE(spy.count(), 1); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" -- cgit v1.2.3