diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2017-03-29 11:40:33 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2017-04-04 09:39:45 +0000 |
commit | 1a61185456822dffbf0f1d5ed047c6c2e7d3ceef (patch) | |
tree | 224dfddbef64ab3e2e7bf9be73dc5e4d88ef9b81 /tests/auto/vehiclefunctions | |
parent | e062a8abb1908fff7e52b453043013441cac3042 (diff) | |
download | qtivi-1a61185456822dffbf0f1d5ed047c6c2e7d3ceef.tar.gz |
Streamline the initialization logic
The new initialize() function in QIviFeatureInterface is now called
by the QIviAbstractFeature after all signals are connected in the
connectToServiceObject() function.
The initialize() and initializeAttribute() functions have beeen removed
from all other interfaces and the default implementation is used.
QIviAbstractFeature now provides a new isInitialized() property, which
changes to true, once the backend has informed the feature about its
current state and the initializationDone() signal was send.
Task-number: QTAUTO-321
Change-Id: I07fd9ee905bb51ad872a49dd543dc739a07fc583
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'tests/auto/vehiclefunctions')
-rw-r--r-- | tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp | 17 | ||||
-rw-r--r-- | tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp | 17 |
2 files changed, 30 insertions, 4 deletions
diff --git a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp b/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp index d307b7e..938cd51 100644 --- a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp +++ b/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp @@ -90,7 +90,7 @@ public: return m_zones; } - void initializeAttributes() Q_DECL_OVERRIDE + void initialize() Q_DECL_OVERRIDE { emit airflowDirectionsChanged(m_airflowDirections); emit airflowDirectionsAttributeChanged(m_airflowDirectionsAttribute); @@ -537,11 +537,24 @@ private: ClimateControlTestBackend *m_backend; }; +class InvalidInterface : public QIviFeatureInterface +{ +public: + InvalidInterface(QObject *parent) + : QIviFeatureInterface(parent) + {} + + void initialize() Q_DECL_OVERRIDE + { + emit initializationDone(); + } +}; + class ClimateControlInvalidServiceObject : public QIviServiceObject { public: explicit ClimateControlInvalidServiceObject(QObject *parent=0) : - QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new QIviFeatureInterface(this)) + QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this)) { m_interfaces << QIviClimateControl_iid; } diff --git a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp b/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp index d5249d2..bc9f488 100644 --- a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp +++ b/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp @@ -62,7 +62,7 @@ public: return m_zoneMap.keys(); } - void initializeAttributes() Q_DECL_OVERRIDE + void initialize() Q_DECL_OVERRIDE { const QStringList zones = availableZones(); //zones.removeLast(); // Do not init zone "Dummy" @@ -257,11 +257,24 @@ private: WindowControlTestBackend *m_backend; }; +class InvalidInterface : public QIviFeatureInterface +{ +public: + InvalidInterface(QObject *parent) + : QIviFeatureInterface(parent) + {} + + void initialize() Q_DECL_OVERRIDE + { + emit initializationDone(); + } +}; + class WindowControlInvalidServiceObject : public QIviServiceObject { public: explicit WindowControlInvalidServiceObject(QObject *parent=0) : - QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new QIviFeatureInterface(this)) + QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this)) { m_interfaces << QIviWindowControl_iid; } |