From fd5ac15ebc643635e436b64cf1e656284380b1a5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 11 Jun 2006 12:18:23 +0000 Subject: * 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. --- test/qt/common.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test/qt/common.h') 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) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) -#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 &l1, const QList &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; -- cgit