diff options
author | David Faure <faure@kde.org> | 2012-05-03 09:02:10 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-04 07:34:03 (GMT) |
commit | 841d72500ce2763f4ce00c5979658a397491d5be (patch) | |
tree | bfbed75f1e93d5264a3ff6fa83f9a8907be243e3 | |
parent | 00ac402870730592965a41567bb4d577fc441f82 (diff) | |
download | Qt-841d72500ce2763f4ce00c5979658a397491d5be.zip Qt-841d72500ce2763f4ce00c5979658a397491d5be.tar.gz Qt-841d72500ce2763f4ce00c5979658a397491d5be.tar.bz2 |
Fix unit confusion in ccf3b9e48b2d773999a9a88e249f79380618cde6
I wrote nonsense in that commit. The older methods that take a timeout
all take milliseconds, and the comments in the unit test really meant
milliseconds, not seconds. 1s is not shorter than 100ms....
Backport of 972464262166752df0015fe1209a7ab307cc7105
Change-Id: I3539cf196848b483b8c3a96b45851a465fc2dfcb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/dbus/qdbusabstractinterface.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index a63864a..e934e1a 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -385,7 +385,7 @@ QDBusError QDBusAbstractInterface::lastError() const } /*! - Sets the timeout in seconds for all future DBus calls to \a timeout. + Sets the timeout in milliseconds for all future DBus calls to \a timeout. -1 means the default DBus timeout (usually 25 seconds). \since 4.8 @@ -396,7 +396,7 @@ void QDBusAbstractInterface::setTimeout(int timeout) } /*! - Returns the current value of the timeout in seconds. + Returns the current value of the timeout in milliseconds. -1 means the default DBus timeout (usually 25 seconds). \since 4.8 diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 5ba581e..07427ed 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -497,7 +497,7 @@ void tst_QDBusAbstractInterface::callWithTimeout() QDBusMessage msg = QDBusMessage::createMethodCall(server_serviceName, server_objectPath, server_interfaceName, "sleepMethod"); - msg << 100; + msg << 100; // sleep 100 ms { // Call with no timeout -> works @@ -507,7 +507,7 @@ void tst_QDBusAbstractInterface::callWithTimeout() } { - // Call with 1 sec timeout -> fails + // Call with 1 msec timeout -> fails QDBusMessage reply = con.call(msg, QDBus::Block, 1); QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); } @@ -522,11 +522,17 @@ void tst_QDBusAbstractInterface::callWithTimeout() QCOMPARE(reply.arguments().at(0).toInt(), 42); } { - // Call with 1 sec timeout -> fails + // Call with 1 msec timeout -> fails iface.setTimeout(1); QDBusMessage reply = iface.call("sleepMethod", 100); QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); } + { + // Call with 300 msec timeout -> works + iface.setTimeout(300); + QDBusMessage reply = iface.call("sleepMethod", 100); + QCOMPARE(reply.arguments().at(0).toInt(), 42); + } // Now using generated code com::trolltech::QtDBus::Pinger p(server_serviceName, server_objectPath, QDBusConnection::sessionBus()); @@ -537,7 +543,7 @@ void tst_QDBusAbstractInterface::callWithTimeout() QCOMPARE(int(reply), 42); } { - // Call with 1 sec timeout -> fails + // Call with 1 msec timeout -> fails p.setTimeout(1); QDBusReply<int> reply = p.sleepMethod(100); QVERIFY(!reply.isValid()); |