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.... Change-Id: Ic18899bb0462d89575dc5a9a311478adc4dea1cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
31a5fb1fa2
commit
9724642621
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -495,7 +495,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
|
||||
|
|
@ -505,7 +505,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);
|
||||
}
|
||||
|
|
@ -520,11 +520,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());
|
||||
|
|
@ -535,7 +541,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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue