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 <ofonocallbarring.h>
32 class TestOfonoCallBarring : public QObject
38 void validityChanged(bool validity)
40 qDebug() << "ValidityChanged" << validity;
43 void voiceIncomingComplete(bool success, QString barrings)
45 qDebug() << "voiceIncomingComplete" << success << barrings;
48 void voiceOutgoingComplete(bool success, QString barrings)
50 qDebug() << "voiceOutgoingComplete" << success << barrings;
53 void voiceIncomingChanged(QString barrings)
55 qDebug() << "voiceIncomingChanged" << barrings;
58 void voiceOutgoingChanged(QString barrings)
60 qDebug() << "voiceOutgoingChanged" << barrings;
63 void setVoiceIncomingFailed()
65 qDebug() << "setVoiceIncomingFailed" << m->errorName() << m->errorMessage();
68 void setVoiceOutgoingFailed()
70 qDebug() << "setVoiceOutgoingFailed" << m->errorName() << m->errorMessage();
73 void incomingBarringInEffect()
75 qDebug() << "incomingBarringInEffect signal";
78 void outgoingBarringInEffect()
80 qDebug() << "outgoingBarringInEffect signal";
84 void disableAllComplete(bool success)
86 qDebug() << "disableAllComplete:" << success;
89 void changePasswordComplete(bool success)
91 qDebug() << "changePasswordComplete:" << success;
98 m = new OfonoCallBarring(OfonoModem::AutomaticSelect, QString(), this);
99 connect(m, SIGNAL(validityChanged(bool)), this,
100 SLOT(validityChanged(bool)));
101 connect(m, SIGNAL(voiceIncomingComplete(bool, QString)), this,
102 SLOT(voiceIncomingComplete(bool, QString)));
103 connect(m, SIGNAL(voiceOutgoingComplete(bool, QString)), this,
104 SLOT(voiceOutgoingComplete(bool, QString)));
105 connect(m, SIGNAL(voiceIncomingChanged(QString)), this,
106 SLOT(voiceIncomingChanged(QString)));
107 connect(m, SIGNAL(voiceOutgoingChanged(QString)), this,
108 SLOT(voiceOutgoingChanged(QString)));
109 connect(m, SIGNAL(setVoiceIncomingFailed()), this,
110 SLOT(setVoiceIncomingFailed()));
111 connect(m, SIGNAL(setVoiceOutgoingFailed()), this,
112 SLOT(setVoiceOutgoingFailed()));
113 connect(m, SIGNAL(incomingBarringInEffect()), this,
114 SLOT(incomingBarringInEffect()));
115 connect(m, SIGNAL(outgoingBarringInEffect()), this,
116 SLOT(outgoingBarringInEffect()));
117 // Wait for properties to arrive...
121 void testOfonoCallbarring()
123 qDebug() << "validity:" << m->isValid();
124 m->requestVoiceIncoming();
126 m->requestVoiceOutgoing();
129 qDebug() << "setVoiceIncoming(always)";
130 m->setVoiceIncoming("always", "3579");
132 qDebug() << "setVoiceOutgoing(international)";
133 m->setVoiceOutgoing("international", "3579");
136 connect(m, SIGNAL(disableAllComplete(bool)),
137 this, SLOT(disableAllComplete(bool)));
138 m->disableAll("3579");
140 m->requestVoiceIncoming();
142 m->requestVoiceOutgoing();
145 connect(m, SIGNAL(changePasswordComplete(bool)),
146 this, SLOT(changePasswordComplete(bool)));
147 m->changePassword("3579", "1234");
149 m->changePassword("1234", "3579");
155 void cleanupTestCase()
165 QTEST_MAIN(TestOfonoCallBarring)
166 #include "test_ofonocallbarring.moc"