28 #include <HbAbstractViewItem> |
28 #include <HbAbstractViewItem> |
29 #include <HbDataFormModel> |
29 #include <HbDataFormModel> |
30 #include "cpitemdatahelper.h" |
30 #include "cpitemdatahelper.h" |
31 #include "cpdivertitemdata.h" |
31 #include "cpdivertitemdata.h" |
32 #include "psetwrappertypes.h" |
32 #include "psetwrappertypes.h" |
|
33 #include "cpdivertselectioncustomitem.h" |
33 |
34 |
34 #define private public |
35 #define private public |
35 #include "cpdivertplugin.h" |
36 #include "cpdivertplugin.h" |
36 #include "cpdivertplugingroup.h" |
37 #include "cpdivertplugingroup.h" |
37 |
38 |
78 m_divertplugin = (CpDivertPlugin*)qt_plugin_instance(); |
79 m_divertplugin = (CpDivertPlugin*)qt_plugin_instance(); |
79 |
80 |
80 QVERIFY(m_divertplugin); |
81 QVERIFY(m_divertplugin); |
81 |
82 |
82 m_helper = new CpItemDataHelper; |
83 m_helper = new CpItemDataHelper; |
83 m_divertpluginGroup = qobject_cast<CpDivertPluginGroup *>( |
84 QList<CpSettingFormItemData*> list; |
84 m_divertplugin->createSettingFormItemData(*m_helper)); |
85 list.append(m_divertplugin->createSettingFormItemData(*m_helper)); |
|
86 m_divertpluginGroup = qobject_cast<CpDivertPluginGroup *>(list.takeFirst()); |
85 QVERIFY(m_divertpluginGroup); |
87 QVERIFY(m_divertpluginGroup); |
86 |
88 |
87 QVERIFY(verify()); |
89 QVERIFY(verify()); |
88 } |
90 } |
89 |
91 |
122 PSetCallDivertingWrapper tmpDivWrapper(tmpContainer); |
124 PSetCallDivertingWrapper tmpDivWrapper(tmpContainer); |
123 |
125 |
124 expect("PSetWrapper::callDivertingWrapper").returns(&tmpDivWrapper); |
126 expect("PSetWrapper::callDivertingWrapper").returns(&tmpDivWrapper); |
125 |
127 |
126 CpDivertPlugin* p = (CpDivertPlugin*)qt_plugin_instance(); |
128 CpDivertPlugin* p = (CpDivertPlugin*)qt_plugin_instance(); |
127 CpSettingFormItemData *pSettingFormItemData = p->createSettingFormItemData(itemDataHelper); |
129 QList<CpSettingFormItemData*> list; |
128 |
130 list.append(p->createSettingFormItemData(itemDataHelper)); |
|
131 qDeleteAll(list); |
129 QVERIFY(verify()); |
132 QVERIFY(verify()); |
130 } |
133 } |
131 |
134 |
132 /*! |
135 /*! |
133 UT_CpDivertPlugin::t_changeDivertingStateRequested |
136 UT_CpDivertPlugin::t_changeDivertingStateRequested |
136 { |
139 { |
137 //except user cancels |
140 //except user cancels |
138 appendAction("All voice calls:", selectAction, "Cancel"); |
141 appendAction("All voice calls:", selectAction, "Cancel"); |
139 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
142 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
140 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData("number", ""); |
143 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData("number", ""); |
|
144 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData( |
|
145 "state", CpDivertSelectionCustomitem::Disabled); |
141 m_divertpluginGroup->m_DataItemAllVoiceCalls->thisItemClicked(); |
146 m_divertpluginGroup->m_DataItemAllVoiceCalls->thisItemClicked(); |
142 QVERIFY(verify()); |
147 QVERIFY(verify()); |
143 |
148 |
144 //except user selects vmb and inserts number |
149 //except user selects vmb and inserts number |
145 appendAction("All voice calls:", selectItem, "Voice mail box"); |
150 appendAction("All voice calls:", selectItem, "txt_phone_setlabel_voice_mbx"); |
146 appendAction("Voice mail box number:", insertText, "12345"); |
151 appendAction("Voice mail box number:", insertText, "12345"); |
147 appendAction("Voice mail box number:", selectAction, "OK"); |
152 appendAction("Voice mail box number:", selectAction, "OK"); |
148 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
153 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
149 expect("SsSettingsWrapper::get"); |
154 expect("SsSettingsWrapper::get"); |
150 expect("PSetCallDivertingWrapper::setCallDiverting"); |
155 expect("PSetCallDivertingWrapper::setCallDiverting"); |
151 expect("CpPhoneNotes::noteShowing").returns(false); |
156 expect("CpPhoneNotes::noteShowing").returns(false); |
152 expect("CpPhoneNotes::showGlobalProgressNote"); |
157 expect("CpPhoneNotes::showGlobalProgressNote"); |
153 m_divertpluginGroup->m_DataItemAllVoiceCalls->thisItemClicked(); |
158 m_divertpluginGroup->m_DataItemAllVoiceCalls->thisItemClicked(); |
161 m_divertpluginGroup->divertRequestProcessed(); |
166 m_divertpluginGroup->divertRequestProcessed(); |
162 QVERIFY(verify()); |
167 QVERIFY(verify()); |
163 |
168 |
164 //except user selects one of the default numbers |
169 //except user selects one of the default numbers |
165 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData("number",""); |
170 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData("number",""); |
|
171 m_divertpluginGroup->m_DataItemAllVoiceCalls->setContentWidgetData( |
|
172 "state", CpDivertSelectionCustomitem::Disabled); |
166 appendAction("All voice calls:", selectItem, "0401234567"); |
173 appendAction("All voice calls:", selectItem, "0401234567"); |
167 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
174 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
168 expect("SsSettingsWrapper::get"); |
175 expect("SsSettingsWrapper::get"); |
169 expect("PSetCallDivertingWrapper::setCallDiverting"); |
176 expect("PSetCallDivertingWrapper::setCallDiverting"); |
170 expect("CpPhoneNotes::noteShowing").returns(false); |
177 expect("CpPhoneNotes::noteShowing").returns(false); |
271 void UT_CpDivertPlugin::t_popUpTimerQuery() |
278 void UT_CpDivertPlugin::t_popUpTimerQuery() |
272 { |
279 { |
273 appendAction("If not answered:", selectItem, "0401234567"); |
280 appendAction("If not answered:", selectItem, "0401234567"); |
274 appendAction("Time out", selectAction, "Cancel"); |
281 appendAction("Time out", selectAction, "Cancel"); |
275 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
282 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
|
283 m_divertpluginGroup->m_DataItemIfNotAnswered->setContentWidgetData("number", ""); |
|
284 m_divertpluginGroup->m_DataItemIfNotAnswered->setContentWidgetData( |
|
285 "state", CpDivertSelectionCustomitem::Disabled); |
276 m_divertpluginGroup->m_DataItemIfNotAnswered->thisItemClicked(); |
286 m_divertpluginGroup->m_DataItemIfNotAnswered->thisItemClicked(); |
277 QVERIFY(verify()); |
287 QVERIFY(verify()); |
278 |
288 |
279 appendAction("If not answered:", selectItem, "Other number"); |
289 appendAction("If not answered:", selectItem, "Other number"); |
280 appendAction("Number:", insertText, "12345"); |
290 appendAction("Number:", insertText, "12345"); |