diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-29 11:23:04 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-30 11:48:31 +0300 |
commit | f828d901eeb539a2756ea4c0cb613d55d04ca8e6 (patch) | |
tree | 1e840d8c0408be8ebf67e458f95fb31556de2566 /tests | |
parent | b16b1e36dae0a5b3203bb671b4f87ce4b0bfe009 (diff) |
Enable QtSensors manual tests as part of build
The two manual test applications are now part of build when manual
tests are built. This helps to detect if the test applications break
over time.
The tests were slightly renamed to avoid a naming clash with an
example app. In addition the commit addresses few trivial things
so that the applications start and run without warnings.
Task-number: QTBUG-92502
Change-Id: Ia0368764102efc16276116bc8c75d562d79c1e27
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/manual/sensor_explorer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/manual/sensorclerk/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tests/manual/sensorclerk/main.cpp | 2 | ||||
-rw-r--r-- | tests/manual/sensorclerk/qml/Button.qml | 117 | ||||
-rw-r--r-- | tests/manual/sensorclerk/qml/main.qml | 10 |
6 files changed, 25 insertions, 125 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt new file mode 100644 index 00000000..bc8b1f30 --- /dev/null +++ b/tests/manual/CMakeLists.txt @@ -0,0 +1,6 @@ +if(TARGET Qt::Widgets) + add_subdirectory(sensor_explorer) +endif() +if (TARGET Qt::Quick) + add_subdirectory(sensorclerk) +endif() diff --git a/tests/manual/sensor_explorer/CMakeLists.txt b/tests/manual/sensor_explorer/CMakeLists.txt index 5d2c2a8d..6d6c9c68 100644 --- a/tests/manual/sensor_explorer/CMakeLists.txt +++ b/tests/manual/sensor_explorer/CMakeLists.txt @@ -2,7 +2,7 @@ ## sensor_explorer Binary: ##################################################################### -qt_internal_add_manual_test(sensor_explorer +qt_internal_add_manual_test(tst_manual_sensor_explorer GUI SOURCES explorer.cpp explorer.h explorer.ui diff --git a/tests/manual/sensorclerk/CMakeLists.txt b/tests/manual/sensorclerk/CMakeLists.txt index 17bd8b7d..cad85743 100644 --- a/tests/manual/sensorclerk/CMakeLists.txt +++ b/tests/manual/sensorclerk/CMakeLists.txt @@ -2,7 +2,7 @@ ## sensorclerk Binary: ##################################################################### -qt_internal_add_manual_test(sensorclerk +qt_internal_add_manual_test(tst_manual_sensor_clerk GUI SOURCES collector.cpp collector.h @@ -12,3 +12,14 @@ qt_internal_add_manual_test(sensorclerk Qt::Quick Qt::Sensors ) + +set(qml_files + "qml/main.qml" +) + +qt_internal_add_resource(tst_manual_sensor_clerk "qml_files" + PREFIX + "/" + FILES + ${qml_files} +) diff --git a/tests/manual/sensorclerk/main.cpp b/tests/manual/sensorclerk/main.cpp index 9265dcc8..1eb398a3 100644 --- a/tests/manual/sensorclerk/main.cpp +++ b/tests/manual/sensorclerk/main.cpp @@ -40,7 +40,7 @@ int main( int argc, char** argv ) qmlRegisterType<Collector>("Collector", 1, 0, "Collector"); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource( QUrl( "qml/main.qml" ) ); + view.setSource(QUrl("qrc:qml/main.qml")); view.show(); return app.exec(); } diff --git a/tests/manual/sensorclerk/qml/Button.qml b/tests/manual/sensorclerk/qml/Button.qml deleted file mode 100644 index 0889e07b..00000000 --- a/tests/manual/sensorclerk/qml/Button.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 - -//Implementation of the Button control. -Item { - id: button - width: 250 - height: 150 - property alias text: innerText.text; - property color color: "white" - property color hoverColor: "#aaaaaa" - property color pressColor: "slategray" - property int fontSize: 10 - property int borderWidth: 1 - property int borderRadius: 2 - scale: state === "Pressed" ? 0.96 : 1.0 - onEnabledChanged: state = "" - signal clicked - - //define a scale animation - Behavior on scale { - NumberAnimation { - duration: 100 - easing.type: Easing.InOutQuad - } - } - - //Rectangle to draw the button - Rectangle { - id: rectangleButton - anchors.fill: parent - radius: borderRadius - color: button.enabled ? button.color : "grey" - border.width: borderWidth - border.color: "black" - - Text { - id: innerText - font.pointSize: fontSize - anchors.centerIn: parent - } - } - - //change the color of the button in differen button states - states: [ - State { - name: "Hovering" - PropertyChanges { - target: rectangleButton - color: hoverColor - } - }, - State { - name: "Pressed" - PropertyChanges { - target: rectangleButton - color: pressColor - } - } - ] - - //define transmission for the states - transitions: [ - Transition { - from: ""; to: "Hovering" - ColorAnimation { duration: 200 } - }, - Transition { - from: "*"; to: "Pressed" - ColorAnimation { duration: 10 } - } - ] - - //Mouse area to react on click events - MouseArea { - hoverEnabled: true - anchors.fill: button - onEntered: { button.state='Hovering'} - onExited: { button.state=''} - onClicked: { button.clicked();} - onPressed: { button.state="Pressed" } - onReleased: { - if (containsMouse) - button.state="Hovering"; - else - button.state=""; - } - } -} diff --git a/tests/manual/sensorclerk/qml/main.qml b/tests/manual/sensorclerk/qml/main.qml index e8b74ff2..b55b53a5 100644 --- a/tests/manual/sensorclerk/qml/main.qml +++ b/tests/manual/sensorclerk/qml/main.qml @@ -25,10 +25,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -import QtQuick 2.0 -import Collector 1.0 -import QtSensors 5.0 +import QtQuick +import QtQuick.Controls +import Collector +import QtSensors Rectangle { Collector { @@ -47,7 +47,7 @@ Rectangle { property bool depressed: false anchors.top: label.bottom enabled: true; - anchors.horizontalCenter: parent + anchors.horizontalCenter: parent.horizontalCenter onClicked: { if (!depressed) { writer.startCollecting() |