summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-03-05 12:10:32 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-05 03:44:01 +0100
commitd423fd0975569928faeafad28702750407e889ee (patch)
tree39b8f23a472df0df36ba1e27d970d720f362abcb /tests
parent8db8a34f07a2f8cbd06dc0b593886a13d52ae4b1 (diff)
Avoid using internal testlib API in QDbusConnection autotest.
QCOMPARE should only be used in a test function because it makes the test function return if the compare fails. The test wants to compare without returning on failure because the compare is inside a helper function called by many test functions, so the test was calling testlib's internal QTest::compare_helper() functions instead of QCOMPARE. This commit makes this code slightly less objectionable by calling the public QTest::qCompare() instead. Change-Id: Ida17a641e89f8a297d6a036449f44b33aa266368 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index e1d128dac7..65b68b7f34 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -829,16 +829,8 @@ bool tst_QDBusConnection::callMethod(const QDBusConnection &conn, const QString
QDBusMessage reply = conn.call(msg, QDBus::Block/*WithGui*/);
if (reply.type() != QDBusMessage::ReplyMessage)
return false;
- if (MyObject::path == path) {
- QTest::compare_helper(true, "COMPARE()", __FILE__, __LINE__);
- } else {
- QTest::compare_helper(false, "Compared values are not the same",
- QTest::toString(MyObject::path), QTest::toString(path),
- "MyObject::path", "path", __FILE__, __LINE__);
- return false;
- }
-
- return true;
+ QTest::qCompare(MyObject::path, path, "MyObject::path", "path", __FILE__, __LINE__);
+ return (MyObject::path == path);
}
bool tst_QDBusConnection::callMethodPeer(const QDBusConnection &conn, const QString &path)
@@ -848,16 +840,8 @@ bool tst_QDBusConnection::callMethodPeer(const QDBusConnection &conn, const QStr
if (reply.type() != QDBusMessage::ReplyMessage)
return false;
- if (MyObject::path == path) {
- QTest::compare_helper(true, "COMPARE()", __FILE__, __LINE__);
- } else {
- QTest::compare_helper(false, "Compared values are not the same",
- QTest::toString(MyObject::path), QTest::toString(path),
- "MyObject::path", "path", __FILE__, __LINE__);
- return false;
- }
-
- return true;
+ QTest::qCompare(MyObject::path, path, "MyObject::path", "path", __FILE__, __LINE__);
+ return (MyObject::path == path);
}
class TestObject : public QObject