summaryrefslogtreecommitdiff
path: root/tests/test-resource-engine/test-resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-09 16:32:16 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-09 16:32:16 +0200
commit30dcb37e647eed8fd68874f7588cd203ef8fc709 (patch)
tree332dd618866da29d196b2e837d12a671a5d18cdb /tests/test-resource-engine/test-resource-engine.cpp
parent910493fac3e328cef329ade5e8c1a71e136ca246 (diff)
downloadlibresourceqt-30dcb37e647eed8fd68874f7588cd203ef8fc709.tar.gz
implemented ResourceEngine::disconnect()
Diffstat (limited to 'tests/test-resource-engine/test-resource-engine.cpp')
-rw-r--r--tests/test-resource-engine/test-resource-engine.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test-resource-engine/test-resource-engine.cpp b/tests/test-resource-engine/test-resource-engine.cpp
index ee2656f..fca6505 100644
--- a/tests/test-resource-engine/test-resource-engine.cpp
+++ b/tests/test-resource-engine/test-resource-engine.cpp
@@ -3,6 +3,9 @@
using namespace ResourcePolicy;
quint32 theID = 0;
+resset_t *libresourceSet = NULL;
+
+void statusCallbackHandler(resset_t *libresourceSet, resmsg_t *message);
static void verify_resproto_init(resproto_role_t role,
resproto_transport_t transport,
@@ -11,6 +14,8 @@ static void verify_resproto_init(resproto_role_t role,
static void verify_resconn_connect(resconn_t *connection, resmsg_t *message,
resproto_status_t callbackFunction);
+static void verify_resconn_disconnect(resset_t *resourceSet, resmsg_t *message,
+ resproto_status_t callbackFunction);
TestResourceEngine::TestResourceEngine()
: resourceEngine(NULL), resourceSet(NULL)
@@ -54,6 +59,27 @@ void TestResourceEngine::testConnect()
QVERIFY(connectIsSuccessful);
}
+void TestResourceEngine::testDisconnect()
+{
+ resourceEngine->connect();
+ bool disconnectIsSuccessful = resourceEngine->disconnect();
+ QVERIFY(disconnectIsSuccessful);
+}
+
+void TestResourceEngine::testStatusMessage()
+{
+ resourceEngine->connect();
+ libresourceSet = resourceEngine->libresourceSet;
+ resourceEngine->messageMap.insert(1, RESMSG_REGISTER);
+ QObject::connect(resourceEngine, SIGNAL(connectedToManager()), this, SLOT(connectedHandler()));
+ resourceEngine->handleStatusMessage(1);
+}
+
+void TestResourceEngine::connectedHandler()
+{
+ QVERIFY(resourceEngine->isConnected());
+}
+
QTEST_MAIN(TestResourceEngine)
////////////////////////////////////////////////////////////////
@@ -132,3 +158,21 @@ int resproto_set_handler(union resconn_u *, resmsg_type_t, resproto_handler_t)
return 1;
}
+int resconn_disconnect(resset_t *resSet, resmsg_t *message,
+ resproto_status_t callbackFunction)
+{
+ verify_resconn_disconnect(resSet, message, callbackFunction);
+
+ return 1;
+}
+
+static void verify_resconn_disconnect(resset_t *resourceSet, resmsg_t *message,
+ resproto_status_t callbackFunction)
+{
+ QVERIFY(resourceSet == libresourceSet);
+ QVERIFY(message->record.type == RESMSG_UNREGISTER);
+ QVERIFY(message->record.id == theID);
+ QVERIFY(message->record.reqno > 1);
+ QVERIFY(callbackFunction != NULL);
+}
+