videoplayback/videoplaybackcontrols/tsrc/videoplaybackcontrols_test/src/videoplaybackcontrolstestblocks.cpp
branchRCL_3
changeset 23 befca0ec475f
equal deleted inserted replaced
22:839377eedc2b 23:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Test Harness for VideoPlayControls
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 13 %
       
    19 
       
    20 
       
    21 // [INCLUDE FILES] - do not remove
       
    22 #include <e32svr.h>
       
    23 #include <e32std.h>
       
    24 #include <w32std.h>
       
    25 #include <coeaui.h>
       
    26 #include <aknutils.h>
       
    27 #include <aknviewappui.h>
       
    28 #include <StifParser.h>
       
    29 #include <Stiftestinterface.h>
       
    30 
       
    31 #include "mpxvideoplaybackviewfiledetails.h"
       
    32 #include "videoplaybackcontrolstest.h"
       
    33 #include "mpxcommonvideoplaybackview.hrh"
       
    34 #include "mpxvideoplaybackcontrolscontroller.h"
       
    35 #include "mpxvideoplaybackcontrol.hrh"
       
    36 #include "mpxvideo_debug.h"
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 // ============================ MEMBER FUNCTIONS ===============================
       
    41 
       
    42 // -------------------------------------------------------------------------------------------------
       
    43 // CVideoPlaybackControlsTest::Delete
       
    44 // Delete here all resources allocated and opened from test methods.
       
    45 // Called from destructor.
       
    46 // -------------------------------------------------------------------------------------------------
       
    47 //
       
    48 void CVideoPlaybackControlsTest::Delete()
       
    49 {
       
    50 }
       
    51 
       
    52 // -------------------------------------------------------------------------------------------------
       
    53 // CVideoPlaybackControlsTest::RunMethodL
       
    54 // Run specified method. Contains also table of test mothods and their names.
       
    55 // -------------------------------------------------------------------------------------------------
       
    56 //
       
    57 TInt CVideoPlaybackControlsTest::RunMethodL( CStifItemParser& aItem )
       
    58 {
       
    59     static TStifFunctionInfo const KFunctions[] =
       
    60     {
       
    61         // Copy this line for every implemented function.
       
    62         // First string is the function name used in TestScripter script file.
       
    63         // Second is the actual implementation member function.
       
    64         ENTRY( "CreateControls", CVideoPlaybackControlsTest::CreateControls ),
       
    65         ENTRY( "PointerEvent", CVideoPlaybackControlsTest::PointerEvent ),
       
    66         ENTRY( "KeyEvent", CVideoPlaybackControlsTest::KeyEvent ),
       
    67         ENTRY( "ExpectedResult",CVideoPlaybackControlsTest::ExpectedResult ),
       
    68         ENTRY( "SetAspectRatio", CVideoPlaybackControlsTest::SetAspectRatio ),
       
    69         ENTRY( "SetVolume", CVideoPlaybackControlsTest::SetVolume ),
       
    70         ENTRY( "SetState", CVideoPlaybackControlsTest::SetState ),
       
    71         ENTRY( "AddDefaultFileDetails", CVideoPlaybackControlsTest::AddDefaultFileDetails ),
       
    72         ENTRY( "AddLongFileDetails", CVideoPlaybackControlsTest::AddLongFileDetails ),
       
    73         ENTRY( "AddAudioOnlyFileDetails", CVideoPlaybackControlsTest::AddAudioOnlyFileDetails ),
       
    74         ENTRY( "AddSameARFileDetails", CVideoPlaybackControlsTest::AddSameARFileDetails ),
       
    75         ENTRY( "AddEmptyTitleFileDetails", CVideoPlaybackControlsTest::AddEmptyTitleFileDetailsL ),
       
    76         ENTRY( "SetDuration", CVideoPlaybackControlsTest::SetDuration ),
       
    77         ENTRY( "SoftkeyPressed", CVideoPlaybackControlsTest::SoftkeyPressed ),
       
    78         ENTRY( "ShowControls", CVideoPlaybackControlsTest::ShowControls ),
       
    79         ENTRY( "ToggleVisibility", CVideoPlaybackControlsTest::ToggleVisibility ),
       
    80         ENTRY( "HandleBackgroundEvnet", CVideoPlaybackControlsTest::HandleBackgroundEvnet ),
       
    81         ENTRY( "DeleteControls", CVideoPlaybackControlsTest::DeleteControls ),
       
    82 
       
    83         // PDL test cases
       
    84         ENTRY( "SetDownLoadSize", CVideoPlaybackControlsTest::SetDownLoadSize ),
       
    85         ENTRY( "SetDownLoadPostion", CVideoPlaybackControlsTest::SetDownLoadPostion ),
       
    86         ENTRY( "UpdateDownloadPosition", CVideoPlaybackControlsTest::UpdateDownloadPosition ),
       
    87         ENTRY( "SetDownLoadPaused", CVideoPlaybackControlsTest::SetDownLoadPaused ),
       
    88         ENTRY( "ClearDownLoadPaused", CVideoPlaybackControlsTest::ClearDownLoadPaused ),
       
    89 
       
    90         // TV out cases
       
    91         ENTRY( "TvOutConnected", CVideoPlaybackControlsTest::TvOutConnected ),
       
    92         ENTRY( "TvOutDisconnected", CVideoPlaybackControlsTest::TvOutDisconnected ),
       
    93 
       
    94         ENTRY( "HandleErrors", CVideoPlaybackControlsTest::HandleErrors ),
       
    95 
       
    96         // Media Details Viewer
       
    97         ENTRY( "ShowMediaDetailsViewer", CVideoPlaybackControlsTest::ShowMediaDetailsViewer ),
       
    98         ENTRY( "CloseMediaDetailsViewer", CVideoPlaybackControlsTest::CloseMediaDetailsViewer )
       
    99 
       
   100         //ADD NEW ENTRY HERE
       
   101         // [test cases entries] - Do not remove
       
   102     };
       
   103 
       
   104     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
       
   105 
       
   106     return RunInternalL( KFunctions, count, aItem );
       
   107 }
       
   108 
       
   109 // -------------------------------------------------------------------------------------------------
       
   110 // CVideoPlaybackControlsTest::CreateController()
       
   111 // -------------------------------------------------------------------------------------------------
       
   112 //
       
   113 void CVideoPlaybackControlsTest::CreateController( const TDesC& aFileName, TInt aMode )
       
   114 {
       
   115     MPX_DEBUG(_L("CVideoPlaybackControlsTest::CreateController( %S, %d )"), &aFileName, aMode );
       
   116 
       
   117     TInt result = KErrGeneral;
       
   118 
       
   119     if ( iAvkonViewAppUi->OrientationCanBeChanged() )
       
   120     {
       
   121         MPX_TRAPD( err, iAvkonViewAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape ) );
       
   122         MPX_DEBUG(_L("CVideoPlaybackControlsTest::CreateController() err = [%d]"), err);
       
   123     }
       
   124 
       
   125     TRect rect = iAvkonViewAppUi->ApplicationRect();
       
   126 
       
   127     MPX_TRAP
       
   128     (
       
   129         result,
       
   130         {
       
   131             iContainer = CMPXVideoPlaybackContainer::NewL( aFileName );
       
   132 
       
   133             iContainer->SetRect( rect );
       
   134 
       
   135             CCoeEnv::Static()->AppUi()->AddToStackL( iContainer );
       
   136 
       
   137             iController =
       
   138                 CMPXVideoPlaybackControlsController::NewL( iContainer,
       
   139                                                            rect,
       
   140                                                            iContainer->FileDetails( aMode ) );
       
   141 
       
   142             iContainer->SetController( iController );
       
   143         }
       
   144     );
       
   145 
       
   146     User::ResetInactivityTime();
       
   147 }
       
   148 
       
   149 // -------------------------------------------------------------------------------------------------
       
   150 // CVideoPlaybackControlsTest::DeleteControls()
       
   151 // -------------------------------------------------------------------------------------------------
       
   152 //
       
   153 TInt CVideoPlaybackControlsTest::DeleteControls()
       
   154 {
       
   155     MPX_DEBUG(_L("CVideoPlaybackControlsTest::DeleteControls()"));
       
   156 
       
   157     TInt err = KErrNone;
       
   158 
       
   159     MPX_TRAP( err, iAvkonViewAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationAutomatic ) );
       
   160 
       
   161     if ( iController )
       
   162     {
       
   163         delete iController;
       
   164         iController = NULL;
       
   165     }
       
   166 
       
   167     CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer );
       
   168 
       
   169     if ( iContainer )
       
   170     {
       
   171         delete iContainer;
       
   172         iContainer = NULL;
       
   173     }
       
   174 
       
   175     return err;
       
   176 }
       
   177 
       
   178 // -------------------------------------------------------------------------------------------------
       
   179 // CVideoPlaybackControlsTest::CreateControls
       
   180 // -------------------------------------------------------------------------------------------------
       
   181 //
       
   182 TInt CVideoPlaybackControlsTest::CreateControls( CStifItemParser&  aItem )
       
   183 {
       
   184     MPX_DEBUG(_L("CVideoPlaybackControlsTest::CreateControls()"));
       
   185 
       
   186     TInt mode = 0;
       
   187     TInt result = KErrNotFound;
       
   188     TPtrC filename;
       
   189 
       
   190     //
       
   191     // get file name first
       
   192     //
       
   193     result = aItem.GetNextString( filename );
       
   194 
       
   195     //
       
   196     // get mode next
       
   197     //
       
   198     if ( result == KErrNone )
       
   199     {
       
   200         result = aItem.GetNextInt( mode );
       
   201     }
       
   202 
       
   203     //
       
   204     // create controller
       
   205     //
       
   206     if ( result == KErrNone )
       
   207     {
       
   208         CreateController( GetFileNameAndPath( filename ), mode );
       
   209         iContainer->DrawNow();
       
   210     }
       
   211 
       
   212     return result;
       
   213 }
       
   214 
       
   215 // -------------------------------------------------------------------------------------------------
       
   216 // CVideoPlaybackControlsTest::SetAspectRatio
       
   217 // Test creation of a general playback command.
       
   218 // -------------------------------------------------------------------------------------------------
       
   219 //
       
   220 TInt CVideoPlaybackControlsTest::SetAspectRatio( CStifItemParser&  aItem )
       
   221 {
       
   222     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetAspectRatio()"));
       
   223 
       
   224     TInt aspectRatio = 0;
       
   225     TInt result = aItem.GetNextInt( aspectRatio );
       
   226 
       
   227     if ( result == KErrNone )
       
   228     {
       
   229         MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetAspectRatio() [%d]"), aspectRatio);
       
   230 
       
   231         MPX_TRAP(
       
   232             result,
       
   233             {
       
   234                 iController->HandleEventL( EMPXControlCmdSetAspectRatio, aspectRatio );
       
   235                 iController->HandleEventL( EMPXControlCmdCreateAspectRatioIcon );
       
   236             } );
       
   237     }
       
   238 
       
   239     return result;
       
   240 }
       
   241 
       
   242 // -------------------------------------------------------------------------------------------------
       
   243 // CVideoPlaybackControlsTest::SetVolume
       
   244 // Test creation of a general playback command.
       
   245 // -------------------------------------------------------------------------------------------------
       
   246 //
       
   247 TInt CVideoPlaybackControlsTest::SetVolume( CStifItemParser&  aItem )
       
   248 {
       
   249     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetVolume()"));
       
   250 
       
   251     TInt volume = 0;
       
   252     TInt result = aItem.GetNextInt( volume );
       
   253 
       
   254     if ( result == KErrNone )
       
   255     {
       
   256         MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetVolume() [%d]"), volume);
       
   257 
       
   258         MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdSetVolume,
       
   259                                                  (TInt64)volume ) );
       
   260     }
       
   261 
       
   262     return result;
       
   263 }
       
   264 
       
   265 // -------------------------------------------------------------------------------------------------
       
   266 // CVideoPlaybackControlsTest::SetDuration
       
   267 // Test creation of a general playback command.
       
   268 // -------------------------------------------------------------------------------------------------
       
   269 //
       
   270 TInt CVideoPlaybackControlsTest::SetDuration( CStifItemParser&  aItem )
       
   271 {
       
   272     TInt duration = 0;
       
   273     TInt result = aItem.GetNextInt( duration );
       
   274 
       
   275     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetDuration() [%d]"), duration);
       
   276 
       
   277     if ( result == KErrNone )
       
   278     {
       
   279          MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdSetDuration,
       
   280                                                    (TInt64)duration ) );
       
   281     }
       
   282 
       
   283     return result;
       
   284 }
       
   285 
       
   286 // -------------------------------------------------------------------------------------------------
       
   287 // CVideoPlaybackControlsTest::PointerEvent
       
   288 // -------------------------------------------------------------------------------------------------
       
   289 //
       
   290 TInt CVideoPlaybackControlsTest::PointerEvent( CStifItemParser&  aItem )
       
   291 {
       
   292     MPX_DEBUG(_L("CVideoPlaybackControlsTest::PointerEvent()"));
       
   293 
       
   294     _LIT( KEventTypeParameter, "eventtype=" );
       
   295     _LIT( KPointerXParameter, "x=" );
       
   296     _LIT( KPointerYParameter, "y=" );
       
   297 
       
   298     TPointerEvent::TType type;
       
   299     TPoint position;
       
   300 
       
   301     TPtrC parameter;
       
   302 
       
   303     TInt result = KErrNone;
       
   304 
       
   305     while ( aItem.GetNextString( parameter ) == KErrNone )
       
   306     {
       
   307         if ( parameter.Find( KEventTypeParameter ) == 0 )
       
   308         {
       
   309             TPtrC parameterValue =
       
   310                 parameter.Right( parameter.Length() - KEventTypeParameter().Length() );
       
   311 
       
   312             if ( ParseType( parameterValue, type ) != KErrNone )
       
   313             {
       
   314                 result = KErrArgument;
       
   315             }
       
   316         }
       
   317         else if ( parameter.Find( KPointerXParameter ) == 0 )
       
   318         {
       
   319             TPtrC parameterValue =
       
   320                 parameter.Right( parameter.Length() - KPointerXParameter().Length() );
       
   321             TLex parameterValueParser( parameterValue );
       
   322             if ( parameterValueParser.Val( position.iX ) != KErrNone )
       
   323             {
       
   324                 result = KErrArgument;
       
   325             }
       
   326         }
       
   327         else if ( parameter.Find( KPointerYParameter ) == 0 )
       
   328         {
       
   329             TPtrC parameterValue =
       
   330                 parameter.Right( parameter.Length() - KPointerYParameter().Length() );
       
   331             TLex parameterValueParser( parameterValue );
       
   332             if ( parameterValueParser.Val( position.iY ) != KErrNone )
       
   333             {
       
   334                 result = KErrArgument;
       
   335             }
       
   336         }
       
   337         else
       
   338         {
       
   339              result = KErrArgument;
       
   340         }
       
   341     }
       
   342 
       
   343     TapOnScreen( type, position );
       
   344 
       
   345     return result;
       
   346 }
       
   347 
       
   348 // -------------------------------------------------------------------------------------------------
       
   349 // CVideoPlaybackControlsTest::KeyEvent
       
   350 // -------------------------------------------------------------------------------------------------
       
   351 //
       
   352 TInt CVideoPlaybackControlsTest::KeyEvent( CStifItemParser&  aItem )
       
   353 {
       
   354     MPX_DEBUG(_L("CVideoPlaybackControlsTest::KeyEvent()"));
       
   355 
       
   356     _LIT( KEventTypeParameter, "eventtype=" );
       
   357     _LIT( KKeyScancode, "scancode=" );
       
   358 
       
   359     _LIT( KKeyDown, "EEventKeyDown" );
       
   360     _LIT( KKeyUp, "EEventKeyUp" );
       
   361 
       
   362     TInt type = 0;
       
   363     TInt scanCode = 0;
       
   364     TPtrC parameter;
       
   365 
       
   366     TInt result = KErrNone;
       
   367 
       
   368     while ( aItem.GetNextString( parameter ) == KErrNone )
       
   369     {
       
   370         if ( parameter.Find( KEventTypeParameter ) == 0 )
       
   371         {
       
   372             TPtrC parameterValue =
       
   373                 parameter.Right( parameter.Length() - KEventTypeParameter().Length() );
       
   374 
       
   375             if ( parameterValue.Compare(KKeyDown) == 0 )
       
   376             {
       
   377                 type = EEventKeyDown;
       
   378             }
       
   379             else if ( parameterValue.Compare(KKeyUp) == 0 )
       
   380             {
       
   381                 type = EEventKeyUp;
       
   382             }
       
   383 
       
   384         }
       
   385         else if ( parameter.Find( KKeyScancode ) == 0 )
       
   386         {
       
   387             TPtrC parameterValue =
       
   388                 parameter.Right( parameter.Length() - KKeyScancode().Length() );
       
   389             TLex parameterValueParser( parameterValue );
       
   390             if ( parameterValueParser.Val( scanCode ) != KErrNone )
       
   391             {
       
   392                 result = KErrArgument;
       
   393             }
       
   394         }
       
   395         else
       
   396         {
       
   397              result = KErrArgument;
       
   398         }
       
   399     }
       
   400 
       
   401 
       
   402     // Now send the key event
       
   403 
       
   404     TRawEvent rawEvent;
       
   405 
       
   406     if ( type == EEventKeyDown )
       
   407     {
       
   408         rawEvent.Set( TRawEvent::EKeyDown , scanCode );
       
   409 
       
   410         iWsSession.SimulateRawEvent( rawEvent );
       
   411         iWsSession.Flush();
       
   412     }
       
   413     else if ( type == EEventKeyUp )
       
   414     {
       
   415         rawEvent.Set( TRawEvent::EKeyUp, scanCode );
       
   416 
       
   417         iWsSession.SimulateRawEvent( rawEvent );
       
   418         iWsSession.Flush();
       
   419     }
       
   420 
       
   421     return result;
       
   422 }
       
   423 
       
   424 // -------------------------------------------------------------------------------------------------
       
   425 // CVideoPlaybackControlsTest::ExpectedResult
       
   426 // -------------------------------------------------------------------------------------------------
       
   427 //
       
   428 TInt CVideoPlaybackControlsTest::ExpectedResult( CStifItemParser&  aItem )
       
   429 {
       
   430     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ExpectedResult()"));
       
   431 
       
   432     TInt command = 0;
       
   433     TInt value = 0 ;
       
   434     TInt result = aItem.GetNextInt( command );
       
   435 
       
   436     if ( result == KErrNone )
       
   437     {
       
   438         result = aItem.GetNextInt ( value );
       
   439 
       
   440         if ( result == KErrNone  )
       
   441         {
       
   442             MPX_TRAP( result, iContainer->ExpectedResultL( command, value ) );
       
   443         }
       
   444     }
       
   445 
       
   446     return result;
       
   447 }
       
   448 
       
   449 // -------------------------------------------------------------------------------------------------
       
   450 // CVideoPlaybackControlsTest::SetState
       
   451 // -------------------------------------------------------------------------------------------------
       
   452 //
       
   453 TInt CVideoPlaybackControlsTest::SetState( CStifItemParser&  aItem )
       
   454 {
       
   455     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetState()"));
       
   456 
       
   457     TInt state = 0;
       
   458     TInt result = aItem.GetNextInt( state );
       
   459 
       
   460     if ( result == KErrNone )
       
   461     {
       
   462         MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdStateChanged, state ) );
       
   463     }
       
   464 
       
   465     return result;
       
   466 }
       
   467 
       
   468 // -------------------------------------------------------------------------------------------------
       
   469 // CVideoPlaybackControlsTest::AddDefaultFileDetails
       
   470 // -------------------------------------------------------------------------------------------------
       
   471 //
       
   472 TInt CVideoPlaybackControlsTest::AddDefaultFileDetails()
       
   473 {
       
   474     MPX_DEBUG(_L("CVideoPlaybackControlsTest::AddDefaultFileDetails()"));
       
   475 
       
   476     MPX_TRAPD( result, iContainer->AddFileDetailsL() );
       
   477 
       
   478     return result;
       
   479 }
       
   480 
       
   481 // -------------------------------------------------------------------------------------------------
       
   482 // CVideoPlaybackControlsTest::AddAudioOnlyFileDetails
       
   483 // -------------------------------------------------------------------------------------------------
       
   484 //
       
   485 TInt CVideoPlaybackControlsTest::AddAudioOnlyFileDetails()
       
   486 {
       
   487     MPX_DEBUG(_L("CVideoPlaybackControlsTest::AddAudioOnlyFileDetails()"));
       
   488 
       
   489     MPX_TRAPD( result, iContainer->AddFileDetailsL( EFalse ) );
       
   490 
       
   491     return result;
       
   492 }
       
   493 
       
   494 // -------------------------------------------------------------------------------------------------
       
   495 // CVideoPlaybackControlsTest::AddLongFileDetails
       
   496 // -------------------------------------------------------------------------------------------------
       
   497 //
       
   498 TInt CVideoPlaybackControlsTest::AddLongFileDetails()
       
   499 {
       
   500     MPX_DEBUG(_L("CVideoPlaybackControlsTest::AddLongFileDetails()"));
       
   501 
       
   502     MPX_TRAPD( result, iContainer->AddLongFileDetailsL() );
       
   503 
       
   504     return result;
       
   505 }
       
   506 
       
   507 // -------------------------------------------------------------------------------------------------
       
   508 // CVideoPlaybackControlsTest::AddSameARFileDetails
       
   509 // -------------------------------------------------------------------------------------------------
       
   510 //
       
   511 TInt CVideoPlaybackControlsTest::AddSameARFileDetails()
       
   512 {
       
   513     MPX_ENTER_EXIT( _L( "CVideoPlaybackControlsTest::AddSameARFileDetails()" ) );
       
   514 
       
   515     MPX_TRAPD( result, iContainer->AddSameARFileDetailsL() );
       
   516 
       
   517     return result;
       
   518 }
       
   519 
       
   520 // -------------------------------------------------------------------------------------------------
       
   521 // CVideoPlaybackControlsTest::AddEmptyTitleFileDetails
       
   522 // -------------------------------------------------------------------------------------------------
       
   523 //
       
   524 TInt CVideoPlaybackControlsTest::AddEmptyTitleFileDetailsL()
       
   525 {
       
   526     MPX_ENTER_EXIT( _L( "CVideoPlaybackControlsTest::AddEmptyTitleFileDetailsL()" ) );
       
   527 
       
   528     MPX_TRAPD( result, iContainer->AddEmptyTitleFileDetailsL() );
       
   529 
       
   530     return result;
       
   531 }
       
   532 
       
   533 // -------------------------------------------------------------------------------------------------
       
   534 // CVideoPlaybackControlsTest::ParseType
       
   535 // -------------------------------------------------------------------------------------------------
       
   536 //
       
   537 TInt CVideoPlaybackControlsTest::ParseType( TDesC& aTypeName,
       
   538                                             TPointerEvent::TType& aType )
       
   539 {
       
   540     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ParseType()"));
       
   541 
       
   542     TBool err = KErrNone;
       
   543 
       
   544     _LIT( KButtonDown, "EButton1Down" );
       
   545     _LIT( KButtonDrag, "EDrag" );
       
   546     _LIT( KButtonUp, "EButton1Up" );
       
   547 
       
   548     if ( aTypeName.Compare(KButtonDown) == 0 )
       
   549     {
       
   550         aType = TPointerEvent::EButton1Down;
       
   551     }
       
   552     else if( aTypeName.Compare(KButtonUp) == 0 )
       
   553     {
       
   554         aType = TPointerEvent::EButton1Up;
       
   555     }
       
   556     else if( aTypeName.Compare(KButtonDrag) == 0 )
       
   557     {
       
   558         aType = TPointerEvent::EDrag;
       
   559     }
       
   560     else
       
   561     {
       
   562         err = KErrNotFound;
       
   563     }
       
   564 
       
   565     return err;
       
   566 }
       
   567 
       
   568 // -------------------------------------------------------------------------------------------------
       
   569 // CVideoPlaybackControlsTest::TapOnScreen
       
   570 // -------------------------------------------------------------------------------------------------
       
   571 //
       
   572 void CVideoPlaybackControlsTest::TapOnScreen( TPointerEvent::TType aType,
       
   573                                               TPoint aPosition )
       
   574 {
       
   575     MPX_DEBUG(_L("CVideoPlaybackControlsTest::TapOnScreen()"));
       
   576 
       
   577     MPX_DEBUG(_L("   aType = %d, aPosition = (%d,%d)"), aType, aPosition.iX, aPosition.iY);
       
   578 
       
   579     TPoint tapPoint( aPosition );
       
   580 
       
   581 #if !defined(__WINS__)
       
   582 
       
   583     //
       
   584     //  On the hardware, the window server is performing a rotation.
       
   585     //  This calculation will adjust the points so the same touch point is received
       
   586     //  on both the emulator and hardware
       
   587     //
       
   588     //  ix = ( ScreenWidth - 1 ) - oldPosition.iY - YOffset
       
   589     //      I am not sure why they subtract 1 from the screen width, but they do
       
   590     //      The YOffset can be read from the wsini.ini file
       
   591     //
       
   592     //  iy = oldPosition.iX
       
   593     //
       
   594     tapPoint.iX = ( 360 - 1 ) - aPosition.iY - 12;
       
   595     tapPoint.iY = aPosition.iX;
       
   596 
       
   597 #endif
       
   598 
       
   599     MPX_DEBUG(_L("   tapPosition = (%d,%d)"), tapPoint.iX, tapPoint.iY);
       
   600 
       
   601     TRawEvent pointer;
       
   602 
       
   603     if ( aType == TPointerEvent::EButton1Down )
       
   604     {
       
   605         pointer.Set( TRawEvent::EButton1Down, tapPoint.iX, tapPoint.iY );
       
   606 
       
   607         iWsSession.SimulateRawEvent( pointer );
       
   608         iWsSession.Flush();
       
   609     }
       
   610     else if ( aType == TPointerEvent::EButton1Up )
       
   611     {
       
   612         pointer.Set( TRawEvent::EButton1Up, tapPoint.iX, tapPoint.iY );
       
   613 
       
   614         iWsSession.SimulateRawEvent( pointer );
       
   615         iWsSession.Flush();
       
   616     }
       
   617 }
       
   618 
       
   619 // -------------------------------------------------------------------------------------------------
       
   620 // CVideoPlaybackControlsTest::SetDownLoadSize
       
   621 // -------------------------------------------------------------------------------------------------
       
   622 //
       
   623 TInt CVideoPlaybackControlsTest::SetDownLoadSize( CStifItemParser& aItem )
       
   624 {
       
   625     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetExpectedResult()"));
       
   626 
       
   627     TInt size = 0;
       
   628     TInt result = aItem.GetNextInt( size );
       
   629 
       
   630     if ( result == KErrNone )
       
   631     {
       
   632         MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdSetDownloadSize, size ) );
       
   633     }
       
   634 
       
   635     return result;
       
   636 }
       
   637 
       
   638 // -------------------------------------------------------------------------------------------------
       
   639 // CVideoPlaybackControlsTest::SetDownLoadPostion
       
   640 // -------------------------------------------------------------------------------------------------
       
   641 //
       
   642 TInt CVideoPlaybackControlsTest::SetDownLoadPostion( CStifItemParser&  aItem )
       
   643 {
       
   644     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetExpectedResult()"));
       
   645 
       
   646     TInt position = 0;
       
   647     TInt result = aItem.GetNextInt( position );
       
   648 
       
   649     if ( result == KErrNone )
       
   650     {
       
   651         MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdSetPosition, position ) );
       
   652     }
       
   653 
       
   654     return result;
       
   655 }
       
   656 
       
   657 // -------------------------------------------------------------------------------------------------
       
   658 // CVideoPlaybackControlsTest::UpdateDownloadPosition
       
   659 // -------------------------------------------------------------------------------------------------
       
   660 //
       
   661 TInt CVideoPlaybackControlsTest::UpdateDownloadPosition( CStifItemParser&  aItem )
       
   662 {
       
   663     MPX_DEBUG(_L("CVideoPlaybackControlsTest::UpdateDownloadPosition()"));
       
   664 
       
   665     TInt position = 0;
       
   666     TInt result = aItem.GetNextInt( position );
       
   667 
       
   668     if ( result == KErrNone )
       
   669     {
       
   670         MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdDownloadUpdated, position ) );
       
   671     }
       
   672 
       
   673     return result;
       
   674 }
       
   675 
       
   676 // -------------------------------------------------------------------------------------------------
       
   677 // CVideoPlaybackControlsTest::SetDownLoadPaused
       
   678 // -------------------------------------------------------------------------------------------------
       
   679 //
       
   680 TInt CVideoPlaybackControlsTest::SetDownLoadPaused()
       
   681 {
       
   682     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SetDownLoadPaused()"));
       
   683 
       
   684     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdSetDownloadPaused) );
       
   685 
       
   686     return result;
       
   687 }
       
   688 
       
   689 // -------------------------------------------------------------------------------------------------
       
   690 // CVideoPlaybackControlsTest::ClearDownLoadPaused
       
   691 // -------------------------------------------------------------------------------------------------
       
   692 //
       
   693 TInt CVideoPlaybackControlsTest::ClearDownLoadPaused()
       
   694 {
       
   695     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ClearDownLoadPaused()"));
       
   696 
       
   697     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdClearDownloadPaused) );
       
   698 
       
   699     return result;
       
   700 }
       
   701 
       
   702 // -------------------------------------------------------------------------------------------------
       
   703 // CVideoPlaybackControlsTest::TvOutConnected
       
   704 // -------------------------------------------------------------------------------------------------
       
   705 //
       
   706 TInt CVideoPlaybackControlsTest::TvOutConnected()
       
   707 {
       
   708     MPX_DEBUG(_L("CVideoPlaybackControlsTest::TvOutConnected()"));
       
   709 
       
   710     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdTvOutConnected ) );
       
   711 
       
   712     return result;
       
   713 }
       
   714 
       
   715 // -------------------------------------------------------------------------------------------------
       
   716 // CVideoPlaybackControlsTest::TvOutDisconnected
       
   717 // -------------------------------------------------------------------------------------------------
       
   718 //
       
   719 TInt CVideoPlaybackControlsTest::TvOutDisconnected()
       
   720 {
       
   721     MPX_DEBUG(_L("CVideoPlaybackControlsTest::TvOutDisconnected()"));
       
   722 
       
   723     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdTvOutDisconnected ) );
       
   724 
       
   725     return result;
       
   726 }
       
   727 
       
   728 // -------------------------------------------------------------------------------------------------
       
   729 // CVideoPlaybackControlsTest::HandleErrors
       
   730 // -------------------------------------------------------------------------------------------------
       
   731 //
       
   732 TInt CVideoPlaybackControlsTest::HandleErrors()
       
   733 {
       
   734     MPX_DEBUG(_L("CVideoPlaybackControlsTest::HandleErrors()"));
       
   735 
       
   736     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdHandleErrors ) );
       
   737 
       
   738     return result;
       
   739 }
       
   740 
       
   741 // -------------------------------------------------------------------------------------------------
       
   742 // CVideoPlaybackControlsTest::SoftkeyPressed
       
   743 // -------------------------------------------------------------------------------------------------
       
   744 //
       
   745 TInt CVideoPlaybackControlsTest::SoftkeyPressed( CStifItemParser&  aItem )
       
   746 {
       
   747     MPX_DEBUG(_L("CVideoPlaybackControlsTest::SoftkeyPressed()"));
       
   748 
       
   749     TInt key = 0;
       
   750 
       
   751     TInt result = aItem.GetNextInt( key );
       
   752 
       
   753     MPX_TRAP( result, iController->HandleEventL( EMPXControlCmdSoftKeyPressed, key ) );
       
   754 
       
   755     return result;
       
   756 }
       
   757 
       
   758 // -------------------------------------------------------------------------------------------------
       
   759 // CVideoPlaybackControlsTest::ShowControls
       
   760 // -------------------------------------------------------------------------------------------------
       
   761 //
       
   762 TInt CVideoPlaybackControlsTest::ShowControls()
       
   763 {
       
   764     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ShowControls()"));
       
   765 
       
   766     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdShowControls ) );
       
   767 
       
   768     return result;
       
   769 }
       
   770 
       
   771 // -------------------------------------------------------------------------------------------------
       
   772 // CVideoPlaybackControlsTest::ToggleVisibility
       
   773 // -------------------------------------------------------------------------------------------------
       
   774 //
       
   775 TInt CVideoPlaybackControlsTest::ToggleVisibility()
       
   776 {
       
   777     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ToggleVisibility()"));
       
   778 
       
   779     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdToggleVisibility ) );
       
   780 
       
   781     return result;
       
   782 }
       
   783 
       
   784 // -------------------------------------------------------------------------------------------------
       
   785 // CVideoPlaybackControlsTest::HandleBackgroundEvnet
       
   786 // -------------------------------------------------------------------------------------------------
       
   787 //
       
   788 TInt CVideoPlaybackControlsTest::HandleBackgroundEvnet()
       
   789 {
       
   790     MPX_DEBUG(_L("CVideoPlaybackControlsTest::HandleBackgroundEvnet()"));
       
   791 
       
   792     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdHandleBackgroundEvent ) );
       
   793 
       
   794     return result;
       
   795 }
       
   796 
       
   797 // -------------------------------------------------------------------------------------------------
       
   798 // CVideoPlaybackControlsTest::GetFileNameAndPath
       
   799 // -------------------------------------------------------------------------------------------------
       
   800 //
       
   801 TFileName CVideoPlaybackControlsTest::GetFileNameAndPath( TDesC& aFileName )
       
   802 {
       
   803     MPX_DEBUG(_L("CMpxVideoPlayer_AppUiEngineTester::GetFileNameAndPath()"));
       
   804 
       
   805     TFileName fullPath;
       
   806 
       
   807 #ifdef __WINSCW__
       
   808     _LIT( KVideoTestPath, "c:\\data\\Videos\\" );
       
   809 #else
       
   810     _LIT( KVideoTestPath, "e:\\testing\\data\\" );
       
   811 #endif
       
   812 
       
   813     _LIT( KStreamingPrefix, "rtsp:" );
       
   814 
       
   815     if ( aFileName.Find( KStreamingPrefix ) < 0 )
       
   816     {
       
   817         fullPath.Append( KVideoTestPath );
       
   818     }
       
   819 
       
   820     fullPath.Append( aFileName );
       
   821 
       
   822     return fullPath;
       
   823 }
       
   824 
       
   825 // -------------------------------------------------------------------------------------------------
       
   826 // CVideoPlaybackControlsTest::ShowMediaDetailsViewer
       
   827 // -------------------------------------------------------------------------------------------------
       
   828 //
       
   829 TInt CVideoPlaybackControlsTest::ShowMediaDetailsViewer()
       
   830 {
       
   831     MPX_DEBUG(_L("CVideoPlaybackControlsTest::ShowMediaDetailsViewer()"));
       
   832 
       
   833     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdShowFileDetailsViewer ) );
       
   834 
       
   835     return result;
       
   836 }
       
   837 
       
   838 // -------------------------------------------------------------------------------------------------
       
   839 // CVideoPlaybackControlsTest::CloseMediaDetailsViewer
       
   840 // -------------------------------------------------------------------------------------------------
       
   841 //
       
   842 TInt CVideoPlaybackControlsTest::CloseMediaDetailsViewer()
       
   843 {
       
   844     MPX_DEBUG(_L("CVideoPlaybackControlsTest::CloseMediaDetailsViewer()"));
       
   845 
       
   846     MPX_TRAPD( result, iController->HandleEventL( EMPXControlCmdCloseFileDetailsViewer ) );
       
   847 
       
   848     return result;
       
   849 }
       
   850 
       
   851 // ========================== OTHER EXPORTED FUNCTIONS =============================================
       
   852 // None
       
   853 
       
   854 //  [End of File] - Do not remove