tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -93,6 +93,7 @@
     }
 
     void init();
+    void unconnected();
     void simpleTypes();
     void complexTypes();
     void wrongTypes();
@@ -252,6 +253,30 @@
     QVERIFY(iface->isValid());
 }
 
+void tst_QDBusPendingReply::unconnected()
+{
+    QDBusConnection con("invalid stored connection");
+    QVERIFY(!con.isConnected());
+    QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+    QVERIFY(!iface.isValid());
+
+    QDBusPendingReply<> rvoid = iface.asyncCall("ReloadConfig");
+    QVERIFY(rvoid.isFinished());
+    QVERIFY(!rvoid.isValid());
+    QVERIFY(rvoid.isError());
+    rvoid.waitForFinished();
+    QVERIFY(!rvoid.isValid());
+    QVERIFY(rvoid.isError());
+
+    QDBusPendingReply<QString> rstring = iface.asyncCall("GetId");
+    QVERIFY(rstring.isFinished());
+    QVERIFY(!rstring.isValid());
+    QVERIFY(rstring.isError());
+    rstring.waitForFinished();
+    QVERIFY(!rstring.isValid());
+    QVERIFY(rstring.isError());
+}
+
 void tst_QDBusPendingReply::simpleTypes()
 {
     QDBusPendingReply<> rvoid = iface->asyncCall("retrieveVoid");