videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp
changeset 35 3738fe97f027
parent 30 4f111d64a341
child 38 ff53afa8ad05
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    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: %
       
    19 
    18 #include <e32err.h>
    20 #include <e32err.h>
    19 #include <w32std.h>
    21 #include <w32std.h>
    20 
    22 
    21 #include <mmf/common/mmferrors.h>
    23 #include <mmf/common/mmferrors.h>
    22 #include <caf/caferr.h>
    24 #include <caf/caferr.h>
   106     
   108     
   107     cleanup();        
   109     cleanup();        
   108 }
   110 }
   109 
   111 
   110 void TestVideoPlaybackView::testHandlePluginError()
   112 void TestVideoPlaybackView::testHandlePluginError()
   111 {   /*
       
   112     setup();
       
   113     
       
   114     mVideoView->handlePluginError( KErrGeneral );	        
       
   115     QVERIFY( mVideoView->isEnabled() );
       
   116     QVERIFY( ! mVideoView->isObscured() );
       
   117     
       
   118     mVideoView->handlePluginError( KErrNotSupported );   
       
   119     
       
   120     mVideoView->handlePluginError( KErrArgument );
       
   121     
       
   122     mVideoView->handlePluginError( KErrSessionClosed );
       
   123     
       
   124     mVideoView->handlePluginError( KErrTimedOut );
       
   125     
       
   126     mVideoView->handlePluginError( KErrNotFound );
       
   127     
       
   128     mVideoView->handlePluginError( KErrMMNotEnoughBandwidth );
       
   129     
       
   130     mVideoView->handlePluginError( KErrDisconnected );
       
   131     
       
   132     mVideoView->handlePluginError( KMPXVideoPlayOver2GDuringVoiceCallError );
       
   133     
       
   134     mVideoView->handlePluginError( KErrTimedOut );
       
   135     
       
   136     mVideoView->handlePluginError( KErrCancel );
       
   137     
       
   138     mVideoView->handlePluginError( KErrCANoPermission );
       
   139     
       
   140     mVideoView->handlePluginError( KMPXVideoCallOngoingError );
       
   141     
       
   142     mVideoView->handlePluginError( KMPXVideoTvOutPlaybackNotAllowed );
       
   143     
       
   144     mVideoView->handlePluginError( KMPXVideoTvOutPlaybackNotAllowedClose );
       
   145 	          
       
   146     cleanup();*/
       
   147 }
       
   148 
       
   149 void TestVideoPlaybackView::testDisplayErrorMessage()
       
   150 {   
   113 {   
   151     setup();
   114     //
   152     
   115     // playback view is closed after displaying these error notes
   153     mVideoView->displayErrorMessage( "test error msg" );
   116     //
   154     
   117     verifyHandlePluginError( KErrNotSupported );
   155     QVERIFY( mVideoView->isEnabled() );
   118     verifyHandlePluginError( KErrUnknown );
   156     QVERIFY( ! mVideoView->isObscured() );
   119     verifyHandlePluginError( KErrMMDecoder );
   157     
   120     verifyHandlePluginError( KErrCorrupt );
   158     cleanup();    
   121     verifyHandlePluginError( KErrTooBig );
   159 }
   122     verifyHandlePluginError( KErrMMInvalidProtocol );
   160 
   123     verifyHandlePluginError( KErrMMInvalidURL );
   161 
   124     verifyHandlePluginError( KErrArgument );
   162 void TestVideoPlaybackView::testDisplayInfoMessage()
   125     verifyHandlePluginError( KErrSessionClosed ); 
       
   126     verifyHandlePluginError( KErrTimedOut );
       
   127     verifyHandlePluginError( KErrNotFound );
       
   128     verifyHandlePluginError( KErrMMNotEnoughBandwidth );   
       
   129     verifyHandlePluginError( KErrDisconnected );
       
   130     verifyHandlePluginError( KErrMMProxyServer ); 
       
   131     verifyHandlePluginError( KErrCouldNotConnect );
       
   132     verifyHandlePluginError( KErrAbort );
       
   133     verifyHandlePluginError( KErrCancel ); 
       
   134     verifyHandlePluginError( KErrMMDRMNotAuthorized );
       
   135     verifyHandlePluginError( KErrCANoRights );
       
   136     verifyHandlePluginError( KErrCANoPermission );
       
   137     verifyHandlePluginError( KMPXVideoTvOutPlaybackNotAllowedClose );
       
   138     
       
   139     //
       
   140     // playback view remains open after displaying these error notes
       
   141     //
       
   142     verifyHandlePluginError( KMPXVideoCallOngoingError, false );
       
   143     verifyHandlePluginError( KMPXVideoTvOutPlaybackNotAllowed, false );
       
   144     verifyHandlePluginError( KMPXVideoPlayOver2GDuringVoiceCallError, false );
       
   145             
       
   146     //
       
   147     // default error case, playback view is closed after displaying error note
       
   148     //
       
   149     verifyHandlePluginError( KErrGeneral );    
       
   150 }
       
   151 
       
   152 void TestVideoPlaybackView::testShowDialog()
   163 {   
   153 {   
   164     setup();
   154     //
   165 
   155     // construct and activate playback view
   166     mVideoView->displayInfoMessage( "test info msg" );
   156     //
   167     
   157     setup();
   168     QVERIFY( mVideoView->isEnabled() );
   158     
   169     QVERIFY( ! mVideoView->isObscured() );  
   159     //
   170     
   160     // ensure that playback view is currently activated
       
   161     //
       
   162     QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
       
   163     
       
   164     //
       
   165     // test showDialog() method
       
   166     //
       
   167     mVideoView->showDialog( "test error msg" );
       
   168     
       
   169     //
       
   170     // connect and emit signal for handleClosePopupDialog() slot
       
   171     //
       
   172     connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
       
   173     emit commandSignal();     
       
   174 
       
   175     //
       
   176     // verify that playback view is properly closed
       
   177     //
       
   178     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
       
   179 
       
   180     //
       
   181     // disconnect signal for handleClosePopupDialog() slot
       
   182     //
       
   183     disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
       
   184     
       
   185     //
       
   186     // destruct playback view
       
   187     //
   171     cleanup();    
   188     cleanup();    
   172 }
   189 }
   173 
   190 
   174 
   191 
   175 void TestVideoPlaybackView::testGetWindow()
   192 void TestVideoPlaybackView::testGetWindow()
   423     QVERIFY( mVideoView->mVideoMpxWrapper == NULL );   
   440     QVERIFY( mVideoView->mVideoMpxWrapper == NULL );   
   424     
   441     
   425     cleanup();        
   442     cleanup();        
   426 }
   443 }
   427 
   444 
       
   445 void TestVideoPlaybackView::verifyHandlePluginError( TInt error, bool closeView )
       
   446 {       
       
   447     //
       
   448     // construct and activate playback view
       
   449     //
       
   450     setup();
       
   451     
       
   452     //
       
   453     // ensure that playback view is currently open
       
   454     //
       
   455     QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
       
   456     
       
   457     //
       
   458     // test handlePluginError() method
       
   459     //
       
   460     mVideoView->handlePluginError( error );   
       
   461     
       
   462     //
       
   463     // close playback view after error note has been launched
       
   464     //
       
   465     if ( closeView )
       
   466     {
       
   467         //
       
   468         // connect and emit signal for handleClosePopupDialog() slot
       
   469         //
       
   470         connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
       
   471         emit commandSignal();  
       
   472 
       
   473         //
       
   474         // verify that playback view is properly closed
       
   475         //
       
   476         QVERIFY( mVideoView->mTimerForClosingView->isActive() );
       
   477     
       
   478         //
       
   479         // disconnect signal for handleClosePopupDialog() slot
       
   480         //
       
   481         disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
       
   482     }
       
   483     else
       
   484     {    
       
   485         //
       
   486         // verify that playback view is still open after error note has been launched
       
   487         //
       
   488         QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
       
   489     }        
       
   490     
       
   491     //
       
   492     // destruct playback view
       
   493     //
       
   494     cleanup();
       
   495 }
   428 
   496 
   429 // End of file
   497 // End of file
   430     
   498     
   431 
   499 
   432 
   500