summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2012-05-29 15:27:35 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-29 15:59:04 +0200
commit001b688e54630f753e3ca3933cca2c2290210ec7 (patch)
tree546e0ab28910473fae7208c311418ebba78cbfed /tests
parent79f51d6718ffb06b3c8ece31c25b5949ca4dcc7d (diff)
Changed behavior of QJsonDbConnection::defaultConnection().
It is much more convenient if it is safe to assume that the returned default connection is already connected, or will be autotomatically connected. Change-Id: I5e0d89ad34f156b5cee5ca6e0f25eb79c32a2bca Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qjsondbrequest/testqjsondbrequest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qjsondbrequest/testqjsondbrequest.cpp b/tests/auto/qjsondbrequest/testqjsondbrequest.cpp
index 7a4dd11..0a9c7d1 100644
--- a/tests/auto/qjsondbrequest/testqjsondbrequest.cpp
+++ b/tests/auto/qjsondbrequest/testqjsondbrequest.cpp
@@ -55,6 +55,7 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
+#include <QTimer>
#include <pwd.h>
#include <signal.h>
@@ -108,6 +109,7 @@ private slots:
void bindings();
void replaceFromNull();
void multiplerequests();
+ void defaultConnection();
private:
bool writeTestObject(QObject* parent, const QString &type, int value, const QString &partition = QString());
@@ -1191,6 +1193,19 @@ void TestQJsonDbRequest::multiplerequests()
QCOMPARE(results.size(), 0);
}
+void TestQJsonDbRequest::defaultConnection()
+{
+ // make sure that the default connection connects automatically
+ QJsonDbConnection *connection = QJsonDbConnection::defaultConnection();
+ QJsonDbReadRequest request(QStringLiteral("[?_type=\"Foo\"]"));
+ QEventLoop ev;
+ QObject::connect(&request, SIGNAL(finished()), &ev, SLOT(quit()));
+ QTimer::singleShot(10000, &ev, SLOT(quit()));
+ QVERIFY(connection->send(&request));
+ ev.exec();
+ QCOMPARE((int)request.status(), (int)QJsonDbRequest::Finished);
+}
+
void TestQJsonDbRequest::bindings()
{
{