mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcviewmanager.cpp
changeset 39 4bcc59142325
parent 34 01f0bb65bcf1
equal deleted inserted replaced
37:e9675fb210bd 39:4bcc59142325
   159 void UT_LcUiViewManager::testPrepareOrientationChange()
   159 void UT_LcUiViewManager::testPrepareOrientationChange()
   160 {
   160 {
   161     mViewManager->prepareOrientationChange();
   161     mViewManager->prepareOrientationChange();
   162 }
   162 }
   163 
   163 
   164 void UT_LcUiViewManager::testMainWindowEvent()
   164 
       
   165 void UT_LcUiViewManager::testHandleBackground()
   165 {
   166 {
   166      QSignalSpy spy( &mViewManager->mMainWindow, SIGNAL(appFocusGained()) );
   167     QSignalSpy spy( &mViewManager->mMainWindow, SIGNAL(appFocusLost()) );
   167      // Not interesting event
   168     QEvent event(QEvent::MaxUser);
   168      QEvent event(QEvent::MaxUser);
   169     QVERIFY( spy.count() == 0 );
   169      mViewManager->mMainWindow.eventFilter(0, &event);
   170     mViewManager->mMainWindow.handleBackground();
   170      QVERIFY( spy.count() == 0 );
   171     QVERIFY( spy.count() == 1 );
   171      
       
   172      // Focus in event
       
   173      QEvent event2(QEvent::ApplicationActivate);
       
   174      mViewManager->mMainWindow.eventFilter(0, &event2);
       
   175      QVERIFY( spy.count() == 1 );
       
   176       
       
   177      // test: Complete focus lost
       
   178      QSignalSpy spy2( &mViewManager->mMainWindow, SIGNAL(appFocusLost()) );
       
   179      // Focus in event
       
   180      QEvent event3(QEvent::ApplicationDeactivate);
       
   181      mViewManager->mMainWindow.mSurface = 0;
       
   182      mViewManager->mMainWindow.eventFilter(0, &event3);
       
   183      QVERIFY( spy2.count() == 1 );
       
   184      
       
   185      // test: partial focus lost i.e. in case of golbal popup.
       
   186      QSignalSpy spy3( &mViewManager->mMainWindow, SIGNAL(appFocusLost()) );
       
   187      // Partial focus in event i.e. Global popup
       
   188      QEvent event4(QEvent::ApplicationDeactivate);
       
   189      QWindowSurface surf;
       
   190      mViewManager->mMainWindow.mSurface = &surf;
       
   191      mViewManager->mMainWindow.eventFilter(0, &event4);
       
   192      QVERIFY( spy3.count() == 0 );
       
   193 }
   172 }
   194 
   173 
       
   174 
       
   175 void UT_LcUiViewManager::testhandleForeground()
       
   176 {
       
   177     QSignalSpy spy( &mViewManager->mMainWindow, SIGNAL(appFocusGained()) );
       
   178     QEvent event(QEvent::MaxUser);
       
   179     QVERIFY( spy.count() == 0 );
       
   180     mViewManager->mMainWindow.handleForeground();
       
   181     QVERIFY( spy.count() == 1 );
       
   182 }
       
   183 
       
   184 
   195 // end of file
   185 // end of file