videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/src/testfullscreencontrol.cpp
changeset 35 3738fe97f027
parent 34 bbb98528c666
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    13 *
    13 *
    14 * Description:   tester for methods in QMPXVideoPlaybackFullScreenControl
    14 * Description:   tester for methods in QMPXVideoPlaybackFullScreenControl
    15 * 
    15 * 
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  1 %
    18 // Version : %version:  2 %
    19 
    19 
    20 
    20 
    21 #include <hbapplication.h>
    21 #include <hbapplication.h>
    22 #include <hbinstance.h>
    22 #include <hbinstance.h>
    23 #include <qdebug>
    23 #include <qdebug>
    26 
    26 
    27 #include "testfullscreencontrol.h"
    27 #include "testfullscreencontrol.h"
    28 
    28 
    29 #include "mpxvideoplaybackviewfiledetails.h"
    29 #include "mpxvideoplaybackviewfiledetails.h"
    30 #include "mpxvideoplaybackcontrolscontroller.h"
    30 #include "mpxvideoplaybackcontrolscontroller.h"
    31 #include "mpxvideoplaybackprogressbar.h"
    31 #include "mpxvideoplaybackcontrolbar.h"
    32 #include "mpxvideoplaybackbuttonbar.h"
       
    33 
    32 
    34 
    33 
    35 #define private public
    34 #define private public
    36 #define protected public
    35 #define protected public
    37 #include "mpxvideoplaybackfullscreencontrol.h"
    36 #include "mpxvideoplaybackfullscreencontrol.h"
   102                                                                          control,
   101                                                                          control,
   103                                                                          NULL, 
   102                                                                          NULL, 
   104                                                                          0 );         
   103                                                                          0 );         
   105             break;    
   104             break;    
   106         }
   105         }
   107         case EMPXProgressBar:
   106         case EMPXControlBar:
   108         {            
   107         {
   109             QMPXVideoPlaybackProgressBar *progressBar = 
   108             QMPXVideoPlaybackControlBar *controlBar = 
   110                     new QMPXVideoPlaybackProgressBar( mControlsController );            
   109                     new QMPXVideoPlaybackControlBar( mControlsController );            
   111 
   110     
   112             mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
   111             mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
   113                                                                          control,
   112                                                                          control,
   114                                                                          progressBar,
   113                                                                          controlBar,
   115                                                                          0 );            
       
   116         
       
   117             break; 
       
   118         }
       
   119         case EMPXButtonBar:
       
   120         {
       
   121             QMPXVideoPlaybackButtonBar *buttonBar = 
       
   122                     new QMPXVideoPlaybackButtonBar( mControlsController );            
       
   123     
       
   124             mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
       
   125                                                                          control,
       
   126                                                                          buttonBar,
       
   127                                                                          0 );            
   114                                                                          0 );            
   128              
   115              
   129             break;
   116             break;
   130         }
   117         }
   131         case EMPXDetailsViewPlaybackWindow:
   118         case EMPXDetailsViewPlaybackWindow:
   196     MPX_ENTER_EXIT(_L("TestFullScreenControl::testDurationChanged()"));
   183     MPX_ENTER_EXIT(_L("TestFullScreenControl::testDurationChanged()"));
   197 
   184 
   198     // test for progress bar
   185     // test for progress bar
   199     delete mFullScreenControl;
   186     delete mFullScreenControl;
   200     mFullScreenControl = NULL;    
   187     mFullScreenControl = NULL;    
   201     setup( EMPXProgressBar );
   188     setup( EMPXControlBar );
   202     QVERIFY( mFullScreenControl->durationChanged( 100 ) );      
   189     QVERIFY( mFullScreenControl->durationChanged( 100 ) );      
   203     QVERIFY( static_cast<QMPXVideoPlaybackProgressBar*>(mFullScreenControl->mControl)->mDuration == 100 );       
   190     QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 );       
   204     
   191     
   205     // test for something other than progress bar
   192     // test for something other than progress bar
   206     delete mFullScreenControl;
   193     delete mFullScreenControl;
   207     mFullScreenControl = NULL;
   194     mFullScreenControl = NULL;
   208     setup( EMPXStatusPane );    
   195     setup( EMPXStatusPane );    
   219     MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()"));
   206     MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()"));
   220 
   207 
   221     // test for progress bar
   208     // test for progress bar
   222     delete mFullScreenControl;
   209     delete mFullScreenControl;
   223     mFullScreenControl = NULL;    
   210     mFullScreenControl = NULL;    
   224     setup( EMPXProgressBar );
   211     setup( EMPXControlBar );
   225     QVERIFY( mFullScreenControl->positionChanged( 100 ) );      
   212     QVERIFY( mFullScreenControl->positionChanged( 100 ) );      
   226     QVERIFY( static_cast<QMPXVideoPlaybackProgressBar*>(mFullScreenControl->mControl)->mPosition == 100 );      
   213     QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 );      
   227     
   214     
   228     // test for something other than progress bar
   215     // test for something other than progress bar
   229     delete mFullScreenControl;
   216     delete mFullScreenControl;
   230     mFullScreenControl = NULL;
   217     mFullScreenControl = NULL;
   231     setup( EMPXStatusPane );    
   218     setup( EMPXStatusPane );    
   241     MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()"));
   228     MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()"));
   242 
   229 
   243     // test for button bar
   230     // test for button bar
   244     delete mFullScreenControl;
   231     delete mFullScreenControl;
   245     mFullScreenControl = NULL;    
   232     mFullScreenControl = NULL;    
   246     setup( EMPXButtonBar );        
   233     setup( EMPXControlBar );        
   247     QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) );  // EMMFNatural
   234     QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) );  // EMMFNatural
   248     QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 ); 
   235     QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 ); 
   249     
   236     
   250     // test for something other than button bar
   237     // test for something other than button bar
   251     delete mFullScreenControl;
   238     delete mFullScreenControl;
   252     mFullScreenControl = NULL;    
   239     mFullScreenControl = NULL;    
   253     setup( EMPXStatusPane );        
   240     setup( EMPXStatusPane );        
   262 {
   249 {
   263     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()"));
   250     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()"));
   264 
   251 
   265     delete mFullScreenControl;
   252     delete mFullScreenControl;
   266     mFullScreenControl = NULL;    
   253     mFullScreenControl = NULL;    
   267     setup( EMPXButtonBar );     
   254     setup( EMPXControlBar );     
   268     mFullScreenControl->updateState( EPbStatePaused ); 
   255     mFullScreenControl->updateState( EPbStatePaused ); 
   269     QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );         
   256     QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );         
   270 }
   257 }
   271 
   258 
   272 // ---------------------------------------------------------------------------
   259 // ---------------------------------------------------------------------------
   273 // testUpdateControlsWithFileDetails
   260 // testUpdateControlsWithFileDetails
   274 // ---------------------------------------------------------------------------
   261 // ---------------------------------------------------------------------------
   277 {
   264 {
   278     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()"));
   265     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()"));
   279 
   266 
   280     delete mFullScreenControl;
   267     delete mFullScreenControl;
   281     mFullScreenControl = NULL;     
   268     mFullScreenControl = NULL;     
   282     setup( EMPXButtonBar );
   269     setup( EMPXControlBar );
   283     
   270     
   284     mFileDetails->mPausableStream = true;
   271     mFileDetails->mPausableStream = true;
   285     
   272     
   286     mFullScreenControl->updateControlsWithFileDetails(mFileDetails);
   273     mFullScreenControl->updateControlsWithFileDetails(mFileDetails);
   287     
   274     
   288     QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mShowPauseButton );    
   275     QVERIFY( static_cast<QMPXVideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream );    
   289 }
   276 }
   290 
   277 
   291 // ---------------------------------------------------------------------------
   278 // ---------------------------------------------------------------------------
   292 // testUpdateControlProperties
   279 // testUpdateControlProperties
   293 // ---------------------------------------------------------------------------
   280 // ---------------------------------------------------------------------------
   301     mFullScreenControl->updateControlProperties( 1 );
   288     mFullScreenControl->updateControlProperties( 1 );
   302     
   289     
   303     QVERIFY( mFullScreenControl != NULL );
   290     QVERIFY( mFullScreenControl != NULL );
   304     
   291     
   305     QVERIFY( mFullScreenControl->mProperties == 1 );
   292     QVERIFY( mFullScreenControl->mProperties == 1 );
   306 }        
   293 }
   307         
   294         
   308 // End of file
   295 // End of file