75 |
75 |
76 void UT_LogsMatchesView::testActivated() |
76 void UT_LogsMatchesView::testActivated() |
77 { |
77 { |
78 //activate for the first time |
78 //activate for the first time |
79 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
79 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
80 mRepository->matchesView(); |
80 LogsMatchesView* view = mRepository->matchesView(); |
81 QVERIFY( !mMatchesView->mInitialized ); |
81 QVERIFY( !mMatchesView->mInitialized ); |
82 QVERIFY( !mMatchesView->mListView ); |
82 QVERIFY( !mMatchesView->mListView ); |
83 QVERIFY( !mMatchesView->mModel ); |
83 QVERIFY( !mMatchesView->mModel ); |
84 QVERIFY( mMatchesView->mActionMap.count() == 0 ); |
84 QVERIFY( mMatchesView->mActionMap.count() == 0 ); |
85 mMatchesView->activated( false,QVariant() ); |
85 mMatchesView->activated( false,QVariant() ); |
238 QVERIFY( mMatchesView->mModel->lastCall() == QString("logsMatches") ); |
239 QVERIFY( mMatchesView->mModel->lastCall() == QString("logsMatches") ); |
239 QVERIFY( mMatchesView->mDialpad->mIsCallButtonEnabled ); |
240 QVERIFY( mMatchesView->mDialpad->mIsCallButtonEnabled ); |
240 |
241 |
241 //text erased from input, view changed to recent calls |
242 //text erased from input, view changed to recent calls |
242 mMatchesView->mDialpad->editor().setText( QString("") ); |
243 mMatchesView->mDialpad->editor().setText( QString("") ); |
|
244 mMatchesView->dialpadEditorTextChanged(); |
243 QVERIFY( mViewManager->mViewId == LogsRecentViewId ); |
245 QVERIFY( mViewManager->mViewId == LogsRecentViewId ); |
244 } |
246 } |
245 |
247 |
246 void UT_LogsMatchesView::testDialpadClosed() |
248 void UT_LogsMatchesView::testDialpadClosed() |
247 { |
249 { |
|
250 LogsMatchesView* view = mRepository->matchesView(); |
248 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
251 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
249 mMatchesView->mListView = new HbListView(); |
252 mMatchesView->initView(); |
250 mMatchesView->mLayoutSectionName = QString("landscape_dialpad"); |
253 mMatchesView->mLayoutSectionName = QString("landscape_dialpad"); |
251 QString hello("hello"); |
254 QString hello("hello"); |
252 mMatchesView->mDialpad->editor().setText( hello ); |
255 mMatchesView->mDialpad->editor().setText( hello ); |
253 mMatchesView->mAddToContactsButton = new HbPushButton(); |
|
254 mMatchesView->mAddToContactsButton->setVisible(true); |
256 mMatchesView->mAddToContactsButton->setVisible(true); |
255 |
257 |
256 mMatchesView->dialpadClosed(); |
258 mMatchesView->dialpadClosed(); |
257 |
259 |
258 QVERIFY( mMatchesView->mDialpad->editor().text() == hello ); |
260 QVERIFY( mMatchesView->mDialpad->editor().text() == hello ); |
259 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
261 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
260 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
262 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
261 delete mMatchesView->mListView; |
263 delete view; |
262 mMatchesView->mListView = 0; |
|
263 delete mMatchesView->mAddToContactsButton; |
|
264 mMatchesView->mAddToContactsButton = 0; |
|
265 } |
264 } |
266 |
265 |
267 void UT_LogsMatchesView::testDialpadOpened() |
266 void UT_LogsMatchesView::testDialpadOpened() |
268 { |
267 { |
269 //widgets size and layout updated |
268 //widgets size and layout updated |
|
269 LogsMatchesView* view = mRepository->matchesView(); |
270 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
270 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
271 mMatchesView->mListView = new HbListView(); |
271 mMatchesView->initView(); |
272 mMatchesView->mLayoutSectionName = QString("dummy"); |
272 mMatchesView->mLayoutSectionName = QString("dummy"); |
273 mMatchesView->mListView->setLayoutName("dummy"); |
273 mMatchesView->mListView->setLayoutName("dummy"); |
274 mMatchesView->mDialpad->mIsOpen = true; |
274 mMatchesView->mDialpad->mIsOpen = true; |
275 mMatchesView->mAddToContactsButton = new HbPushButton(); |
|
276 mMatchesView->mAddToContactsButton->setVisible(false); |
275 mMatchesView->mAddToContactsButton->setVisible(false); |
277 mMatchesView->mDialpad->editor().setText( "hello" ); |
276 mMatchesView->mDialpad->editor().setText( "hello" ); |
278 mMatchesView->mDialpad->mIsOpen = true; |
277 mMatchesView->mDialpad->mIsOpen = true; |
279 |
278 |
280 mMatchesView->dialpadOpened(); |
279 mMatchesView->dialpadOpened(); |
281 |
280 |
282 QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); |
281 QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); |
283 QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection ); |
282 QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection ); |
284 QVERIFY( mMatchesView->mAddToContactsButton->isVisible() ); |
283 QVERIFY( mMatchesView->mAddToContactsButton->isVisible() ); |
285 delete mMatchesView->mListView; |
284 delete view; |
286 mMatchesView->mListView = 0; |
|
287 delete mMatchesView->mAddToContactsButton; |
|
288 mMatchesView->mAddToContactsButton = 0; |
|
289 } |
285 } |
290 |
286 |
291 void UT_LogsMatchesView::testModel() |
287 void UT_LogsMatchesView::testModel() |
292 { |
288 { |
293 QVERIFY( !mMatchesView->model() ); |
289 QVERIFY( !mMatchesView->model() ); |
302 //no listView, nothing happens |
298 //no listView, nothing happens |
303 QVERIFY( !mMatchesView->mListView ); |
299 QVERIFY( !mMatchesView->mListView ); |
304 mMatchesView->updateWidgetsSizeAndLayout(); |
300 mMatchesView->updateWidgetsSizeAndLayout(); |
305 |
301 |
306 //listView exists, layout and size updated, dialpad not visible |
302 //listView exists, layout and size updated, dialpad not visible |
307 mRepository->matchesView(); |
303 LogsMatchesView* view = mRepository->matchesView(); |
308 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
304 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
309 mMatchesView->mDialpad->closeDialpad(); |
305 mMatchesView->mDialpad->closeDialpad(); |
310 mMatchesView->mListView = new HbListView(); |
306 mMatchesView->mListView = new HbListView(); |
311 mMatchesView->mListView->setLayoutName("dummy"); |
307 mMatchesView->mListView->setLayoutName("dummy"); |
312 mMatchesView->updateWidgetsSizeAndLayout(); |
308 mMatchesView->updateWidgetsSizeAndLayout(); |
329 QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection ); |
325 QVERIFY( mMatchesView->mLayoutSectionName == logsViewPortraitDialpadSection ); |
330 QVERIFY( videoCallAction->isVisible() ); |
326 QVERIFY( videoCallAction->isVisible() ); |
331 QVERIFY( messageAction->isVisible() ); |
327 QVERIFY( messageAction->isVisible() ); |
332 |
328 |
333 delete mMatchesView->mListView; |
329 delete mMatchesView->mListView; |
334 mMatchesView->mListView = 0; |
330 mMatchesView->mListView = 0; |
335 } |
331 delete view; |
|
332 } |
336 |
333 |
337 void UT_LogsMatchesView::testHandleOrientationChanged() |
334 void UT_LogsMatchesView::testHandleOrientationChanged() |
338 { |
335 { |
339 //dialpad position recalculated and layout/size updated |
336 //dialpad position recalculated and layout/size updated |
340 QPointF pos; |
337 QPointF pos; |
341 mMatchesView->mListView = new HbListView(); |
338 LogsMatchesView* view = mRepository->matchesView(); |
|
339 mMatchesView->initView(); |
342 mMatchesView->mListView->setLayoutName("dummy"); |
340 mMatchesView->mListView->setLayoutName("dummy"); |
343 mMatchesView->mLayoutSectionName = "dummy"; |
341 mMatchesView->mLayoutSectionName = "dummy"; |
344 mMatchesView->mDialpad->setPos(pos); |
342 mMatchesView->mDialpad->setPos(pos); |
345 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
343 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
346 |
344 |
347 mMatchesView->handleOrientationChanged(); |
345 mMatchesView->handleOrientationChanged(); |
348 |
346 |
349 QVERIFY( pos != mMatchesView->mDialpad->pos() ); |
347 QVERIFY( pos != mMatchesView->mDialpad->pos() ); |
350 QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeLayout ); |
348 QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeLayout ); |
351 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
349 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
352 delete mMatchesView->mListView; |
350 delete view; |
353 mMatchesView->mListView = 0; |
|
354 } |
351 } |
355 |
352 |
356 void UT_LogsMatchesView::testUpdateEmptyListWidgetsVisibility() |
353 void UT_LogsMatchesView::testUpdateEmptyListWidgetsVisibility() |
357 { |
354 { |
358 LogsDbConnector* dbConnector = 0; |
355 LogsDbConnector* dbConnector = 0; |