80 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
79 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Vertical ); |
81 LogsMatchesView* view = mRepository->matchesView(); |
80 LogsMatchesView* view = mRepository->matchesView(); |
82 QVERIFY( !mMatchesView->mInitialized ); |
81 QVERIFY( !mMatchesView->mInitialized ); |
83 QVERIFY( !mMatchesView->mListView ); |
82 QVERIFY( !mMatchesView->mListView ); |
84 QVERIFY( !mMatchesView->mModel ); |
83 QVERIFY( !mMatchesView->mModel ); |
85 QVERIFY( mMatchesView->mActionMap.count() == 0 ); |
84 mMatchesView->activated( false,QVariant(), mMatchesView->mDialpad->editor().text() ); |
86 mMatchesView->activated( false,QVariant() ); |
|
87 QVERIFY( mMatchesView->mInitialized ); |
85 QVERIFY( mMatchesView->mInitialized ); |
88 QVERIFY( mMatchesView->mListView ); |
86 QVERIFY( mMatchesView->mListView ); |
89 QVERIFY( mMatchesView->mModel ); |
87 QVERIFY( mMatchesView->mModel ); |
90 QVERIFY( mMatchesView->mActionMap.count() == 4 ); |
|
91 QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); |
88 QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout ); |
92 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
89 QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection ); |
93 QVERIFY( mMatchesView->mAddToContactsButton ); |
90 QVERIFY( mMatchesView->mAddToContactsButton ); |
94 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
91 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
95 |
92 |
96 //activate once again, model recreated |
93 //activate once again, model recreated |
97 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
94 mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal ); |
98 LogsModel::setMatchesModelCreated(false); |
95 LogsModel::setMatchesModelCreated(false); |
99 mMatchesView->activated( true,QVariant() ); |
96 mMatchesView->activated( true,QVariant(), mMatchesView->mDialpad->editor().text() ); |
100 QVERIFY( mMatchesView->mListView ); |
97 QVERIFY( mMatchesView->mListView ); |
101 QVERIFY( mMatchesView->mModel ); |
98 QVERIFY( mMatchesView->mModel ); |
102 QVERIFY( LogsModel::isMatchesModelCreated() ); //model recreated |
99 QVERIFY( LogsModel::isMatchesModelCreated() ); //model recreated |
103 QVERIFY( mMatchesView->mActionMap.count() == 4 ); |
|
104 QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout ); |
100 QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout ); |
105 QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection ); |
101 QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection ); |
106 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
102 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
107 |
103 |
108 //Pass model as input arg |
104 //Pass model as input arg |
109 LogsDbConnector* dbConnector = 0; |
105 LogsDbConnector* dbConnector = 0; |
110 LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector); |
106 LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector); |
111 model1->resetLastCall(); |
107 model1->resetLastCall(); |
112 QVariant arg = qVariantFromValue( model1 ); |
108 QVariant arg = qVariantFromValue( model1 ); |
113 mMatchesView->activated( true, arg ); |
109 mMatchesView->activated( true, arg , mMatchesView->mDialpad->editor().text()); |
114 QVERIFY( mMatchesView->mListView ); |
110 QVERIFY( mMatchesView->mListView ); |
115 QVERIFY( mMatchesView->mModel == model1 ); |
111 QVERIFY( mMatchesView->mModel == model1 ); |
116 QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() ); |
112 QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() ); |
117 |
113 |
118 LogsMatchesModel* model2 = new LogsMatchesModel(*dbConnector); |
114 LogsMatchesModel* model2 = new LogsMatchesModel(*dbConnector); |
119 model2->resetLastCall(); |
115 model2->resetLastCall(); |
120 QVariant arg2 = qVariantFromValue( model2 ); |
116 QVariant arg2 = qVariantFromValue( model2 ); |
121 mMatchesView->activated( true, arg2 ); |
117 mMatchesView->activated( true, arg2, mMatchesView->mDialpad->editor().text() ); |
122 QVERIFY( mMatchesView->mListView ); |
118 QVERIFY( mMatchesView->mListView ); |
123 QVERIFY( mMatchesView->mModel == model2 ); |
119 QVERIFY( mMatchesView->mModel == model2 ); |
124 QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() ); |
120 QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() ); |
125 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
121 QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() ); |
126 |
122 |
127 // After passing model as input arg, do not pass model |
123 // After passing model as input arg, do not pass model |
128 mMatchesView->mActivating = true; |
124 mMatchesView->mActivating = true; |
129 mMatchesView->activated( true,QVariant() ); |
125 mMatchesView->activated( true,QVariant(), mMatchesView->mDialpad->editor().text() ); |
130 QVERIFY( mMatchesView->mListView ); |
126 QVERIFY( mMatchesView->mListView ); |
131 QVERIFY( mMatchesView->mModel ); |
127 QVERIFY( mMatchesView->mModel ); |
132 QVERIFY( mMatchesView->mModel->mLastCall == QLatin1String("constructor") ); |
128 QVERIFY( mMatchesView->mModel->mLastCall == QLatin1String("constructor") ); |
133 QVERIFY( !mMatchesView->mActivating ); |
129 QVERIFY( !mMatchesView->mActivating ); |
134 delete view; |
130 delete view; |
429 { |
425 { |
430 LogsMatchesView* view = mRepository->matchesView(); |
426 LogsMatchesView* view = mRepository->matchesView(); |
431 LogsDbConnector* dbConnector = 0; |
427 LogsDbConnector* dbConnector = 0; |
432 LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector); |
428 LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector); |
433 QVariant arg = qVariantFromValue( model1 ); |
429 QVariant arg = qVariantFromValue( model1 ); |
434 view->activated( true, arg ); |
430 view->activated( true, arg , view->mDialpad->editor().text()); |
435 int status = view->mModel->predictiveSearchStatus(); |
431 int status = view->mModel->predictiveSearchStatus(); |
436 QVERIFY( status == 1 ); |
432 QVERIFY( status == 1 ); |
437 |
433 |
438 //set contact search off, view changes and dialpad content is not cleared |
434 //set contact search off, view changes and dialpad content is not cleared |
439 mMatchesView->mDialpad->editor().setText( "1234" ); |
435 mMatchesView->mDialpad->editor().setText( "1234" ); |
440 mViewManager->reset(); |
436 mViewManager->reset(); |
441 view->toggleContactSearch(); |
437 view->toggleContactSearch(); |
442 status = view->mModel->predictiveSearchStatus(); |
438 status = view->mModel->predictiveSearchStatus(); |
443 QVERIFY( status == 2 ); |
439 QVERIFY( status == 2 ); |
444 QVERIFY( mViewManager->mViewId == LogsRecentViewId ); |
440 QVERIFY( mViewManager->mViewId == LogsRecentViewId ); |
445 QVERIFY( mMatchesView->mDialpad->editor().text() == "1234" ); |
441 QVERIFY( mMatchesView->currDialpadText() == "1234" ); |
446 delete view; |
442 delete view; |
447 } |
443 } |
448 |
444 |
449 void UT_LogsMatchesView::testLocaleChanged() |
445 void UT_LogsMatchesView::testLocaleChanged() |
450 { |
446 { |