mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/src/ui_mediaplayersettingsenginetestBlocks.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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: Cui_mediaplayersettingsenginetest block implementation for STIF Test Framework TestScripter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES] - do not remove
       
    21 #include <e32svr.h>
       
    22 #include <StifParser.h>
       
    23 #include <Stiftestinterface.h>
       
    24 #include "ui_mediaplayersettingsenginetest.h"
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 //extern  ?external_data;
       
    28 
       
    29 // EXTERNAL FUNCTION PROTOTYPES  
       
    30 //extern ?external_function( ?arg_type,?arg_type );
       
    31 
       
    32 // CONSTANTS
       
    33 //const ?type ?constant_var = ?constant;
       
    34 
       
    35 // MACROS
       
    36 //#define ?macro ?macro_def
       
    37 
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 //const ?type ?constant_var = ?constant;
       
    40 //#define ?macro_name ?macro_def
       
    41 
       
    42 // MODULE DATA STRUCTURES
       
    43 //enum ?declaration
       
    44 //typedef ?declaration
       
    45 
       
    46 // LOCAL FUNCTION PROTOTYPES
       
    47 //?type ?function_name( ?arg_type, ?arg_type );
       
    48 
       
    49 // FORWARD DECLARATIONS
       
    50 //class ?FORWARD_CLASSNAME;
       
    51 
       
    52 // ============================= LOCAL FUNCTIONS ===============================
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // ?function_name ?description.
       
    56 // ?description
       
    57 // Returns: ?value_1: ?description
       
    58 //          ?value_n: ?description_line1
       
    59 //                    ?description_line2
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 /*
       
    63 ?type ?function_name(
       
    64     ?arg_type arg,  // ?description
       
    65     ?arg_type arg)  // ?description
       
    66     {
       
    67 
       
    68     ?code  // ?comment
       
    69 
       
    70     // ?comment
       
    71     ?code
       
    72     }
       
    73 */
       
    74 
       
    75 // ============================ MEMBER FUNCTIONS ===============================
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // Cui_mediaplayersettingsenginetest::Delete
       
    79 // Delete here all resources allocated and opened from test methods. 
       
    80 // Called from destructor. 
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void Cui_mediaplayersettingsenginetest::Delete() 
       
    84     {
       
    85 
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // Cui_mediaplayersettingsenginetest::RunMethodL
       
    90 // Run specified method. Contains also table of test mothods and their names.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 TInt Cui_mediaplayersettingsenginetest::RunMethodL( 
       
    94     CStifItemParser& aItem ) 
       
    95     {
       
    96 
       
    97     static TStifFunctionInfo const KFunctions[] =
       
    98         {  
       
    99         // Copy this line for every implemented function.
       
   100         // First string is the function name used in TestScripter script file.
       
   101         // Second is the actual implementation member function. 
       
   102         ENTRY( "Example", Cui_mediaplayersettingsenginetest::ExampleL ),
       
   103         ENTRY( "CreateCMPSettingsModel", Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel ),
       
   104         ENTRY( "DestructCMPSettingsModel", Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel ),
       
   105         ENTRY( "MPSListImplementations", Cui_mediaplayersettingsenginetest::MPSListImplementations ),
       
   106         //ADD NEW ENTRY HERE
       
   107         // [test cases entries] - Do not remove
       
   108 
       
   109         };
       
   110 
       
   111     const TInt count = sizeof( KFunctions ) / 
       
   112                         sizeof( TStifFunctionInfo );
       
   113 
       
   114     return RunInternalL( KFunctions, count, aItem );
       
   115 
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // Cui_mediaplayersettingsenginetest::ExampleL
       
   120 // Example test method function.
       
   121 // (other items were commented in a header).
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 TInt Cui_mediaplayersettingsenginetest::ExampleL( CStifItemParser& aItem )
       
   125     {
       
   126 
       
   127     // Print to UI
       
   128     _LIT( Kui_mediaplayersettingsenginetest, "ui_mediaplayersettingsenginetest" );
       
   129     _LIT( KExample, "In Example" );
       
   130     TestModuleIf().Printf( 0, Kui_mediaplayersettingsenginetest, KExample );
       
   131     // Print to log file
       
   132     iLog->Log( KExample );
       
   133 
       
   134     TInt i = 0;
       
   135     TPtrC string;
       
   136     _LIT( KParam, "Param[%i]: %S" );
       
   137     while ( aItem.GetNextString ( string ) == KErrNone )
       
   138         {
       
   139         TestModuleIf().Printf( i, Kui_mediaplayersettingsenginetest, 
       
   140                                 KParam, i, &string );
       
   141         i++;
       
   142         }
       
   143 
       
   144     return KErrNone;
       
   145 
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel
       
   150 // CreateCMPSettingsModel test method function.
       
   151 // (other items were commented in a header).
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 TInt Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel( CStifItemParser& /*aItem*/ )
       
   155     {
       
   156     TInt err = KErrNone;
       
   157  
       
   158     const TUid KSettingsModelForROPUid = {KMPSettEngImplUidROP};
       
   159     TRAP(err, iRopSettingsModel = CMPSettingsModel::NewL(KSettingsModelForROPUid));
       
   160   
       
   161     if (err==KErrNone)
       
   162     	{
       
   163     	iLog->Log( _L("Create CMPSettingsModel Success!"));
       
   164     	}
       
   165     else
       
   166     	{
       
   167     	iLog->Log( _L("Create CMPSettingsModel Faile! %d"), err );
       
   168     	}
       
   169     return  err ;
       
   170     }
       
   171 // -----------------------------------------------------------------------------
       
   172 // Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel
       
   173 // DestructCMPSettingsModel test method function.
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 TInt Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel( CStifItemParser& /*aItem*/ )
       
   178     {
       
   179     TInt err = KErrNone;
       
   180     if(iRopSettingsModel)
       
   181 	   {
       
   182 		//REComSession::FinalClose();
       
   183 	   delete iRopSettingsModel;
       
   184 	   iRopSettingsModel = NULL;
       
   185 	   }
       
   186 	iLog->Log( _L("Create CMPSettingsModel Success!"));
       
   187     return err;
       
   188     }
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // Cui_mediaplayersettingsenginetest::MPSListImplementations
       
   192 // MPSListImplementations test method function.
       
   193 // (other items were commented in a header).
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 TInt Cui_mediaplayersettingsenginetest::MPSListImplementations( CStifItemParser& /*aItem*/ )
       
   197     {
       
   198     iLog->Log( _L("Test ListImplementationsL,begins!") );
       
   199     TInt result( KErrNone );
       
   200     RImplInfoPtrArray impInfoArray;
       
   201     
       
   202     TRAP( result, CMPSettingsModel::ListImplementationsL(impInfoArray));
       
   203   
       
   204     if( result == KErrNone )
       
   205     	{
       
   206     	iLog->Log( _L("Succeeds!The details of the implementation array are listed here:") );
       
   207     	for( TInt i=0;i<impInfoArray.Count();i++ )
       
   208     		{
       
   209     		iLog->Log( _L("The class name of impInfoArray[%d] is:"),i );
       
   210     		iLog->Log( impInfoArray[i]->DisplayName() );
       
   211     		iLog->Log( _L("Its uid is %d."),impInfoArray[i]->ImplementationUid().iUid );
       
   212     		}
       
   213     	iLog->Log( _L("End!") );
       
   214     	}
       
   215     else
       
   216     	{
       
   217     	iLog->Log( _L("Fails,error %d returns!End!"),result );
       
   218     	}
       
   219     impInfoArray.Close();
       
   220     return result;
       
   221     }
       
   222 
       
   223 // -----------------------------------------------------------------------------
       
   224 // Cui_mediaplayersettingsenginetest::?member_function
       
   225 // ?implementation_description
       
   226 // (other items were commented in a header).
       
   227 // -----------------------------------------------------------------------------
       
   228 //
       
   229 /*
       
   230 TInt Cui_mediaplayersettingsenginetest::?member_function(
       
   231    CItemParser& aItem )
       
   232    {
       
   233 
       
   234    ?code
       
   235 
       
   236    }
       
   237 */
       
   238 
       
   239 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   240 // None
       
   241 
       
   242 //  [End of File] - Do not remove