summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.pro5
-rw-r--r--tests/testserver/main.cpp44
-rw-r--r--tests/testserver/testserver.cpp157
-rw-r--r--tests/testserver/testserver.h77
-rw-r--r--tests/testserver/testserver.pro15
-rw-r--r--tests/testserver/testserveradaptor.cpp101
-rw-r--r--tests/testserver/testserveradaptor.h67
-rw-r--r--tests/tst_dbusplugin/tst_dbusinterface.qml248
-rw-r--r--tests/tst_dbusplugin/tst_dbusplugin.cpp51
-rw-r--r--tests/tst_dbusplugin/tst_dbusplugin.pro9
10 files changed, 774 insertions, 0 deletions
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 0000000..de3ffe4
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+
+SUBDIRS += testserver \
+ tst_dbusplugin
diff --git a/tests/testserver/main.cpp b/tests/testserver/main.cpp
new file mode 100644
index 0000000..892f860
--- /dev/null
+++ b/tests/testserver/main.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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 <QCoreApplication>
+#include "testserver.h"
+#include "testserveradaptor.h"
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+
+ TestServer server;
+ TestServerAdaptor adaptor(&server);
+
+ qDebug() << "startServer" << QDBusConnection::sessionBus().registerObject("/", &server);
+ qDebug() << "startService" << QDBusConnection::sessionBus().registerService("org.pelagicore.TestServer");
+
+ return app.exec();
+}
diff --git a/tests/testserver/testserver.cpp b/tests/testserver/testserver.cpp
new file mode 100644
index 0000000..324b954
--- /dev/null
+++ b/tests/testserver/testserver.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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 "testserver.h"
+
+TestServer::TestServer(QObject *parent) :
+ QObject(parent) ,
+ m_testProperty(false)
+{
+}
+
+bool TestServer::testProperty() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ return m_testProperty;
+}
+
+void TestServer::setTestProperty(bool arg)
+{
+ qDebug() << __PRETTY_FUNCTION__ << arg;
+ m_testProperty = arg;
+ emit testPropertyChanged();
+ notifyPropertyChanged("testProperty");
+}
+
+void TestServer::userError()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ sendErrorReply("com.userError", "This is a user error");
+}
+
+void TestServer::systemError()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ sendErrorReply(QDBusError::InternalError, "Internal error");
+}
+
+void TestServer::testMethod()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ emit testMethodCalled();
+}
+
+void TestServer::testMethodWithArguments(const QString &argument)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ emit testMethodWithArgumentsCalled(argument);
+}
+
+bool TestServer::testMethodWithReturnValue()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ return true;
+}
+
+void TestServer::asyncUserError(const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ createReply(message);
+ m_pendingReply = message.createErrorReply("com.userError", "This is a user error");
+
+ QTimer::singleShot(2000, this, SLOT(sendAsyncResult()));
+}
+
+void TestServer::asyncSystemError(const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ createReply(message);
+ m_pendingReply = message.createErrorReply(QDBusError::InternalError, "Internal error");
+
+ QTimer::singleShot(2000, this, SLOT(sendAsyncResult()));
+}
+
+void TestServer::asyncTestMethod(const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ createReply(message);
+
+ emit asyncTestMethodCalled();
+
+ QTimer::singleShot(2000, this, SLOT(sendAsyncResult()));
+}
+
+void TestServer::asyncTestMethodWithArguments(const QString &argument, const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ createReply(message);
+
+ emit asyncTestMethodWithArgumentsCalled(argument);
+
+ QTimer::singleShot(2000, this, SLOT(sendAsyncResult()));
+}
+
+bool TestServer::asyncTestMethodWithReturnValue(const QDBusMessage &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ createReply(message);
+ m_pendingReply << true;
+
+ QTimer::singleShot(2000, this, SLOT(sendAsyncResult()));
+
+ return false;
+}
+
+void TestServer::sendAsyncResult()
+{
+ qDebug() << "send Async Result" << m_pendingReply;
+
+ QDBusConnection::sessionBus().send(m_pendingReply);
+}
+
+void TestServer::createReply(const QDBusMessage &message)
+{
+ message.setDelayedReply(true);
+ m_pendingReply = message.createReply();
+}
+
+void TestServer::notifyPropertyChanged(const QString& propertyName )
+{
+ qDebug() << "notify Property changes" << propertyName;
+
+ QDBusMessage signal = QDBusMessage::createSignal(
+ "/object/path",
+ "org.freedesktop.DBus.Properties",
+ "PropertiesChanged");
+ signal << "org.pelagicore.TestServer";
+ QVariantMap changedProps;
+ changedProps.insert(propertyName, property(qPrintable(propertyName)));
+ signal << changedProps;
+ signal << QStringList();
+ QDBusConnection::sessionBus().send(signal);
+}
diff --git a/tests/testserver/testserver.h b/tests/testserver/testserver.h
new file mode 100644
index 0000000..bbb4262
--- /dev/null
+++ b/tests/testserver/testserver.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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$
+**
+****************************************************************************/
+
+
+#ifndef TESTSERVER_H
+#define TESTSERVER_H
+
+#include <QtDBus>
+
+class TestServer : public QObject, protected QDBusContext
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(bool testProperty READ testProperty WRITE setTestProperty NOTIFY testPropertyChanged)
+
+public:
+ TestServer(QObject* object = 0);
+
+ bool testProperty() const;
+ void setTestProperty(bool arg);
+
+public slots:
+ void userError();
+ void systemError();
+ void testMethod();
+ void testMethodWithArguments(const QString& argument);
+ bool testMethodWithReturnValue();
+
+ void asyncUserError(const QDBusMessage &message);
+ void asyncSystemError(const QDBusMessage &message);
+ void asyncTestMethod(const QDBusMessage &message);
+ void asyncTestMethodWithArguments(const QString& argument, const QDBusMessage &message);
+ bool asyncTestMethodWithReturnValue(const QDBusMessage &message);
+
+ void sendAsyncResult();
+
+signals:
+ void testPropertyChanged();
+ void testMethodCalled();
+ void testMethodWithArgumentsCalled(const QString& argument);
+ void asyncTestMethodCalled();
+ void asyncTestMethodWithArgumentsCalled(const QString& argument);
+
+private:
+ void notifyPropertyChanged(const QString &propertyName);
+ void createReply(const QDBusMessage &message);
+
+ bool m_testProperty;
+ QDBusMessage m_pendingReply;
+};
+
+#endif // TESTSERVER_H
diff --git a/tests/testserver/testserver.pro b/tests/testserver/testserver.pro
new file mode 100644
index 0000000..c458db0
--- /dev/null
+++ b/tests/testserver/testserver.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+TARGET = testserver
+QT += dbus
+CONFIG += qt
+
+#DESTDIR = ../../qml/testserverplugin
+
+HEADERS += \
+ testserver.h \
+ testserveradaptor.h
+
+SOURCES += \
+ testserver.cpp \
+ main.cpp \
+ testserveradaptor.cpp
diff --git a/tests/testserver/testserveradaptor.cpp b/tests/testserver/testserveradaptor.cpp
new file mode 100644
index 0000000..17a9878
--- /dev/null
+++ b/tests/testserver/testserveradaptor.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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 "testserveradaptor.h"
+
+TestServerAdaptor::TestServerAdaptor(QObject *parent) :
+ QDBusAbstractAdaptor(parent)
+{
+ setAutoRelaySignals(true);
+}
+
+bool TestServerAdaptor::testProperty() const
+{
+ return parent()->property("testProperty").toBool();
+}
+
+void TestServerAdaptor::setTestProperty(bool arg)
+{
+ parent()->setProperty("testProperty", arg);
+}
+
+void TestServerAdaptor::userError()
+{
+ QMetaObject::invokeMethod(parent(), "userError");
+}
+
+void TestServerAdaptor::systemError()
+{
+ QMetaObject::invokeMethod(parent(), "systemError");
+}
+
+void TestServerAdaptor::testMethod()
+{
+ QMetaObject::invokeMethod(parent(), "testMethod");
+}
+
+void TestServerAdaptor::testMethodWithArguments(const QString &argument)
+{
+ QMetaObject::invokeMethod(parent(), "testMethodWithArguments", Q_ARG(QString, argument));
+}
+
+bool TestServerAdaptor::testMethodWithReturnValue()
+{
+ bool retVal;
+ QMetaObject::invokeMethod(parent(), "testMethodWithReturnValue", Q_RETURN_ARG(bool, retVal));
+
+ return retVal;
+}
+
+void TestServerAdaptor::asyncUserError(const QDBusMessage &message)
+{
+ QMetaObject::invokeMethod(parent(), "asyncUserError", Q_ARG(QDBusMessage, message));
+}
+
+void TestServerAdaptor::asyncSystemError(const QDBusMessage &message)
+{
+ QMetaObject::invokeMethod(parent(), "asyncSystemError", Q_ARG(QDBusMessage, message));
+}
+
+void TestServerAdaptor::asyncTestMethod(const QDBusMessage &message)
+{
+ QMetaObject::invokeMethod(parent(), "asyncTestMethod", Q_ARG(QDBusMessage, message));
+}
+
+void TestServerAdaptor::asyncTestMethodWithArguments(const QString &argument, const QDBusMessage &message)
+{
+ QMetaObject::invokeMethod(parent(), "asyncTestMethodWithArguments", Q_ARG(QString, argument), Q_ARG(QDBusMessage, message));
+}
+
+bool TestServerAdaptor::asyncTestMethodWithReturnValue(const QDBusMessage &message)
+{
+ bool retVal;
+ QMetaObject::invokeMethod(parent(), "asyncTestMethodWithReturnValue", Q_RETURN_ARG(bool, retVal), Q_ARG(QDBusMessage, message));
+
+ return retVal;
+}
diff --git a/tests/testserver/testserveradaptor.h b/tests/testserver/testserveradaptor.h
new file mode 100644
index 0000000..95aab20
--- /dev/null
+++ b/tests/testserver/testserveradaptor.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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$
+**
+****************************************************************************/
+
+#ifndef TESTSERVERADAPTOR_H
+#define TESTSERVERADAPTOR_H
+
+#include <QtDBus>
+#include <QDBusAbstractAdaptor>
+
+class TestServerAdaptor : public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.pelagicore.TestServer")
+ Q_PROPERTY(bool testProperty READ testProperty WRITE setTestProperty NOTIFY testPropertyChanged)
+public:
+ explicit TestServerAdaptor(QObject *parent = 0);
+
+ bool testProperty() const;
+ void setTestProperty(bool arg);
+
+public slots:
+ void userError();
+ void systemError();
+ void testMethod();
+ void testMethodWithArguments(const QString& argument);
+ bool testMethodWithReturnValue();
+
+ void asyncUserError(const QDBusMessage &message);
+ void asyncSystemError(const QDBusMessage &message);
+ void asyncTestMethod(const QDBusMessage &message);
+ void asyncTestMethodWithArguments(const QString& argument, const QDBusMessage &message);
+ bool asyncTestMethodWithReturnValue(const QDBusMessage &message);
+
+signals:
+ void testPropertyChanged();
+ void testMethodCalled();
+ void testMethodWithArgumentsCalled(const QString& argument);
+ void asyncTestMethodCalled();
+ void asyncTestMethodWithArgumentsCalled(const QString& argument);
+};
+
+#endif // TESTSERVERADAPTOR_H
diff --git a/tests/tst_dbusplugin/tst_dbusinterface.qml b/tests/tst_dbusplugin/tst_dbusinterface.qml
new file mode 100644
index 0000000..db88c9f
--- /dev/null
+++ b/tests/tst_dbusplugin/tst_dbusinterface.qml
@@ -0,0 +1,248 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import com.pelagicore.dbus 1.0
+
+TestCase {
+ name: "InterfaceTests"
+
+ DBusInterface {
+ id: dbusInterface
+
+ bus: SessionBus{}
+
+ interfaceName: "org.pelagicore.TestServer"
+ path: "/"
+ service: "org.pelagicore.TestServer"
+ }
+
+ SignalSpy {
+ id: interfaceSpy
+ target: dbusInterface.interfaceObject
+ }
+
+ SignalSpy {
+ id: spy
+ }
+
+ function test_errors_sync() {
+ var callReply = dbusInterface.call("userError");
+
+ compare(callReply.valid, false)
+ compare(callReply.errorName, "com.userError")
+ compare(callReply.errorString, "This is a user error")
+
+ var interfaceReply = dbusInterface.interfaceObject.userError();
+
+ //TODO add lastError to Interface and check this against it.
+
+ callReply = dbusInterface.call("systemError");
+
+ compare(callReply.valid, false)
+ compare(callReply.errorName, "org.qtproject.QtDBus.Error.InternalError")
+ compare(callReply.errorString, "Internal error")
+
+ interfaceReply = dbusInterface.interfaceObject.systemError();
+ }
+
+ function test_errors_async() {
+ spy.clear()
+ var callReply = dbusInterface.asyncCall("asyncUserError");
+ spy.signalName = ""
+ spy.target = callReply
+ spy.signalName = "waitingChanged"
+
+ compare(spy.count, 0)
+
+ compare(callReply.valid, true)
+ compare(callReply.waiting, true)
+
+ spy.wait()
+
+ compare(spy.count, 1)
+
+ compare(callReply.waiting, false)
+ compare(callReply.valid, false)
+ compare(callReply.errorName, "com.userError")
+ compare(callReply.errorString, "This is a user error")
+
+
+ spy.clear()
+ callReply = dbusInterface.asyncCall("asyncSystemError");
+ spy.target = callReply
+
+ compare(spy.count, 0)
+
+ compare(callReply.valid, true)
+ compare(callReply.waiting, true)
+
+ spy.wait()
+
+ compare(spy.count, 1)
+
+ compare(callReply.waiting, false)
+ compare(callReply.valid, false)
+ compare(callReply.errorName, "org.qtproject.QtDBus.Error.InternalError")
+ compare(callReply.errorString, "Internal error")
+ }
+
+ function test_methods_sync() {
+ interfaceSpy.clear()
+ interfaceSpy.signalName = "testMethodCalled"
+ var callReply = dbusInterface.call("testMethod");
+
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+ interfaceSpy.wait()
+ compare(interfaceSpy.count, 1)
+
+
+ interfaceSpy.clear()
+ interfaceSpy.signalName = "testMethodWithArgumentsCalled"
+ callReply = dbusInterface.call("testMethodWithArguments", "hello");
+
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+ interfaceSpy.wait()
+ compare(interfaceSpy.signalArguments[0][0], "hello")
+ compare(interfaceSpy.count, 1)
+
+
+ callReply = dbusInterface.call("testMethodWithReturnValue");
+
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+ compare(callReply.values.length, 1)
+ compare(callReply.values[0], true)
+ }
+
+ function test_methods_async() {
+
+ //asyncTestMethod
+
+ interfaceSpy.clear()
+ interfaceSpy.signalName = "asyncTestMethodCalled"
+ spy.clear();
+
+ var callReply = dbusInterface.asyncCall("asyncTestMethod");
+ spy.signalName = ""
+ spy.target = callReply
+ spy.signalName = "waitingChanged"
+
+ compare(spy.count, 0)
+ compare(interfaceSpy.count, 0)
+
+ compare(callReply.valid, true)
+ compare(callReply.waiting, true)
+
+ spy.wait()
+ compare(spy.count, 1)
+
+ if (interfaceSpy.count == 0)
+ interfaceSpy.wait()
+
+ compare(interfaceSpy.count, 1)
+
+ compare(callReply.waiting, false)
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+
+
+ //asyncTestMethodWithArguments
+
+ interfaceSpy.clear()
+ interfaceSpy.signalName = "asyncTestMethodWithArgumentsCalled"
+ spy.clear();
+
+ callReply = dbusInterface.asyncCall("asyncTestMethodWithArguments", "hello");
+ spy.signalName = ""
+ spy.target = callReply
+ spy.signalName = "waitingChanged"
+
+ compare(spy.count, 0)
+ compare(interfaceSpy.count, 0)
+
+ compare(callReply.valid, true)
+ compare(callReply.waiting, true)
+
+ spy.wait()
+ compare(spy.count, 1)
+
+ if (interfaceSpy.count == 0)
+ interfaceSpy.wait()
+
+ compare(interfaceSpy.signalArguments[0][0], "hello")
+ compare(interfaceSpy.count, 1)
+
+ compare(callReply.waiting, false)
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+
+ //asyncTestMethodWithReturnValue
+
+ spy.clear();
+
+ callReply = dbusInterface.asyncCall("asyncTestMethodWithReturnValue");
+ spy.signalName = ""
+ spy.target = callReply
+ spy.signalName = "waitingChanged"
+
+ compare(spy.count, 0)
+
+ compare(callReply.valid, true)
+ compare(callReply.waiting, true)
+
+ spy.wait()
+ compare(spy.count, 1)
+
+ compare(callReply.waiting, false)
+ compare(callReply.valid, true)
+ compare(callReply.errorName, "")
+ compare(callReply.errorString, "")
+ compare(callReply.values[0], true)
+ }
+
+ function test_properties() {
+ compare(dbusInterface.interfaceObject.testProperty, false)
+ spy.clear()
+ spy.signalName = ""
+ spy.target = dbusInterface.interfaceObject
+ spy.signalName = "testPropertyChanged"
+ dbusInterface.interfaceObject.testProperty = true
+ spy.wait()
+ compare(spy.count, 1)
+ compare(dbusInterface.interfaceObject.testProperty, true)
+ }
+}
diff --git a/tests/tst_dbusplugin/tst_dbusplugin.cpp b/tests/tst_dbusplugin/tst_dbusplugin.cpp
new file mode 100644
index 0000000..79f7f71
--- /dev/null
+++ b/tests/tst_dbusplugin/tst_dbusplugin.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmldpusplugin 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 <QtQuickTest/quicktest.h>
+#include <QApplication>
+#include <QProcess>
+
+int main(int argc, char **argv)
+{
+ QProcess* testServer = new QProcess();
+ testServer->start("../testserver/testserver");
+
+ if (!testServer->waitForStarted())
+ qFatal("failed to start TestServer: %s", qPrintable(testServer->errorString()));
+
+ int retVal;
+#ifdef QUICK_TEST_SOURCE_DIR
+ retVal = quick_test_main(argc, argv, "dbusplugin", QUICK_TEST_SOURCE_DIR);
+#else
+ retVal = quick_test_main(argc, argv, "dbusplugin", 0);
+#endif
+
+ testServer->kill();
+
+ return retVal;
+}
diff --git a/tests/tst_dbusplugin/tst_dbusplugin.pro b/tests/tst_dbusplugin/tst_dbusplugin.pro
new file mode 100644
index 0000000..97a2699
--- /dev/null
+++ b/tests/tst_dbusplugin/tst_dbusplugin.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET = tst_dbusplugin
+CONFIG += warn_on qmltestcase
+SOURCES += tst_dbusplugin.cpp
+
+OTHER_FILES = *.qml \
+ tst_dbusinterface.qml
+
+IMPORTPATH += $$PWD/../../qml $$PWD/../qml