author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:33:21 +0100 | |
branch | GCC_SURGE |
changeset 51 | f39ed5e045e0 |
parent 30 | ebdbd102c78a |
parent 45 | 6b911d05207e |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <HbDataFormModel> |
|
19 |
#include <HbCheckBox> |
|
20 |
#include <psetwrapper.h> |
|
21 |
#include "ut_barringplugingroup.h" |
|
22 |
#include "qtestmains60.h" |
|
23 |
#include "cpitemdatahelper.h" |
|
24 |
#include "cpphonenotes.h" |
|
25 |
#define private friend class UT_CpBarringPluginGroup; private |
|
26 |
#include "cpbarringplugingroup.h" |
|
27 |
||
28 |
void setNoteIdentifier(int ¬eId, const QString& text) |
|
29 |
{ |
|
30 |
Q_UNUSED(text) |
|
31 |
||
32 |
noteId = 1; |
|
33 |
} |
|
34 |
||
35 |
||
36 |
const QString KCurrentPassword = "1234"; |
|
37 |
void setCurrentPasswordParams( |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
38 |
const QString &title, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
39 |
const QValidator &validator, |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
40 |
int maxPasswordLength) |
37 | 41 |
{ |
42 |
Q_UNUSED(title) |
|
43 |
Q_UNUSED(validator) |
|
44 |
Q_UNUSED(maxPasswordLength) |
|
45 |
} |
|
46 |
||
47 |
||
48 |
const QString KNewAndVerifiedPassword = "4321"; |
|
49 |
void setNewAndVerifiedPasswordParams( |
|
50 |
const QString &title, |
|
51 |
const QValidator &validator, |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
52 |
int maxPasswordLength) |
37 | 53 |
{ |
54 |
Q_UNUSED(title) |
|
55 |
Q_UNUSED(validator) |
|
56 |
Q_UNUSED(maxPasswordLength) |
|
57 |
} |
|
58 |
||
59 |
||
60 |
void setPasswordParamsCancel( |
|
61 |
const QString &title, |
|
62 |
const QValidator &validator, |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
63 |
int maxPasswordLength) |
37 | 64 |
{ |
65 |
Q_UNUSED(title) |
|
66 |
Q_UNUSED(validator) |
|
67 |
Q_UNUSED(maxPasswordLength) |
|
68 |
} |
|
69 |
||
70 |
||
71 |
/*! |
|
72 |
UT_CpBarringPluginGroup::UT_CpBarringPluginGroup |
|
73 |
*/ |
|
74 |
UT_CpBarringPluginGroup::UT_CpBarringPluginGroup() |
|
75 |
: |
|
76 |
m_barringpluginGroup(NULL), |
|
77 |
m_barringWrapperMock(NULL), |
|
78 |
m_dataFormModel(NULL) |
|
79 |
{ |
|
80 |
||
81 |
} |
|
82 |
||
83 |
||
84 |
/*! |
|
85 |
UT_CpBarringPluginGroup::~UT_CpBarringPluginGroup |
|
86 |
*/ |
|
87 |
UT_CpBarringPluginGroup::~UT_CpBarringPluginGroup() |
|
88 |
{ |
|
89 |
delete m_barringWrapperMock; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
90 |
delete m_dataFormModel; |
37 | 91 |
} |
92 |
||
93 |
||
94 |
/*! |
|
95 |
UT_CpBarringPluginGroup::init |
|
96 |
*/ |
|
97 |
void UT_CpBarringPluginGroup::init() |
|
98 |
{ |
|
99 |
initialize(); |
|
100 |
QT_TRAP_THROWING(SmcDefaultValue<QString>::SetL(QString(""))); |
|
101 |
||
102 |
CPsetContainer &dummyContainer = reinterpret_cast<CPsetContainer &>(*this); |
|
103 |
m_barringWrapperMock = new PSetCallBarringWrapper(dummyContainer); |
|
104 |
EXPECT(PSetWrapper::callBarringWrapper).returns(m_barringWrapperMock); |
|
105 |
||
106 |
CpItemDataHelper itemDataHelper; |
|
107 |
m_barringpluginGroup = new CpBarringPluginGroup(itemDataHelper); |
|
108 |
||
109 |
m_dataFormModel = new HbDataFormModel(); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
110 |
m_dataFormModel->appendDataFormItem(m_barringpluginGroup); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
111 |
m_barringpluginGroup->m_model = m_dataFormModel; |
37 | 112 |
|
113 |
QVERIFY(verify()); |
|
114 |
||
115 |
connect( |
|
116 |
this, SIGNAL(simulateCheckStateChange(int)), |
|
117 |
m_barringpluginGroup, SLOT(changeBarringStateRequested(int))); |
|
118 |
} |
|
119 |
||
120 |
||
121 |
/*! |
|
122 |
UT_CpBarringPluginGroup::cleanup |
|
123 |
*/ |
|
124 |
void UT_CpBarringPluginGroup::cleanup() |
|
125 |
{ |
|
126 |
reset(); |
|
127 |
||
128 |
disconnect( |
|
129 |
this, SIGNAL(simulateCheckStateChange(int)), |
|
130 |
m_barringpluginGroup, SLOT(changeBarringStateRequested(int))); |
|
131 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
132 |
delete m_dataFormModel; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
133 |
m_dataFormModel = NULL; |
37 | 134 |
delete m_barringWrapperMock; |
135 |
m_barringWrapperMock = NULL; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
136 |
|
37 | 137 |
} |
138 |
||
139 |
||
140 |
/*! |
|
141 |
UT_CpBarringPluginGroup::t_memleak |
|
142 |
*/ |
|
143 |
void UT_CpBarringPluginGroup::t_memleak() |
|
144 |
{ |
|
145 |
||
146 |
} |
|
147 |
||
148 |
||
149 |
/*! |
|
150 |
UT_CpBarringPluginGroup::t_itemShownNotBarringItem |
|
151 |
Tests that itemShown() for other setting group's item is not handled. |
|
152 |
*/ |
|
153 |
void UT_CpBarringPluginGroup::t_itemShownNotBarringItem() |
|
154 |
{ |
|
155 |
EXPECT(PSetCallBarringWrapper::barringStatus).times(0); |
|
156 |
||
157 |
QScopedPointer<CpSettingFormItemData> item(new CpSettingFormItemData( |
|
158 |
HbDataFormModelItem::CheckBoxItem, hbTrId(""), NULL)); |
|
159 |
m_dataFormModel->appendDataFormItem(item.data(), m_barringpluginGroup); |
|
160 |
m_barringpluginGroup->itemShown( |
|
161 |
m_dataFormModel->indexFromItem(item.data())); |
|
162 |
m_dataFormModel->removeItem(item.take()); |
|
163 |
||
164 |
QVERIFY(verify()); |
|
165 |
} |
|
166 |
||
167 |
||
168 |
/*! |
|
169 |
UT_CpBarringPluginGroup::t_itemShownBarringStatusRequestOngoing |
|
170 |
Tests that another progress note is not launched if one is already shown. |
|
171 |
*/ |
|
172 |
void UT_CpBarringPluginGroup::t_itemShownBarringStatusRequestOngoing() |
|
173 |
{ |
|
174 |
EXPECT(PSetCallBarringWrapper::barringStatus); |
|
175 |
EXPECT(CpPhoneNotes::noteShowing).returns(true); |
|
176 |
EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
|
177 |
||
178 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
|
179 |
m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
|
180 |
||
181 |
QVERIFY(verify()); |
|
182 |
} |
|
183 |
||
184 |
||
185 |
/*! |
|
186 |
UT_CpBarringPluginGroup::t_barringStatusRequestCompletedForUpdateInquiry |
|
187 |
*/ |
|
188 |
void UT_CpBarringPluginGroup::t_barringStatusRequestCompletedForUpdateInquiry() |
|
189 |
{ |
|
190 |
// simulate successfull initial status inquiry |
|
191 |
QList<unsigned char> basicServiceGroupIds; |
|
192 |
const int errorCode = 0; |
|
193 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
194 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
195 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
196 |
m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
|
197 |
||
198 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
199 |
errorCode, |
|
200 |
basicServiceGroupIds, |
|
201 |
PSetCallBarringWrapper::BarringStatusActive); |
|
202 |
} |
|
203 |
||
204 |
// simulate barring enable request |
|
205 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
|
206 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
207 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
208 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
209 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
210 |
KCurrentPassword, true); |
37 | 211 |
|
212 |
// verify that already connected items are not enabled/connected again |
|
213 |
EXPECT(CpItemDataHelper::removeConnection).times(1); |
|
214 |
EXPECT(CpItemDataHelper::addConnection).times(1); |
|
215 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
216 |
errorCode, |
|
217 |
basicServiceGroupIds, |
|
218 |
PSetCallBarringWrapper::BarringStatusActive); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
219 |
|
37 | 220 |
QVERIFY(verify()); |
221 |
} |
|
222 |
||
223 |
||
224 |
/*! |
|
225 |
UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError |
|
226 |
*/ |
|
227 |
void UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError() |
|
228 |
{ |
|
229 |
EXPECT(CpPhoneNotes::cancelNote); |
|
230 |
EXPECT(CpPhoneNotes::showGlobalErrorNote); |
|
231 |
EXPECT(CpItemDataHelper::addConnection).times(0); |
|
232 |
||
233 |
QList<unsigned char> basicServiceGroupIds; |
|
234 |
const int errorCode = -1; |
|
235 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
236 |
errorCode, |
|
237 |
basicServiceGroupIds, |
|
238 |
PSetCallBarringWrapper::BarringStatusUnavailable); |
|
239 |
||
240 |
QVERIFY(verify()); |
|
241 |
} |
|
242 |
||
243 |
||
244 |
/*! |
|
245 |
UT_CpBarringPluginGroup::t_getBarringStatuses |
|
246 |
Tests functions |
|
247 |
CpBarringPluginGroup::itemShown, |
|
248 |
CpBarringPluginGroup::barringStatusRequestCompleted |
|
249 |
*/ |
|
250 |
Q_DECLARE_METATYPE(QModelIndex) |
|
251 |
void UT_CpBarringPluginGroup::t_getBarringStatuses() |
|
252 |
{ |
|
253 |
qRegisterMetaType<QModelIndex>("QModelIndex"); |
|
254 |
||
255 |
EXPECT(PSetCallBarringWrapper::barringStatus) |
|
256 |
.with(ServiceGroupVoice, |
|
257 |
PSetCallBarringWrapper::BarringTypeAllOutgoing); |
|
258 |
EXPECT(PSetCallBarringWrapper::barringStatus) |
|
259 |
.with(ServiceGroupVoice, |
|
260 |
PSetCallBarringWrapper::BarringTypeOutgoingInternational); |
|
261 |
EXPECT(PSetCallBarringWrapper::barringStatus) |
|
262 |
.with(ServiceGroupVoice, |
|
263 |
PSetCallBarringWrapper::BarringTypeOutgoingInternationalExceptToHomeCountry); |
|
264 |
EXPECT(PSetCallBarringWrapper::barringStatus) |
|
265 |
.with(ServiceGroupVoice, |
|
266 |
PSetCallBarringWrapper::BarringTypeAllIncoming); |
|
267 |
EXPECT(PSetCallBarringWrapper::barringStatus) |
|
268 |
.with(ServiceGroupVoice, |
|
269 |
PSetCallBarringWrapper::BarringTypeIncomingWhenRoaming); |
|
270 |
EXPECT(CpPhoneNotes::showGlobalProgressNote) |
|
271 |
.willOnce(invoke(setNoteIdentifier)); |
|
272 |
EXPECT(CpItemDataHelper::addConnection).times(6); |
|
273 |
||
274 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
275 |
for (int childIndex = 0; childIndex < numOfChilds; childIndex++) { |
|
276 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
277 |
m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
|
278 |
} |
|
279 |
||
280 |
connect( |
|
281 |
m_dataFormModel, |
|
282 |
SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), |
|
283 |
this, |
|
284 |
SLOT(dataChanged(const QModelIndex &, const QModelIndex &))); |
|
285 |
||
286 |
QSignalSpy spy( |
|
287 |
m_dataFormModel, |
|
288 |
SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); |
|
289 |
QList<unsigned char> basicServiceGroupIds; |
|
290 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
291 |
PSetCallBarringWrapper::BarringErrorNone, |
|
292 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
293 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
294 |
PSetCallBarringWrapper::BarringErrorNone, |
|
295 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusInactive); |
|
296 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
297 |
PSetCallBarringWrapper::BarringErrorNone, |
|
298 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusNotProvisioned); |
|
299 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
300 |
PSetCallBarringWrapper::BarringErrorNone, |
|
301 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusUnavailable); |
|
302 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
303 |
PSetCallBarringWrapper::BarringErrorNone, |
|
304 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusUnknown); |
|
305 |
QCOMPARE(spy.count(), 11); |
|
306 |
||
307 |
QVERIFY(verify()); |
|
308 |
||
309 |
// Verify that barring status checking is not started on item show if |
|
310 |
// status is already queried. |
|
311 |
EXPECT(PSetCallBarringWrapper::barringStatus).times(0); |
|
312 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
|
313 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
314 |
m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
|
315 |
||
316 |
QVERIFY(verify()); |
|
317 |
} |
|
318 |
||
319 |
||
320 |
/*! |
|
321 |
UT_CpBarringPluginGroup::t_enableBarringRequestCompleted |
|
322 |
*/ |
|
323 |
void UT_CpBarringPluginGroup::t_enableBarringRequestCompleted() |
|
324 |
{ |
|
325 |
// request completed succesfully -case |
|
326 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
|
327 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
328 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
329 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
330 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 331 |
|
332 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
333 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
334 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
335 |
|
37 | 336 |
m_barringpluginGroup->enableBarringRequestCompleted( |
337 |
0, |
|
338 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
339 |
PSetCallBarringWrapper::BarringStatusActive, |
|
340 |
false); |
|
341 |
||
342 |
QVERIFY(verify()); |
|
343 |
QList<unsigned char> basicServiceGroupIds; |
|
344 |
||
345 |
// request completed with an error -case |
|
346 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
|
347 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
348 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
349 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
350 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
351 |
EXPECT(CpItemDataHelper::removeConnection); |
|
352 |
EXPECT(CpItemDataHelper::addConnection); |
|
353 |
EXPECT(CpPhoneNotes::cancelNote); |
|
354 |
EXPECT(CpPhoneNotes::showGlobalErrorNote); |
|
355 |
||
356 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
357 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
358 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
359 |
|
37 | 360 |
m_barringpluginGroup->enableBarringRequestCompleted( |
361 |
-1, |
|
362 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
363 |
PSetCallBarringWrapper::BarringStatusActive, |
|
364 |
false); |
|
365 |
||
366 |
QVERIFY(verify()); |
|
367 |
||
368 |
// request completed successfully and dependent barring setting needs |
|
369 |
// status inquiry |
|
370 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
371 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
372 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
373 |
// some other (outgoing) barring is enabled, status inquiery for that |
|
374 |
// should be done. |
|
375 |
item = m_barringpluginGroup->childAt(1); |
|
376 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
377 |
EXPECT(PSetCallBarringWrapper::barringStatus); |
|
378 |
EXPECT(CpPhoneNotes::cancelNote).times(0); |
|
379 |
EXPECT(CpPhoneNotes::showGlobalNote).times(0); |
|
380 |
||
381 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
382 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
383 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
384 |
|
37 | 385 |
m_barringpluginGroup->enableBarringRequestCompleted( |
386 |
0, |
|
387 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
388 |
PSetCallBarringWrapper::BarringStatusActive, |
|
389 |
false); |
|
390 |
||
391 |
QVERIFY(verify()); |
|
392 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
393 |
PSetCallBarringWrapper::BarringErrorNone, |
|
394 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
395 |
} |
|
396 |
||
397 |
||
398 |
/*! |
|
399 |
UT_CpBarringPluginGroup::t_enableBarringRequestCompletedUnknownBarring |
|
400 |
*/ |
|
401 |
void UT_CpBarringPluginGroup::t_enableBarringRequestCompletedUnknownBarring() |
|
402 |
{ |
|
403 |
// something very weird has happened and enable request completes for unknown |
|
404 |
// barring type. |
|
405 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(5); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
406 |
QModelIndex modelIndex = m_dataFormModel->indexFromItem(item); |
37 | 407 |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
408 |
EXPECT(CpItemDataHelper::widgetFromModelIndex) |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
409 |
.with<const QModelIndex &>(modelIndex).returns(this); |
37 | 410 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
411 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
412 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
413 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 414 |
// completion of unknown barring type should not lead to updating |
415 |
EXPECT(PSetCallBarringWrapper::barringStatus).times(0); |
|
416 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
417 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
418 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
419 |
|
37 | 420 |
m_barringpluginGroup->enableBarringRequestCompleted( |
421 |
0, |
|
422 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
423 |
PSetCallBarringWrapper::BarringStatusActive, |
|
424 |
false); |
|
425 |
||
426 |
QVERIFY(verify()); |
|
427 |
} |
|
428 |
||
429 |
||
430 |
/*! |
|
431 |
UT_CpBarringPluginGroup::t_enableBAOCRequestCompletedStatusUpdate |
|
432 |
*/ |
|
433 |
void UT_CpBarringPluginGroup::t_enableBAOCRequestCompletedStatusUpdate() |
|
434 |
{ |
|
435 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
436 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
437 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
438 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
439 |
} |
|
440 |
||
441 |
QList<unsigned char> basicServiceGroupIds; |
|
442 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
443 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
444 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
445 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
446 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
447 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
448 |
|
37 | 449 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
450 |
ServiceGroupVoice, PSetCallBarringWrapper::BarringTypeOutgoingInternational); |
|
451 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
|
452 |
ServiceGroupVoice, |
|
453 |
PSetCallBarringWrapper::BarringTypeOutgoingInternationalExceptToHomeCountry); |
|
454 |
m_barringpluginGroup->enableBarringRequestCompleted( |
|
455 |
0, |
|
456 |
PSetCallBarringWrapper::BarringTypeAllOutgoing, |
|
457 |
PSetCallBarringWrapper::BarringStatusActive, |
|
458 |
false); |
|
459 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
460 |
PSetCallBarringWrapper::BarringErrorNone, |
|
461 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
462 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
463 |
PSetCallBarringWrapper::BarringErrorNone, |
|
464 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
465 |
QVERIFY(verify()); |
|
466 |
} |
|
467 |
||
468 |
||
469 |
/*! |
|
470 |
UT_CpBarringPluginGroup::t_enableBOICRequestCompletedStatusUpdate |
|
471 |
*/ |
|
472 |
void UT_CpBarringPluginGroup::t_enableBOICRequestCompletedStatusUpdate() |
|
473 |
{ |
|
474 |
QModelIndex modelIndex; |
|
475 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
476 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
477 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
478 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
479 |
if (childIndex == 1) { |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
480 |
modelIndex = m_dataFormModel->indexFromItem(item); |
37 | 481 |
} |
482 |
} |
|
483 |
||
484 |
QList<unsigned char> basicServiceGroupIds; |
|
485 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
|
486 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
487 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
488 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
489 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
490 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
491 |
|
37 | 492 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
493 |
ServiceGroupVoice, |
|
494 |
PSetCallBarringWrapper::BarringTypeAllOutgoing); |
|
495 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
|
496 |
ServiceGroupVoice, |
|
497 |
PSetCallBarringWrapper::BarringTypeOutgoingInternationalExceptToHomeCountry); |
|
498 |
m_barringpluginGroup->enableBarringRequestCompleted( |
|
499 |
0, |
|
500 |
PSetCallBarringWrapper::BarringTypeOutgoingInternational, |
|
501 |
PSetCallBarringWrapper::BarringStatusActive, |
|
502 |
false); |
|
503 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
504 |
PSetCallBarringWrapper::BarringErrorNone, |
|
505 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
506 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
507 |
PSetCallBarringWrapper::BarringErrorNone, |
|
508 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
509 |
QVERIFY(verify()); |
|
510 |
} |
|
511 |
||
512 |
||
513 |
/*! |
|
514 |
UT_CpBarringPluginGroup::t_enableBOICexHCRequestCompletedStatusUpdate |
|
515 |
*/ |
|
516 |
void UT_CpBarringPluginGroup::t_enableBOICexHCRequestCompletedStatusUpdate() |
|
517 |
{ |
|
518 |
QModelIndex modelIndex; |
|
519 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
520 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
521 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
522 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
523 |
if (childIndex == 2) { |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
524 |
modelIndex = m_dataFormModel->indexFromItem(item); |
37 | 525 |
} |
526 |
} |
|
527 |
||
528 |
QList<unsigned char> basicServiceGroupIds; |
|
529 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
|
530 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
531 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
532 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
533 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
534 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
535 |
|
37 | 536 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
537 |
ServiceGroupVoice, |
|
538 |
PSetCallBarringWrapper::BarringTypeAllOutgoing); |
|
539 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
|
540 |
ServiceGroupVoice, |
|
541 |
PSetCallBarringWrapper::BarringTypeOutgoingInternational); |
|
542 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
|
543 |
ServiceGroupVoice, |
|
544 |
PSetCallBarringWrapper::BarringTypeOutgoingInternationalExceptToHomeCountry); |
|
545 |
m_barringpluginGroup->enableBarringRequestCompleted( |
|
546 |
0, |
|
547 |
PSetCallBarringWrapper::BarringTypeOutgoingInternationalExceptToHomeCountry, |
|
548 |
PSetCallBarringWrapper::BarringStatusActive, |
|
549 |
false); |
|
550 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
551 |
PSetCallBarringWrapper::BarringErrorNone, |
|
552 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
553 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
554 |
PSetCallBarringWrapper::BarringErrorNone, |
|
555 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
556 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
557 |
PSetCallBarringWrapper::BarringErrorNone, |
|
558 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
559 |
QVERIFY(verify()); |
|
560 |
} |
|
561 |
||
562 |
||
563 |
/*! |
|
564 |
UT_CpBarringPluginGroup::t_enableBAICRequestCompletedStatusUpdate |
|
565 |
*/ |
|
566 |
void UT_CpBarringPluginGroup::t_enableBAICRequestCompletedStatusUpdate() |
|
567 |
{ |
|
568 |
QModelIndex modelIndex; |
|
569 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
570 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
571 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
572 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
573 |
if (childIndex == 3) { |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
574 |
modelIndex = m_dataFormModel->indexFromItem(item); |
37 | 575 |
} |
576 |
} |
|
577 |
||
578 |
QList<unsigned char> basicServiceGroupIds; |
|
579 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
|
580 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
581 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
582 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
583 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
584 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
585 |
|
37 | 586 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
587 |
ServiceGroupVoice, |
|
588 |
PSetCallBarringWrapper::BarringTypeIncomingWhenRoaming); |
|
589 |
m_barringpluginGroup->enableBarringRequestCompleted( |
|
590 |
0, |
|
591 |
PSetCallBarringWrapper::BarringTypeAllIncoming, |
|
592 |
PSetCallBarringWrapper::BarringStatusActive, |
|
593 |
false); |
|
594 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
595 |
PSetCallBarringWrapper::BarringErrorNone, |
|
596 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
597 |
QVERIFY(verify()); |
|
598 |
} |
|
599 |
||
600 |
||
601 |
/*! |
|
602 |
UT_CpBarringPluginGroup::t_enableBICRoamRequestCompletedStatusUpdate |
|
603 |
*/ |
|
604 |
void UT_CpBarringPluginGroup::t_enableBICRoamRequestCompletedStatusUpdate() |
|
605 |
{ |
|
606 |
QModelIndex modelIndex; |
|
607 |
int numOfChilds = m_barringpluginGroup->childCount(); |
|
608 |
for (int childIndex = 0; childIndex < numOfChilds - 1; childIndex++) { |
|
609 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(childIndex); |
|
610 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
|
611 |
if (childIndex == 4) { |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
612 |
modelIndex = m_dataFormModel->indexFromItem(item); |
37 | 613 |
} |
614 |
} |
|
615 |
||
616 |
QList<unsigned char> basicServiceGroupIds; |
|
617 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
|
618 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
619 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
620 |
emit simulateCheckStateChange(Qt::Checked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
621 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
622 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
623 |
|
37 | 624 |
EXPECT(PSetCallBarringWrapper::barringStatus).with( |
625 |
ServiceGroupVoice, |
|
626 |
PSetCallBarringWrapper::BarringTypeAllIncoming); |
|
627 |
m_barringpluginGroup->enableBarringRequestCompleted( |
|
628 |
0, |
|
629 |
PSetCallBarringWrapper::BarringTypeIncomingWhenRoaming, |
|
630 |
PSetCallBarringWrapper::BarringStatusActive, |
|
631 |
false); |
|
632 |
m_barringpluginGroup->barringStatusRequestCompleted( |
|
633 |
PSetCallBarringWrapper::BarringErrorNone, |
|
634 |
basicServiceGroupIds, PSetCallBarringWrapper::BarringStatusActive); |
|
635 |
QVERIFY(verify()); |
|
636 |
} |
|
637 |
||
638 |
||
639 |
/*! |
|
640 |
UT_CpBarringPluginGroup::t_disableBarringRequestCompleted |
|
641 |
*/ |
|
642 |
void UT_CpBarringPluginGroup::t_disableBarringRequestCompleted() |
|
643 |
{ |
|
644 |
// request completed succesfully -case |
|
645 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
|
646 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
647 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
648 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
649 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 650 |
emit simulateCheckStateChange(Qt::Unchecked); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
651 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
652 |
KCurrentPassword, true); |
37 | 653 |
|
654 |
m_barringpluginGroup->disableBarringRequestCompleted( |
|
655 |
0, |
|
656 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
657 |
PSetCallBarringWrapper::BarringStatusActive, |
|
658 |
false); |
|
659 |
||
660 |
QVERIFY(verify()); |
|
661 |
||
662 |
// request completed with an error -case |
|
663 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
|
664 |
item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
|
665 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
666 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
667 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
668 |
EXPECT(CpItemDataHelper::removeConnection); |
|
669 |
EXPECT(CpItemDataHelper::addConnection); |
|
670 |
EXPECT(CpPhoneNotes::cancelNote); |
|
671 |
EXPECT(CpPhoneNotes::showGlobalErrorNote); |
|
672 |
||
673 |
emit simulateCheckStateChange(Qt::Unchecked); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
674 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
675 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
676 |
|
37 | 677 |
m_barringpluginGroup->disableBarringRequestCompleted( |
678 |
-1, |
|
679 |
PSetCallBarringWrapper::BarringTypeAllBarrings, |
|
680 |
PSetCallBarringWrapper::BarringStatusActive, |
|
681 |
false); |
|
682 |
||
683 |
QVERIFY(verify()); |
|
684 |
} |
|
685 |
||
686 |
||
687 |
/*! |
|
688 |
UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted |
|
689 |
*/ |
|
690 |
void UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted() |
|
691 |
{ |
|
692 |
// request completed with no error |
|
693 |
EXPECT(CpPhoneNotes::cancelNote); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
694 |
EXPECT(CpPhoneNotes::showNotificationDialog); |
37 | 695 |
|
696 |
m_barringpluginGroup->barringPasswordChangeRequestCompleted(0); |
|
697 |
||
698 |
QVERIFY(verify()); |
|
699 |
||
700 |
// request completed with an error |
|
701 |
EXPECT(CpPhoneNotes::cancelNote); |
|
702 |
EXPECT(CpPhoneNotes::showGlobalErrorNote); |
|
703 |
||
704 |
m_barringpluginGroup->barringPasswordChangeRequestCompleted(-1); |
|
705 |
||
706 |
QVERIFY(verify()); |
|
707 |
} |
|
708 |
||
709 |
||
710 |
/*! |
|
711 |
UT_CpBarringPluginGroup::t_changeBarringStateRequested |
|
712 |
*/ |
|
713 |
void UT_CpBarringPluginGroup::t_changeBarringStateRequested() |
|
714 |
{ |
|
715 |
// barring enable request case |
|
716 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
717 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
718 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
719 |
EXPECT(PSetCallBarringWrapper::enableBarring) |
|
720 |
.with(ServiceGroupVoice, |
|
721 |
PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
|
722 |
EXPECT(CpPhoneNotes::showGlobalProgressNote); |
|
723 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
724 |
HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
725 |
item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
37 | 726 |
emit simulateCheckStateChange(Qt::Checked); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
727 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
728 |
KCurrentPassword, true); |
37 | 729 |
|
730 |
QVERIFY(verify()); |
|
731 |
||
732 |
// barring disable request case |
|
733 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
734 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
735 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
736 |
EXPECT(PSetCallBarringWrapper::disableBarring) |
|
737 |
.with(ServiceGroupVoice, |
|
738 |
PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
|
739 |
EXPECT(CpPhoneNotes::showGlobalProgressNote); |
|
740 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
741 |
item = m_barringpluginGroup->childAt(0); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
742 |
item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
37 | 743 |
emit simulateCheckStateChange(Qt::Unchecked); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
744 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
745 |
KCurrentPassword, true); |
37 | 746 |
|
747 |
QVERIFY(verify()); |
|
748 |
||
749 |
// cancel pressed while querying barring password |
|
750 |
EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
|
751 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
752 |
.willOnce(invoke(setPasswordParamsCancel)); |
|
753 |
EXPECT(CpItemDataHelper::removeConnection); |
|
754 |
EXPECT(CpItemDataHelper::addConnection); |
|
755 |
EXPECT(PSetCallBarringWrapper::disableBarring).times(0); |
|
756 |
EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
|
757 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
758 |
item = m_barringpluginGroup->childAt(0); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
759 |
item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
37 | 760 |
emit simulateCheckStateChange(Qt::Unchecked); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
761 |
m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
762 |
"", false); |
37 | 763 |
|
764 |
QVERIFY(verify()); |
|
765 |
||
766 |
// barring item not found case |
|
767 |
EXPECT(PSetCallBarringWrapper::enableBarring).times(0); |
|
768 |
EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
|
769 |
||
770 |
emit simulateCheckStateChange(Qt::Checked); |
|
771 |
||
772 |
QVERIFY(verify()); |
|
773 |
} |
|
774 |
||
775 |
||
776 |
/*! |
|
777 |
UT_CpBarringPluginGroup::t_changeBarringPasswordRequested |
|
778 |
*/ |
|
779 |
void UT_CpBarringPluginGroup::t_changeBarringPasswordRequested() |
|
780 |
{ |
|
781 |
connect( |
|
782 |
this, SIGNAL(simulateEditPasswordButtonClicked(bool)), |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
783 |
m_barringpluginGroup, SLOT(changeBarringPasswordRequested())); |
37 | 784 |
|
785 |
// cancel from current password query |
|
786 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
787 |
.willOnce(invoke(setPasswordParamsCancel)); |
|
788 |
emit simulateEditPasswordButtonClicked(false); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
789 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling("", false); |
37 | 790 |
QVERIFY(verify()); |
791 |
||
792 |
// cancel from new password query |
|
793 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
794 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
795 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
796 |
.willOnce(invoke(setPasswordParamsCancel)); |
|
797 |
emit simulateEditPasswordButtonClicked(false); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
798 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
799 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
800 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
801 |
"", false); |
37 | 802 |
QVERIFY(verify()); |
803 |
||
804 |
// cancel from verify new password query |
|
805 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
806 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
807 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
808 |
.willOnce(invoke(setNewAndVerifiedPasswordParams)); |
|
809 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
810 |
.willOnce(invoke(setPasswordParamsCancel)); |
|
811 |
emit simulateEditPasswordButtonClicked(false); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
812 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
813 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
814 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
815 |
KNewAndVerifiedPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
816 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
817 |
"", false); |
37 | 818 |
QVERIFY(verify()); |
819 |
||
820 |
// all data successfully queried |
|
821 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
822 |
.willOnce(invoke(setCurrentPasswordParams)); |
|
823 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
824 |
.willOnce(invoke(setNewAndVerifiedPasswordParams)); |
|
825 |
EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
|
826 |
.willOnce(invoke(setNewAndVerifiedPasswordParams)); |
|
827 |
EXPECT(PSetCallBarringWrapper::changeBarringPassword) |
|
828 |
.with(KCurrentPassword, KNewAndVerifiedPassword, KNewAndVerifiedPassword); |
|
829 |
emit simulateEditPasswordButtonClicked(false); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
830 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
831 |
KCurrentPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
832 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
833 |
KNewAndVerifiedPassword, true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
834 |
m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
835 |
KNewAndVerifiedPassword, true); |
37 | 836 |
QVERIFY(verify()); |
837 |
} |
|
838 |
||
839 |
QTEST_MAIN_S60(UT_CpBarringPluginGroup) |