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 <ofonocallsettings.h>
32 class TestOfonoCallSettings : public QObject
38 void validityChanged(bool validity)
40 qDebug() << "ValidityChanged" << validity;
43 void callingLinePresentationComplete(bool success, QString setting)
45 qDebug() << "callingLinePresentationComplete" << success << setting;
47 void calledLinePresentationComplete(bool success, QString setting)
49 qDebug() << "calledLinePresentationComplete" << success << setting;
51 void calledLineRestrictionComplete(bool success, QString setting)
53 qDebug() << "calledLineRestrictionComplete" << success << setting;
55 void callingLineRestrictionComplete(bool success, QString setting)
57 qDebug() << "callingLineRestrictionComplete" << success << setting;
59 void hideCallerIdComplete(bool success, QString setting)
61 qDebug() << "hideCallerIdComplete" << success << setting;
63 void voiceCallWaitingComplete(bool success, QString setting)
65 qDebug() << "voiceCallWaitingComplete" << success << setting;
68 void callingLinePresentationChanged(QString setting)
70 qDebug() << "callingLinePresentationChanged" << setting;
72 void calledLinePresentationChanged(QString setting)
74 qDebug() << "calledLinePresentationChanged" << setting;
76 void calledLineRestrictionChanged(QString setting)
78 qDebug() << "calledLineRestrictionChanged" << setting;
80 void callingLineRestrictionChanged(QString setting)
82 qDebug() << "callingLineRestrictionChanged" << setting;
84 void hideCallerIdChanged(QString setting)
86 qDebug() << "hideCallerIdChanged" << setting;
88 void voiceCallWaitingChanged(QString setting)
90 qDebug() << "voiceCallWaitingChanged" << setting;
93 void setHideCallerIdFailed()
95 qDebug() << "setHideCallerIdFailed";
97 void setVoiceCallWaitingFailed()
99 qDebug() << "setVoiceCallWaitingFailed";
104 m = new OfonoCallSettings(QString(), this);
105 connect(m, SIGNAL(validityChanged(bool)), this,
106 SLOT(validityChanged(bool)));
107 connect(m, SIGNAL(callingLinePresentationChanged(QString)), this,
108 SLOT(callingLinePresentationChanged(QString)));
109 connect(m, SIGNAL(calledLinePresentationChanged(QString)), this,
110 SLOT(calledLinePresentationChanged(QString)));
111 connect(m, SIGNAL(calledLineRestrictionChanged(QString)), this,
112 SLOT(calledLineRestrictionChanged(QString)));
113 connect(m, SIGNAL(callingLineRestrictionChanged(QString)), this,
114 SLOT(callingLineRestrictionChanged(QString)));
115 connect(m, SIGNAL(hideCallerIdChanged(QString)), this,
116 SLOT(hideCallerIdChanged(QString)));
117 connect(m, SIGNAL(voiceCallWaitingChanged(QString)), this,
118 SLOT(voiceCallWaitingChanged(QString)));
119 connect(m, SIGNAL(setHideCallerIdFailed()), this,
120 SLOT(setHideCallerIdFailed()));
121 connect(m, SIGNAL(setVoiceCallWaitingFailed()), this,
122 SLOT(setVoiceCallWaitingFailed()));
124 connect(m, SIGNAL(callingLinePresentationComplete( bool, QString)), this,
125 SLOT(callingLinePresentationComplete( bool, QString)));
126 connect(m, SIGNAL(calledLinePresentationComplete( bool, QString)), this,
127 SLOT(calledLinePresentationComplete( bool, QString)));
128 connect(m, SIGNAL(calledLineRestrictionComplete( bool, QString)), this,
129 SLOT(calledLineRestrictionComplete( bool, QString)));
130 connect(m, SIGNAL(callingLineRestrictionComplete( bool, QString)), this,
131 SLOT(callingLineRestrictionComplete( bool, QString)));
132 connect(m, SIGNAL(hideCallerIdComplete( bool, QString)), this,
133 SLOT(hideCallerIdComplete( bool, QString)));
134 connect(m, SIGNAL(voiceCallWaitingComplete( bool, QString)), this,
135 SLOT(voiceCallWaitingComplete( bool, QString)));
139 void testOfonoCallSettings()
141 qDebug() << "validity:" << m->isValid();
142 m->requestCallingLinePresentation();
144 m->requestCalledLinePresentation();
146 m->requestCalledLineRestriction();
148 m->requestCallingLineRestriction();
150 m->requestHideCallerId();
152 m->requestVoiceCallWaiting();
154 qDebug() << "setHideCallerId(enabled):";
155 m->setHideCallerId("enabled");
156 qDebug() << "setVoiceCallWaiting(enabled):";
157 m->setVoiceCallWaiting("enabled");
158 qDebug() << "setHideCallerId(disabled):";
159 m->setHideCallerId("disabled");
160 qDebug() << "setVoiceCallWaiting(disabled):";
161 m->setVoiceCallWaiting("disabled");
163 QTest::qWait(120000);
167 void cleanupTestCase()
174 OfonoCallSettings *m;
177 QTEST_MAIN(TestOfonoCallSettings)
178 #include "test_ofonocallsettings.moc"