logsui/logsapp/tsrc/ut_logsapp/src/ut_logsmatchesview.cpp
changeset 11 64a47b97e1e1
parent 10 b04270301d3b
child 16 c5af8598d22c
equal deleted inserted replaced
10:b04270301d3b 11:64a47b97e1e1
    88     QVERIFY( mMatchesView->mModel );
    88     QVERIFY( mMatchesView->mModel );
    89     QVERIFY( mMatchesView->mActionMap.count() == 4 );
    89     QVERIFY( mMatchesView->mActionMap.count() == 4 );
    90     QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
    90     QVERIFY( mMatchesView->mListView->layoutName() == logsListDefaultLayout );
    91     QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
    91     QVERIFY( mMatchesView->mLayoutSectionName == logsViewDefaultSection );
    92     QVERIFY( mMatchesView->mAddToContactsButton );
    92     QVERIFY( mMatchesView->mAddToContactsButton );
       
    93     QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
    93     
    94     
    94     //activate once again, model recreated
    95     //activate once again, model recreated
    95     mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
    96     mMatchesView->mViewManager.mainWindow().setOrientation( Qt::Horizontal );
    96     LogsModel::setMatchesModelCreated(false);
    97     LogsModel::setMatchesModelCreated(false);
    97     mMatchesView->activated( true,QVariant() );
    98     mMatchesView->activated( true,QVariant() );
    99     QVERIFY( mMatchesView->mModel );    
   100     QVERIFY( mMatchesView->mModel );    
   100     QVERIFY( LogsModel::isMatchesModelCreated() ); //model recreated
   101     QVERIFY( LogsModel::isMatchesModelCreated() ); //model recreated
   101     QVERIFY( mMatchesView->mActionMap.count() == 4 );
   102     QVERIFY( mMatchesView->mActionMap.count() == 4 );
   102     QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout );
   103     QVERIFY( mMatchesView->mListView->layoutName() == logsListLandscapeDialpadLayout );
   103     QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection );
   104     QVERIFY( mMatchesView->mLayoutSectionName == logsViewLandscapeDialpadSection );
       
   105     QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
   104     
   106     
   105     //Pass model as input arg
   107     //Pass model as input arg
   106     LogsDbConnector* dbConnector = 0;
   108     LogsDbConnector* dbConnector = 0;
   107     LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector);
   109     LogsMatchesModel* model1 = new LogsMatchesModel(*dbConnector);
   108     model1->resetLastCall();
   110     model1->resetLastCall();
   117     QVariant arg2 = qVariantFromValue( model2 );
   119     QVariant arg2 = qVariantFromValue( model2 );
   118     mMatchesView->activated( true, arg2 );
   120     mMatchesView->activated( true, arg2 );
   119     QVERIFY( mMatchesView->mListView );
   121     QVERIFY( mMatchesView->mListView );
   120     QVERIFY( mMatchesView->mModel == model2 );
   122     QVERIFY( mMatchesView->mModel == model2 );
   121     QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() );
   123     QVERIFY( mMatchesView->mModel->mLastCall.isEmpty() );
       
   124     QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
   122     
   125     
   123     // After passing model as input arg, do not pass model
   126     // After passing model as input arg, do not pass model
   124     mMatchesView->activated( true,QVariant() );
   127     mMatchesView->activated( true,QVariant() );
   125     QVERIFY( mMatchesView->mListView );
   128     QVERIFY( mMatchesView->mListView );
   126     QVERIFY( mMatchesView->mModel );
   129     QVERIFY( mMatchesView->mModel );
   364 
   367 
   365     mMatchesView->updateEmptyListWidgetsVisibility();
   368     mMatchesView->updateEmptyListWidgetsVisibility();
   366     
   369     
   367     QVERIFY( mMatchesView->mEmptyListLabel->isVisible() );
   370     QVERIFY( mMatchesView->mEmptyListLabel->isVisible() );
   368     QVERIFY( mMatchesView->mAddToContactsButton->isVisible() );
   371     QVERIFY( mMatchesView->mAddToContactsButton->isVisible() );
       
   372     
       
   373     mMatchesView->mAddToContactsButtonDisabled = true;
       
   374     mMatchesView->updateEmptyListWidgetsVisibility();
       
   375     QVERIFY( mMatchesView->mEmptyListLabel->isVisible() );
       
   376     QVERIFY( !mMatchesView->mAddToContactsButton->isVisible() );
       
   377     
   369     delete mMatchesView->mEmptyListLabel;
   378     delete mMatchesView->mEmptyListLabel;
   370     mMatchesView->mEmptyListLabel = 0;
   379     mMatchesView->mEmptyListLabel = 0;
   371     delete mMatchesView->mAddToContactsButton;
   380     delete mMatchesView->mAddToContactsButton;
   372     mMatchesView->mAddToContactsButton = 0;
   381     mMatchesView->mAddToContactsButton = 0;
   373 }
   382 }