16 */ |
16 */ |
17 |
17 |
18 #include <HbDataFormModel> |
18 #include <HbDataFormModel> |
19 #include <HbCheckBox> |
19 #include <HbCheckBox> |
20 #include <psetwrapper.h> |
20 #include <psetwrapper.h> |
|
21 #include <psuinotes.h> |
21 #include "ut_barringplugingroup.h" |
22 #include "ut_barringplugingroup.h" |
22 #include "qtestmains60.h" |
23 #include "qtestmains60.h" |
23 #include "cpitemdatahelper.h" |
24 #include "cpitemdatahelper.h" |
24 #include "cpphonenotes.h" |
|
25 #define private friend class UT_CpBarringPluginGroup; private |
25 #define private friend class UT_CpBarringPluginGroup; private |
26 #include "cpbarringplugingroup.h" |
26 #include "cpbarringplugingroup.h" |
27 |
27 |
28 void setNoteIdentifier(int ¬eId, const QString& text) |
28 void setNoteIdentifier(int ¬eId, const QString& text) |
29 { |
29 { |
170 Tests that another progress note is not launched if one is already shown. |
170 Tests that another progress note is not launched if one is already shown. |
171 */ |
171 */ |
172 void UT_CpBarringPluginGroup::t_itemShownBarringStatusRequestOngoing() |
172 void UT_CpBarringPluginGroup::t_itemShownBarringStatusRequestOngoing() |
173 { |
173 { |
174 EXPECT(PSetCallBarringWrapper::barringStatus); |
174 EXPECT(PSetCallBarringWrapper::barringStatus); |
175 EXPECT(CpPhoneNotes::noteShowing).returns(true); |
175 EXPECT(PsUiNotes::noteShowing).returns(true); |
176 EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
176 EXPECT(PsUiNotes::showGlobalProgressNote).times(0); |
177 |
177 |
178 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
178 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
179 m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
179 m_barringpluginGroup->itemShown(m_dataFormModel->indexFromItem(item)); |
180 |
180 |
181 QVERIFY(verify()); |
181 QVERIFY(verify()); |
201 PSetCallBarringWrapper::BarringStatusActive); |
201 PSetCallBarringWrapper::BarringStatusActive); |
202 } |
202 } |
203 |
203 |
204 // simulate barring enable request |
204 // simulate barring enable request |
205 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
205 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
206 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
206 EXPECT(PsUiNotes::showPasswordQueryDialog) |
207 .willOnce(invoke(setCurrentPasswordParams)); |
207 .willOnce(invoke(setCurrentPasswordParams)); |
208 emit simulateCheckStateChange(Qt::Checked); |
208 emit simulateCheckStateChange(Qt::Checked); |
209 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
209 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
210 KCurrentPassword, true); |
210 KCurrentPassword, true); |
211 |
211 |
224 /*! |
224 /*! |
225 UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError |
225 UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError |
226 */ |
226 */ |
227 void UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError() |
227 void UT_CpBarringPluginGroup::t_barringStatusRequestCompletedWithAnError() |
228 { |
228 { |
229 EXPECT(CpPhoneNotes::cancelNote); |
229 EXPECT(PsUiNotes::cancelNote); |
230 EXPECT(CpPhoneNotes::showGlobalErrorNote); |
230 EXPECT(PsUiNotes::showGlobalErrorNote); |
231 EXPECT(CpItemDataHelper::addConnection).times(0); |
231 EXPECT(CpItemDataHelper::addConnection).times(0); |
232 |
232 |
233 QList<unsigned char> basicServiceGroupIds; |
233 QList<unsigned char> basicServiceGroupIds; |
234 const int errorCode = -1; |
234 const int errorCode = -1; |
235 m_barringpluginGroup->barringStatusRequestCompleted( |
235 m_barringpluginGroup->barringStatusRequestCompleted( |
265 .with(ServiceGroupVoice, |
265 .with(ServiceGroupVoice, |
266 PSetCallBarringWrapper::BarringTypeAllIncoming); |
266 PSetCallBarringWrapper::BarringTypeAllIncoming); |
267 EXPECT(PSetCallBarringWrapper::barringStatus) |
267 EXPECT(PSetCallBarringWrapper::barringStatus) |
268 .with(ServiceGroupVoice, |
268 .with(ServiceGroupVoice, |
269 PSetCallBarringWrapper::BarringTypeIncomingWhenRoaming); |
269 PSetCallBarringWrapper::BarringTypeIncomingWhenRoaming); |
270 EXPECT(CpPhoneNotes::showGlobalProgressNote) |
270 EXPECT(PsUiNotes::showGlobalProgressNote) |
271 .willOnce(invoke(setNoteIdentifier)); |
271 .willOnce(invoke(setNoteIdentifier)); |
272 EXPECT(CpItemDataHelper::addConnection).times(6); |
272 EXPECT(CpItemDataHelper::addConnection).times(6); |
273 |
273 |
274 int numOfChilds = m_barringpluginGroup->childCount(); |
274 int numOfChilds = m_barringpluginGroup->childCount(); |
275 for (int childIndex = 0; childIndex < numOfChilds; childIndex++) { |
275 for (int childIndex = 0; childIndex < numOfChilds; childIndex++) { |
322 */ |
322 */ |
323 void UT_CpBarringPluginGroup::t_enableBarringRequestCompleted() |
323 void UT_CpBarringPluginGroup::t_enableBarringRequestCompleted() |
324 { |
324 { |
325 // request completed succesfully -case |
325 // request completed succesfully -case |
326 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
326 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
327 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
327 EXPECT(PsUiNotes::showPasswordQueryDialog) |
328 .willOnce(invoke(setCurrentPasswordParams)); |
328 .willOnce(invoke(setCurrentPasswordParams)); |
329 EXPECT(CpPhoneNotes::cancelNote); |
329 EXPECT(PsUiNotes::cancelNote); |
330 EXPECT(CpPhoneNotes::showNotificationDialog); |
330 EXPECT(PsUiNotes::showNotificationDialog); |
331 |
331 |
332 emit simulateCheckStateChange(Qt::Checked); |
332 emit simulateCheckStateChange(Qt::Checked); |
333 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
333 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
334 KCurrentPassword, true); |
334 KCurrentPassword, true); |
335 |
335 |
344 |
344 |
345 // request completed with an error -case |
345 // request completed with an error -case |
346 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
346 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
347 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
347 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
348 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
348 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
349 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
349 EXPECT(PsUiNotes::showPasswordQueryDialog) |
350 .willOnce(invoke(setCurrentPasswordParams)); |
350 .willOnce(invoke(setCurrentPasswordParams)); |
351 EXPECT(CpItemDataHelper::removeConnection); |
351 EXPECT(CpItemDataHelper::removeConnection); |
352 EXPECT(CpItemDataHelper::addConnection); |
352 EXPECT(CpItemDataHelper::addConnection); |
353 EXPECT(CpPhoneNotes::cancelNote); |
353 EXPECT(PsUiNotes::cancelNote); |
354 EXPECT(CpPhoneNotes::showGlobalErrorNote); |
354 EXPECT(PsUiNotes::showGlobalErrorNote); |
355 |
355 |
356 emit simulateCheckStateChange(Qt::Checked); |
356 emit simulateCheckStateChange(Qt::Checked); |
357 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
357 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
358 KCurrentPassword, true); |
358 KCurrentPassword, true); |
359 |
359 |
366 QVERIFY(verify()); |
366 QVERIFY(verify()); |
367 |
367 |
368 // request completed successfully and dependent barring setting needs |
368 // request completed successfully and dependent barring setting needs |
369 // status inquiry |
369 // status inquiry |
370 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
370 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
371 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
371 EXPECT(PsUiNotes::showPasswordQueryDialog) |
372 .willOnce(invoke(setCurrentPasswordParams)); |
372 .willOnce(invoke(setCurrentPasswordParams)); |
373 // some other (outgoing) barring is enabled, status inquiery for that |
373 // some other (outgoing) barring is enabled, status inquiery for that |
374 // should be done. |
374 // should be done. |
375 item = m_barringpluginGroup->childAt(1); |
375 item = m_barringpluginGroup->childAt(1); |
376 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
376 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
377 EXPECT(PSetCallBarringWrapper::barringStatus); |
377 EXPECT(PSetCallBarringWrapper::barringStatus); |
378 EXPECT(CpPhoneNotes::cancelNote).times(0); |
378 EXPECT(PsUiNotes::cancelNote).times(0); |
379 EXPECT(CpPhoneNotes::showGlobalNote).times(0); |
379 EXPECT(PsUiNotes::showGlobalNote).times(0); |
380 |
380 |
381 emit simulateCheckStateChange(Qt::Checked); |
381 emit simulateCheckStateChange(Qt::Checked); |
382 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
382 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
383 KCurrentPassword, true); |
383 KCurrentPassword, true); |
384 |
384 |
405 HbDataFormModelItem *item = m_barringpluginGroup->childAt(5); |
405 HbDataFormModelItem *item = m_barringpluginGroup->childAt(5); |
406 QModelIndex modelIndex = m_dataFormModel->indexFromItem(item); |
406 QModelIndex modelIndex = m_dataFormModel->indexFromItem(item); |
407 |
407 |
408 EXPECT(CpItemDataHelper::widgetFromModelIndex) |
408 EXPECT(CpItemDataHelper::widgetFromModelIndex) |
409 .with<const QModelIndex &>(modelIndex).returns(this); |
409 .with<const QModelIndex &>(modelIndex).returns(this); |
410 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
410 EXPECT(PsUiNotes::showPasswordQueryDialog) |
411 .willOnce(invoke(setCurrentPasswordParams)); |
411 .willOnce(invoke(setCurrentPasswordParams)); |
412 EXPECT(CpPhoneNotes::cancelNote); |
412 EXPECT(PsUiNotes::cancelNote); |
413 EXPECT(CpPhoneNotes::showNotificationDialog); |
413 EXPECT(PsUiNotes::showNotificationDialog); |
414 // completion of unknown barring type should not lead to updating |
414 // completion of unknown barring type should not lead to updating |
415 EXPECT(PSetCallBarringWrapper::barringStatus).times(0); |
415 EXPECT(PSetCallBarringWrapper::barringStatus).times(0); |
416 emit simulateCheckStateChange(Qt::Checked); |
416 emit simulateCheckStateChange(Qt::Checked); |
417 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
417 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
418 KCurrentPassword, true); |
418 KCurrentPassword, true); |
438 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
438 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
439 } |
439 } |
440 |
440 |
441 QList<unsigned char> basicServiceGroupIds; |
441 QList<unsigned char> basicServiceGroupIds; |
442 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
442 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
443 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
443 EXPECT(PsUiNotes::showPasswordQueryDialog) |
444 .willOnce(invoke(setCurrentPasswordParams)); |
444 .willOnce(invoke(setCurrentPasswordParams)); |
445 emit simulateCheckStateChange(Qt::Checked); |
445 emit simulateCheckStateChange(Qt::Checked); |
446 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
446 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
447 KCurrentPassword, true); |
447 KCurrentPassword, true); |
448 |
448 |
481 } |
481 } |
482 } |
482 } |
483 |
483 |
484 QList<unsigned char> basicServiceGroupIds; |
484 QList<unsigned char> basicServiceGroupIds; |
485 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
485 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
486 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
486 EXPECT(PsUiNotes::showPasswordQueryDialog) |
487 .willOnce(invoke(setCurrentPasswordParams)); |
487 .willOnce(invoke(setCurrentPasswordParams)); |
488 emit simulateCheckStateChange(Qt::Checked); |
488 emit simulateCheckStateChange(Qt::Checked); |
489 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
489 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
490 KCurrentPassword, true); |
490 KCurrentPassword, true); |
491 |
491 |
525 } |
525 } |
526 } |
526 } |
527 |
527 |
528 QList<unsigned char> basicServiceGroupIds; |
528 QList<unsigned char> basicServiceGroupIds; |
529 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
529 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
530 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
530 EXPECT(PsUiNotes::showPasswordQueryDialog) |
531 .willOnce(invoke(setCurrentPasswordParams)); |
531 .willOnce(invoke(setCurrentPasswordParams)); |
532 emit simulateCheckStateChange(Qt::Checked); |
532 emit simulateCheckStateChange(Qt::Checked); |
533 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
533 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
534 KCurrentPassword, true); |
534 KCurrentPassword, true); |
535 |
535 |
575 } |
575 } |
576 } |
576 } |
577 |
577 |
578 QList<unsigned char> basicServiceGroupIds; |
578 QList<unsigned char> basicServiceGroupIds; |
579 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
579 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
580 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
580 EXPECT(PsUiNotes::showPasswordQueryDialog) |
581 .willOnce(invoke(setCurrentPasswordParams)); |
581 .willOnce(invoke(setCurrentPasswordParams)); |
582 emit simulateCheckStateChange(Qt::Checked); |
582 emit simulateCheckStateChange(Qt::Checked); |
583 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
583 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
584 KCurrentPassword, true); |
584 KCurrentPassword, true); |
585 |
585 |
613 } |
613 } |
614 } |
614 } |
615 |
615 |
616 QList<unsigned char> basicServiceGroupIds; |
616 QList<unsigned char> basicServiceGroupIds; |
617 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
617 EXPECT(CpItemDataHelper::widgetFromModelIndex).with(modelIndex).returns(this); |
618 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
618 EXPECT(PsUiNotes::showPasswordQueryDialog) |
619 .willOnce(invoke(setCurrentPasswordParams)); |
619 .willOnce(invoke(setCurrentPasswordParams)); |
620 emit simulateCheckStateChange(Qt::Checked); |
620 emit simulateCheckStateChange(Qt::Checked); |
621 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
621 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
622 KCurrentPassword, true); |
622 KCurrentPassword, true); |
623 |
623 |
641 */ |
641 */ |
642 void UT_CpBarringPluginGroup::t_disableBarringRequestCompleted() |
642 void UT_CpBarringPluginGroup::t_disableBarringRequestCompleted() |
643 { |
643 { |
644 // request completed succesfully -case |
644 // request completed succesfully -case |
645 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
645 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this).times(1); |
646 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
646 EXPECT(PsUiNotes::showPasswordQueryDialog) |
647 .willOnce(invoke(setCurrentPasswordParams)); |
647 .willOnce(invoke(setCurrentPasswordParams)); |
648 EXPECT(CpPhoneNotes::cancelNote); |
648 EXPECT(PsUiNotes::cancelNote); |
649 EXPECT(CpPhoneNotes::showNotificationDialog); |
649 EXPECT(PsUiNotes::showNotificationDialog); |
650 emit simulateCheckStateChange(Qt::Unchecked); |
650 emit simulateCheckStateChange(Qt::Unchecked); |
651 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
651 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
652 KCurrentPassword, true); |
652 KCurrentPassword, true); |
653 |
653 |
654 m_barringpluginGroup->disableBarringRequestCompleted( |
654 m_barringpluginGroup->disableBarringRequestCompleted( |
661 |
661 |
662 // request completed with an error -case |
662 // request completed with an error -case |
663 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
663 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
664 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
664 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
665 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
665 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
666 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
666 EXPECT(PsUiNotes::showPasswordQueryDialog) |
667 .willOnce(invoke(setCurrentPasswordParams)); |
667 .willOnce(invoke(setCurrentPasswordParams)); |
668 EXPECT(CpItemDataHelper::removeConnection); |
668 EXPECT(CpItemDataHelper::removeConnection); |
669 EXPECT(CpItemDataHelper::addConnection); |
669 EXPECT(CpItemDataHelper::addConnection); |
670 EXPECT(CpPhoneNotes::cancelNote); |
670 EXPECT(PsUiNotes::cancelNote); |
671 EXPECT(CpPhoneNotes::showGlobalErrorNote); |
671 EXPECT(PsUiNotes::showGlobalErrorNote); |
672 |
672 |
673 emit simulateCheckStateChange(Qt::Unchecked); |
673 emit simulateCheckStateChange(Qt::Unchecked); |
674 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
674 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
675 KCurrentPassword, true); |
675 KCurrentPassword, true); |
676 |
676 |
688 UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted |
688 UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted |
689 */ |
689 */ |
690 void UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted() |
690 void UT_CpBarringPluginGroup::t_barringPasswordChangeRequestCompleted() |
691 { |
691 { |
692 // request completed with no error |
692 // request completed with no error |
693 EXPECT(CpPhoneNotes::cancelNote); |
693 EXPECT(PsUiNotes::cancelNote); |
694 EXPECT(CpPhoneNotes::showNotificationDialog); |
694 EXPECT(PsUiNotes::showNotificationDialog); |
695 |
695 |
696 m_barringpluginGroup->barringPasswordChangeRequestCompleted(0); |
696 m_barringpluginGroup->barringPasswordChangeRequestCompleted(0); |
697 |
697 |
698 QVERIFY(verify()); |
698 QVERIFY(verify()); |
699 |
699 |
700 // request completed with an error |
700 // request completed with an error |
701 EXPECT(CpPhoneNotes::cancelNote); |
701 EXPECT(PsUiNotes::cancelNote); |
702 EXPECT(CpPhoneNotes::showGlobalErrorNote); |
702 EXPECT(PsUiNotes::showGlobalErrorNote); |
703 |
703 |
704 m_barringpluginGroup->barringPasswordChangeRequestCompleted(-1); |
704 m_barringpluginGroup->barringPasswordChangeRequestCompleted(-1); |
705 |
705 |
706 QVERIFY(verify()); |
706 QVERIFY(verify()); |
707 } |
707 } |
712 */ |
712 */ |
713 void UT_CpBarringPluginGroup::t_changeBarringStateRequested() |
713 void UT_CpBarringPluginGroup::t_changeBarringStateRequested() |
714 { |
714 { |
715 // barring enable request case |
715 // barring enable request case |
716 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
716 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
717 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
717 EXPECT(PsUiNotes::showPasswordQueryDialog) |
718 .willOnce(invoke(setCurrentPasswordParams)); |
718 .willOnce(invoke(setCurrentPasswordParams)); |
719 EXPECT(PSetCallBarringWrapper::enableBarring) |
719 EXPECT(PSetCallBarringWrapper::enableBarring) |
720 .with(ServiceGroupVoice, |
720 .with(ServiceGroupVoice, |
721 PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
721 PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
722 EXPECT(CpPhoneNotes::showGlobalProgressNote); |
722 EXPECT(PsUiNotes::showGlobalProgressNote); |
723 |
723 |
724 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
724 HbDataFormModelItem *item = m_barringpluginGroup->childAt(0); |
725 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
725 item->setContentWidgetData("checkState", QVariant(Qt::Checked)); |
726 emit simulateCheckStateChange(Qt::Checked); |
726 emit simulateCheckStateChange(Qt::Checked); |
727 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
727 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
729 |
729 |
730 QVERIFY(verify()); |
730 QVERIFY(verify()); |
731 |
731 |
732 // barring disable request case |
732 // barring disable request case |
733 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
733 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
734 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
734 EXPECT(PsUiNotes::showPasswordQueryDialog) |
735 .willOnce(invoke(setCurrentPasswordParams)); |
735 .willOnce(invoke(setCurrentPasswordParams)); |
736 EXPECT(PSetCallBarringWrapper::disableBarring) |
736 EXPECT(PSetCallBarringWrapper::disableBarring) |
737 .with(ServiceGroupVoice, |
737 .with(ServiceGroupVoice, |
738 PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
738 PSetCallBarringWrapper::BarringTypeAllOutgoing, KCurrentPassword); |
739 EXPECT(CpPhoneNotes::showGlobalProgressNote); |
739 EXPECT(PsUiNotes::showGlobalProgressNote); |
740 |
740 |
741 item = m_barringpluginGroup->childAt(0); |
741 item = m_barringpluginGroup->childAt(0); |
742 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
742 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
743 emit simulateCheckStateChange(Qt::Unchecked); |
743 emit simulateCheckStateChange(Qt::Unchecked); |
744 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
744 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
746 |
746 |
747 QVERIFY(verify()); |
747 QVERIFY(verify()); |
748 |
748 |
749 // cancel pressed while querying barring password |
749 // cancel pressed while querying barring password |
750 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
750 EXPECT(CpItemDataHelper::widgetFromModelIndex).returns(this); |
751 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
751 EXPECT(PsUiNotes::showPasswordQueryDialog) |
752 .willOnce(invoke(setPasswordParamsCancel)); |
752 .willOnce(invoke(setPasswordParamsCancel)); |
753 EXPECT(CpItemDataHelper::removeConnection); |
753 EXPECT(CpItemDataHelper::removeConnection); |
754 EXPECT(CpItemDataHelper::addConnection); |
754 EXPECT(CpItemDataHelper::addConnection); |
755 EXPECT(PSetCallBarringWrapper::disableBarring).times(0); |
755 EXPECT(PSetCallBarringWrapper::disableBarring).times(0); |
756 EXPECT(CpPhoneNotes::showGlobalProgressNote).times(0); |
756 EXPECT(PsUiNotes::showGlobalProgressNote).times(0); |
757 |
757 |
758 item = m_barringpluginGroup->childAt(0); |
758 item = m_barringpluginGroup->childAt(0); |
759 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
759 item->setContentWidgetData("checkState", QVariant(Qt::Unchecked)); |
760 emit simulateCheckStateChange(Qt::Unchecked); |
760 emit simulateCheckStateChange(Qt::Unchecked); |
761 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
761 m_barringpluginGroup->completeBarringStateChangeRequestHandling( |
781 connect( |
781 connect( |
782 this, SIGNAL(simulateEditPasswordButtonClicked(bool)), |
782 this, SIGNAL(simulateEditPasswordButtonClicked(bool)), |
783 m_barringpluginGroup, SLOT(changeBarringPasswordRequested())); |
783 m_barringpluginGroup, SLOT(changeBarringPasswordRequested())); |
784 |
784 |
785 // cancel from current password query |
785 // cancel from current password query |
786 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
786 EXPECT(PsUiNotes::showPasswordQueryDialog) |
787 .willOnce(invoke(setPasswordParamsCancel)); |
787 .willOnce(invoke(setPasswordParamsCancel)); |
788 emit simulateEditPasswordButtonClicked(false); |
788 emit simulateEditPasswordButtonClicked(false); |
789 m_barringpluginGroup->changeBarringPasswordPhasesHandling("", false); |
789 m_barringpluginGroup->changeBarringPasswordPhasesHandling("", false); |
790 QVERIFY(verify()); |
790 QVERIFY(verify()); |
791 |
791 |
792 // cancel from new password query |
792 // cancel from new password query |
793 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
793 EXPECT(PsUiNotes::showPasswordQueryDialog) |
794 .willOnce(invoke(setCurrentPasswordParams)); |
794 .willOnce(invoke(setCurrentPasswordParams)); |
795 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
795 EXPECT(PsUiNotes::showPasswordQueryDialog) |
796 .willOnce(invoke(setPasswordParamsCancel)); |
796 .willOnce(invoke(setPasswordParamsCancel)); |
797 emit simulateEditPasswordButtonClicked(false); |
797 emit simulateEditPasswordButtonClicked(false); |
798 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
798 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
799 KCurrentPassword, true); |
799 KCurrentPassword, true); |
800 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
800 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
801 "", false); |
801 "", false); |
802 QVERIFY(verify()); |
802 QVERIFY(verify()); |
803 |
803 |
804 // cancel from verify new password query |
804 // cancel from verify new password query |
805 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
805 EXPECT(PsUiNotes::showPasswordQueryDialog) |
806 .willOnce(invoke(setCurrentPasswordParams)); |
806 .willOnce(invoke(setCurrentPasswordParams)); |
807 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
807 EXPECT(PsUiNotes::showPasswordQueryDialog) |
808 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
808 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
809 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
809 EXPECT(PsUiNotes::showPasswordQueryDialog) |
810 .willOnce(invoke(setPasswordParamsCancel)); |
810 .willOnce(invoke(setPasswordParamsCancel)); |
811 emit simulateEditPasswordButtonClicked(false); |
811 emit simulateEditPasswordButtonClicked(false); |
812 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
812 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
813 KCurrentPassword, true); |
813 KCurrentPassword, true); |
814 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
814 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
816 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
816 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
817 "", false); |
817 "", false); |
818 QVERIFY(verify()); |
818 QVERIFY(verify()); |
819 |
819 |
820 // all data successfully queried |
820 // all data successfully queried |
821 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
821 EXPECT(PsUiNotes::showPasswordQueryDialog) |
822 .willOnce(invoke(setCurrentPasswordParams)); |
822 .willOnce(invoke(setCurrentPasswordParams)); |
823 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
823 EXPECT(PsUiNotes::showPasswordQueryDialog) |
824 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
824 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
825 EXPECT(CpPhoneNotes::showPasswordQueryDialog) |
825 EXPECT(PsUiNotes::showPasswordQueryDialog) |
826 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
826 .willOnce(invoke(setNewAndVerifiedPasswordParams)); |
827 EXPECT(PSetCallBarringWrapper::changeBarringPassword) |
827 EXPECT(PSetCallBarringWrapper::changeBarringPassword) |
828 .with(KCurrentPassword, KNewAndVerifiedPassword, KNewAndVerifiedPassword); |
828 .with(KCurrentPassword, KNewAndVerifiedPassword, KNewAndVerifiedPassword); |
829 emit simulateEditPasswordButtonClicked(false); |
829 emit simulateEditPasswordButtonClicked(false); |
830 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |
830 m_barringpluginGroup->changeBarringPasswordPhasesHandling( |