videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp
changeset 55 4bfa887905cf
parent 41 229f037ce963
child 58 d2b028fd1f7d
equal deleted inserted replaced
50:21fe8338c6bf 55:4bfa887905cf
   302     QVERIFY( mTestView->mView == 0 );
   302     QVERIFY( mTestView->mView == 0 );
   303     QVERIFY( mTestView->mUiLoader == 0);
   303     QVERIFY( mTestView->mUiLoader == 0);
   304 }
   304 }
   305 
   305 
   306 // ---------------------------------------------------------------------------
   306 // ---------------------------------------------------------------------------
       
   307 // testBack
       
   308 // ---------------------------------------------------------------------------
       
   309 //
       
   310 void TestCollectionView::testBack()
       
   311 {
       
   312     mTestView->back();
       
   313     QCOMPARE( VideoListViewData::mBackCount, 0 );
       
   314     mTestView->activateView();
       
   315     mTestView->back();
       
   316     QCOMPARE( VideoListViewData::mBackCount, 1 );
       
   317 }
       
   318 
       
   319 // ---------------------------------------------------------------------------
       
   320 // testOrientationChange
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 void TestCollectionView::testOrientationChange()
       
   324 {
       
   325     // there's nothing to be tested for this.
       
   326     // slot is probably going to be removed. This is here just to have the
       
   327     // function decision coverage on correct level.
       
   328     mTestView->orientationChange(Qt::Horizontal);
       
   329 
       
   330 }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // testTimerEvent
       
   334 // ---------------------------------------------------------------------------
       
   335 //
       
   336 void TestCollectionView::testTimerEvent()
       
   337 {
       
   338     QSignalSpy commandSpy(mTestView, SIGNAL(command(int)));
       
   339     QSignalSpy delayedSpy(mTestView, SIGNAL(doDelayeds()));
       
   340     
       
   341     QEvent event(QEvent::Timer);
       
   342     QApplication::sendEvent(mTestView, &event);
       
   343     QVERIFY(commandSpy.count() == 0);
       
   344     QVERIFY(delayedSpy.count() == 0);
       
   345     
       
   346     QTimerEvent timerEvent(mTestView->mTimerId);
       
   347     QApplication::sendEvent(mTestView, &timerEvent);
       
   348     QVERIFY(commandSpy.count() == 1);
       
   349     QVERIFY(delayedSpy.count() == 1);
       
   350     
       
   351 }
       
   352 
       
   353 // ---------------------------------------------------------------------------
   307 // testGetView
   354 // testGetView
   308 // ---------------------------------------------------------------------------
   355 // ---------------------------------------------------------------------------
   309 //
   356 //
   310 void TestCollectionView::testGetView()
   357 void TestCollectionView::testGetView()
   311 {
   358 {
   318     QVERIFY( mTestView->getView() == mTestView->mView );
   365     QVERIFY( mTestView->getView() == mTestView->mView );
   319     mTestView->destroyView();
   366     mTestView->destroyView();
   320     QVERIFY( mTestView->getView() == 0 );    
   367     QVERIFY( mTestView->getView() == 0 );    
   321     // need to create view to handle cleaning up correctly
   368     // need to create view to handle cleaning up correctly
   322     mTestView->createView();
   369     mTestView->createView();
   323 }
   370     HbMainWindow *window = hbInstance->allMainWindows().value(0);
   324 
   371     window->removeView(mTestView->mView);
   325 // ---------------------------------------------------------------------------
   372 }
   326 // testBack
       
   327 // ---------------------------------------------------------------------------
       
   328 //
       
   329 void TestCollectionView::testBack()
       
   330 {
       
   331     mTestView->back();
       
   332     QCOMPARE( VideoListViewData::mBackCount, 0 );
       
   333     mTestView->activateView();
       
   334     mTestView->back();
       
   335     QCOMPARE( VideoListViewData::mBackCount, 1 );
       
   336 }
       
   337 
       
   338 // ---------------------------------------------------------------------------
       
   339 // testOrientationChange
       
   340 // ---------------------------------------------------------------------------
       
   341 //
       
   342 void TestCollectionView::testOrientationChange()
       
   343 {
       
   344     // there's nothing to be tested for this.
       
   345     // slot is probably going to be removed. This is here just to have the
       
   346     // function decision coverage on correct level.
       
   347     mTestView->orientationChange(Qt::Horizontal);
       
   348 
       
   349 }
       
   350 
       
   351 // ---------------------------------------------------------------------------
       
   352 // testTimerEvent
       
   353 // ---------------------------------------------------------------------------
       
   354 //
       
   355 void TestCollectionView::testTimerEvent()
       
   356 {
       
   357     QSignalSpy commandSpy(mTestView, SIGNAL(command(int)));
       
   358     QSignalSpy delayedSpy(mTestView, SIGNAL(doDelayeds()));
       
   359     
       
   360     QEvent event(QEvent::Timer);
       
   361     QApplication::sendEvent(mTestView, &event);
       
   362     QVERIFY(commandSpy.count() == 0);
       
   363     QVERIFY(delayedSpy.count() == 0);
       
   364     
       
   365     QTimerEvent timerEvent(mTestView->mTimerId);
       
   366     QApplication::sendEvent(mTestView, &timerEvent);
       
   367     QVERIFY(commandSpy.count() == 1);
       
   368     QVERIFY(delayedSpy.count() == 1);
       
   369     
       
   370 }
       
   371 
       
   372 
       
   373 
   373 
   374 // End of file
   374 // End of file
   375 
   375