diff options
author | Bramastyo Harimukti <bramastyo.harimukti.santoso@pelagicore.com> | 2019-03-22 15:44:21 +0100 |
---|---|---|
committer | Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com> | 2019-03-25 07:31:45 +0000 |
commit | 64cf934bdb37094522549b27e3a7ebda0ce81e2c (patch) | |
tree | eecccb7ccd0f0e7918129da0e16e5d2d7ed5de0d /tests | |
parent | f48b3e7d85745cf6d9d65a782a63c9fa7e2955ff (diff) |
[harness] improve the cluster harness by moving them back to tests
- this way the app folder are not polluted by unnecessary files when
it is built
Change-Id: Ie91c4d00b93a45111f070aeb53ec3124c417270c
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/apps/apps.pro | 4 | ||||
-rw-r--r-- | tests/apps/com.theqtcompany.cluster/harnesses/ClusterViewHarness.qml | 127 | ||||
-rw-r--r-- | tests/apps/com.theqtcompany.cluster/harnesses/DialPowerHarness.qml (renamed from tests/apps/com.theqtcompany.cluster/DialPowerHarness.qml) | 11 | ||||
-rw-r--r-- | tests/apps/com.theqtcompany.cluster/harnesses/DialSpeedHarness.qml (renamed from tests/apps/com.theqtcompany.cluster/DialSpeedHarness.qml) | 11 | ||||
-rw-r--r-- | tests/apps/com.theqtcompany.cluster/harnesses/harnesses.pro | 4 | ||||
-rw-r--r-- | tests/tests.pro | 4 |
6 files changed, 154 insertions, 7 deletions
diff --git a/tests/apps/apps.pro b/tests/apps/apps.pro new file mode 100644 index 00000000..89e0a1f7 --- /dev/null +++ b/tests/apps/apps.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + com.theqtcompany.cluster/harnesses \ diff --git a/tests/apps/com.theqtcompany.cluster/harnesses/ClusterViewHarness.qml b/tests/apps/com.theqtcompany.cluster/harnesses/ClusterViewHarness.qml new file mode 100644 index 00000000..1b14512e --- /dev/null +++ b/tests/apps/com.theqtcompany.cluster/harnesses/ClusterViewHarness.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 Cluster UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Window 2.2 +import shared.utils 1.0 + +import shared.Style 1.0 +import shared.Sizes 1.0 + +import views 1.0 +import stores 1.0 + +Item { + id: root + width: Sizes.dp(1920) + height: Sizes.dp(720) + + readonly property real scaleRatio: Math.min(root.width / 1920, root.height / 720) + onScaleRatioChanged: { + root.Sizes.scale = scaleRatio + } + + Image { + anchors.fill: parent + source: Style.image("instrument-cluster-bg") + fillMode: Image.Stretch + } + + ClusterView { + anchors.fill: parent + rtlMode: root.LayoutMirroring.enabled + store: RootStoreInterface { + id: dummystore + + vehicleInterface: VehicleInterface { + speed: 0.0 + speedLimit: 120 + speedCruise: 40.0 + driveTrainState: 2 + ePower: 50 + + lowBeamHeadlight: true + highBeamHeadlight: true + fogLight: true + stabilityControl: true + seatBeltFasten: true + leftTurn: true + + rightTurn: true + absFailure: true + parkBrake: true + tyrePressureLow: true + brakeFailure: true + airbagFailure: true + } + + behaviourInterface: BehaviourInterface { + navigationMode: false + } + } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: { + if (dummystore.vehicleInterface.speed < 140) { + dummystore.vehicleInterface.speed = dummystore.vehicleInterface.speed + 10; + } else { + dummystore.vehicleInterface.speed = 0.0; + } + + if (dummystore.vehicleInterface.ePower < 80) { + dummystore.vehicleInterface.ePower = dummystore.vehicleInterface.ePower + 2; + } else { + dummystore.vehicleInterface.ePower = 0.0; + } + + if (dummystore.vehicleInterface.speedLimit < 100) { + dummystore.vehicleInterface.speedLimit = dummystore.vehicleInterface.speedLimit + 10; + } else { + dummystore.vehicleInterface.speedLimit = 0; + } + + if (dummystore.vehicleInterface.speedCruise < 100) { + dummystore.vehicleInterface.speedCruise = dummystore.vehicleInterface.speedCruise + 10; + } else { + dummystore.vehicleInterface.speedCruise = 0; + } + } + } + } + + Component.onCompleted: { + root.Style.theme = Style.Dark + } +} diff --git a/tests/apps/com.theqtcompany.cluster/DialPowerHarness.qml b/tests/apps/com.theqtcompany.cluster/harnesses/DialPowerHarness.qml index 92a25dea..10e659fd 100644 --- a/tests/apps/com.theqtcompany.cluster/DialPowerHarness.qml +++ b/tests/apps/com.theqtcompany.cluster/harnesses/DialPowerHarness.qml @@ -34,13 +34,18 @@ import QtQuick 2.8 import shared.utils 1.0 import shared.Style 1.0 - +import shared.Sizes 1.0 import panels 1.0 Item { id: root - width: 600 - height: 600 + width: Sizes.dp(560) + height: width + + readonly property real scaleRatio: Math.min(root.width / 560, root.height / 560) + onScaleRatioChanged: { + root.Sizes.scale = scaleRatio + } Image { anchors.fill: parent diff --git a/tests/apps/com.theqtcompany.cluster/DialSpeedHarness.qml b/tests/apps/com.theqtcompany.cluster/harnesses/DialSpeedHarness.qml index 265abd20..4b979d6d 100644 --- a/tests/apps/com.theqtcompany.cluster/DialSpeedHarness.qml +++ b/tests/apps/com.theqtcompany.cluster/harnesses/DialSpeedHarness.qml @@ -32,15 +32,20 @@ import QtQuick 2.8 import shared.utils 1.0 - +import shared.Sizes 1.0 import shared.Style 1.0 import panels 1.0 Item { id: root - width: 600 - height: 600 + width: Sizes.dp(560) + height: width + + readonly property real scaleRatio: Math.min(root.width / 560, root.height / 560) + onScaleRatioChanged: { + root.Sizes.scale = scaleRatio + } Image { anchors.fill: parent diff --git a/tests/apps/com.theqtcompany.cluster/harnesses/harnesses.pro b/tests/apps/com.theqtcompany.cluster/harnesses/harnesses.pro new file mode 100644 index 00000000..1b0bdc9b --- /dev/null +++ b/tests/apps/com.theqtcompany.cluster/harnesses/harnesses.pro @@ -0,0 +1,4 @@ +CONFIG += neptune-livereload + +HARNESSES_WORKSPACE=$$_PRO_FILE_PWD_/ClusterViewHarness.qml +APPLICATION_NAME=com.theqtcompany.cluster diff --git a/tests/tests.pro b/tests/tests.pro index 48ba98e9..9f0a37ac 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += qmltests neptune-qmlscene +SUBDIRS += apps \ + qmltests \ + neptune-qmlscene |