From 95d1ca09f68d618c9cd23020e72b5deff0ae4816 Mon Sep 17 00:00:00 2001 From: Nathan Osman Date: Wed, 3 Jul 2013 10:55:41 -0700 Subject: [PATCH] Added QSignalSpy to TestClient to ensure that reply signal is emitted and contains correct value. --- tests/testclient.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testclient.cpp b/tests/testclient.cpp index 50d26ed..036942e 100644 --- a/tests/testclient.cpp +++ b/tests/testclient.cpp @@ -6,6 +6,8 @@ void TestClient::initTestCase() { + qRegisterMetaType("ReplyType"); + client.connectToHost("localhost"); QVERIFY(client.waitForConnected()); } @@ -21,5 +23,9 @@ void TestClient::cleanupTestCase() void TestClient::testPing() { QRedis::Request * request = client.sendCommand("PING"); + QSignalSpy spy(request, SIGNAL(reply(ReplyType,QVariant))); + QVERIFY(request->waitForReply()); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy[0][1].toString(), QString("PONG")); }