107 int createCallHeader(); |
99 int createCallHeader(); |
108 |
100 |
109 private: |
101 private: |
110 PhoneUIQtView *m_view; // class under test |
102 PhoneUIQtView *m_view; // class under test |
111 HbMainWindow *m_main_window; |
103 HbMainWindow *m_main_window; |
112 |
104 HbLineEdit *m_lineEdit; |
|
105 HbToolBar *m_toolBar; |
113 }; |
106 }; |
114 |
107 |
115 void QTimer::stop() |
|
116 { |
|
117 m_qtimer_stop_called = true; |
|
118 } |
|
119 |
|
120 TestPhoneUIQtView::TestPhoneUIQtView () |
108 TestPhoneUIQtView::TestPhoneUIQtView () |
121 { |
109 { |
|
110 |
122 } |
111 } |
123 |
112 |
124 TestPhoneUIQtView::~TestPhoneUIQtView () |
113 TestPhoneUIQtView::~TestPhoneUIQtView () |
125 { |
114 { |
126 } |
115 } |
127 |
116 |
128 void TestPhoneUIQtView::initTestCase () |
117 void TestPhoneUIQtView::initTestCase () |
129 { |
118 { |
130 m_main_window = new HbMainWindow(); |
119 m_main_window = new HbMainWindow(); |
|
120 m_lineEdit = new HbLineEdit(); |
|
121 m_toolBar = new HbToolBar(); |
|
122 SmcDefaultValue<QPointF>::SetL(QPointF(0, 0)); |
|
123 SmcDefaultValue<QRectF>::SetL(QRectF(0, 0, 0, 0)); |
|
124 SmcDefaultValue<QVariant>::SetL(QVariant(0)); |
|
125 SmcDefaultValue<Qt::Orientation>::SetL(Qt::Horizontal); |
|
126 SmcDefaultValue<HbLineEdit *>::SetL(m_lineEdit); |
|
127 SmcDefaultValue<HbLineEdit &>::SetL(*m_lineEdit); |
|
128 |
|
129 EXPECT(HbView, setTitle).with(QString("Unit test network")); |
|
130 EXPECT(QtMobility::QSystemNetworkInfo, networkName).returns(QString("Unit test network")); |
131 m_view = new PhoneUIQtView(*m_main_window); |
131 m_view = new PhoneUIQtView(*m_main_window); |
132 QCOMPARE(m_networkName, QString("Unit test network")); |
132 QVERIFY(verify()); |
133 } |
133 } |
134 |
134 |
135 void TestPhoneUIQtView::cleanupTestCase () |
135 void TestPhoneUIQtView::cleanupTestCase () |
136 { |
136 { |
|
137 SmcDefaultValue<QPointF>::Reset(); |
|
138 SmcDefaultValue<QRectF>::Reset(); |
|
139 SmcDefaultValue<QVariant>::Reset(); |
|
140 SmcDefaultValue<Qt::Orientation>::Reset(); |
|
141 SmcDefaultValue<HbLineEdit *>::Reset(); |
|
142 SmcDefaultValue<HbLineEdit &>::Reset(); |
137 delete m_view; |
143 delete m_view; |
138 } |
144 delete m_lineEdit; |
139 |
145 delete m_toolBar; |
140 void TestPhoneUIQtView::init () |
146 delete m_main_window; |
141 { |
147 } |
142 m_qtimer_stop_called = false; |
148 |
143 m_take_menu_called = false; |
149 void TestPhoneUIQtView::init() |
144 m_set_menu_called = false; |
150 { |
|
151 initialize(); |
145 } |
152 } |
146 |
153 |
147 void TestPhoneUIQtView::cleanup () |
154 void TestPhoneUIQtView::cleanup () |
148 { |
155 { |
|
156 reset(); |
149 } |
157 } |
150 |
158 |
151 void TestPhoneUIQtView::testAddBubbleCommand () |
159 void TestPhoneUIQtView::testAddBubbleCommand () |
152 { |
160 { |
153 m_view->bubbleManager ().startChanges (); |
161 m_view->bubbleManager().startChanges(); |
154 int bubbleId = createCallHeader(); |
162 int bubbleId = createCallHeader(); |
155 int bubbleId2 = createCallHeader(); |
163 int bubbleId2 = createCallHeader(); |
156 |
164 |
157 PhoneAction action1; |
165 HbAction *action1 = new HbAction; |
158 action1.setText("Command 1"); |
166 action1->setText("Command 1"); |
159 action1.setCommand(1); |
167 action1->setProperty("command", 1); |
160 action1.setActionRole(PhoneAction::None); |
168 action1->setSoftKeyRole(QAction::NoSoftKey); |
161 |
169 |
162 PhoneAction action2; |
170 HbAction *action2 = new HbAction; |
163 action2.setText("Command 2"); |
171 action2->setText("Command 2"); |
164 action2.setCommand(2); |
172 action2->setProperty("command", 2); |
165 action2.setActionRole(PhoneAction::Accept); |
173 action2->setSoftKeyRole(QAction::PositiveSoftKey); |
166 |
174 |
167 PhoneAction action3; |
175 HbAction *action3 = new HbAction; |
168 action3.setText("Command 3"); |
176 action3->setText("Command 3"); |
169 action3.setCommand(3); |
177 action3->setProperty("command", 3); |
170 action3.setActionRole(PhoneAction::Decline); |
178 action3->setSoftKeyRole(QAction::NegativeSoftKey); |
171 |
179 |
172 m_view->addBubbleCommand (bubbleId, action1); |
180 m_view->addBubbleCommand(bubbleId, action1); |
173 m_view->addBubbleCommand (bubbleId, action2); |
181 m_view->addBubbleCommand(bubbleId, action2); |
174 m_view->addBubbleCommand (bubbleId2, action3); |
182 m_view->addBubbleCommand(bubbleId2, action3); |
175 m_view->bubbleManager ().endChanges (); |
183 m_view->bubbleManager().endChanges(); |
176 |
184 |
177 m_view->bubbleManager ().startChanges (); |
185 m_view->bubbleManager().startChanges(); |
178 m_view->clearBubbleCommands (bubbleId); |
186 m_view->clearBubbleCommands(bubbleId); |
179 m_view->clearBubbleCommands (bubbleId2); |
187 m_view->clearBubbleCommands(bubbleId2); |
180 m_view->clearBubbleCommands (bubbleId2); |
188 m_view->clearBubbleCommands(bubbleId2); |
181 m_view->bubbleManager ().endChanges (); |
189 m_view->bubbleManager().endChanges(); |
182 } |
190 } |
183 |
191 |
184 void TestPhoneUIQtView::testHideToolbar () |
192 void TestPhoneUIQtView::testHideToolbar () |
185 { |
193 { |
186 m_view->hideToolbar (); |
194 EXPECT(HbView, toolBar).returns(m_toolBar); |
187 QCOMPARE (m_hideCalled, true); |
195 m_view->hideToolbar(); |
|
196 QVERIFY(verify()); |
188 } |
197 } |
189 |
198 |
190 void TestPhoneUIQtView::testShowToolbar () |
199 void TestPhoneUIQtView::testShowToolbar () |
191 { |
200 { |
192 m_view->showToolbar (); |
201 EXPECT(HbView, toolBar).returns(m_toolBar); |
193 QCOMPARE (m_showCalled, true); |
202 m_view->showToolbar(); |
|
203 QVERIFY(verify()); |
194 } |
204 } |
195 |
205 |
196 void TestPhoneUIQtView::testAddToolbarActions () |
206 void TestPhoneUIQtView::testAddToolbarActions () |
197 { |
207 { |
198 m_actions.clear(); |
|
199 HbIcon icon ("foo.jpg"); |
208 HbIcon icon ("foo.jpg"); |
200 PhoneAction *testAction = new PhoneAction (); |
209 HbAction *testAction = new HbAction (); |
201 testAction->setIcon(icon); |
210 testAction->setIcon(icon); |
202 testAction->setText("foo"); |
211 testAction->setText("foo"); |
203 testAction->setCommand(20); |
212 testAction->setProperty("command", 20); |
204 QList<PhoneAction*> actions; |
213 QList<HbAction*> actions; |
|
214 QList<QAction *> retActions; |
|
215 EXPECT(QGraphicsWidget, actions).returns(retActions); |
205 actions.append(testAction); |
216 actions.append(testAction); |
206 |
217 |
207 m_view->setToolbarActions(actions); |
218 m_view->setToolbarActions(actions); |
208 QCOMPARE (m_action->icon(), icon); |
219 //QCOMPARE (m_action->icon(), icon); |
209 QCOMPARE(true, m_toolBarUpdateCalled); |
220 //QCOMPARE(true, m_toolBarUpdateCalled); |
210 |
221 |
|
222 actions[0] = new HbAction(); |
|
223 EXPECT(QGraphicsWidget, actions).returns(retActions); |
211 m_view->setToolbarActions(actions); |
224 m_view->setToolbarActions(actions); |
212 |
225 |
213 m_toolBarUpdateCalled = false; |
226 EXPECT(QGraphicsItem, update); |
214 PhoneAction *testAction2 = new PhoneAction (); |
227 HbAction *testAction2 = new HbAction (); |
215 testAction2->setIcon(icon); |
228 testAction2->setIcon(icon); |
216 testAction2->setText("foo2"); |
229 testAction2->setText("foo2"); |
217 testAction2->setCommand(21); |
230 testAction2->setProperty("command", 21); |
|
231 actions[0] = new HbAction(); |
218 actions.append(testAction2); |
232 actions.append(testAction2); |
219 |
233 |
|
234 EXPECT(QGraphicsWidget, actions).returns(retActions); |
220 m_view->setToolbarActions(actions); |
235 m_view->setToolbarActions(actions); |
221 QCOMPARE(true, m_toolBarUpdateCalled); |
236 QVERIFY(verify()); |
222 actions.removeOne(testAction2); |
237 actions.removeOne(testAction2); |
223 |
238 |
224 m_toolBarUpdateCalled = false; |
239 EXPECT(QGraphicsItem, update); |
|
240 actions[0] = new HbAction(); |
|
241 EXPECT(QGraphicsWidget, actions).returns(retActions); |
225 m_view->setToolbarActions(actions); |
242 m_view->setToolbarActions(actions); |
226 QCOMPARE(true, m_toolBarUpdateCalled); |
243 QVERIFY(verify()); |
227 |
244 |
228 actions.clear(); |
245 actions.clear(); |
229 delete testAction; |
|
230 delete testAction2; |
|
231 } |
246 } |
232 |
247 |
233 void TestPhoneUIQtView::testSetVolumeSliderValue () |
248 void TestPhoneUIQtView::testSetVolumeSliderValue () |
234 { |
249 { |
235 m_view->setVolumeSliderValue (1, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
250 EXPECT(HbPopup, setDismissPolicy).with(HbDialog::TapOutside); |
236 QCOMPARE (m_volumeSliderContructorCalled, true); |
251 EXPECT(HbPopup, setTimeout).with(10000); |
237 QCOMPARE (m_sliderRangeMin, KMINVOLUME); |
252 EXPECT(HbSliderPopup, minimum).returns(0); |
238 QCOMPARE (m_sliderRangeMax, KMAXVOLUME); |
253 EXPECT(HbSliderPopup, maximum).returns(100); |
239 QCOMPARE (m_volumeSliderSetTimeoutCalled, true); |
254 EXPECT(HbSliderPopup, setRange).with(KMINVOLUME, KMAXVOLUME); |
240 QCOMPARE (m_sliderTimeout, 10000); |
255 EXPECT(HbSliderPopup, setValue).with(1); |
241 QCOMPARE (m_volumeSliderSetValueCalled, true); |
256 EXPECT(QGraphicsItem, isVisible).returns(false); |
242 QCOMPARE (m_sliderValue, 1); |
257 //EXPECT(QGraphicsItem, show); |
243 QCOMPARE (m_volumeSliderShowCalled, true); |
258 m_view->setVolumeSliderValue(1, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
244 |
259 |
245 // reset values |
260 QVERIFY(verify()); |
246 m_volumeSliderContructorCalled = false; |
261 reset(); |
247 m_volumeSliderSetValueCalled = false; |
262 |
248 m_sliderRangeMin = -1; |
|
249 m_sliderRangeMax = -1; |
|
250 m_volumeSliderSetTimeoutCalled = false; |
|
251 m_sliderTimeout = -1; |
|
252 m_volumeSliderSetValueCalled = false; |
|
253 m_sliderValue = -1; |
|
254 m_volumeSliderShowCalled = false; |
|
255 |
|
256 // The second call shouldn't create a new instance |
263 // The second call shouldn't create a new instance |
|
264 EXPECT(HbPopup, setDismissPolicy).with(HbDialog::TapOutside).times(0); |
|
265 EXPECT(HbPopup, setTimeout).with(10000).times(0); |
|
266 EXPECT(HbSliderPopup, minimum).returns(0); |
|
267 EXPECT(HbSliderPopup, maximum).returns(100); |
|
268 EXPECT(HbSliderPopup, setRange).with(KMINVOLUME, KMAXVOLUME); |
|
269 EXPECT(HbSliderPopup, setValue).with(2); |
|
270 EXPECT(QGraphicsItem, isVisible).returns(true); |
|
271 //EXPECT(QGraphicsItem, show).times(0); |
257 m_view->setVolumeSliderValue (2, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
272 m_view->setVolumeSliderValue (2, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
258 QCOMPARE (m_volumeSliderContructorCalled, false); |
273 |
259 QCOMPARE (m_sliderRangeMin, KMINVOLUME); |
274 QVERIFY(verify()); |
260 QCOMPARE (m_sliderRangeMax, KMAXVOLUME); |
|
261 QCOMPARE (m_volumeSliderSetTimeoutCalled, false); |
|
262 QCOMPARE (m_sliderTimeout, -1); |
|
263 QCOMPARE (m_volumeSliderSetValueCalled, true); |
|
264 QCOMPARE (m_sliderValue, 2); |
|
265 QCOMPARE (m_volumeSliderShowCalled, false); |
|
266 } |
275 } |
267 |
276 |
268 void TestPhoneUIQtView::testRemoveVolumeSlider () |
277 void TestPhoneUIQtView::testRemoveVolumeSlider () |
269 { |
278 { |
|
279 //EXPECT(QGraphicsItem, hide); |
270 m_view->setVolumeSliderValue (1, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
280 m_view->setVolumeSliderValue (1, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
271 m_view->removeVolumeSlider (); |
281 m_view->removeVolumeSlider (); |
272 QCOMPARE (m_volumeSliderHideCalled, true); |
282 QVERIFY(verify()); |
273 } |
283 } |
274 |
284 |
275 void TestPhoneUIQtView::testVolumeSliderValue () |
285 void TestPhoneUIQtView::testVolumeSliderValue () |
276 { |
286 { |
277 m_sliderValue = -1; |
287 EXPECT(HbSliderPopup, value).returns(4); |
278 int value = m_view->volumeSliderValue (); |
288 int value = m_view->volumeSliderValue(); |
279 QCOMPARE (m_sliderValue, -1); |
289 QCOMPARE (value, -1); |
280 m_view->setVolumeSliderValue (3, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
290 |
281 value = m_view->volumeSliderValue (); |
291 // Create slider |
282 QCOMPARE (m_volumeSliderValueCalled, true); |
292 m_view->setVolumeSliderValue (1, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
|
293 |
|
294 EXPECT(HbSliderPopup, value).returns(7); |
|
295 value = m_view->volumeSliderValue(); |
|
296 QCOMPARE (value, 7); |
|
297 |
|
298 EXPECT(HbSliderPopup, value).returns(3); |
|
299 value = m_view->volumeSliderValue(); |
283 QCOMPARE (value, 3); |
300 QCOMPARE (value, 3); |
284 } |
301 } |
285 |
302 |
286 void TestPhoneUIQtView::testVolumeSliderChanged () |
303 void TestPhoneUIQtView::testVolumeSliderChanged () |
287 { |
304 { |
288 m_view->setVolumeSliderValue (3, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
305 m_view->setVolumeSliderValue(3, KVOLUMECOMMAND, KMAXVOLUME, KMINVOLUME); |
289 QSignalSpy spy (m_view, SIGNAL(command(int))); |
306 QSignalSpy spy(m_view, SIGNAL(command(int))); |
290 m_view->volumeSliderChanged (1); |
307 m_view->m_priv->volumeSliderChanged(1); |
291 QCOMPARE (spy.count(), 1); |
308 QCOMPARE(spy.count(), 1); |
292 int command = qvariant_cast<int>(spy.at (0).at (0)); |
309 int command = qvariant_cast<int>(spy.at(0).at(0)); |
293 QCOMPARE (command, (int)KVOLUMECOMMAND); |
310 QCOMPARE(command, (int)KVOLUMECOMMAND); |
294 } |
311 } |
295 |
312 |
296 void TestPhoneUIQtView::testParticipantListAction () |
313 void TestPhoneUIQtView::testParticipantListAction () |
297 { |
314 { |
298 m_view->bubbleManager ().startChanges (); |
315 m_view->bubbleManager ().startChanges (); |
361 // m_view->backButtonClicked(); |
360 // m_view->backButtonClicked(); |
362 } |
361 } |
363 |
362 |
364 void TestPhoneUIQtView::testShowDialpad() |
363 void TestPhoneUIQtView::testShowDialpad() |
365 { |
364 { |
|
365 EXPECT(QGraphicsItem, isVisible).returns(true); |
|
366 EXPECT(Dialpad, closeDialpad); |
366 m_view->hideDialpad(); |
367 m_view->hideDialpad(); |
|
368 QVERIFY(verify()); |
|
369 |
|
370 EXPECT(QGraphicsItem, isVisible).returns(false); |
|
371 EXPECT(Dialpad, openDialpad); |
367 m_view->showDialpad(); |
372 m_view->showDialpad(); |
|
373 QVERIFY(verify()); |
|
374 |
|
375 reset(); |
|
376 EXPECT(QGraphicsItem, isVisible).returns(true); |
|
377 EXPECT(Dialpad, openDialpad).times(0); |
368 m_view->showDialpad(); |
378 m_view->showDialpad(); |
369 QVERIFY(true == m_view->isDialpadVisible()); |
379 QVERIFY(verify()); |
|
380 |
|
381 EXPECT(Dialpad, closeDialpad); |
|
382 EXPECT(QGraphicsItem, isVisible).returns(true); |
370 m_view->hideDialpad(); |
383 m_view->hideDialpad(); |
|
384 QVERIFY(verify()); |
371 } |
385 } |
372 |
386 |
373 void TestPhoneUIQtView::testDialpadText() |
387 void TestPhoneUIQtView::testDialpadText() |
374 { |
388 { |
375 m_view->showDialpad(); |
389 m_view->showDialpad(); |
376 m_view->clearDialpad(); |
390 m_view->clearDialpad(); |
377 QVERIFY(QString("") == m_view->dialpadText()); |
391 EXPECT(HbLineEdit, text).returns(QString("12345")); |
|
392 QCOMPARE(m_view->dialpadText(), QString("12345")); |
378 m_view->clearAndHideDialpad(); |
393 m_view->clearAndHideDialpad(); |
|
394 QVERIFY(verify()); |
379 } |
395 } |
380 |
396 |
381 void TestPhoneUIQtView::testSetMenuActions() |
397 void TestPhoneUIQtView::testSetMenuActions() |
382 { |
398 { |
383 QList<PhoneAction*> actions; |
399 EXPECT(HbView, takeMenu); |
|
400 QList<HbAction *> actions; |
|
401 QList<QAction *> retActions; |
|
402 EXPECT(QGraphicsWidget, actions).returns(retActions).times(1); |
384 m_view->setMenuActions(actions); |
403 m_view->setMenuActions(actions); |
385 |
404 QVERIFY(verify()); |
386 QVERIFY(m_take_menu_called); |
405 reset(); |
387 |
406 |
388 PhoneAction* phoneAction = new PhoneAction; |
407 HbAction* action = new HbAction; |
389 phoneAction->setText(QString("test")); |
408 action->setText(QString("test")); |
390 phoneAction->setCommand(1); |
409 action->setProperty("command", 1); |
391 actions.append(phoneAction); |
410 actions.append(action); |
392 |
411 |
|
412 retActions.append(new HbAction); |
|
413 EXPECT(HbView, takeMenu).times(0); |
|
414 EXPECT(QGraphicsWidget, actions).returns(retActions).times(1); |
393 m_view->setMenuActions(actions); |
415 m_view->setMenuActions(actions); |
394 qDeleteAll(actions); |
|
395 actions.clear(); |
416 actions.clear(); |
396 |
417 retActions.clear(); |
397 m_take_menu_called = false; |
418 QVERIFY(verify()); |
|
419 reset(); |
|
420 |
|
421 EXPECT(HbView, takeMenu); |
|
422 EXPECT(QGraphicsWidget, actions).returns(retActions).times(1); |
398 m_view->setMenuActions(actions); |
423 m_view->setMenuActions(actions); |
399 QVERIFY(m_take_menu_called); |
424 |
|
425 QVERIFY(verify()); |
|
426 reset(); |
400 } |
427 } |
401 |
428 |
402 //Private methods |
429 //Private methods |
403 int TestPhoneUIQtView::createCallHeader () |
430 int TestPhoneUIQtView::createCallHeader () |
404 { |
431 { |
405 int bubble = m_view->bubbleManager().createCallHeader (); |
432 int bubble = m_view->bubbleManager().createCallHeader(); |
406 |
433 |
407 return bubble; |
434 return bubble; |
408 } |
435 } |
409 |
436 |
410 void TestPhoneUIQtView::testLongEndKeyPressEventOutsideTelephony() |
437 void TestPhoneUIQtView::testLongEndKeyPressEventOutsideTelephony() |
451 QKeyEvent oneUp(QEvent::KeyRelease, Qt::Key_1, Qt::NoModifier); |
479 QKeyEvent oneUp(QEvent::KeyRelease, Qt::Key_1, Qt::NoModifier); |
452 QSignalSpy downSpy(m_view, SIGNAL(keyPressed(QKeyEvent*))); |
480 QSignalSpy downSpy(m_view, SIGNAL(keyPressed(QKeyEvent*))); |
453 QSignalSpy upSpy(m_view, SIGNAL(keyReleased(QKeyEvent*))); |
481 QSignalSpy upSpy(m_view, SIGNAL(keyReleased(QKeyEvent*))); |
454 |
482 |
455 m_view->setRestrictedMode(true); |
483 m_view->setRestrictedMode(true); |
456 m_view->m_dialpad->editor().setText("1"); // emits signal |
484 |
457 QCOMPARE(m_view->m_dialpad->isCallButtonEnabled(), false); |
485 EXPECT(HbLineEdit, text).returns(QString("1")).times(4); |
458 m_view->eventFilter(0, &oneDown); |
486 EXPECT(Dialpad, setCallButtonEnabled).times(0); |
459 m_view->eventFilter(0, &oneUp); |
487 EXPECT(Dialpad, isCallButtonEnabled).returns(false); |
460 m_view->eventFilter(0, &yesDown); |
488 /*m_view->m_priv->onEditorContentChanged(); // Simulate signal |
461 m_view->eventFilter(0, &yesUp); |
489 */ |
|
490 m_view->m_priv->eventFilter(0, &oneDown); |
|
491 m_view->m_priv->eventFilter(0, &oneUp); |
|
492 m_view->m_priv->eventFilter(0, &yesDown); |
|
493 m_view->m_priv->eventFilter(0, &yesUp); |
462 QCOMPARE(downSpy.count(), 1); // Only Key_1 is passed |
494 QCOMPARE(downSpy.count(), 1); // Only Key_1 is passed |
463 QCOMPARE(upSpy.count(), 1); // Only Key_1 is passed |
495 QCOMPARE(upSpy.count(), 1); // Only Key_1 is passed |
464 QCOMPARE(m_view->m_dialpad->isCallButtonEnabled(), false); |
496 QCOMPARE(m_view->m_priv->m_backAction->isEnabled(), false); |
465 QCOMPARE(m_view->m_backAction->isEnabled(), false); |
|
466 |
497 |
467 // Test backbutton |
498 // Test backbutton |
468 m_view->setBackButtonVisible(true); |
499 m_view->setBackButtonVisible(true); |
469 QCOMPARE(m_view->m_backAction->isEnabled(), false); |
500 QCOMPARE(m_view->m_priv->m_backAction->isEnabled(), false); |
470 |
501 |
471 // Test return to normal mode |
502 // Test return to normal mode |
472 downSpy.clear(); |
503 downSpy.clear(); |
473 upSpy.clear(); |
504 upSpy.clear(); |
474 m_view->setRestrictedMode(false); |
505 m_view->setRestrictedMode(false); |
475 m_view->m_dialpad->editor().setText("1"); // emits signal |
506 EXPECT(HbLineEdit, text).returns(QString("1")).times(5); |
476 QCOMPARE(m_view->m_dialpad->isCallButtonEnabled(), true); |
507 EXPECT(Dialpad, setCallButtonEnabled).with(true); |
477 m_view->eventFilter(0, &oneDown); |
508 EXPECT(Dialpad, isCallButtonEnabled).returns(true).times(4); |
478 m_view->eventFilter(0, &oneUp); |
509 m_view->m_priv->onEditorContentChanged(); // Simulate signal |
479 m_view->eventFilter(0, &yesDown); |
510 m_view->m_priv->eventFilter(0, &oneDown); |
480 m_view->eventFilter(0, &yesUp); |
511 m_view->m_priv->eventFilter(0, &oneUp); |
|
512 m_view->m_priv->eventFilter(0, &yesDown); |
|
513 m_view->m_priv->eventFilter(0, &yesUp); |
481 QCOMPARE(downSpy.count(), 2); |
514 QCOMPARE(downSpy.count(), 2); |
482 QCOMPARE(upSpy.count(), 2); |
515 QCOMPARE(upSpy.count(), 2); |
483 QCOMPARE(m_view->m_dialpad->isCallButtonEnabled(), true); |
516 QCOMPARE(m_view->m_priv->m_backAction->isEnabled(), true); |
484 QCOMPARE(m_view->m_backAction->isEnabled(), true); |
517 } |
485 } |
|
486 |
|
487 HbMenu * HbView::takeMenu() |
|
488 { |
|
489 m_take_menu_called = true; |
|
490 return 0; |
|
491 } |
|
492 |
|
493 void HbView::setMenu(HbMenu* menu) |
|
494 { |
|
495 m_set_menu_called = true; |
|
496 } |
|
497 |
|
498 void HbView::setTitle (const QString &title) |
|
499 { |
|
500 m_networkName = title; |
|
501 } |
|
502 |
|
503 |
518 |
504 PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView) |
519 PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView) |
505 Q_DECLARE_METATYPE(QKeyEvent *) |
520 Q_DECLARE_METATYPE(QKeyEvent *) |
506 #include "unit_tests.moc" |
521 #include "unit_tests.moc" |