[Telepathy-commits] [telepathy-qt4/master] Tests: promote expectSuccessfulCall into superclass
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Dec 3 09:58:57 PST 2008
---
tests/pinocchio/chan-basics.cpp | 16 ----------------
tests/pinocchio/conn-basics.cpp | 28 ----------------------------
tests/pinocchio/lib.cpp | 27 +++++++++++++++++++++++++++
tests/pinocchio/lib.h | 5 +++++
4 files changed, 32 insertions(+), 44 deletions(-)
diff --git a/tests/pinocchio/chan-basics.cpp b/tests/pinocchio/chan-basics.cpp
index a512fa2..ebc8f4f 100644
--- a/tests/pinocchio/chan-basics.cpp
+++ b/tests/pinocchio/chan-basics.cpp
@@ -33,7 +33,6 @@ protected Q_SLOTS:
// were test cases. So, they're protected instead
void expectConnReady(uint);
void expectChanReady(uint);
- void expectSuccessfulCall(QDBusPendingCallWatcher*);
void expectPendingChannelFinished(Telepathy::Client::PendingOperation*);
void expectPendingChannelError(Telepathy::Client::PendingOperation*);
@@ -50,21 +49,6 @@ private Q_SLOTS:
};
-void TestChanBasics::expectSuccessfulCall(QDBusPendingCallWatcher* watcher)
-{
- QDBusPendingReply<> reply = *watcher;
-
- if (reply.isError()) {
- qWarning().nospace() << reply.error().name()
- << ": " << reply.error().message();
- mLoop->exit(1);
- return;
- }
-
- mLoop->exit(0);
-}
-
-
void TestChanBasics::expectConnReady(uint newReadiness)
{
switch (newReadiness) {
diff --git a/tests/pinocchio/conn-basics.cpp b/tests/pinocchio/conn-basics.cpp
index 864f165..f480173 100644
--- a/tests/pinocchio/conn-basics.cpp
+++ b/tests/pinocchio/conn-basics.cpp
@@ -25,8 +25,6 @@ private:
protected Q_SLOTS:
void expectNotYetConnected(uint);
void expectReady(uint);
- void expectSuccessfulCall(QDBusPendingCallWatcher*);
- void expectSuccessfulCall(Telepathy::Client::PendingOperation*);
private Q_SLOTS:
void initTestCase();
@@ -142,32 +140,6 @@ void TestConnBasics::testInitialIntrospection()
}
-void TestConnBasics::expectSuccessfulCall(PendingOperation* op)
-{
- if (op->isError()) {
- qWarning().nospace() << op->errorName()
- << ": " << op->errorMessage();
- mLoop->exit(1);
- return;
- }
-
- mLoop->exit(0);
-}
-
-
-void TestConnBasics::expectSuccessfulCall(QDBusPendingCallWatcher* watcher)
-{
- if (watcher->isError()) {
- qWarning().nospace() << watcher->error().name()
- << ": " << watcher->error().message();
- mLoop->exit(1);
- return;
- }
-
- mLoop->exit(0);
-}
-
-
void TestConnBasics::expectReady(uint newReadiness)
{
switch (newReadiness) {
diff --git a/tests/pinocchio/lib.cpp b/tests/pinocchio/lib.cpp
index 7f69dfd..9a14727 100644
--- a/tests/pinocchio/lib.cpp
+++ b/tests/pinocchio/lib.cpp
@@ -8,6 +8,7 @@
#include <TelepathyQt4/Debug>
#include <TelepathyQt4/Client/DBus>
+using namespace Telepathy::Client;
using namespace Telepathy::Client::DBus;
PinocchioTest::~PinocchioTest()
@@ -59,6 +60,32 @@ void PinocchioTest::cleanupImpl()
}
+void PinocchioTest::expectSuccessfulCall(PendingOperation* op)
+{
+ if (op->isError()) {
+ qWarning().nospace() << op->errorName()
+ << ": " << op->errorMessage();
+ mLoop->exit(1);
+ return;
+ }
+
+ mLoop->exit(0);
+}
+
+
+void PinocchioTest::expectSuccessfulCall(QDBusPendingCallWatcher* watcher)
+{
+ if (watcher->isError()) {
+ qWarning().nospace() << watcher->error().name()
+ << ": " << watcher->error().message();
+ mLoop->exit(1);
+ return;
+ }
+
+ mLoop->exit(0);
+}
+
+
void PinocchioTest::gotNameOwner(QDBusPendingCallWatcher* watcher)
{
QDBusPendingReply<QString> reply = *watcher;
diff --git a/tests/pinocchio/lib.h b/tests/pinocchio/lib.h
index 1889bc0..e96b5c4 100644
--- a/tests/pinocchio/lib.h
+++ b/tests/pinocchio/lib.h
@@ -4,6 +4,8 @@
#include <QtTest/QtTest>
+#include <TelepathyQt4/Client/PendingOperation>
+
class PinocchioTest : public QObject
{
Q_OBJECT
@@ -37,6 +39,9 @@ protected:
QEventLoop *mLoop;
protected Q_SLOTS:
+ void expectSuccessfulCall(QDBusPendingCallWatcher*);
+ void expectSuccessfulCall(Telepathy::Client::PendingOperation*);
+
virtual void initTestCaseImpl();
virtual void initImpl();
--
1.5.6.5
More information about the Telepathy-commits
mailing list