summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-11 14:39:22 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-20 07:36:52 +0100
commit91fe8129fa54847b8d4146672d561349633aea79 (patch)
tree4c17db4ea8dd537e74b1e0622bc00abe33cf03e9 /tests
parent7b6ab50c68e771ecbd350b58890fae0e58330e9f (diff)
Autotest: Make the peer executables report error if they failed
QDBusServer::address() will return an empty QString, which caused the tests to fail later with no apparent reason. Change-Id: I86f448dfc67a6cdb27ecda2d490f335766cfaf4f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp4
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp4
-rw-r--r--tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp4
3 files changed, 9 insertions, 3 deletions
diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
index b0b9889e70..b4a79fa754 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
@@ -44,7 +44,7 @@ QString valueSpy;
Q_DECLARE_METATYPE(QDBusConnection::RegisterOptions)
-class MyServer : public QDBusServer
+class MyServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qmyserver")
@@ -67,6 +67,8 @@ public:
public slots:
QString address() const
{
+ if (!QDBusServer::isConnected())
+ sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}
diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
index 7466526c99..49291abf92 100644
--- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
+++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
@@ -38,7 +38,7 @@ static const char serviceName[] = "org.qtproject.autotests.qpinger";
static const char objectPath[] = "/org/qtproject/qpinger";
//static const char *interfaceName = serviceName;
-class PingerServer : public QDBusServer
+class PingerServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qpinger")
@@ -54,6 +54,8 @@ public:
public slots:
QString address() const
{
+ if (!QDBusServer::isConnected())
+ sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}
diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
index cb7296e7d2..4aacbdc5a2 100644
--- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
@@ -42,7 +42,7 @@ static const char objectPath[] = "/org/qtproject/qmyserver";
int MyObject::callCount = 0;
QVariantList MyObject::callArgs;
-class MyServer : public QDBusServer
+class MyServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qmyserver")
@@ -58,6 +58,8 @@ public:
public slots:
QString address() const
{
+ if (!QDBusServer::isConnected())
+ sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}