diff options
author | Denis Dzyubenko <[email protected]> | 2012-04-11 15:59:00 +0200 |
---|---|---|
committer | Denis Dzyubenko <[email protected]> | 2012-04-11 16:54:46 +0200 |
commit | 6b7df60a752422b1f6ff07bb2682c21e18a43985 (patch) | |
tree | 3e56bd3f4ee34a228777d00ff328ef1c53cb1df1 /tests/shared/clientwrapper.h | |
parent | 20549eedb5b5e852c0e384cd76bfbff14168dbda (diff) | |
parent | 7ef36e3c5a88560eb4e3a81c2c9f14059739108b (diff) |
Merge remote-tracking branch 'gerrit/master' into hbtreehbtree
Conflicts:
src/daemon/daemon.pri
src/daemon/jsondbview.cpp
src/partition/jsondbindex.cpp
src/partition/jsondbindex.h
src/partition/jsondbindexquery.h
src/partition/jsondbmanagedbtree.cpp
src/partition/jsondbmanagedbtree.h
src/partition/jsondbmanagedbtreetxn.cpp
src/partition/jsondbmanagedbtreetxn.h
src/partition/jsondbobjecttable.cpp
src/partition/jsondbobjecttable.h
src/partition/jsondbpartition.cpp
src/partition/jsondbpartition.h
tests/auto/auto.pro
tests/auto/partition/testpartition.cpp
tests/benchmarks/benchmarks.pro
Change-Id: I963adefd6d32fca9b3537981306b67538c759034
Diffstat (limited to 'tests/shared/clientwrapper.h')
-rw-r--r-- | tests/shared/clientwrapper.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/shared/clientwrapper.h b/tests/shared/clientwrapper.h index 32e71db..1fc5b92 100644 --- a/tests/shared/clientwrapper.h +++ b/tests/shared/clientwrapper.h @@ -45,6 +45,10 @@ #include <QEventLoop> #include <QElapsedTimer> #include <QDebug> +#include <QJsonObject> +#include <QJsonArray> +#include <QJsonValue> +#include <QJsonDocument> #include "jsondb-client.h" @@ -81,7 +85,8 @@ QT_USE_NAMESPACE_JSONDB if ((result)->mNotificationId.isNull()) { \ QVERIFY2(false, "we expected notification but did not get it :("); \ } else { \ - QString data = JsonWriter().toString((result)->mNotifications.last().mObject); \ + QJsonValue value = QJsonValue::fromVariant((result)->mNotifications.last().mObject); \ + QString data = QString::fromUtf8(value.isArray() ? QJsonDocument(value.toArray()).toJson() : QJsonDocument(value.toObject()).toJson()); \ QByteArray ba = QString("we didn't expect notification but got it. %1").arg(data).toLatin1(); \ QVERIFY2(false, ba.constData()); \ } \ @@ -96,6 +101,22 @@ QT_USE_NAMESPACE_JSONDB #define waitForResponse3(id, code, notificationId) waitForResponse(mEventLoop, this, id, code, notificationId, 0) #define waitForResponse4(id, code, notificationId, count) waitForResponse(mEventLoop, this, id, code, notificationId, count) +#define waitForCallbackGeneric(eventloop) \ +{ \ + QTimer timer; \ + QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); \ + QObject::connect(&timer, SIGNAL(timeout()), &eventloop, SLOT(quit())); \ + timer.start(mClientTimeout); \ + mElapsedTimer.start(); \ + mTimedOut = false;\ + callbackError = false; \ + eventloop.exec(QEventLoop::AllEvents); \ + QCOMPARE(false, mTimedOut); \ +} + +#define waitForCallback() waitForCallbackGeneric(mEventLoop) +#define waitForCallback2() waitForCallbackGeneric(mEventLoop2) + class JsonDbTestNotification { public: |