videoplayback/videoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp
changeset 66 adb51f74b890
parent 63 4707a0db12f6
equal deleted inserted replaced
63:4707a0db12f6 66:adb51f74b890
    13 *
    13 *
    14 * Description:   tester for methods in VideoSortFilterProxyModel
    14 * Description:   tester for methods in VideoSortFilterProxyModel
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: ou1cpsw#16 %
    18 // Version : %version: 17 %
    19 
    19 
    20 #include <e32err.h>
    20 #include <e32err.h>
    21 #include <w32std.h>
    21 #include <w32std.h>
    22 
    22 
    23 #include <mmf/common/mmferrors.h>
    23 #include <mmf/common/mmferrors.h>
   169 {
   169 {
   170     //
   170     //
   171     // construct and activate playback view
   171     // construct and activate playback view
   172     //
   172     //
   173     setup();
   173     setup();
   174     
   174 
   175     HbMessageBox::mMessageBConstructCount = 0;
   175     HbMessageBox::mMessageBConstructCount = 0;
   176     HbNotificationDialog::mNotifConstructCount = 0;
   176     HbNotificationDialog::mNotifConstructCount = 0;
   177     //
   177     //
   178     // ensure that playback view is currently activated
   178     // ensure that playback view is currently activated
   179     //
   179     //
   181 
   181 
   182     //
   182     //
   183     // test showDialog() method using default arguments
   183     // test showDialog() method using default arguments
   184     //
   184     //
   185     mVideoView->showDialog( "test error msg" );
   185     mVideoView->showDialog( "test error msg" );
   186     
   186 
   187     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
   187     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
   188     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
   188     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
   189     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   189     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   190 
   190 
   191     mVideoView->handleActivateView();
   191     mVideoView->handleActivateView();
   192     HbMessageBox::mMessageBConstructCount = 0;
   192     HbMessageBox::mMessageBConstructCount = 0;
   193     HbNotificationDialog::mNotifConstructCount = 0;
   193     HbNotificationDialog::mNotifConstructCount = 0;
   194     mVideoView->mTimerForClosingView->stop();
   194     mVideoView->mTimerForClosingView->stop();
   195     
   195 
   196     //
   196     //
   197     // test showDialog() method, error, no closing 
   197     // test showDialog() method, error, no closing
   198     //
   198     //
   199     mVideoView->showDialog( "test error msg", false );
   199     mVideoView->showDialog( "test error msg", false );
   200     
   200 
   201     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
   201     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
   202     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
   202     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
   203     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
   203     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
   204     
   204 
   205     HbMessageBox::mMessageBConstructCount = 0;
   205     HbMessageBox::mMessageBConstructCount = 0;
   206     HbNotificationDialog::mNotifConstructCount = 0;
   206     HbNotificationDialog::mNotifConstructCount = 0;
   207     
   207 
   208     //
   208     //
   209     // test showDialog() method, nofitification, closing 
   209     // test showDialog() method, nofitification, closing
   210     //
   210     //
   211     mVideoView->showDialog( "test error msg", true, false );
   211     mVideoView->showDialog( "test error msg", true, false );
   212     
   212 
   213     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
   213     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
   214     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
   214     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
   215     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   215     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   216     
   216 
   217     mVideoView->handleActivateView();
   217     mVideoView->handleActivateView();
   218     HbMessageBox::mMessageBConstructCount = 0;
   218     HbMessageBox::mMessageBConstructCount = 0;
   219     HbNotificationDialog::mNotifConstructCount = 0;
   219     HbNotificationDialog::mNotifConstructCount = 0;
   220     mVideoView->mTimerForClosingView->stop();
   220     mVideoView->mTimerForClosingView->stop();
   221     
   221 
   222     //
   222     //
   223     // test showDialog() method, nofitification, not closing 
   223     // test showDialog() method, nofitification, not closing
   224     //
   224     //
   225     mVideoView->showDialog( "test error msg", false, false );
   225     mVideoView->showDialog( "test error msg", false, false );
   226 
   226 
   227     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
   227     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
   228     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
   228     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
   229     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
   229     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
   230 
   230 
   231     
   231 
   232     //
   232     //
   233     // destruct playback view
   233     // destruct playback view
   234     //
   234     //
   235     cleanup();
   235     cleanup();
   236 }
   236 }
   620     // ensure signal has not been emitted yet
   620     // ensure signal has not been emitted yet
   621     //
   621     //
   622     QCOMPARE( spy1.count(), 0 );
   622     QCOMPARE( spy1.count(), 0 );
   623 
   623 
   624     //
   624     //
   625     // Test pan gesture with GestureFinished
   625     // 1. Test pan gesture with GestureFinished
   626     //
   626     //
   627     panGesture->mState = Qt::GestureFinished;
   627     panGesture->mState = Qt::GestureFinished;
   628     panGesture->mSceneDelta = QPointF( 5, 0 );
   628     panGesture->mSceneVelocity = QPointF( 5, 0 );
       
   629     panGesture->mSceneOffset = QPointF( 205, 0 );
   629     mVideoView->gestureEvent( event );
   630     mVideoView->gestureEvent( event );
   630 
   631 
   631     //
   632     //
   632     // ensure signal has been emitted
   633     // ensure signal has been emitted
   633     //
   634     //
   634     QCOMPARE( spy1.count(), 1 );
   635     QCOMPARE( spy1.count(), 1 );
       
   636 
       
   637     //
       
   638     // 2. Test pan gesture with GestureFinished
       
   639     //
       
   640     panGesture->mSceneVelocity = QPointF( 5, 0 );
       
   641     panGesture->mSceneOffset = QPointF( 105, 0 );
       
   642     mVideoView->gestureEvent( event );
       
   643 
       
   644     //
       
   645     // ensure signal has not been emitted
       
   646     //
       
   647     QCOMPARE( spy1.count(), 1 );
       
   648 
   635     spy1.clear();
   649     spy1.clear();
   636 
   650 
   637     //
   651     //
   638     // Test pan gesture with GestureFinished
   652     // 3. Test pan gesture with GestureFinished
   639     //
   653     //
   640 
   654 
   641     //
   655     //
   642     // connect to pannedToRight() signal and record its emission
   656     // connect to pannedToRight() signal and record its emission
   643     //
   657     //
   647     // ensure signal has not been emitted yet
   661     // ensure signal has not been emitted yet
   648     //
   662     //
   649     QCOMPARE( spy2.count(), 0 );
   663     QCOMPARE( spy2.count(), 0 );
   650 
   664 
   651     panGesture->mState = Qt::GestureFinished;
   665     panGesture->mState = Qt::GestureFinished;
   652     panGesture->mSceneDelta = QPointF( -5, 0 );
   666     panGesture->mSceneVelocity = QPointF( -5, 0 );
       
   667     panGesture->mSceneOffset = QPointF( -205, 0 );
       
   668     mVideoView->gestureEvent( event );
       
   669 
       
   670     //
       
   671     // ensure signal has been emitted yet
       
   672     //
       
   673     QCOMPARE( spy2.count(), 1 );
       
   674 
       
   675     //
       
   676     // 4. Test pan gesture with GestureFinished
       
   677     //
       
   678     panGesture->mSceneVelocity = QPointF( -5, 0 );
       
   679     panGesture->mSceneOffset = QPointF( -105, 0 );
   653     mVideoView->gestureEvent( event );
   680     mVideoView->gestureEvent( event );
   654 
   681 
   655     //
   682     //
   656     // ensure signal has not been emitted yet
   683     // ensure signal has not been emitted yet
   657     //
   684     //