35 #include <hbmenu.h> |
35 #include <hbmenu.h> |
36 #include <dialpad.h> |
36 #include <dialpad.h> |
37 #include <hblineedit.h> |
37 #include <hblineedit.h> |
38 #include <hblistviewitem.h> |
38 #include <hblistviewitem.h> |
39 #include <hblistview.h> |
39 #include <hblistview.h> |
|
40 #include <hbmessagebox.h> |
40 #include <QStringListModel> |
41 #include <QStringListModel> |
41 #include <hbapplication.h> |
42 #include <hbapplication.h> |
42 #include <hbactivitymanager.h> |
43 #include <hbactivitymanager.h> |
43 |
44 |
44 void UT_LogsBaseView::initTestCase() |
45 void UT_LogsBaseView::initTestCase() |
545 mBaseView->mDetailsModel = model; |
546 mBaseView->mDetailsModel = model; |
546 mBaseView->deleteEvent(); |
547 mBaseView->deleteEvent(); |
547 QVERIFY( HbStubHelper::dialogShown() ); |
548 QVERIFY( HbStubHelper::dialogShown() ); |
548 } |
549 } |
549 |
550 |
550 void UT_LogsBaseView::testDeleteEventOkAnswer() |
551 void UT_LogsBaseView::testDeleteEventAnswer() |
551 { |
552 { |
552 // No model, nothing happens |
553 // No model, nothing happens |
553 QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() ); |
554 QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() ); |
554 QVERIFY( !mBaseView->mDetailsModel ); |
555 QVERIFY( !mBaseView->mDetailsModel ); |
555 mBaseView->deleteEventOkAnswer(); |
556 mBaseView->deleteEventAnswer(HbMessageBox::Ok); |
556 QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() ); |
557 QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() ); |
557 |
558 |
|
559 // Model exists, cancel button pressed |
|
560 LogsDetailsModel* model = new LogsDetailsModel(); |
|
561 mBaseView->mDetailsModel = model; |
|
562 mBaseView->deleteEventAnswer(HbMessageBox::Cancel); |
|
563 QVERIFY( LogsDetailsModel::mLastCallName.isEmpty() ); |
|
564 |
558 // Model exists, call to delete event made and view is closed |
565 // Model exists, call to delete event made and view is closed |
559 mViewManager->reset(); |
566 mViewManager->reset(); |
560 LogsDetailsModel* model = new LogsDetailsModel(); |
567 mBaseView->deleteEventAnswer(HbMessageBox::Ok); |
561 mBaseView->mDetailsModel = model; |
|
562 mBaseView->deleteEventOkAnswer(); |
|
563 QVERIFY( LogsDetailsModel::mLastCallName == QLatin1String("clearEvent") ); |
568 QVERIFY( LogsDetailsModel::mLastCallName == QLatin1String("clearEvent") ); |
564 QVERIFY( !mViewManager->mPreviousActivated ); |
569 QVERIFY( !mViewManager->mPreviousActivated ); |
565 } |
|
566 |
|
567 void UT_LogsBaseView::testAskConfirmation() |
|
568 { |
|
569 // No receiver and slots specified |
|
570 mBaseView->askConfirmation(QLatin1String("heading"), QLatin1String("text"), 0); |
|
571 QVERIFY( HbStubHelper::dialogShown() ); |
|
572 |
|
573 // Receiver and slots specified |
|
574 HbStubHelper::reset(); |
|
575 mBaseView->askConfirmation(QLatin1String("heading"), QLatin1String("text"), this, |
|
576 SLOT("dummy()"), SLOT("dummy()")); |
|
577 QVERIFY( HbStubHelper::dialogShown() ); |
|
578 } |
570 } |
579 |
571 |
580 void UT_LogsBaseView::testMatchWithActivityId() |
572 void UT_LogsBaseView::testMatchWithActivityId() |
581 { |
573 { |
582 QVERIFY( !mBaseView->matchWithActivityId(QString("")) ); |
574 QVERIFY( !mBaseView->matchWithActivityId(QString("")) ); |
681 list.setModel(&model2); |
673 list.setModel(&model2); |
682 list.setCurrentIndex(model2.index(0,0)); |
674 list.setCurrentIndex(model2.index(0,0)); |
683 delete HbStubHelper::listItems().takeLast(); |
675 delete HbStubHelper::listItems().takeLast(); |
684 mBaseView->ensureListPositioning(list); |
676 mBaseView->ensureListPositioning(list); |
685 QVERIFY( HbStubHelper::listEnsureVisibleCalled() ); |
677 QVERIFY( HbStubHelper::listEnsureVisibleCalled() ); |
686 QVERIFY( HbStubHelper::listScrollToCalled() ); |
678 // TODO: stub does not work due it uses virtual table inside hbcore. Whole |
687 |
679 // list should be stubbed. |
688 } |
680 //QVERIFY( HbStubHelper::listScrollToCalled() ); |
|
681 } |
|
682 |
|
683 void UT_LogsBaseView::testCancelServiceRequest() |
|
684 { |
|
685 QVERIFY( !mBaseView->mContact ); |
|
686 QVERIFY( !LogsContact::mServiceRequestCanceled ); |
|
687 mBaseView->cancelServiceRequest(); |
|
688 QVERIFY( !LogsContact::mServiceRequestCanceled ); |
|
689 |
|
690 mBaseView->mContact = new LogsContact(); |
|
691 mBaseView->cancelServiceRequest(); |
|
692 QVERIFY( LogsContact::mServiceRequestCanceled ); |
|
693 } |