videoplayback/videoplaybackview/tsrc/testfullscreencontrol/src/testfullscreencontrol.cpp
changeset 62 0e1e938beb1a
parent 52 e3cecb93e76a
--- a/videoplayback/videoplaybackview/tsrc/testfullscreencontrol/src/testfullscreencontrol.cpp	Thu Sep 02 20:28:16 2010 +0300
+++ b/videoplayback/videoplaybackview/tsrc/testfullscreencontrol/src/testfullscreencontrol.cpp	Fri Sep 17 08:30:05 2010 +0300
@@ -1,5 +1,5 @@
 /**
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -12,10 +12,10 @@
 * Contributors:
 *
 * Description:   tester for methods in VideoPlaybackFullScreenControl
-* 
+*
 */
 
-// Version : %version:  4 %
+// Version : %version:  5 %
 
 
 #include <hbapplication.h>
@@ -38,9 +38,9 @@
 #undef private
 
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // main
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 int main(int argc, char *argv[])
 {
@@ -48,31 +48,31 @@
 
     HbApplication app(argc, argv);
     HbMainWindow window;
-    
+
     TestFullScreenControl tv;
 
     char *pass[3];
     pass[0] = argv[0];
     pass[1] = "-o";
     pass[2] = "c:\\data\\testfullscreencontrol.txt";
-    
+
     int res = QTest::qExec(&tv, 3, pass);
-    
+
     return res;
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // init
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::init()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::init()"));
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // setup
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::setup( TVideoPlaybackControls control )
 {
@@ -80,13 +80,13 @@
 
 
     mControlsController = new VideoPlaybackControlsController();
-    
-    createControl( control );                                                                                                                                           
+
+    createControl( control );
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // createControl
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::createControl( TVideoPlaybackControls control )
 {
@@ -96,68 +96,70 @@
     {
         case EStatusPane:
         {
-            mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController, 
+            mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController,
                                                                      control,
-                                                                     NULL, 
-                                                                     0 );         
-            break;    
+                                                                     NULL,
+                                                                     0 );
+            break;
         }
         case EControlBar:
         {
-            VideoPlaybackControlBar *controlBar = 
-                    new VideoPlaybackControlBar( mControlsController );            
-    
+            VideoPlaybackControlBar *controlBar =
+                    new VideoPlaybackControlBar( mControlsController );
+
             mFullScreenControl = new VideoPlaybackFullScreenControl( mControlsController,
                                                                      control,
                                                                      controlBar,
-                                                                     0 );            
-             
+                                                                     0 );
+
             break;
         }
         case EDetailsViewPlaybackWindow:
         {
-            break;    
+            break;
         }
-    }    
+    }
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // cleanup
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::cleanup()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::cleanup()"));
 
+    if ( mFullScreenControl )
+    {
+        delete mFullScreenControl;
+        mFullScreenControl = NULL;
+    }
+
     if ( mControlsController )
     {
         delete mControlsController;
-        mControlsController = NULL;    
-    }
-    
-    if ( mFullScreenControl )
-    {
-        delete mFullScreenControl;
-        mFullScreenControl = NULL;    
+        mControlsController = NULL;
     }
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testControlIndex
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testControlIndex()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testControlIndex()"));
 
     setup( EStatusPane );
-    
+
     QVERIFY( mFullScreenControl->controlIndex() == EStatusPane );
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testDurationChanged
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testDurationChanged()
 {
@@ -165,118 +167,150 @@
 
     // test for progress bar
     delete mFullScreenControl;
-    mFullScreenControl = NULL;    
+    mFullScreenControl = NULL;
     setup( EControlBar );
-    QVERIFY( mFullScreenControl->durationChanged( 100 ) );      
-    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 );       
-    
+    QVERIFY( mFullScreenControl->durationChanged( 100 ) );
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mDuration == 100 );
+
     // test for something other than progress bar
     delete mFullScreenControl;
     mFullScreenControl = NULL;
-    setup( EStatusPane );    
-    QVERIFY( ! mFullScreenControl->durationChanged( 100 ) );    
-            
+    setup( EStatusPane );
+    QVERIFY( ! mFullScreenControl->durationChanged( 100 ) );
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testPositionChanged
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testPositionChanged()
-{ 
+{
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()"));
 
     // test for progress bar
     delete mFullScreenControl;
-    mFullScreenControl = NULL;    
+    mFullScreenControl = NULL;
     setup( EControlBar );
-    QVERIFY( mFullScreenControl->positionChanged( 100 ) );      
-    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 );      
-    
+    QVERIFY( mFullScreenControl->positionChanged( 100 ) );
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mPosition == 100 );
+
     // test for something other than progress bar
     delete mFullScreenControl;
     mFullScreenControl = NULL;
-    setup( EStatusPane );    
+    setup( EStatusPane );
     QVERIFY( ! mFullScreenControl->positionChanged( 100 ) );
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testAspectRatioChanged
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testAspectRatioChanged()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()"));
 
-    // test for button bar
-    delete mFullScreenControl;
-    mFullScreenControl = NULL;    
-    setup( EControlBar );        
+    setup( EControlBar );
     QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) );  // EMMFNatural
-    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 ); 
-    
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 );
+
     // test for something other than button bar
-    delete mFullScreenControl;
-    mFullScreenControl = NULL;    
-    setup( EStatusPane );        
+    if ( mFullScreenControl )
+    {
+        delete mFullScreenControl;
+        mFullScreenControl = NULL;
+    }
+
+    setup( EStatusPane );
     QVERIFY( ! mFullScreenControl->aspectRatioChanged( 3 ) );  // EMMFNatural
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testUpdateState
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testUpdateState()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()"));
 
-    delete mFullScreenControl;
-    mFullScreenControl = NULL;    
-    setup( EControlBar );     
-    mFullScreenControl->updateState( EPbStatePaused ); 
-    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );         
+    setup( EControlBar );
+
+    mFullScreenControl->updateState( EPbStatePaused );
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testUpdateControlsWithFileDetails
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testUpdateControlsWithFileDetails()
 {
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()"));
 
-    VideoPlaybackViewFileDetails *fileDetails = new VideoPlaybackViewFileDetails(); 
-    
+    VideoPlaybackViewFileDetails *fileDetails = new VideoPlaybackViewFileDetails();
+
     setup( EControlBar );
-    
+
     fileDetails->mPausableStream = true;
-    
+
     mFullScreenControl->updateControlsWithFileDetails( fileDetails );
-    
-    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream );    
+
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mFileDetails->mPausableStream );
 
     if ( fileDetails )
     {
         delete fileDetails;
-        fileDetails = NULL;    
+        fileDetails = NULL;
     }
+
+    cleanup();
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // testUpdateControlProperties
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 void TestFullScreenControl::testUpdateControlProperties()
-{  
+{
     MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlProperties()"));
 
     setup( EStatusPane );
-    
+
     mFullScreenControl->updateControlProperties( 1 );
-    
+
     QVERIFY( mFullScreenControl != NULL );
-    
+
     QVERIFY( mFullScreenControl->mProperties == 1 );
+
+    cleanup();
 }
-        
+
+// -------------------------------------------------------------------------------------------------
+// testResetControl
+// -------------------------------------------------------------------------------------------------
+//
+void TestFullScreenControl::testResetControl()
+{
+    MPX_ENTER_EXIT(_L("TestFullScreenControl::testResetControl()"));
+
+    setup( EControlBar );
+
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mReset == false );
+
+    mFullScreenControl->resetControl();
+
+    QVERIFY( mFullScreenControl != NULL );
+
+    QVERIFY( static_cast<VideoPlaybackControlBar*>(mFullScreenControl->mControl)->mReset );
+
+    cleanup();
+}
+
 // End of file