summaryrefslogtreecommitdiffstats
path: root/tests/auto/dbus/qdbuspendingreply
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-01-11 11:25:28 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-14 13:03:50 +0100
commitdc131e3a5378d84026941e6626db524688b988f4 (patch)
treed1a172da2b4b87f046b08508e7d333e070ccb1e9 /tests/auto/dbus/qdbuspendingreply
parent9110d4f1ed65f02d8bbcb81ed0634d5a38c2bf9f (diff)
Make QDBusPendingReply behave like QDBusReply when dealing with errors
QDBusReply allows one to extract a QVariant and the type reply from an error reply and getting a default-constructed value. This is useful when a valid reply can never contain the default-constructed value (0, false, empty strings, empty arrays, etc.), so it simplifies error checking. More importantly, qdbusxml2cpp was changed a while ago from generating QDBusReply to generating QDBusPendingReply, so we need to have the same behavior. Task-number: QTBUG-29046 Change-Id: Ia873b9fd4311c0d4e94f0ef623ba405c20bc0e8c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/dbus/qdbuspendingreply')
-rw-r--r--tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp b/tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp
index e4863574e3..31b7e0dbce 100644
--- a/tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp
+++ b/tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp
@@ -572,6 +572,8 @@ void tst_QDBusPendingReply::errors()
QVERIFY(rint.isError());
error = rint.error();
VERIFY_ERROR(error);
+ int dummyint = rint;
+ QCOMPARE(dummyint, int());
QDBusPendingReply<int,int> rintint(iface->asyncCall("sendError"));
rintint.waitForFinished();
@@ -579,6 +581,9 @@ void tst_QDBusPendingReply::errors()
QVERIFY(rintint.isError());
error = rintint.error();
VERIFY_ERROR(error);
+ dummyint = rintint;
+ QCOMPARE(dummyint, int());
+ QCOMPARE(rintint.argumentAt<1>(), int());
QDBusPendingReply<QString> rstring(iface->asyncCall("sendError"));
rstring.waitForFinished();
@@ -586,6 +591,8 @@ void tst_QDBusPendingReply::errors()
QVERIFY(rstring.isError());
error = rstring.error();
VERIFY_ERROR(error);
+ QString dummystring = rstring;
+ QCOMPARE(dummystring, QString());
}
QTEST_MAIN(tst_QDBusPendingReply)