videoplayback/videoplaybackview/tsrc/testcontrolconfiguration/src/testcontrolconfiguration.cpp
changeset 50 21fe8338c6bf
parent 44 518105d52e45
child 63 4707a0db12f6
equal deleted inserted replaced
49:824471cb468a 50:21fe8338c6bf
     1 /**
     1 /**
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   tester for methods in videoplaybackcontrolconfiguration
    14 * Description:   tester for methods in videoplaybackcontrolconfiguration
    15 * 
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 5 %
    18 // Version : %version: 6 %
    19 
    19 
    20 #include <hbapplication.h>
    20 #include <hbapplication.h>
    21 #include <hbinstance.h>
    21 #include <hbinstance.h>
    22 #include <qdebug>
    22 #include <qdebug>
    23 #include <qgraphicswidget>
    23 #include <qgraphicswidget>
    45 {
    45 {
    46     MPX_ENTER_EXIT(_L("TestControlConfiguration::Main()"));
    46     MPX_ENTER_EXIT(_L("TestControlConfiguration::Main()"));
    47 
    47 
    48     HbApplication app(argc, argv);
    48     HbApplication app(argc, argv);
    49     HbMainWindow window;
    49     HbMainWindow window;
    50     
    50 
    51     TestControlConfiguration tv;
    51     TestControlConfiguration tv;
    52 
    52 
    53     char *pass[3];
    53     char *pass[3];
    54     pass[0] = argv[0];
    54     pass[0] = argv[0];
    55     pass[1] = "-o";
    55     pass[1] = "-o";
    56     pass[2] = "c:\\data\\testcontrolconfiguration.txt";
    56     pass[2] = "c:\\data\\testcontrolconfiguration.txt";
    57     
    57 
    58     int res = QTest::qExec(&tv, 3, pass);
    58     int res = QTest::qExec(&tv, 3, pass);
    59 
    59 
    60     return res;
    60     return res;
    61 }
    61 }
    62 
    62 
    75 //
    75 //
    76 void TestControlConfiguration::setup()
    76 void TestControlConfiguration::setup()
    77 {
    77 {
    78     MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()"));
    78     MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()"));
    79 
    79 
    80     mFileDetails = new VideoPlaybackViewFileDetails();  
    80     mFileDetails = new VideoPlaybackViewFileDetails();
    81     
    81 
    82     mControlsController = new VideoPlaybackControlsController( mFileDetails );
    82     mControlsController = new VideoPlaybackControlsController( mFileDetails );
    83                                                                      
    83 
    84     mControlConfig = new VideoPlaybackControlConfiguration( mControlsController );
    84     mControlConfig = new VideoPlaybackControlConfiguration( mControlsController );
    85 }
    85 }
    86 
    86 
    87 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    88 // cleanup
    88 // cleanup
    93     MPX_ENTER_EXIT(_L("TestControlConfiguration::cleanup()"));
    93     MPX_ENTER_EXIT(_L("TestControlConfiguration::cleanup()"));
    94 
    94 
    95     if ( mFileDetails )
    95     if ( mFileDetails )
    96     {
    96     {
    97         delete mFileDetails;
    97         delete mFileDetails;
    98         mFileDetails = NULL;    
    98         mFileDetails = NULL;
    99     }
    99     }
   100     
   100 
   101     if ( mControlsController )
   101     if ( mControlsController )
   102     {
   102     {
   103         delete mControlsController;
   103         delete mControlsController;
   104         mControlsController = NULL;    
   104         mControlsController = NULL;
   105     }
   105     }
   106     
   106 
   107     if ( mControlConfig )
   107     if ( mControlConfig )
   108     {
   108     {
   109         delete mControlConfig;
   109         delete mControlConfig;
   110         mControlConfig = NULL;    
   110         mControlConfig = NULL;
   111     }
   111     }
   112 }
   112 }
   113 
   113 
   114 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   115 // testControlList
   115 // testControlList
   183 
   183 
   184     //
   184     //
   185     // 1. test with mVideoEnabled = false
   185     // 1. test with mVideoEnabled = false
   186     //
   186     //
   187     mControlsController->mFileDetails->mVideoEnabled = false;
   187     mControlsController->mFileDetails->mVideoEnabled = false;
   188     
   188 
   189     mControlConfig->updateControlsWithFileDetails();
   189     mControlConfig->updateControlsWithFileDetails();
   190     
   190 
   191     QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList();
   191     QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList();
   192     
   192 
   193     QVERIFY( controlsList.contains( EControlBar ) );
   193     QVERIFY( controlsList.contains( EControlBar ) );
   194 
   194 
   195     //
   195     //
   196     // 2. test with mVideoEnabled = true
   196     // 2. test with mVideoEnabled = true
   197     //
   197     //
   198     mControlsController->mFileDetails->mVideoEnabled = false;
   198     mControlsController->mFileDetails->mVideoEnabled = false;
   199     
   199 
   200     mControlConfig->updateControlsWithFileDetails(); 
   200     mControlConfig->updateControlsWithFileDetails();
   201     
   201 
   202     QVERIFY( controlsList.contains( EControlBar ) );
   202     QVERIFY( controlsList.contains( EControlBar ) );
   203     
   203 
   204     QGraphicsWidget *widget = 
   204     QGraphicsWidget *widget =
   205             mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
   205             mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
   206 
   206 
   207     QVERIFY( widget->isVisible() );
   207     QVERIFY( widget->isVisible() );
   208 
   208 
   209     cleanup();
   209     cleanup();
   215 //
   215 //
   216 void TestControlConfiguration::testUpdateControlList()
   216 void TestControlConfiguration::testUpdateControlList()
   217 {
   217 {
   218     MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()"));
   218     MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()"));
   219 
   219 
   220     setup();    
   220     setup();
   221     mControlConfig->createControlList();
   221     mControlConfig->createControlList();
   222 
   222 
       
   223     QGraphicsWidget *widget =
       
   224             mControlConfig->mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
   223     //
   225     //
   224     // 1.  Test for Details View
   226     // 1.  Test for Details View
   225     //
   227     //
   226     mControlConfig->updateControlList( EControlCmdDetailsViewOpened );
   228     mControlConfig->updateControlList( EControlCmdDetailsViewOpened );
   227     QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList();
   229     QList<TVideoPlaybackControls> controlsList = mControlConfig->controlList();
   228 
   230 
   229     QVERIFY( controlsList.contains( EFileDetailsWidget ) );    
   231     QVERIFY( ! widget->isVisible() );
       
   232     QVERIFY( controlsList.contains( EFileDetailsWidget ) );
   230     QVERIFY( controlsList.contains( EDetailsViewPlaybackWindow ) );
   233     QVERIFY( controlsList.contains( EDetailsViewPlaybackWindow ) );
   231     QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );    
   234     QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
   232 
   235 
   233 
   236     //
   234     //
   237     // 2-1. Test for Fullscreen View
   235     // 2. Test for Fullscreen View
   238     //
   236     //
   239     mControlConfig->mSurfaceAttached = false;
   237     mControlConfig->updateControlList( EControlCmdFullScreenViewOpened );
   240     mControlConfig->updateControlList( EControlCmdFullScreenViewOpened );
   238     controlsList = mControlConfig->controlList();
   241     controlsList = mControlConfig->controlList();
   239     
   242 
   240     QVERIFY( ! controlsList.contains( EFileDetailsWidget ) );    
   243     QVERIFY( ! widget->isVisible() );
   241     QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );    
   244     QVERIFY( ! controlsList.contains( EFileDetailsWidget ) );
       
   245     QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
   242     QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
   246     QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
   243 
   247 
   244     //
   248     //
       
   249     // 2-2. Test for Fullscreen View
       
   250     //
       
   251     mControlConfig->mSurfaceAttached = true;
       
   252     mControlConfig->updateControlList( EControlCmdFullScreenViewOpened );
       
   253     controlsList = mControlConfig->controlList();
       
   254 
       
   255     QVERIFY( widget->isVisible() );
       
   256     QVERIFY( ! controlsList.contains( EFileDetailsWidget ) );
       
   257     QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
       
   258     QVERIFY( ! controlsList.contains( EIndicatorBitmap ) );
       
   259 
       
   260     //
   245     // 3. Test for Audio Only View
   261     // 3. Test for Audio Only View
   246     //
   262     //
   247     mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened );
   263     mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened );
   248     controlsList = mControlConfig->controlList();
   264     controlsList = mControlConfig->controlList();
   249     
   265 
   250     QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) ); 
   266     QVERIFY( ! widget->isVisible() );
       
   267     QVERIFY( ! controlsList.contains( EDetailsViewPlaybackWindow ) );
   251     QVERIFY( controlsList.contains( EIndicatorBitmap ) );
   268     QVERIFY( controlsList.contains( EIndicatorBitmap ) );
   252     QVERIFY( controlsList.contains( EFileDetailsWidget ) );
   269     QVERIFY( controlsList.contains( EFileDetailsWidget ) );
   253 
   270 
   254     //
   271     //
   255     // 4. RN log gets removed
   272     // 4. RN log gets removed
   256     //
   273     //
   257     mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened );
   274     mControlConfig->updateControlList( EControlCmdAudionOnlyViewOpened );
   258     controlsList = mControlConfig->controlList();
   275     controlsList = mControlConfig->controlList();
   259 
   276 
   260     QVERIFY( ! controlsList.contains( ERealLogoBitmap ) ); 
   277     QVERIFY( ! controlsList.contains( ERealLogoBitmap ) );
   261 
   278 
       
   279     //
       
   280     // 5. Surface attached
       
   281     //
       
   282     mControlConfig->updateControlList( EControlCmdSurfaceAttached );
       
   283     controlsList = mControlConfig->controlList();
       
   284 
       
   285     QVERIFY( widget->isVisible() );
       
   286 
       
   287     //
       
   288     // 6. Surface detached
       
   289     //
       
   290     mControlConfig->updateControlList( EControlCmdSurfaceDetached );
       
   291     controlsList = mControlConfig->controlList();
       
   292 
       
   293     QVERIFY( ! widget->isVisible() );
   262     cleanup();
   294     cleanup();
   263 }
   295 }
   264 
   296 
   265 // End of file
   297 // End of file