summaryrefslogtreecommitdiffstats
path: root/test/qt/common.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2006-06-11 12:18:23 +0000
committerThiago Macieira <thiago@kde.org>2006-06-11 12:18:23 +0000
commitfd5ac15ebc643635e436b64cf1e656284380b1a5 (patch)
treef1630dd4f97b5f56c61150ee2a0186831d81c256 /test/qt/common.h
parent3b50a8c9fe65839b79f8df988aee6124abd4f0c4 (diff)
* test/qt/*: Update the testcases, including testing the new
functionality of sending null QByteArray and QString over the bus. Add new headertest test and restore the old qdbusxmlparser test.
Diffstat (limited to 'test/qt/common.h')
-rw-r--r--test/qt/common.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/qt/common.h b/test/qt/common.h
index 943d3d95..58beae4e 100644
--- a/test/qt/common.h
+++ b/test/qt/common.h
@@ -9,8 +9,8 @@ Q_DECLARE_METATYPE(QList<uint>)
Q_DECLARE_METATYPE(QList<qlonglong>)
Q_DECLARE_METATYPE(QList<qulonglong>)
Q_DECLARE_METATYPE(QList<double>)
-#if 0
-#include "../qdbusintrospection_p.h"
+#ifdef USE_PRIVATE_CODE
+#include "../../qt/src/qdbusintrospection_p.h"
// just to make it easier:
typedef QDBusIntrospection::Interfaces InterfaceMap;
@@ -157,6 +157,20 @@ bool compare(const QList<double> &l1, const QList<double> &l2)
return true;
}
+bool compare(const QString &s1, const QString &s2)
+{
+ if (s1.isEmpty() && s2.isEmpty())
+ return true; // regardless of whether one of them is null
+ return s1 == s2;
+}
+
+bool compare(const QByteArray &ba1, const QByteArray &ba2)
+{
+ if (ba1.isEmpty() && ba2.isEmpty())
+ return true; // regardless of whether one of them is null
+ return ba1 == ba2;
+}
+
bool compare(const QVariant &v1, const QVariant &v2)
{
if (v1.userType() != v2.userType())
@@ -169,6 +183,12 @@ bool compare(const QVariant &v1, const QVariant &v2)
else if (id == QVariant::Map)
return compare(v1.toMap(), v2.toMap());
+ else if (id == QVariant::String)
+ return compare(v1.toString(), v2.toString());
+
+ else if (id == QVariant::ByteArray)
+ return compare(v1.toByteArray(), v2.toByteArray());
+
else if (id < int(QVariant::UserType)) // yes, v1.type()
// QVariant can compare
return v1 == v2;