diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2022-03-31 17:09:09 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2022-03-31 20:57:12 +0300 |
commit | d7bd6f19fea015228ec0a5b9ac0b89363f0c9bec (patch) | |
tree | 011f4bd24d2dc9a5e87019a876b12d715f3c97c8 | |
parent | 47a7a9e16922b22fb0adc5b138348ea7cf49a212 (diff) |
Add simple manual test to benchmark startup performance
Task-number: QTBUG-102166
Change-Id: Idab8a407f28d3977b08af98d1b2b8b64a1a8eb72
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | tests/manual/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/manual/startupperformance/CMakeLists.txt | 21 | ||||
-rw-r--r-- | tests/manual/startupperformance/main.cpp | 49 | ||||
-rw-r--r-- | tests/manual/startupperformance/main.qml | 54 |
4 files changed, 125 insertions, 0 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt index a1d2a41d..506f82de 100644 --- a/tests/manual/CMakeLists.txt +++ b/tests/manual/CMakeLists.txt @@ -3,3 +3,4 @@ add_subdirectory(x11vkbwrapper) add_subdirectory(x11vkbtest) add_subdirectory(quickcontrols2) +add_subdirectory(startupperformance) diff --git a/tests/manual/startupperformance/CMakeLists.txt b/tests/manual/startupperformance/CMakeLists.txt new file mode 100644 index 00000000..7ae59751 --- /dev/null +++ b/tests/manual/startupperformance/CMakeLists.txt @@ -0,0 +1,21 @@ +qt_internal_add_manual_test(startupperformance + GUI + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Quick +) + +# Resources: +set(main_resource_files + "main.qml" +) + +qt_internal_add_resource(startupperformance "main" + PREFIX + "/" + FILES + ${main_resource_files} +) diff --git a/tests/manual/startupperformance/main.cpp b/tests/manual/startupperformance/main.cpp new file mode 100644 index 00000000..c7de9a29 --- /dev/null +++ b/tests/manual/startupperformance/main.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** 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 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** 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$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QElapsedTimer> + +int main(int argc, char *argv[]) +{ + QElapsedTimer timer; + timer.restart(); + qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QLatin1String("qrc:/main.qml"))); + + int result = app.exec(); + + qDebug() << "Start to finish" << timer.elapsed() << "ms"; + return result; +} diff --git a/tests/manual/startupperformance/main.qml b/tests/manual/startupperformance/main.qml new file mode 100644 index 00000000..6e7c975b --- /dev/null +++ b/tests/manual/startupperformance/main.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** 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 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** 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 +import QtQuick.Window +import QtQuick.VirtualKeyboard + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Virtual Keyboard") + id: root + + TextInput { + anchors.fill: parent + Component.onCompleted: { + forceActiveFocus() + Qt.quit() + } + } + + InputPanel { + id: inputPanel + anchors.bottom: parent.bottom + width: root.width + } +} |