2 * This file is part of ofono-qt
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <QtTest/QtTest>
25 #include <QtCore/QObject>
27 #include <ofonocallforwarding.h>
32 class TestOfonoCallForwarding : public QObject
38 void validityChanged(bool validity)
40 qDebug() << "ValidityChanged" << validity;
42 void voiceUnconditionalComplete(bool success, QString property)
44 qDebug() << "voiceUnconditionalComplete" << success << property;
46 void voiceBusyComplete(bool success, QString property)
48 qDebug() << "voiceBusyComplete" << success << property;
50 void voiceNoReplyComplete(bool success, QString property)
52 qDebug() << "voiceNoReplyComplete" << success << property;
54 void voiceNoReplyTimeoutComplete(bool success, ushort timeout)
56 qDebug() << "voiceNoReplyTimeoutComplete" << success << timeout;
58 void voiceNotReachableComplete(bool success, QString property)
60 qDebug() << "voiceNotReachableComplete" << success << property;
63 void voiceUnconditionalChanged(QString property)
65 qDebug() << "voiceUnconditionalChanged" << property;
67 void voiceBusyChanged(QString property)
69 qDebug() << "voiceBusyChanged" << property;
71 void voiceNoReplyChanged(QString property)
73 qDebug() << "voiceNoReplyChanged" << property;
75 void voiceNoReplyTimeoutChanged(ushort timeout)
77 qDebug() << "voiceNoReplyTimeoutChanged" << timeout;
79 void voiceNotReachableChanged(QString property)
81 qDebug() << "voiceNotReachableChanged" << property;
84 void disableAllComplete(bool success)
86 qDebug() << "disableAllComplete:" << success;
92 m = new OfonoCallForwarding(QString(), this);
93 connect(m, SIGNAL(validityChanged(bool)), this,
94 SLOT(validityChanged(bool)));
95 connect(m, SIGNAL(voiceUnconditionalChanged(QString)), this,
96 SLOT(voiceUnconditionalChanged(QString)));
97 connect(m, SIGNAL(voiceBusyChanged(QString)), this,
98 SLOT(voiceBusyChanged(QString)));
99 connect(m, SIGNAL(voiceNoReplyChanged(QString)), this,
100 SLOT(voiceNoReplyChanged(QString)));
101 connect(m, SIGNAL(voiceNoReplyTimeoutChanged(ushort)), this,
102 SLOT(voiceNoReplyTimeoutChanged(ushort)));
103 connect(m, SIGNAL(voiceNotReachableChanged(QString)), this,
104 SLOT(voiceNotReachableChanged(QString)));
105 connect(m, SIGNAL(voiceUnconditionalComplete(bool, QString)), this,
106 SLOT(voiceUnconditionalComplete(bool, QString)));
107 connect(m, SIGNAL(voiceBusyComplete(bool, QString)), this,
108 SLOT(voiceBusyComplete(bool, QString)));
109 connect(m, SIGNAL(voiceNoReplyComplete(bool, QString)), this,
110 SLOT(voiceNoReplyComplete(bool, QString)));
111 connect(m, SIGNAL(voiceNoReplyTimeoutComplete(bool, ushort)), this,
112 SLOT(voiceNoReplyTimeoutComplete(bool, ushort)));
113 connect(m, SIGNAL(voiceNotReachableComplete(bool, QString)), this,
114 SLOT(voiceNotReachableComplete(bool, QString)));
115 //FIXME: should connect to setSomethingFailed signals too
118 void testOfonoCallForwarding()
120 qDebug() << "validity:" << m->isValid();
121 m->requestVoiceUnconditional();
123 m->requestVoiceBusy();
125 m->requestVoiceNoReply();
127 m->requestVoiceNoReplyTimeout();
129 m->requestVoiceNotReachable();
132 qDebug() << "setVoiceBusy():";
133 m->setVoiceBusy("12345678");
134 qDebug() << "setVoiceNoReply():";
135 m->setVoiceNoReply("12345678");
136 qDebug() << "setVoiceNoReplyTimeout():";
137 m->setVoiceNoReplyTimeout(30);
138 qDebug() << "setVoiceNotReachable():";
139 m->setVoiceNotReachable("12345678");
140 qDebug() << "setVoiceUnconditional():";
141 m->setVoiceUnconditional("12345678");
143 qDebug() << "setVoiceBusy():";
145 qDebug() << "setVoiceNoReply():";
146 m->setVoiceNoReply("");
147 qDebug() << "setVoiceNotReachable():";
148 m->setVoiceNotReachable("");
149 qDebug() << "setVoiceUnconditional():";
150 m->setVoiceUnconditional("");
153 connect(m, SIGNAL(disableAllComplete(bool)),
154 this, SLOT(disableAllComplete(bool)));
155 m->requestDisableAll("all");
157 QTest::qWait(120000);
161 void cleanupTestCase()
168 OfonoCallForwarding *m;
171 QTEST_MAIN(TestOfonoCallForwarding)
172 #include "test_ofonocallforwarding.moc"