aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2018-02-06 10:57:12 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2018-02-07 13:26:02 +0000
commitf38d9f6432a6e23099aa1da4d5e618fba3db7f20 (patch)
tree6656902ddbb55818854b8878a9f235553cede68e
parent7d9598740374db338687b9c3d2d6fb7d89b6ae67 (diff)
Cleanup unneeded files
Change-Id: I582e8c4c9aa137c6497594433ab751cd961d05f4 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rwxr-xr-xexamples/ivicore/qface-ivi-climate/build.sh77
-rwxr-xr-xtests/auto/core/ivigenerator/autotest.sh157
-rw-r--r--tests/auto/vehiclefunctions/climatecontroltest/climatecontroltest.pro11
-rw-r--r--tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp827
-rw-r--r--tests/auto/vehiclefunctions/vehiclefunctions.pro2
-rw-r--r--tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp487
-rw-r--r--tests/auto/vehiclefunctions/windowcontroltest/windowcontroltest.pro11
7 files changed, 0 insertions, 1572 deletions
diff --git a/examples/ivicore/qface-ivi-climate/build.sh b/examples/ivicore/qface-ivi-climate/build.sh
deleted file mode 100755
index f61aabe..0000000
--- a/examples/ivicore/qface-ivi-climate/build.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/bash -e
-
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:BSD-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.
-#
-# BSD License Usage
-# Alternatively, you may use this file under the terms of the BSD license
-# as follows:
-#
-# "Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of The Qt Company Ltd nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-# A die helper function
-# $1: The exit message
-# $2: The exit code
-die() {
- echo "${1}"
- exit ${2}
-}
-
-WORKDIR=$(dirname $0)
-GENERATOR=${WORKDIR}/../../src/tools/ivigenerator/generate.py
-test -x ${GENERATOR} || die "${GENERATOR} does not exists or can't be executed" 1
-out_dir=${WORKDIR}
-idlfile=qface-ivi-climate
-/bin/rm -rf ${out_dir}/frontend/*.{h,cpp,pri}
-/bin/rm -rf ${out_dir}/backend_simulator/*.{h,cpp,pri}
-${GENERATOR} --format=frontend ${WORKDIR}/${idlfile}.qface ${out_dir}/frontend || die "Generator failed" 1
-${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${out_dir}/backend_simulator || die "Generator for backend failed" 1
-test -d build && /bin/rm -rf build
-test -d build && die "Cannot remove existing build folder" 1
-mkdir -p build || die "Cannot create build folder" 1
-pushd build
-project_dir=..
-qmake ${project_dir}/${idlfile}.pro || die "Failed to run qmake" 1
-make || die "Failed to build" 1
-popd
-
-die "All OK" 0
diff --git a/tests/auto/core/ivigenerator/autotest.sh b/tests/auto/core/ivigenerator/autotest.sh
deleted file mode 100755
index 9d92ae7..0000000
--- a/tests/auto/core/ivigenerator/autotest.sh
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash -e
-
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-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 Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or 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.GPL2 and 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-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-
-# A die helper function
-# $1: The exit message
-# $2: The exit code
-die() {
- echo "${1}"
- exit ${2}
-}
-
-checkFileCount() {
- if [ "$#" -eq 3 ]; then
- FILECOUNT=$(find "." -type f -name "${3}" | wc -l)
- else
- FILECOUNT=$(find "." -type f | wc -l)
- fi
- echo "${1} generated: " ${FILECOUNT}
- test ${FILECOUNT} -eq ${2} || die "Not a correct number of files (${2} expected)" 1
-}
-
-QFACE_INIT_SCRIPT="src/tools/ivigenerator/qtivi_qface_virtualenv/bin/activate"
-# Load virtualenv where qface is installed to
-if [ -f $QFACE_INIT_SCRIPT ]; then
- . $QFACE_INIT_SCRIPT
-else
- echo "Warning: Can't find qface virtualenv activate script: $QFACE_INIT_SCRIPT"
-fi
-
-WORKDIR=$(dirname $0)
-GENERATOR=${WORKDIR}/../../../../src/tools/ivigenerator/generate.py
-TEST_FILES=(org.example.echo) # org.example.echo.noprivate)
-test -x ${GENERATOR} || die "${GENERATOR} does not exists or can't be executed" 1
-for idlfile in "${TEST_FILES[@]}"
-do
- echo "Testing '$idlfile' ================"
- idldir=$(echo $idlfile | tr . -)
- out_dir=${WORKDIR}/projects/${idldir}
- /bin/rm -rf ${out_dir}/frontend/*.{h,cpp,pri}
- /bin/rm -rf ${out_dir}/backend_simulator/*.{h,cpp,pri}
- ${GENERATOR} --format=frontend --validation_info=True ${WORKDIR}/${idlfile}.qface ${out_dir}/frontend || die "Generator failed" 1
- ${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${out_dir}/backend_simulator || die "Generator for backend failed" 1
- ${GENERATOR} --format=generation_validator ${WORKDIR}/${idlfile}.qface ${out_dir}/ui || die "Generator for validator failed" 1
- test -d build/${idldir} && /bin/rm -rf build/${idldir}
- test -d build/${idldir} && die "Cannot remove existing build folder" 1
- mkdir -p build/${idldir} || die "Cannot create build folder" 1
- pushd build/${idldir}
- project_dir=../../projects/${idldir}
- qmake ${project_dir}/${idldir}-project.pro || die "Failed to run qmake" 1
- make || die "Failed to build" 1
-if [[ "$OSTYPE" == "linux-gnu" ]]; then
- OLD_LD_PATH=$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH=./out:$LD_LIBRARY_PATH
- #./out/ui || die "Test failed"
- export LD_LIBRARY_PATH=${OLD_LD_PATH}
-
-elif [[ "$OSTYPE" == "darwin"* ]]; then
- OLD_DYLD_PATH=$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH=./out:$DYLD_LIBRARY_PATH
- #./out/ui.app/Contents/MacOS/ui || die "Test failed"
- export DYLD_LIBRARY_PATH=${OLD_DYLD_PATH}
-fi
-
- popd
- echo "Done '$idlfile' ================"
-done
-
-for idlfile in "${TEST_FILES[@]}"
-do
- echo "Testing '$idlfile' backend_simulator ================"
- idldir=$(echo $idlfile | tr . -)
- bdir=${WORKDIR}/projects/${idldir}/backend_simulator
- /bin/rm -rf ${bdir}/*.{h,cpp,pri}
- mkdir -p ${bdir}
-
- ${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${bdir} || die "Generator failed" 1
-
- pushd ${bdir}
- checkFileCount "Total files" 9
- checkFileCount "Plugins" 2 "*plugin.*"
- checkFileCount "Backends" 4 "*backend.*"
- popd
-
- echo "Done '$idlfile' ================"
-done
-
-# Test control panel generation
-for idlfile in "${TEST_FILES[@]}"
-do
- echo "Testing '$idlfile' backend_simulator ================"
- idldir=$(echo $idlfile | tr . -)
- bdir=${WORKDIR}/projects/${idldir}/control_panel
- /bin/rm -rf ${bdir}/*.{h,cpp,pri}
- mkdir -p ${bdir}
-
- ${GENERATOR} --format=control_panel ${WORKDIR}/${idlfile}.qface ${bdir} || die "Generator failed" 1
- test -d build/${idldir} && /bin/rm -rf build/${idldir}
- test -d build/${idldir} && die "Cannot remove existing build folder" 1
- mkdir -p build/${idldir} || die "Cannot create build folder" 1
- pushd build/${idldir}
- project_dir=../../projects/${idldir}/control_panel
- qmake ${project_dir}/control_panel.pro || die "Failed to run qmake" 1
- make || die "Failed to build" 1
-if [[ "$OSTYPE" == "linux-gnu" ]]; then
- OLD_LD_PATH=$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH=./out:$LD_LIBRARY_PATH
- ./out/control_panel || die "Test failed"
- export LD_LIBRARY_PATH=${OLD_LD_PATH}
-
-elif [[ "$OSTYPE" == "darwin"* ]]; then
- OLD_DYLD_PATH=$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH=./out:$DYLD_LIBRARY_PATH
- ./out/control_panel.app/Contents/MacOS/control_panel || die "Test failed"
- export DYLD_LIBRARY_PATH=${OLD_DYLD_PATH}
-fi
- popd
-
- echo "Done '$idlfile' ================"
-done
-
-die "All OK" 0
diff --git a/tests/auto/vehiclefunctions/climatecontroltest/climatecontroltest.pro b/tests/auto/vehiclefunctions/climatecontroltest/climatecontroltest.pro
deleted file mode 100644
index 78b0a6d..0000000
--- a/tests/auto/vehiclefunctions/climatecontroltest/climatecontroltest.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-QT += testlib ivicore ivicore-private ivivehiclefunctions
-
-TARGET = tst_climatecontroltest
-CONFIG += testcase
-
-TEMPLATE = app
-
-SOURCES += \
- tst_climatecontroltest.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp b/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp
deleted file mode 100644
index d3b480c..0000000
--- a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pelagicore AG
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtIvi module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT-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 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$
-**
-****************************************************************************/
-
-#include <QtTest>
-
-#include <QtIviCore/QIviServiceManager>
-#include <QtIviCore/QIviServiceObject>
-#include <QtIviVehicleFunctions/QIviClimateControl>
-#include <QtIviVehicleFunctions/QIviClimateControlBackendInterface>
-#include <private/qtiviglobal_p.h>
-#include <private/qivipropertytester_p.h>
-
-class ClimateControlTestBackend : public QIviClimateControlBackendInterface
-{
- Q_OBJECT
-
-public:
- ClimateControlTestBackend()
- : QIviClimateControlBackendInterface()
- , m_airflowDirections(QIviClimateControl::Floor | QIviClimateControl::Dashboard)
- , m_airConditioningEnabled(false)
- , m_airConditioningAttribute(QIviPropertyAttribute<bool>(true))
- , m_heaterEnabled(false)
- , m_heaterAttribute(QIviPropertyAttribute<bool>(true))
- , m_zoneSynchronizationEnabled(false)
- , m_zoneSynchronizationAttribute(QIviPropertyAttribute<bool>(true))
- , m_defrostEnabled(false)
- , m_defrostAttribute(QIviPropertyAttribute<bool>(true))
- , m_recirculationMode(QIviClimateControl::RecirculationOff)
- , m_recirculationSensitivityLevel(0)
- , m_recirculationSensitivityLevelAttribute(QIviPropertyAttribute<int>(0, 10))
- , m_climateMode(QIviClimateControl::ClimateOff)
- , m_automaticClimateFanIntensityLevel(0)
- , m_automaticClimateFanIntensityLevelAttribute(QIviPropertyAttribute<int>(0, 10))
- , m_outsideTemperature(0)
- , m_outsideTemperatureAttribute(QIviPropertyAttribute<int>(0, 10))
- , m_recirculationEnabled(false)
- , m_recirculationAttribute(true)
- {
- QVector<QIviClimateControl::AirflowDirections> list;
- list << (QIviClimateControl::Floor | QIviClimateControl::Dashboard) << QIviClimateControl::Floor << QIviClimateControl::Dashboard;
- m_airflowDirectionsAttribute = list;
- QVector<QIviClimateControl::RecirculationMode> recirculation;
- recirculation << QIviClimateControl::RecirculationOff << QIviClimateControl::RecirculationOn;
- m_recirculationModeAttribute = recirculation;
- QVector<QIviClimateControl::ClimateMode> climate;
- climate << QIviClimateControl::ClimateOff << QIviClimateControl::ClimateOn;
- m_climateModeAttribute = climate;
- m_zones << "FrontLeft" << "Upper" << "Lower";
- for (const QString &z : qAsConst(m_zones)) {
- m_zoneTargetTemperature[z] = 0;
- m_zoneTargetTemperatureAttribute[z] = QIviPropertyAttribute<int>(0, 10);
- m_zoneSeatCooler[z] = 0;
- m_zoneSeatCoolerAttribute[z] = QIviPropertyAttribute<int>(0, 10);
- m_zoneSeatHeater[z] = 0;
- m_zoneSeatHeaterAttribute[z] = QIviPropertyAttribute<int>(0, 10);
- m_zoneSteeringWheelHeater[z] = 0;
- m_zoneSteeringWheelHeaterAttribute[z] = QIviPropertyAttribute<int>(0, 10);
- m_zoneFanSpeedLevel[z] = 0;
- m_zoneFanSpeedLevelAttribute[z] = QIviPropertyAttribute<int>(0, 10);
- }
- m_zones << "Dummy"; // to test unavailable attributes
- }
-
- QStringList availableZones() const override
- {
- return m_zones;
- }
-
- void initialize() override
- {
- emit airflowDirectionsChanged(m_airflowDirections);
- emit airflowDirectionsAttributeChanged(m_airflowDirectionsAttribute);
- emit airConditioningEnabledChanged(m_airConditioningEnabled);
- emit airConditioningAttributeChanged(m_airConditioningAttribute);
- emit heaterEnabledChanged(m_heaterEnabled);
- emit heaterAttributeChanged(m_heaterAttribute);
- emit zoneSynchronizationEnabledChanged(m_zoneSynchronizationEnabled);
- emit zoneSynchronizationAttributeChanged(m_zoneSynchronizationAttribute);
- emit defrostEnabledChanged(m_defrostEnabled);
- emit defrostAttributeChanged(m_defrostAttribute);
- emit outsideTemperatureChanged(m_outsideTemperature);
- emit recirculationModeChanged(m_recirculationMode);
- emit recirculationModeAttributeChanged(m_recirculationModeAttribute);
- emit recirculationSensitivityLevelChanged(m_recirculationSensitivityLevel);
- emit recirculationSensitivityLevelAttributeChanged(m_recirculationSensitivityLevelAttribute);
- emit climateModeChanged(m_climateMode);
- emit climateModeAttributeChanged(m_climateModeAttribute);
- emit automaticClimateFanIntensityLevelChanged(m_automaticClimateFanIntensityLevel);
- emit automaticClimateFanIntensityLevelAttributeChanged(m_automaticClimateFanIntensityLevelAttribute);
- emit outsideTemperatureAttributeChanged(m_outsideTemperatureAttribute);
- emit recirculationEnabledChanged(m_recirculationEnabled);
- emit recirculationAttributeChanged(m_recirculationAttribute);
-
- QStringList zones = availableZones();
- zones.removeLast(); // Do not init zone "Dummy"
- for (const QString &zone : qAsConst(zones)) {
- emit targetTemperatureChanged(m_zoneTargetTemperature[zone], zone);
- emit targetTemperatureAttributeChanged(m_zoneTargetTemperatureAttribute[zone], zone);
- emit seatCoolerChanged(m_zoneSeatCooler[zone], zone);
- emit seatCoolerAttributeChanged(m_zoneSeatCoolerAttribute[zone], zone);
- emit seatHeaterChanged(m_zoneSeatHeater[zone], zone);
- emit seatHeaterAttributeChanged(m_zoneSeatHeaterAttribute[zone], zone);
- emit steeringWheelHeaterChanged(m_zoneSteeringWheelHeater[zone], zone);
- emit steeringWheelHeaterAttributeChanged(m_zoneSteeringWheelHeaterAttribute[zone], zone);
- emit fanSpeedLevelChanged(m_zoneFanSpeedLevel[zone], zone);
- emit fanSpeedLevelAttributeChanged(m_zoneFanSpeedLevelAttribute[zone], zone);
- }
- }
-
- void setTargetTemperature(int t, const QString &z) override
- {
- if (!m_zoneTargetTemperature.contains(z)) {
- qWarning() << "Trying to set ClimateControl::targetTemperature in an unsupported zone.";
- return;
- }
-
- if (m_zoneTargetTemperature[z] != t){
- m_zoneTargetTemperature[z] = t;
- emit targetTemperatureChanged(m_zoneTargetTemperature[z], z);
- }
- }
-
- void setTargetTemperatureAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- if (!m_zoneTargetTemperatureAttribute.contains(z))
- return;
-
- if (m_zoneTargetTemperatureAttribute[z] != attribute) {
- m_zoneTargetTemperatureAttribute[z] = attribute;
- emit targetTemperatureAttributeChanged(m_zoneTargetTemperatureAttribute[z], z);
- }
- }
-
- void setSeatCooler(int t, const QString &z) override
- {
- if (!m_zoneSeatCooler.contains(z)) {
- qWarning() << "Trying to set ClimateControl::seatCooler in an unsupported zone.";
- return;
- }
-
- if (m_zoneSeatCooler[z] != t) {
- m_zoneSeatCooler[z] = t;
- emit seatCoolerChanged(m_zoneSeatCooler[z], z);
- }
- }
-
- void setSeatCoolerAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- if (!m_zoneSeatCoolerAttribute.contains(z))
- return;
-
- if (m_zoneSeatCoolerAttribute[z] != attribute) {
- m_zoneSeatCoolerAttribute[z] = attribute;
- emit seatCoolerAttributeChanged(m_zoneSeatCoolerAttribute[z], z);
- }
- }
-
- void setSeatHeater(int t, const QString &z) override
- {
- if (!m_zoneSeatHeater.contains(z)) {
- qWarning() << "Trying to set ClimateControl::seatHeater in an unsupported zone.";
- return;
- }
-
- if (m_zoneSeatHeater[z] != t) {
- m_zoneSeatHeater[z] = t;
- emit seatHeaterChanged(m_zoneSeatHeater[z], z);
- }
- }
-
- void setSeatHeaterAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- if (!m_zoneSeatHeaterAttribute.contains(z))
- return;
-
- if (m_zoneSeatHeaterAttribute[z] != attribute) {
- m_zoneSeatHeaterAttribute[z] = attribute;
- emit seatHeaterAttributeChanged(m_zoneSeatHeaterAttribute[z], z);
- }
- }
-
- void setAirflowDirections(QIviClimateControl::AirflowDirections ad, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_airflowDirections != ad) {
- m_airflowDirections = ad;
- emit airflowDirectionsChanged(m_airflowDirections);
- }
- }
-
- void setAirflowDirectionsAttribute(QIviPropertyAttribute<QIviClimateControl::AirflowDirections> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_airflowDirectionsAttribute != attribute) {
- m_airflowDirectionsAttribute = attribute;
- emit airflowDirectionsAttributeChanged(m_airflowDirectionsAttribute, z);
- }
- }
-
- void setAirConditioningEnabled(bool e, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_airConditioningEnabled != e) {
- m_airConditioningEnabled = e;
- emit airConditioningEnabledChanged(m_airConditioningEnabled);
- }
- }
-
- void setAirConditioningAttribute(QIviPropertyAttribute<bool> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_airConditioningAttribute != attribute) {
- m_airConditioningAttribute = attribute;
- emit airConditioningAttributeChanged(m_airConditioningAttribute, z);
- }
- }
-
- void setHeaterEnabled(bool e, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_heaterEnabled != e) {
- m_heaterEnabled = e;
- emit heaterEnabledChanged(m_heaterEnabled);
- }
- }
-
- void setHeaterAttribute(QIviPropertyAttribute<bool> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_heaterAttribute != attribute) {
- m_heaterAttribute = attribute;
- emit heaterAttributeChanged(m_heaterAttribute, z);
- }
- }
-
- void setSteeringWheelHeater(int t, const QString &z) override
- {
- if (!m_zoneSteeringWheelHeater.contains(z))
- return;
-
- if (m_zoneSteeringWheelHeater[z] != t) {
- m_zoneSteeringWheelHeater[z] = t;
- emit steeringWheelHeaterChanged(m_zoneSteeringWheelHeater[z], z);
- }
- }
-
- void setSteeringWheelHeaterAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- if (!m_zoneSteeringWheelHeaterAttribute.contains(z))
- return;
-
- if (m_zoneSteeringWheelHeaterAttribute[z] != attribute) {
- m_zoneSteeringWheelHeaterAttribute[z] = attribute;
- emit steeringWheelHeaterAttributeChanged(m_zoneSteeringWheelHeaterAttribute[z], z);
- }
- }
-
- void setFanSpeedLevel(int fsl, const QString &z) override
- {
- if (!m_zoneFanSpeedLevel.contains(z))
- return;
-
- if (fsl < 0 || fsl > 10) {
- qWarning() << "Attempted to set Zone" << z << "fanSpeedLevel to" << fsl << " which is out of range (0-10).";
- return;
- }
-
- if (m_zoneFanSpeedLevel[z] != fsl) {
- m_zoneFanSpeedLevel[z] = fsl;
- emit fanSpeedLevelChanged(m_zoneFanSpeedLevel[z], z);
- }
- }
-
- void setFanSpeedLevelAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- if (!m_zoneFanSpeedLevelAttribute.contains(z))
- return;
-
- if (m_zoneFanSpeedLevelAttribute[z] != attribute) {
- m_zoneFanSpeedLevelAttribute[z] = attribute;
- emit fanSpeedLevelAttributeChanged(m_zoneFanSpeedLevelAttribute[z], z);
- }
- }
-
- void setOutsideTemperature(int temperature, const QString &z)
- {
- Q_UNUSED(z)
- if (m_outsideTemperature != temperature) {
- m_outsideTemperature = temperature;
- emit outsideTemperatureChanged(m_outsideTemperature);
- }
- }
-
- void setOutsideTemperatureAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_outsideTemperatureAttribute != attribute) {
- m_outsideTemperatureAttribute = attribute;
- emit outsideTemperatureAttributeChanged(attribute, z);
- }
- }
-
- void setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_zoneSynchronizationEnabled != zoneSynchronization) {
- m_zoneSynchronizationEnabled = zoneSynchronization;
- emit zoneSynchronizationEnabledChanged(zoneSynchronization);
- }
- }
-
- void setZoneSynchronizationAttribute(QIviPropertyAttribute<bool> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_zoneSynchronizationAttribute != attribute) {
- m_zoneSynchronizationAttribute = attribute;
- emit zoneSynchronizationAttributeChanged(attribute, z);
- }
- }
-
- void setDefrostEnabled(bool defrost, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_defrostEnabled != defrost) {
- m_defrostEnabled = defrost;
- emit defrostEnabledChanged(defrost);
- }
- }
-
- void setDefrostAttribute(QIviPropertyAttribute<bool> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_defrostAttribute != attribute) {
- m_defrostAttribute = attribute;
- emit defrostAttributeChanged(attribute, z);
- }
- }
-
- void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_recirculationMode != recirculationMode) {
- m_recirculationMode = recirculationMode;
- emit recirculationModeChanged(recirculationMode);
- }
- }
-
- void setRecirculationModeAttribute(QIviPropertyAttribute<QIviClimateControl::RecirculationMode> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_recirculationModeAttribute != attribute) {
- m_recirculationModeAttribute = attribute;
- emit recirculationModeAttributeChanged(attribute, z);
- }
- }
-
- void setRecirculationEnabled(bool recirculation, const QString &z)
- {
- Q_UNUSED(z)
- if (m_recirculationEnabled != recirculation) {
- m_recirculationEnabled = recirculation;
- emit recirculationEnabledChanged(m_recirculationEnabled);
- }
- }
-
- void setRecirculationAttribute(QIviPropertyAttribute<bool> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_recirculationAttribute != attribute) {
- m_recirculationAttribute = attribute;
- emit recirculationAttributeChanged(attribute, z);
- }
- }
-
- void setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &z) override
- {
- Q_UNUSED(z)
-
- if (recirculationSensitivityLevel < 0 || recirculationSensitivityLevel > 10) {
- qWarning() << "Attempted to set recirculationSensitivityLevel to" << recirculationSensitivityLevel << " which is out of range (0-10).";
- return;
- }
-
- if (m_recirculationSensitivityLevel != recirculationSensitivityLevel) {
- m_recirculationSensitivityLevel = recirculationSensitivityLevel;
- emit recirculationSensitivityLevelChanged(recirculationSensitivityLevel);
- }
- }
-
- void setRecirculationSensitivityLevelAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_recirculationSensitivityLevelAttribute != attribute) {
- m_recirculationSensitivityLevelAttribute = attribute;
- emit recirculationSensitivityLevelAttributeChanged(attribute, z);
- }
- }
-
- void setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &z) override
- {
- Q_UNUSED(z)
- if (m_climateMode != climateMode) {
- m_climateMode = climateMode;
- emit climateModeChanged(climateMode);
- }
- }
-
- void setClimateModeAttribute(QIviPropertyAttribute<QIviClimateControl::ClimateMode> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_climateModeAttribute != attribute) {
- m_climateModeAttribute = attribute;
- emit climateModeAttributeChanged(attribute, z);
- }
- }
-
- void setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &z) override
- {
- Q_UNUSED(z)
-
- if (automaticClimateFanIntensityLevel < 0 || automaticClimateFanIntensityLevel > 10) {
- qWarning() << "Attempted to set automaticClimateFanIntensityLevel to" << automaticClimateFanIntensityLevel << " which is out of range (0-10).";
- return;
- }
-
- if (m_automaticClimateFanIntensityLevel != automaticClimateFanIntensityLevel) {
- m_automaticClimateFanIntensityLevel = automaticClimateFanIntensityLevel;
- emit automaticClimateFanIntensityLevelChanged(automaticClimateFanIntensityLevel);
- }
- }
-
- void setAutomaticClimateFanIntensityLevelAttribute(QIviPropertyAttribute<int> attribute, const QString &z)
- {
- Q_UNUSED(z)
- if (m_automaticClimateFanIntensityLevelAttribute != attribute) {
- m_automaticClimateFanIntensityLevelAttribute = attribute;
- emit automaticClimateFanIntensityLevelAttributeChanged(attribute, z);
- }
- }
-
-private:
- QIviClimateControl::AirflowDirections m_airflowDirections;
- QIviPropertyAttribute<QIviClimateControl::AirflowDirections> m_airflowDirectionsAttribute;
- bool m_airConditioningEnabled;
- QIviPropertyAttribute<bool> m_airConditioningAttribute;
- bool m_heaterEnabled;
- QIviPropertyAttribute<bool> m_heaterAttribute;
- bool m_zoneSynchronizationEnabled;
- QIviPropertyAttribute<bool> m_zoneSynchronizationAttribute;
- bool m_defrostEnabled;
- QIviPropertyAttribute<bool> m_defrostAttribute;
- QIviClimateControl::RecirculationMode m_recirculationMode;
- QIviPropertyAttribute<QIviClimateControl::RecirculationMode> m_recirculationModeAttribute;
- int m_recirculationSensitivityLevel;
- QIviPropertyAttribute<int> m_recirculationSensitivityLevelAttribute;
- QIviClimateControl::ClimateMode m_climateMode;
- QIviPropertyAttribute<QIviClimateControl::ClimateMode> m_climateModeAttribute;
- int m_automaticClimateFanIntensityLevel;
- QIviPropertyAttribute<int> m_automaticClimateFanIntensityLevelAttribute;
- int m_outsideTemperature;
- QIviPropertyAttribute<int> m_outsideTemperatureAttribute;
- bool m_recirculationEnabled;
- QIviPropertyAttribute<bool> m_recirculationAttribute;
-
- QMap<QString, int> m_zoneTargetTemperature;
- QMap<QString, int> m_zoneSeatCooler;
- QMap<QString, int> m_zoneSeatHeater;
- QMap<QString, int> m_zoneSteeringWheelHeater;
- QMap<QString, int> m_zoneFanSpeedLevel;
- QMap<QString, QIviPropertyAttribute<int>> m_zoneTargetTemperatureAttribute;
- QMap<QString, QIviPropertyAttribute<int>> m_zoneSeatCoolerAttribute;
- QMap<QString, QIviPropertyAttribute<int>> m_zoneSeatHeaterAttribute;
- QMap<QString, QIviPropertyAttribute<int>> m_zoneSteeringWheelHeaterAttribute;
- QMap<QString, QIviPropertyAttribute<int>> m_zoneFanSpeedLevelAttribute;
-
- QStringList m_zones;
-};
-
-typedef QIviPropertyTestData<QIviClimateControl, ClimateControlTestBackend, int> ClimateControlTestDataInt;
-Q_DECLARE_METATYPE(ClimateControlTestDataInt)
-
-typedef QIviPropertyTestData<QIviClimateControl, ClimateControlTestBackend, bool> ClimateControlTestDataBool;
-Q_DECLARE_METATYPE(ClimateControlTestDataBool)
-
-class ClimateControlTestServiceObject : public QIviServiceObject
-{
- Q_OBJECT
-
-public:
- explicit ClimateControlTestServiceObject(QObject *parent = nullptr) :
- QIviServiceObject(parent), m_name(QLatin1String(""))
- {
- m_backend = new ClimateControlTestBackend;
- m_interfaces << QIviClimateControl_iid;
- }
-
- QString name() const { return m_name; }
- QStringList interfaces() const { return m_interfaces; }
- QIviFeatureInterface *interfaceInstance(const QString& interface) const
- {
- if (interface == QIviClimateControl_iid)
- return testBackend();
- else
- return 0;
- }
-
- ClimateControlTestBackend *testBackend() const
- {
- return m_backend;
- }
-
-private:
- QString m_name;
- QStringList m_interfaces;
- ClimateControlTestBackend *m_backend;
-};
-
-class InvalidInterface : public QIviFeatureInterface
-{
- Q_OBJECT
-public:
- InvalidInterface(QObject *parent)
- : QIviFeatureInterface(parent)
- {}
-
- void initialize() override
- {
- emit initializationDone();
- }
-};
-
-class ClimateControlInvalidServiceObject : public QIviServiceObject
-{
- Q_OBJECT
-
-public:
- explicit ClimateControlInvalidServiceObject(QObject *parent = nullptr) :
- QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this))
- {
- m_interfaces << QIviClimateControl_iid;
- }
-
- QString name() const { return m_name; }
- QStringList interfaces() const { return m_interfaces; }
- QIviFeatureInterface *interfaceInstance(const QString& ) const { return m_dummyBackend; }
-
-private:
- QString m_name;
- QStringList m_interfaces;
- QIviFeatureInterface *m_dummyBackend;
-};
-
-class ClimateControlTest : public QObject
-{
- Q_OBJECT
-
-public:
- ClimateControlTest();
-
-private slots:
- void cleanup();
-
- void testWithoutBackend();
- void testInvalidBackend();
- void testClearServiceObject();
-
- void testIntProperties_data();
- void testIntProperties();
- void testBoolProperties_data();
- void testBoolProperties();
-
- void testAirflowDirections();
- void testRecirculationMode();
- void testClimateMode();
-
-private:
- QIviServiceManager *manager;
-};
-
-ClimateControlTest::ClimateControlTest()
- : QObject()
-{
- manager = QIviServiceManager::instance();
-}
-
-void ClimateControlTest::cleanup()
-{
- manager->unloadAllBackends();
-}
-
-void ClimateControlTest::testWithoutBackend()
-{
- QIviClimateControl cc;
-
- // Running without a backend means that changes do not propagate
- // We check this on a single property in this case
- QSignalSpy heaterEnabledSpy(&cc, SIGNAL(heaterEnabledChanged(bool)));
-
- bool e = cc.isHeaterEnabled();
- QVERIFY(!e);
- cc.setHeaterEnabled(true);
- QCOMPARE(heaterEnabledSpy.count(), 0);
- QCOMPARE(cc.isHeaterEnabled(), e);
-
- QCOMPARE(cc.zones().count(), 0);
-}
-
-void ClimateControlTest::testInvalidBackend()
-{
- ClimateControlInvalidServiceObject *service = new ClimateControlInvalidServiceObject(); \
- manager->registerService(service, service->interfaces()); \
- QIviClimateControl cc;
- cc.startAutoDiscovery();
-
- // Running without a backend means that changes do not propagate
- // We check this on a single property in this case
- QSignalSpy heaterEnabledSpy(&cc, SIGNAL(heaterEnabledChanged(bool)));
-
- bool e = cc.isHeaterEnabled();
- QVERIFY(!e);
- cc.setHeaterEnabled(true);
- QCOMPARE(heaterEnabledSpy.count(), 0);
- QCOMPARE(cc.isHeaterEnabled(), e);
-
- QCOMPARE(cc.zones().count(), 0);
-}
-
-void ClimateControlTest::testClearServiceObject()
-{
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- service->testBackend()->setAirConditioningEnabled(true, QString());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
- QCOMPARE(cc.isAirConditioningEnabled(), true);
- cc.setServiceObject(0);
- QCOMPARE(cc.isAirConditioningEnabled(), false);
-}
-
-void ClimateControlTest::testIntProperties_data()
-{
- QTest::addColumn<ClimateControlTestDataInt>("testData");
- QTest::addColumn<bool>("testZones");
-
- QTest::newRow("recirculationSensitivityLevel") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, recirculationSensitivityLevel, RecirculationSensitivityLevel,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << false;
-
- QTest::newRow("automaticClimateFanIntensityLevel") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, automaticClimateFanIntensityLevel, AutomaticClimateFanIntensityLevel,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << false;
- QTest::newRow("outsideTemperature") << PROPERTY_TEST_DATA_READONLY(QIviClimateControl, ClimateControlTestBackend, int, outsideTemperature, OutsideTemperature,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << false;
- QTest::newRow("fanSpeedLevel") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, fanSpeedLevel, FanSpeedLevel,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << true;
- QTest::newRow("steeringWheelHeater") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, steeringWheelHeater, SteeringWheelHeater,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << true;
- QTest::newRow("targetTemperature") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, targetTemperature, TargetTemperature,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << true;
- QTest::newRow("seatCooler") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, seatCooler, SeatCooler,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << true;
- QTest::newRow("seatHeater") << PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, int, seatHeater, SeatHeater,
- QList<int>({0, 5, 8, 6}),
- QList<QIviPropertyAttribute<int>>({QIviPropertyAttribute<int>(0, 10), QIviPropertyAttribute<int>(5, 15)}))
- << true;
-}
-
-void ClimateControlTest::testIntProperties()
-{
- QFETCH(ClimateControlTestDataInt, testData);
- QFETCH(bool, testZones);
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
-
- if (testZones) {
- const QStringList zones = cc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviClimateControl *climateZone = qobject_cast<QIviClimateControl*>(cc.zoneAt(z));
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, int>(testData, climateZone, service->testBackend(), z);
- }
- } else {
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, int>(testData, &cc, service->testBackend());
- }
-}
-
-void ClimateControlTest::testBoolProperties_data()
-{
- QTest::addColumn<ClimateControlTestDataBool>("testData");
- QTest::addColumn<bool>("testZones");
-
- QTest::newRow("airConditioning") << PROPERTY_TEST_DATA_BOOL(QIviClimateControl, ClimateControlTestBackend, airConditioning, AirConditioning,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}))
- << false;
- QTest::newRow("heater") << PROPERTY_TEST_DATA_BOOL(QIviClimateControl, ClimateControlTestBackend, heater, Heater,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}))
- << false;
- QTest::newRow("zoneSynchronization") << PROPERTY_TEST_DATA_BOOL(QIviClimateControl, ClimateControlTestBackend, zoneSynchronization, ZoneSynchronization,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}))
- << false;
- QTest::newRow("defrost") << PROPERTY_TEST_DATA_BOOL(QIviClimateControl, ClimateControlTestBackend, defrost, Defrost,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}))
- << false;
- QTest::newRow("recirculation") << PROPERTY_TEST_DATA_BOOL_READONLY(QIviClimateControl, ClimateControlTestBackend, recirculation, Recirculation,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}))
- << false;
-}
-
-void ClimateControlTest::testBoolProperties()
-{
- QFETCH(ClimateControlTestDataBool, testData);
- QFETCH(bool, testZones);
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
-
- if (testZones) {
- const QStringList zones = cc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviClimateControl *climateZone = qobject_cast<QIviClimateControl*>(cc.zoneAt(z));
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, bool>(testData, climateZone, service->testBackend(), z);
- }
- } else {
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, bool>(testData, &cc, service->testBackend());
- }
-}
-
-void ClimateControlTest::testAirflowDirections()
-{
- QVector<QIviClimateControl::AirflowDirections> list;
- list << (QIviClimateControl::Floor | QIviClimateControl::Dashboard) << QIviClimateControl::Floor << QIviClimateControl::Dashboard;
-
- auto testData = PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::AirflowDirections, airflowDirections, AirflowDirections,
- QList<QIviClimateControl::AirflowDirections>({QIviClimateControl::Dashboard, QIviClimateControl::Floor, QIviClimateControl::Windshield, QIviClimateControl::Dashboard | QIviClimateControl::Windshield}),
- QList<QIviPropertyAttribute<QIviClimateControl::AirflowDirections>>({QIviPropertyAttribute<QIviClimateControl::AirflowDirections>(list), QIviPropertyAttribute<QIviClimateControl::AirflowDirections>(QIviClimateControl::Dashboard)}));
-
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::AirflowDirections>(testData, &cc, service->testBackend());
-}
-
-void ClimateControlTest::testRecirculationMode()
-{
- QVector<QIviClimateControl::RecirculationMode> list;
- list << QIviClimateControl::RecirculationOff << QIviClimateControl::RecirculationOn;
-
- auto testData = PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::RecirculationMode, recirculationMode, RecirculationMode,
- QList<QIviClimateControl::RecirculationMode>({QIviClimateControl::RecirculationOff, QIviClimateControl::RecirculationOn, QIviClimateControl::RecirculationOff, QIviClimateControl::RecirculationOn}),
- QList<QIviPropertyAttribute<QIviClimateControl::RecirculationMode>>({QIviPropertyAttribute<QIviClimateControl::RecirculationMode>(list), QIviPropertyAttribute<QIviClimateControl::RecirculationMode>(QIviClimateControl::RecirculationOn)}));
-
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::RecirculationMode>(testData, &cc, service->testBackend());
-}
-
-void ClimateControlTest::testClimateMode()
-{
- QVector<QIviClimateControl::ClimateMode> list;
- list << QIviClimateControl::ClimateOff << QIviClimateControl::ClimateOn;
-
- auto testData = PROPERTY_TEST_DATA(QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::ClimateMode, climateMode, ClimateMode,
- QList<QIviClimateControl::ClimateMode>({QIviClimateControl::ClimateOff, QIviClimateControl::ClimateOn, QIviClimateControl::ClimateOff, QIviClimateControl::ClimateOn}),
- QList<QIviPropertyAttribute<QIviClimateControl::ClimateMode>>({QIviPropertyAttribute<QIviClimateControl::ClimateMode>(list), QIviPropertyAttribute<QIviClimateControl::ClimateMode>(QIviClimateControl::ClimateOn)}));
-
- ClimateControlTestServiceObject *service = new ClimateControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviClimateControl cc;
- cc.startAutoDiscovery();
- testIVIProperty<QIviClimateControl, ClimateControlTestBackend, QIviClimateControl::ClimateMode>(testData, &cc, service->testBackend());
-}
-
-QTEST_APPLESS_MAIN(ClimateControlTest)
-
-#include "tst_climatecontroltest.moc"
diff --git a/tests/auto/vehiclefunctions/vehiclefunctions.pro b/tests/auto/vehiclefunctions/vehiclefunctions.pro
index f8e6ba3..c3856df 100644
--- a/tests/auto/vehiclefunctions/vehiclefunctions.pro
+++ b/tests/auto/vehiclefunctions/vehiclefunctions.pro
@@ -1,5 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = basic
-#SUBDIRS = climatecontroltest \
- windowcontroltest
diff --git a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp b/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp
deleted file mode 100644
index 4425208..0000000
--- a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp
+++ /dev/null
@@ -1,487 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pelagicore AG
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtIvi module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT-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 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$
-**
-****************************************************************************/
-
-#include <QtTest>
-
-#include <QtIviCore/QIviServiceManager>
-#include <QtIviCore/QIviServiceObject>
-#include <QtIviVehicleFunctions/QIviWindowControl>
-#include <QtIviVehicleFunctions/QIviWindowControlBackendInterface>
-#include <private/qivipropertytester_p.h>
-
-class WindowControlTestBackend : public QIviWindowControlBackendInterface
-{
- Q_OBJECT
-
-public:
- WindowControlTestBackend()
- : QIviWindowControlBackendInterface()
- {
- ZoneBackend zone;
- zone.heaterMode = QIviWindowControl::HeaterOff;
- zone.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- zone.heaterEnabled = false;
- zone.heaterAttribute = QIviPropertyAttribute<bool>(true);
- zone.blindMode = QIviWindowControl::BlindClosed;
- zone.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(QVector<QIviWindowControl::BlindMode>({QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen}));
- zone.blindState = QIviWindowControl::Closed;
- zone.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- zone.state = QIviWindowControl::Closed;
- zone.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
-
- m_zoneMap.insert("FrontLeft", zone);
- m_zoneMap.insert("FrontRight", zone);
- m_zoneMap.insert("Rear", zone);
- }
-
- QStringList availableZones() const override
- {
- return m_zoneMap.keys();
- }
-
- void initialize() override
- {
- const QStringList zones = availableZones();
- //zones.removeLast(); // Do not init zone "Dummy"
- for (const QString &zone : zones) {
- emit heaterModeChanged(m_zoneMap[zone].heaterMode, zone);
- emit heaterModeAttributeChanged(m_zoneMap[zone].heaterModeAttribute, zone);
- emit heaterEnabledChanged(m_zoneMap[zone].heaterEnabled, zone);
- emit heaterAttributeChanged(m_zoneMap[zone].heaterAttribute, zone);
- emit blindModeChanged(m_zoneMap[zone].blindMode, zone);
- emit blindModeAttributeChanged(m_zoneMap[zone].blindModeAttribute, zone);
- emit blindStateChanged(m_zoneMap[zone].blindState, zone);
- emit blindStateAttributeChanged(m_zoneMap[zone].blindStateAttribute, zone);
- emit stateChanged(m_zoneMap[zone].state, zone);
- emit stateAttributeChanged(m_zoneMap[zone].stateAttribute, zone);
- }
- }
-
-public:
-
- void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) override
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].heaterMode != value) {
- m_zoneMap[zone].heaterMode = value;
- emit heaterModeChanged(value, zone);
- }
- }
-
- void setHeaterModeAttribute(QIviPropertyAttribute<QIviWindowControl::HeaterMode> attribute, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].heaterModeAttribute != attribute) {
- m_zoneMap[zone].heaterModeAttribute = attribute;
- emit heaterModeAttributeChanged(attribute, zone);
- }
- }
-
- void setHeaterEnabled(bool enabled, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].heaterEnabled != enabled) {
- m_zoneMap[zone].heaterEnabled = enabled;
- emit heaterEnabledChanged(enabled, zone);
- }
- }
-
- void setHeaterAttribute(QIviPropertyAttribute<bool> attribute, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].heaterAttribute != attribute) {
- m_zoneMap[zone].heaterAttribute = attribute;
- emit heaterAttributeChanged(attribute, zone);
- }
- }
-
- void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) override
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].blindMode != value) {
- m_zoneMap[zone].blindMode = value;
- emit blindModeChanged(value, zone);
- }
- }
-
- void setBlindModeAttribute(QIviPropertyAttribute<QIviWindowControl::BlindMode> attribute, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].blindModeAttribute != attribute) {
- m_zoneMap[zone].blindModeAttribute = attribute;
- emit blindModeAttributeChanged(attribute, zone);
- }
- }
-
- void setBlindState(QIviWindowControl::State value, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].blindState != value) {
- m_zoneMap[zone].blindState = value;
- emit blindStateChanged(value, zone);
- }
- }
-
- void setBlindStateAttribute(QIviPropertyAttribute<QIviWindowControl::State> attribute, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].blindStateAttribute != attribute) {
- m_zoneMap[zone].blindStateAttribute = attribute;
- emit blindStateAttributeChanged(attribute, zone);
- }
- }
-
-
- void setState(QIviWindowControl::State value, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].state != value) {
- m_zoneMap[zone].state = value;
- emit stateChanged(value, zone);
- }
- }
-
- void setStateAttribute(QIviPropertyAttribute<QIviWindowControl::State> attribute, const QString &zone)
- {
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].stateAttribute != attribute) {
- m_zoneMap[zone].stateAttribute = attribute;
- emit stateAttributeChanged(attribute, zone);
- }
- }
-
- //TODO add an autotest for this
- void open(const QString &zone) override
- {
- Q_UNUSED(zone)
- }
-
- void close(const QString &zone) override
- {
- Q_UNUSED(zone)
- }
-
-private:
-
- struct ZoneBackend {
- QIviWindowControl::HeaterMode heaterMode;
- QIviPropertyAttribute<QIviWindowControl::HeaterMode> heaterModeAttribute;
- bool heaterEnabled;
- QIviPropertyAttribute<bool> heaterAttribute;
- QIviWindowControl::BlindMode blindMode;
- QIviPropertyAttribute<QIviWindowControl::BlindMode> blindModeAttribute;
- QIviWindowControl::State blindState;
- QIviPropertyAttribute<QIviWindowControl::State> blindStateAttribute;
- QIviWindowControl::State state;
- QIviPropertyAttribute<QIviWindowControl::State> stateAttribute;
- };
-
- QMap<QString,ZoneBackend> m_zoneMap;
-};
-
-
-typedef QIviPropertyTestData<QIviWindowControl, WindowControlTestBackend, QIviWindowControl::State> WindowControlTestDataState;
-Q_DECLARE_METATYPE(WindowControlTestDataState)
-
-class WindowControlTestServiceObject : public QIviServiceObject
-{
- Q_OBJECT
-
-public:
- explicit WindowControlTestServiceObject(QObject *parent = nullptr) :
- QIviServiceObject(parent), m_name(QLatin1String(""))
- {
- m_backend = new WindowControlTestBackend;
- m_interfaces << QIviWindowControl_iid;
- }
-
- QString name() const { return m_name; }
- QStringList interfaces() const { return m_interfaces; }
- QIviFeatureInterface *interfaceInstance(const QString& interface) const
- {
- if (interface == QIviWindowControl_iid)
- return testBackend();
- else
- return 0;
- }
-
- WindowControlTestBackend *testBackend() const
- {
- return m_backend;
- }
-
-private:
- QString m_name;
- QStringList m_interfaces;
- WindowControlTestBackend *m_backend;
-};
-
-class InvalidInterface : public QIviFeatureInterface
-{
- Q_OBJECT
-
-public:
- InvalidInterface(QObject *parent)
- : QIviFeatureInterface(parent)
- {}
-
- void initialize() override
- {
- emit initializationDone();
- }
-};
-
-class WindowControlInvalidServiceObject : public QIviServiceObject
-{
- Q_OBJECT
-
-public:
- explicit WindowControlInvalidServiceObject(QObject *parent = nullptr) :
- QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this))
- {
- m_interfaces << QIviWindowControl_iid;
- }
-
- QString name() const { return m_name; }
- QStringList interfaces() const { return m_interfaces; }
- QIviFeatureInterface *interfaceInstance(const QString& ) const { return m_dummyBackend; }
-
-private:
- QString m_name;
- QStringList m_interfaces;
- QIviFeatureInterface *m_dummyBackend;
-};
-
-class WindowControlTest : public QObject
-{
- Q_OBJECT
-
-public:
- WindowControlTest();
-
-private slots:
- void cleanup();
-
- void testWithoutBackend();
- void testInvalidBackend();
- void testClearServiceObject();
-
- void testHeaterMode();
- void testHeaterEnabled();
- void testBlindMode();
-
- void testStates_data();
- void testStates();
-
-private:
- QIviServiceManager *manager;
-};
-
-WindowControlTest::WindowControlTest()
- : QObject()
-{
- manager = QIviServiceManager::instance();
-}
-
-void WindowControlTest::cleanup()
-{
- manager->unloadAllBackends();
-}
-
-void WindowControlTest::testWithoutBackend()
-{
- QIviWindowControl wc;
-
- // Running without a backend means that changes do not propagate
- // We check this on a single property in this case
- QSignalSpy heaterModeSpy(&wc, SIGNAL(heaterModeChanged(QIviWindowControl::HeaterMode)));
-
- QIviWindowControl::HeaterMode e = wc.heaterMode();
- QCOMPARE(e, QIviWindowControl::HeaterOff);
- wc.setHeaterMode(QIviWindowControl::HeaterOn);
- QCOMPARE(heaterModeSpy.count(), 0);
- QCOMPARE(wc.heaterMode(), e);
-
- QCOMPARE(wc.zones().count(), 0);
-}
-
-void WindowControlTest::testInvalidBackend()
-{
- WindowControlInvalidServiceObject *service = new WindowControlInvalidServiceObject();
- manager->registerService(service, service->interfaces());
- QIviWindowControl wc;
- wc.startAutoDiscovery();
-
- // Running without a backend means that changes do not propagate
- // We check this on a single property in this case
- QSignalSpy heaterModeSpy(&wc, SIGNAL(heaterModeChanged(QIviWindowControl::HeaterMode)));
-
- QIviWindowControl::HeaterMode e = wc.heaterMode();
- QCOMPARE(e, QIviWindowControl::HeaterOff);
- wc.setHeaterMode(QIviWindowControl::HeaterOn);
- QCOMPARE(heaterModeSpy.count(), 0);
- QCOMPARE(wc.heaterMode(), e);
-
- QCOMPARE(wc.zones().count(), 0);
-}
-
-void WindowControlTest::testClearServiceObject()
-{
- WindowControlTestServiceObject *service = new WindowControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- service->testBackend()->setHeaterMode(QIviWindowControl::HeaterOn, "FrontLeft");
- QIviWindowControl wc;
- wc.startAutoDiscovery();
- QVERIFY(wc.availableZones().contains("FrontLeft"));
- QIviWindowControl *zone = qobject_cast<QIviWindowControl*>(wc.zoneAt("FrontLeft"));
- QVERIFY(zone);
- QCOMPARE(zone->heaterMode(), QIviWindowControl::HeaterOn);
- wc.setServiceObject(nullptr);
- QVERIFY(!wc.zoneAt("FrontLeft"));
-}
-
-void WindowControlTest::testHeaterMode()
-{
- QVector<QIviWindowControl::HeaterMode> list;
- list << QIviWindowControl::HeaterOff << QIviWindowControl::HeaterOn;
-
- auto testData = PROPERTY_TEST_DATA(QIviWindowControl, WindowControlTestBackend, QIviWindowControl::HeaterMode, heaterMode, HeaterMode,
- QList<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn, QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}),
- QList<QIviPropertyAttribute<QIviWindowControl::HeaterMode>>({QIviPropertyAttribute<QIviWindowControl::HeaterMode>(list), QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QIviWindowControl::AutoHeater)}));
-
- WindowControlTestServiceObject *service = new WindowControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviWindowControl wc;
- wc.startAutoDiscovery();
- const QStringList zones = wc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviWindowControl *window = qobject_cast<QIviWindowControl*>(wc.zoneAt(z));
- testIVIProperty<QIviWindowControl, WindowControlTestBackend, QIviWindowControl::HeaterMode>(testData, window, service->testBackend(), z);
- }
-}
-
-void WindowControlTest::testHeaterEnabled()
-{
- auto testData = PROPERTY_TEST_DATA_BOOL_READONLY(QIviWindowControl, WindowControlTestBackend, heater, Heater,
- QList<bool>({false, true, false, true}),
- QList<QIviPropertyAttribute<bool>>({QIviPropertyAttribute<bool>(true), QIviPropertyAttribute<bool>(false)}));
-
- WindowControlTestServiceObject *service = new WindowControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviWindowControl wc;
- wc.startAutoDiscovery();
- const QStringList zones = wc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviWindowControl *window = qobject_cast<QIviWindowControl*>(wc.zoneAt(z));
- testIVIProperty<QIviWindowControl, WindowControlTestBackend, bool>(testData, window, service->testBackend(), z);
- }
-}
-
-void WindowControlTest::testBlindMode()
-{
- QVector<QIviWindowControl::BlindMode> list;
- list << QIviWindowControl::BlindClosed << QIviWindowControl::BlindOpen;
-
- auto testData = PROPERTY_TEST_DATA(QIviWindowControl, WindowControlTestBackend, QIviWindowControl::BlindMode, blindMode, BlindMode,
- QList<QIviWindowControl::BlindMode>({QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen, QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen}),
- QList<QIviPropertyAttribute<QIviWindowControl::BlindMode>>({QIviPropertyAttribute<QIviWindowControl::BlindMode>(list), QIviPropertyAttribute<QIviWindowControl::BlindMode>(QIviWindowControl::AutoBlind)}));
-
- WindowControlTestServiceObject *service = new WindowControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviWindowControl wc;
- wc.startAutoDiscovery();
- const QStringList zones = wc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviWindowControl *window = qobject_cast<QIviWindowControl*>(wc.zoneAt(z));
- testIVIProperty<QIviWindowControl, WindowControlTestBackend, QIviWindowControl::BlindMode>(testData, window, service->testBackend(), z);
- }
-}
-
-void WindowControlTest::testStates_data()
-{
- QTest::addColumn<WindowControlTestDataState>("testData");
- QVector<QIviWindowControl::State> list;
- list << QIviWindowControl::Closed << QIviWindowControl::Open << QIviWindowControl::FullyOpen;
-
- QTest::newRow("state") << PROPERTY_TEST_DATA_READONLY(QIviWindowControl, WindowControlTestBackend, QIviWindowControl::State, state, State,
- QList<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen, QIviWindowControl::Closed}),
- QList<QIviPropertyAttribute<QIviWindowControl::State>>({QIviPropertyAttribute<QIviWindowControl::State>(list), QIviPropertyAttribute<QIviWindowControl::State>(QIviWindowControl::Closed)}));
-
- QTest::newRow("blindState") << PROPERTY_TEST_DATA_READONLY(QIviWindowControl, WindowControlTestBackend, QIviWindowControl::State, state, State,
- QList<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen, QIviWindowControl::Closed}),
- QList<QIviPropertyAttribute<QIviWindowControl::State>>({QIviPropertyAttribute<QIviWindowControl::State>(list), QIviPropertyAttribute<QIviWindowControl::State>(QIviWindowControl::Closed)}));
-
-}
-
-void WindowControlTest::testStates()
-{
- QFETCH(WindowControlTestDataState, testData);
-
- WindowControlTestServiceObject *service = new WindowControlTestServiceObject();
- manager->registerService(service, service->interfaces());
- QIviWindowControl wc;
- wc.startAutoDiscovery();
- const QStringList zones = wc.availableZones();
- for (const QString &z : zones) {
- if (z == QLatin1String("Dummy"))
- continue;
- QIviWindowControl *window = qobject_cast<QIviWindowControl*>(wc.zoneAt(z));
- testIVIProperty<QIviWindowControl, WindowControlTestBackend, QIviWindowControl::State>(testData, window, service->testBackend(), z);
- }
-}
-
-QTEST_APPLESS_MAIN(WindowControlTest)
-
-#include "tst_windowcontroltest.moc"
-
diff --git a/tests/auto/vehiclefunctions/windowcontroltest/windowcontroltest.pro b/tests/auto/vehiclefunctions/windowcontroltest/windowcontroltest.pro
deleted file mode 100644
index 7b599b6..0000000
--- a/tests/auto/vehiclefunctions/windowcontroltest/windowcontroltest.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-QT += testlib ivicore ivicore-private ivivehiclefunctions
-
-TARGET = tst_windowcontroltest
-CONFIG += testcase
-
-TEMPLATE = app
-
-SOURCES += \
- tst_windowcontroltest.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"