diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2012-05-29 14:44:21 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-29 15:59:04 +0200 |
commit | 670d454b05efd998988fbf308652dc4281a9d14e (patch) | |
tree | e6269c4fde6fdf26ba90a8d68a95ac9b41907459 /tests | |
parent | d923963118922ca498b90c627c545fb0658d3cdb (diff) |
Changed QJsonDbWatcher to change its status to Inactive later.
QJsonDbWatcher was setting its status to Inactive before the deactivation
request was processed by the server (and hence it was possible to receive
notifications and emit notificationsAvailable() signal even though the status
== Inactive). Fixed it to deactive asynchronously so that the status changes
when the server replies to deactivation request.
Change-Id: If2940e7afb9d1cb75d0579657f6f2c95e2c50099
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp b/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp index e1cdb47..bfe6faa 100644 --- a/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp +++ b/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp @@ -93,6 +93,7 @@ private slots: void invalid(); void privatePartition(); void addAndRemove(); + void removeWatcherStatus(); }; TestQJsonDbWatcher::TestQJsonDbWatcher() @@ -821,6 +822,26 @@ void TestQJsonDbWatcher::addAndRemove() QVERIFY(waitForResponse(&read)); } +void TestQJsonDbWatcher::removeWatcherStatus() +{ + { + QJsonDbWatcher watcher; + watcher.setQuery("[?_type=\"Foo\"]"); + QVERIFY(mConnection->addWatcher(&watcher)); + QVERIFY(waitForStatus(&watcher, QJsonDbWatcher::Active)); + QVERIFY(mConnection->removeWatcher(&watcher)); + QVERIFY(waitForStatus(&watcher, QJsonDbWatcher::Inactive)); + } + + { + QJsonDbWatcher watcher; + watcher.setQuery("[?_type=\"Foo\"]"); + QVERIFY(mConnection->addWatcher(&watcher)); + QVERIFY(mConnection->removeWatcher(&watcher)); + QVERIFY(waitForStatus(&watcher, QJsonDbWatcher::Inactive)); + } +} + QTEST_MAIN(TestQJsonDbWatcher) #include "testqjsondbwatcher.moc" |