146 UT_CpDivertPlugin::t_changeDivertingStateRequested |
151 UT_CpDivertPlugin::t_changeDivertingStateRequested |
147 */ |
152 */ |
148 void UT_CpDivertPlugin::t_changeDivertingStateRequested() |
153 void UT_CpDivertPlugin::t_changeDivertingStateRequested() |
149 { |
154 { |
150 //except user cancels |
155 //except user cancels |
151 appendAction("All voice calls:", selectAction, "Cancel"); |
156 /* |
|
157 appendAction("txt_phone_setlabel_all_calls", selectAction, "Cancel"); |
152 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
158 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
153 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData("number", ""); |
159 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData("text", ""); |
154 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
160 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
155 "state", CpDivertSelectionCustomitem::Disabled); |
161 "checkState", Qt::Checked); |
156 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
162 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
|
163 waitForQueueEmpty(); |
157 QVERIFY(verify()); |
164 QVERIFY(verify()); |
158 |
165 |
159 //except user selects vmb |
166 //except user selects vmb |
160 appendAction("All voice calls:", selectItem, "txt_phone_setlabel_voice_mbx"); |
167 appendAction("txt_phone_setlabel_all_calls", selectItem, "txt_phone_setlabel_voice_mbx"); |
161 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
168 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
162 expect("PSetCallDivertingWrapper::getVoiceMailBoxNumber").willOnce(invoke(fillNumber)); |
169 expect("PSetCallDivertingWrapper::queryVoiceMailBoxNumber").willOnce(invoke(fillNumber)).returns(0); |
163 expect("SsSettingsWrapper::get"); |
170 expect("SsSettingsWrapper::get"); |
164 expect("PSetCallDivertingWrapper::setCallDiverting"); |
171 expect("PSetCallDivertingWrapper::setCallDiverting"); |
165 expect("CpPhoneNotes::noteShowing").returns(false); |
172 expect("CpPhoneNotes::noteShowing").returns(false); |
166 expect("CpPhoneNotes::showGlobalProgressNote"); |
173 expect("CpPhoneNotes::showGlobalProgressNote"); |
|
174 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
|
175 "checkState", Qt::Checked); |
167 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
176 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
|
177 waitForQueueEmpty(); |
168 QVERIFY(verify()); // Verify item click |
178 QVERIFY(verify()); // Verify item click |
169 PSCallDivertingCommand command; |
179 PSCallDivertingCommand command; |
170 command.iNumber = "12345"; |
180 command.iNumber = "12345"; |
171 command.iStatus = DivertingStatusActive; |
181 command.iStatus = DivertingStatusActive; |
172 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
182 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
173 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
183 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
174 command.iServiceGroup = ServiceGroupVoice; |
184 command.iServiceGroup = ServiceGroupVoice; |
175 expect("CpPhoneNotes::showGlobalNote"); |
185 expect("CpPhoneNotes::showNotificationDialog"); |
176 m_divertpluginGroup->handleDivertingChanged(command, false); |
186 m_divertpluginGroup->handleDivertingChanged(command, false); |
177 expect("CpPhoneNotes::cancelNote"); |
187 expect("CpPhoneNotes::cancelNote"); |
178 m_divertpluginGroup->divertRequestProcessed(); |
188 m_divertpluginGroup->divertRequestProcessed(); |
179 QVERIFY(verify()); // Verify result processing |
189 QVERIFY(verify()); // Verify result processing |
180 |
190 |
181 //except user selects one of the default numbers |
191 //except user selects one of the default numbers |
182 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData("number",""); |
192 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData("text", ""); |
183 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
193 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
184 "state", CpDivertSelectionCustomitem::Disabled); |
194 "checkState", Qt::Checked); |
185 appendAction("All voice calls:", selectItem, "0401234567"); |
195 appendAction("txt_phone_setlabel_all_calls", selectItem, "0401234567"); |
186 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
196 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
187 expect("SsSettingsWrapper::get"); |
197 expect("SsSettingsWrapper::get"); |
188 expect("PSetCallDivertingWrapper::setCallDiverting"); |
198 expect("PSetCallDivertingWrapper::setCallDiverting"); |
189 expect("CpPhoneNotes::noteShowing").returns(false); |
199 expect("CpPhoneNotes::noteShowing").returns(false); |
190 expect("CpPhoneNotes::showGlobalProgressNote"); |
200 expect("CpPhoneNotes::showGlobalProgressNote"); |
191 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
201 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
|
202 waitForQueueEmpty(); |
192 command.iNumber = "0401234567"; |
203 command.iNumber = "0401234567"; |
193 command.iStatus = DivertingStatusActive; |
204 command.iStatus = DivertingStatusActive; |
194 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
205 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
195 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
206 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
196 command.iServiceGroup = ServiceGroupVoice; |
207 command.iServiceGroup = ServiceGroupVoice; |
197 expect("CpPhoneNotes::cancelNote"); |
208 expect("CpPhoneNotes::cancelNote"); |
198 expect("CpPhoneNotes::showGlobalNote"); |
209 expect("CpPhoneNotes::showNotificationDialog"); |
199 expect("PSetCallDivertingWrapper::setNewDefaultNumber").with(QString("0401234567")); |
210 expect("PSetCallDivertingWrapper::setNewDefaultNumber").with(QString("0401234567")); |
200 expect("Tools::voipSupported").returns(false); |
|
201 m_divertpluginGroup->handleDivertingChanged(command, true); |
211 m_divertpluginGroup->handleDivertingChanged(command, true); |
202 expect("CpPhoneNotes::cancelNote"); |
212 expect("CpPhoneNotes::cancelNote"); |
203 m_divertpluginGroup->divertRequestProcessed(); |
213 m_divertpluginGroup->divertRequestProcessed(); |
204 QVERIFY(verify()); |
214 QVERIFY(verify()); |
205 |
215 |
206 // Divert is disabled |
216 // Divert is disabled |
207 expect("SsSettingsWrapper::get"); |
217 expect("SsSettingsWrapper::get"); |
208 expect("PSetCallDivertingWrapper::setCallDiverting"); // Disable divert |
218 expect("PSetCallDivertingWrapper::setCallDiverting"); // Disable divert |
209 expect("CpPhoneNotes::noteShowing").returns(false); |
219 expect("CpPhoneNotes::noteShowing").returns(false); |
210 expect("CpPhoneNotes::showGlobalProgressNote"); |
220 expect("CpPhoneNotes::showGlobalProgressNote"); |
|
221 m_divertpluginGroup->m_DataItemVoiceAllCalls->setContentWidgetData( |
|
222 "checkState", Qt::Unchecked); |
211 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
223 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
|
224 waitForQueueEmpty(); |
212 command.iNumber = ""; |
225 command.iNumber = ""; |
213 command.iStatus = DivertingStatusInactive; |
226 command.iStatus = DivertingStatusInactive; |
214 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
227 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
215 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
228 m_divertpluginGroup->m_DataItemVoiceAllCalls->property("condition")); |
216 command.iServiceGroup = ServiceGroupVoice; |
229 command.iServiceGroup = ServiceGroupVoice; |
217 expect("CpPhoneNotes::showGlobalNote"); |
230 expect("CpPhoneNotes::showNotificationDialog"); |
218 m_divertpluginGroup->handleDivertingChanged(command, false); |
231 m_divertpluginGroup->handleDivertingChanged(command, false); |
219 expect("CpPhoneNotes::cancelNote"); |
232 //expect("CpPhoneNotes::cancelNote"); |
220 m_divertpluginGroup->divertRequestProcessed(); |
233 m_divertpluginGroup->divertRequestProcessed(); |
221 QVERIFY(verify()); |
234 QVERIFY(verify()); |
222 |
235 */ |
223 //except user selects other number, inserts number and cancels |
236 //except user selects other number, inserts number and cancels |
|
237 /* BUG in framework (Crash in QGestureManager::getState due to QWeakPointer) */ |
|
238 /* |
224 appendAction("All voice calls:", selectItem, "Other number"); |
239 appendAction("All voice calls:", selectItem, "Other number"); |
225 appendAction("Number:", insertText, "12345"); |
240 appendAction("Number:", insertText, "12345"); |
226 appendAction("Number:", selectAction, "Cancel"); |
241 appendAction("Number:", selectAction, "Cancel"); |
227 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
242 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
228 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
243 m_divertpluginGroup->m_DataItemVoiceAllCalls->thisItemClicked(); |
229 QVERIFY(verify()); |
244 waitForQueueEmpty(); |
|
245 QVERIFY(verify()); |
|
246 */ |
230 } |
247 } |
231 |
248 |
232 /*! |
249 /*! |
233 UT_CpDivertPlugin::t_itemShown |
250 UT_CpDivertPlugin::t_itemShown |
234 */ |
251 */ |
235 void UT_CpDivertPlugin::t_itemShown() |
252 void UT_CpDivertPlugin::t_itemShown() |
236 { |
253 { |
237 HbDataFormModel* model = |
|
238 qobject_cast<HbDataFormModel*>(m_divertpluginGroup->model()); |
|
239 |
|
240 expect("PSetCallDivertingWrapper::getCallDivertingStatus"); |
254 expect("PSetCallDivertingWrapper::getCallDivertingStatus"); |
241 expect("CpPhoneNotes::noteShowing").returns(false); |
255 expect("CpPhoneNotes::noteShowing").returns(false); |
242 expect("CpPhoneNotes::showGlobalProgressNote"); |
256 expect("CpPhoneNotes::showGlobalProgressNote"); |
243 m_divertpluginGroup->itemShown( |
257 m_divertpluginGroup->itemShown( |
244 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceAllCalls)); |
258 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceAllCalls)); |
245 m_divertpluginGroup->itemShown( |
259 m_divertpluginGroup->itemShown( |
246 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfBusy)); |
260 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfBusy)); |
247 m_divertpluginGroup->itemShown( |
261 m_divertpluginGroup->itemShown( |
248 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAnswered)); |
262 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAnswered)); |
249 m_divertpluginGroup->itemShown( |
263 m_divertpluginGroup->itemShown( |
250 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfOutOfReach)); |
264 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfOutOfReach)); |
251 m_divertpluginGroup->itemShown( |
265 m_divertpluginGroup->itemShown( |
252 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAvailable)); |
266 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAvailable)); |
253 |
267 |
254 QList<PSCallDivertingStatus*> list; |
268 QList<PSCallDivertingStatus*> list; |
255 PSCallDivertingStatus divertStatus; |
269 PSCallDivertingStatus divertStatus; |
256 list.append(&divertStatus); |
270 list.append(&divertStatus); |
257 divertStatus.iCondition = qvariant_cast<PsCallDivertingCondition>( |
271 divertStatus.iCondition = qvariant_cast<PsCallDivertingCondition>( |
277 |
291 |
278 m_divertpluginGroup->divertRequestProcessed(); // Test overflow |
292 m_divertpluginGroup->divertRequestProcessed(); // Test overflow |
279 |
293 |
280 // Test, Do not check status again |
294 // Test, Do not check status again |
281 m_divertpluginGroup->itemShown( |
295 m_divertpluginGroup->itemShown( |
282 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceAllCalls)); |
296 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceAllCalls)); |
283 m_divertpluginGroup->itemShown( |
297 m_divertpluginGroup->itemShown( |
284 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfBusy)); |
298 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfBusy)); |
285 m_divertpluginGroup->itemShown( |
299 m_divertpluginGroup->itemShown( |
286 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAnswered)); |
300 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAnswered)); |
287 m_divertpluginGroup->itemShown( |
301 m_divertpluginGroup->itemShown( |
288 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfOutOfReach)); |
302 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfOutOfReach)); |
289 m_divertpluginGroup->itemShown( |
303 m_divertpluginGroup->itemShown( |
290 model->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAvailable)); |
304 m_dataForm->indexFromItem(m_divertpluginGroup->m_DataItemVoiceIfNotAvailable)); |
291 |
305 |
292 |
306 |
293 QVERIFY(verify()); |
307 QVERIFY(verify()); |
294 } |
308 } |
295 |
309 |
296 /*! |
310 /*! |
297 UT_CpDivertPlugin::t_popUpTimerQuery |
311 UT_CpDivertPlugin::t_popUpTimerQuery |
298 */ |
312 */ |
299 void UT_CpDivertPlugin::t_popUpTimerQuery() |
313 void UT_CpDivertPlugin::t_popUpTimerQuery() |
300 { |
314 { |
301 appendAction("If not answered:", selectItem, "0401234567"); |
315 const QString delayLnString("txt_phone_list_ln_seconds"); |
302 appendAction("Time out", selectAction, "Cancel"); |
316 |
303 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
317 appendAction("txt_phone_setlabel_if_not_answered", selectItem, "txt_phone_list_enter_number_manually"); |
304 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->setContentWidgetData("number", ""); |
318 appendAction("txt_phone_info_number", insertText, "12345"); |
305 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->setContentWidgetData( |
319 appendAction("txt_phone_info_number", selectAction, "OK"); |
306 "state", CpDivertSelectionCustomitem::Disabled); |
320 appendAction("txt_phone_title_delay", selectItem, delayLnString); |
307 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->thisItemClicked(); |
321 // expect user chooses other number and inserts number and timeout |
308 QVERIFY(verify()); |
|
309 |
|
310 appendAction("If not answered:", selectItem, "Other number"); |
|
311 appendAction("Number:", insertText, "12345"); |
|
312 appendAction("Number:", selectAction, "OK"); |
|
313 appendAction("Time out", selectItem, "15 second"); |
|
314 //except user chooses other number and inserts number and timeout |
|
315 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
322 expect("PSetCallDivertingWrapper::getDefaultNumbers"); |
316 expect("SsSettingsWrapper::get"); |
323 expect("SsSettingsWrapper::get"); |
317 expect("PSetCallDivertingWrapper::setCallDiverting"); |
324 expect("PSetCallDivertingWrapper::setCallDiverting"); |
|
325 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->setContentWidgetData( |
|
326 "checkState", Qt::Checked); |
318 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->thisItemClicked(); |
327 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->thisItemClicked(); |
|
328 waitForQueueEmpty(); |
319 PSCallDivertingCommand command; |
329 PSCallDivertingCommand command; |
320 command.iNumber = "12345"; |
330 command.iNumber = "12345"; |
321 command.iNoReplyTimer = 15; |
331 command.iNoReplyTimer = 15; |
322 command.iStatus = DivertingStatusActive; |
332 command.iStatus = DivertingStatusActive; |
323 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
333 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
324 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->property("condition")); |
334 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->property("condition")); |
325 command.iServiceGroup = ServiceGroupVoice; |
335 command.iServiceGroup = ServiceGroupVoice; |
326 expect("CpPhoneNotes::showGlobalNote"); |
336 expect("CpPhoneNotes::showNotificationDialog"); |
327 m_divertpluginGroup->handleDivertingChanged(command, false); |
337 m_divertpluginGroup->handleDivertingChanged(command, false); |
328 expect("CpPhoneNotes::cancelNote"); |
338 expect("CpPhoneNotes::cancelNote"); |
329 m_divertpluginGroup->divertRequestProcessed(); |
339 m_divertpluginGroup->divertRequestProcessed(); |
330 QVERIFY(verify()); |
340 QVERIFY(verify()); |
331 |
341 |
332 expect("SsSettingsWrapper::get"); |
342 expect("SsSettingsWrapper::get"); |
333 expect("PSetCallDivertingWrapper::setCallDiverting"); |
343 expect("PSetCallDivertingWrapper::setCallDiverting"); |
|
344 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->setContentWidgetData( |
|
345 "checkState", Qt::Unchecked); |
334 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->thisItemClicked(); |
346 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->thisItemClicked(); |
|
347 waitForQueueEmpty(); |
335 command.iNumber = ""; |
348 command.iNumber = ""; |
336 command.iNoReplyTimer = 0; |
349 command.iNoReplyTimer = 0; |
337 command.iStatus = DivertingStatusInactive; |
350 command.iStatus = DivertingStatusInactive; |
338 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
351 command.iCondition = qvariant_cast<PsCallDivertingCondition>( |
339 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->property("condition")); |
352 m_divertpluginGroup->m_DataItemVoiceIfNotAnswered->property("condition")); |
340 command.iServiceGroup = ServiceGroupVoice; |
353 command.iServiceGroup = ServiceGroupVoice; |
341 expect("CpPhoneNotes::showGlobalNote"); |
354 expect("CpPhoneNotes::showNotificationDialog"); |
342 m_divertpluginGroup->handleDivertingChanged(command, false); |
355 m_divertpluginGroup->handleDivertingChanged(command, false); |
343 expect("CpPhoneNotes::cancelNote"); |
356 expect("CpPhoneNotes::cancelNote"); |
344 m_divertpluginGroup->divertRequestProcessed(); |
357 m_divertpluginGroup->divertRequestProcessed(); |
345 QVERIFY(verify()); |
358 QVERIFY(verify()); |
346 |
359 |