videoplayback/videoplaybackviews/tsrc/ut_userinputhandlertest/src/userinputhandlertestBlocks.cpp
branchRCL_3
changeset 9 5294c000a26d
parent 8 ce5ada96ab30
equal deleted inserted replaced
8:ce5ada96ab30 9:5294c000a26d
    13 *
    13 *
    14 * Description:  Video Playback User Input Handler Test class for STIF unit testing
    14 * Description:  Video Playback User Input Handler Test class for STIF unit testing
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 6 %
    18 // Version : %version: ou1cpsw#7 %
    19 
    19 
    20 
    20 
    21 // [INCLUDE FILES] - do not remove
    21 // [INCLUDE FILES] - do not remove
    22 #include <e32svr.h>
    22 #include <e32svr.h>
    23 #include <e32std.h>
    23 #include <e32std.h>
   110         ENTRY( "PointerEvent", CUserinputhandlertest::PointerEvent ),
   110         ENTRY( "PointerEvent", CUserinputhandlertest::PointerEvent ),
   111         ENTRY( "KeyEvent", CUserinputhandlertest::KeyEvent ),
   111         ENTRY( "KeyEvent", CUserinputhandlertest::KeyEvent ),
   112         ENTRY( "MediaKeyEvent", CUserinputhandlertest::MediaKeyEvent ),
   112         ENTRY( "MediaKeyEvent", CUserinputhandlertest::MediaKeyEvent ),
   113         ENTRY( "SetForeground", CUserinputhandlertest::SetForeground ),
   113         ENTRY( "SetForeground", CUserinputhandlertest::SetForeground ),
   114         ENTRY( "CheckExpectedResult",CUserinputhandlertest::CheckExpectedResult ),
   114         ENTRY( "CheckExpectedResult",CUserinputhandlertest::CheckExpectedResult ),
   115         ENTRY( "CheckExpectedCommand",CUserinputhandlertest::CheckExpectedCommand ),
   115         ENTRY( "CheckExpectedCommand",CUserinputhandlertest::CheckExpectedCommand ),      
   116         ENTRY( "TvOutEvent",CUserinputhandlertest::TvOutEvent ),
       
   117         ENTRY( "CheckBacklightState",CUserinputhandlertest::CheckBacklightState ),        
       
   118     };
   116     };
   119 
   117 
   120     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
   118     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
   121 
   119 
   122     return RunInternalL( KFunctions, count, aItem );
   120     return RunInternalL( KFunctions, count, aItem );
   126 //   CUserinputhandlertest::CreateStubs
   124 //   CUserinputhandlertest::CreateStubs
   127 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   128 //
   126 //
   129 TInt CUserinputhandlertest::CreateStubsL( CStifItemParser&  aItem )
   127 TInt CUserinputhandlertest::CreateStubsL( CStifItemParser&  aItem )
   130 {
   128 {
   131     TInt tvOutConnected;
   129 
   132     TInt err = aItem.GetNextInt( tvOutConnected );
       
   133     //
   130     //
   134     // Stubs
   131     // Stubs
   135     //
   132     //
   136     iContainer = CMPXVideoPlaybackContainer::NewL();
   133     iContainer = CMPXVideoPlaybackContainer::NewL();
   137     iControl = CMPXVideoPlaybackControl::NewL();
   134     iControl = CMPXVideoPlaybackControl::NewL();
   138 
   135 
   139     //
   136     //
   140     // Class to be unit-tested
   137     // Class to be unit-tested
   141     //
   138     //
   142 	if ( err == KErrNone )
   139 
   143 	{
   140     iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( iContainer );
   144         iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( iContainer, tvOutConnected );
   141 
   145     }
       
   146 	
       
   147     return KErrNone;
   142     return KErrNone;
   148 }
   143 }
   149 
   144 
   150 
   145 
   151 // -------------------------------------------------------------------------------------------------
   146 // -------------------------------------------------------------------------------------------------
   551     }
   546     }
   552 
   547 
   553     return result;
   548     return result;
   554 }
   549 }
   555 
   550 
   556 // -------------------------------------------------------------------------------------------------
   551 
   557 // CUserinputhandlertest::TvOutEvent
       
   558 // -------------------------------------------------------------------------------------------------
       
   559 //
       
   560 TInt CUserinputhandlertest::TvOutEvent( CStifItemParser& aItem )
       
   561 {
       
   562     MPX_DEBUG(_L("CUserinputhandlertest::CheckBacklightState()"));
       
   563 
       
   564     TInt tvOutEvent;
       
   565     
       
   566     TInt result = aItem.GetNextInt( tvOutEvent );
       
   567 
       
   568     iUserInputHandler->HandleTVOutEvent( tvOutEvent );
       
   569     
       
   570     return result;
       
   571 }
       
   572 
       
   573 // -------------------------------------------------------------------------------------------------
       
   574 // CUserinputhandlertest::CheckBacklightState
       
   575 // -------------------------------------------------------------------------------------------------
       
   576 //
       
   577 TInt CUserinputhandlertest::CheckBacklightState( CStifItemParser& aItem )
       
   578 {
       
   579     MPX_DEBUG(_L("CUserinputhandlertest::CheckBacklightState()"));
       
   580 
       
   581     TLightStatus backlightState = ELightStatusUnknown;
       
   582     TInt status;
       
   583     
       
   584     CHWRMLight* light = NULL;
       
   585     MPX_TRAPD( err, light = CHWRMLight::NewL() );
       
   586     backlightState = light->LightStatus( CHWRMLight::EPrimaryDisplay );
       
   587     delete light;
       
   588 
       
   589     TInt result = aItem.GetNextInt( status );
       
   590 
       
   591     if ( result == KErrNone && status == backlightState )
       
   592     {
       
   593         result = KErrNone;
       
   594     }
       
   595     else
       
   596     {
       
   597         MPX_DEBUG(_L("CheckBacklightState FAILED: expectedState=%d, actualState=%d]"),
       
   598                 backlightState, status );
       
   599 
       
   600         result = KErrArgument;
       
   601     }
       
   602 
       
   603     return result;
       
   604 }
       
   605 
   552 
   606 //  [End of File] - Do not remove
   553 //  [End of File] - Do not remove