musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ui_mpxmusicplayercommonuitestBlocks.cpp
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     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:  CMPXMusicPlayerCommonuiStifTest test class 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_mpxmusicplayercommonuitest.h"
       
    25 
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CMPXMusicPlayerCommonuiStifTest ::Delete
       
    32 // Delete here all resources allocated and opened from test methods. 
       
    33 // Called from destructor. 
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 void CMPXMusicPlayerCommonuiStifTest::Delete() 
       
    37     {
       
    38 
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CMPXMusicPlayerCommonuiStifTest ::RunMethodL
       
    43 // Run specified method. Contains also table of test mothods and their names.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TInt CMPXMusicPlayerCommonuiStifTest::RunMethodL( 
       
    47     CStifItemParser& aItem ) 
       
    48     {
       
    49 
       
    50     static TStifFunctionInfo const KFunctions[] =
       
    51         {  
       
    52         // Copy this line for every implemented function.
       
    53         // First string is the function name used in TestScripter script file.
       
    54         // Second is the actual implementation member function. 
       
    55         ENTRY( "Example", CMPXMusicPlayerCommonuiStifTest ::ExampleL ),
       
    56         //test functions for mpxalbumartutil.h
       
    57         ENTRY( "CMPXAlbumArtUtilCreate", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCreate ),
       
    58         ENTRY( "CMPXAlbumArtUtilDestructor", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilDestructor ),
       
    59         ENTRY( "CMPXAlbumArtUtilExtractAlbumArtL", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilExtractAlbumArtL ),
       
    60         ENTRY( "CMPXAlbumArtUtilCancelRequest", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCancelRequest ),
       
    61         //test functions for mpxlbxextendedfeatures.h
       
    62         ENTRY( "CMPXLbxExtendedFeaturesCreate", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesCreate ),
       
    63         ENTRY( "CMPXLbxExtendedFeaturesDestructor", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesDestructor ),
       
    64         ENTRY( "CMPXLbxExtendedFeaturesHandleLbxKeyEventL", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesHandleLbxKeyEventL ),
       
    65         ENTRY( "CMPXLbxExtendedFeaturesEnableSpeedScrollL", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesEnableSpeedScrollL ),
       
    66         ENTRY( "CMPXLbxExtendedFeaturesSpeedNaviUpdating", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesSpeedNaviUpdating ),
       
    67 
       
    68         //ADD NEW ENTRY HERE
       
    69         // [test cases entries] - Do not remove
       
    70 
       
    71         };
       
    72 
       
    73     const TInt count = sizeof( KFunctions ) / 
       
    74                         sizeof( TStifFunctionInfo );
       
    75 
       
    76     return RunInternalL( KFunctions, count, aItem );
       
    77 
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CMPXMusicPlayerCommonuiStifTest ::ExampleL
       
    82 // Example test method function.
       
    83 // (other items were commented in a header).
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 TInt CMPXMusicPlayerCommonuiStifTest::ExampleL( CStifItemParser& aItem )
       
    87     {
       
    88 
       
    89 	    // Print to UI
       
    90 	    _LIT( Kui_mpxmusicplayercommonuitest, "ui_mpxmusicplayercommonuitest" );
       
    91 	    _LIT( KExample, "In Example" );
       
    92 	    TestModuleIf().Printf( 0, Kui_mpxmusicplayercommonuitest, KExample );
       
    93 	    // Print to log file
       
    94 	    iLog->Log( KExample );
       
    95 	
       
    96 	    TInt i = 0;
       
    97 	    TPtrC string;
       
    98 	    _LIT( KParam, "Param[%i]: %S" );
       
    99 	    while ( aItem.GetNextString ( string ) == KErrNone )
       
   100 	        {
       
   101 	          TestModuleIf().Printf( i, Kui_mpxmusicplayercommonuitest, 
       
   102 	                                KParam, i, &string );
       
   103 	          i++;
       
   104 	        }
       
   105 	
       
   106 	    return KErrNone;
       
   107 
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCreate
       
   112 // ?implementation_description
       
   113 // (other items were commented in a header).
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate( CStifItemParser& /*aItem*/ )
       
   117     {
       
   118     TInt err=KErrNone;
       
   119    
       
   120     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate"));
       
   121     
       
   122     TRAP( err , iMPXAlbumArtUtil = CMPXAlbumArtUtil::NewL() );
       
   123     
       
   124 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate returned: %d"), err);
       
   125     return err;
       
   126     }
       
   127 
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilDestructor
       
   131 // ?implementation_description
       
   132 // (other items were commented in a header).
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor( CStifItemParser& /*aItem*/ )
       
   136     {
       
   137     TInt err=KErrNone;
       
   138     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor begin:"));
       
   139     
       
   140     if( iMPXAlbumArtUtil != NULL )
       
   141     	{
       
   142 		 delete iMPXAlbumArtUtil;
       
   143 		 iMPXAlbumArtUtil = NULL;
       
   144     	}
       
   145 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor end."));
       
   146     return err;
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilExtractAlbumArtL
       
   151 // ?implementation_description
       
   152 // (other items were commented in a header).
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL( CStifItemParser& aItem )
       
   156     {
       
   157     TInt err=KErrNone;
       
   158     TPtrC string;
       
   159    // CFbsBitmap* bitmap(NULL);
       
   160     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL"));
       
   161     
       
   162     while ( aItem.GetNextString( string ) == KErrNone )
       
   163            {
       
   164 	    	TBuf<120> uri;
       
   165 	    	uri.Append(Kui_mpxmusicplayercommonuitestDataPath);
       
   166 	    	uri.Append(string);
       
   167 	    	while ( aItem.GetNextString( string ) == KErrNone )
       
   168 	    		 {
       
   169 		    	  TBuf<120> KFileName;
       
   170 		    	  KFileName.Append(Kui_mpxmusicplayercommonuitestDataPath);
       
   171 		    	  KFileName.Append(string);
       
   172 				  CMPXMedia* media = CMPXMedia::NewL();
       
   173 				  CleanupStack::PushL(media);
       
   174 				  media->SetTObjectValueL(KMPXMediaMusicAlbumArtFileName, KFileName);
       
   175 				  media->SetTObjectValueL(KMPXMediaGeneralUri,uri);
       
   176 				  TRAP(err,iMPXAlbumArtUtil->ExtractAlbumArtL(*media,*this,TSize(1,1)));
       
   177 				  CleanupStack::PopAndDestroy(media);
       
   178 			      iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL returned: %d"), err);
       
   179 			    }
       
   180            }
       
   181     
       
   182     return err;
       
   183     }
       
   184 
       
   185 
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCancelRequest
       
   189 // ?implementation_description
       
   190 // (other items were commented in a header).
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCancelRequest( CStifItemParser& /*aItem*/ )
       
   194     {
       
   195     TInt err=KErrNone;
       
   196     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCancelRequest begin:"));
       
   197     
       
   198     iMPXAlbumArtUtil->CancelRequest();
       
   199     
       
   200 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CancelRequest end."));
       
   201 	
       
   202     return err;
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesCreate
       
   207 // ?implementation_description
       
   208 // (other items were commented in a header).
       
   209 // -----------------------------------------------------------------------------
       
   210 //
       
   211 TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesCreate( CStifItemParser& /*aItem*/ )
       
   212     {
       
   213     TInt err=KErrNone;
       
   214     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesCreate"));
       
   215     
       
   216     CEikTextListBox* listBox = new (ELeave) CEikTextListBox;
       
   217     TRAP( err,iMPXLbxExtendedFeatures = CMPXLbxExtendedFeatures::NewL(listBox) );
       
   218     
       
   219     if ( listBox != NULL )
       
   220     	{
       
   221 		 delete listBox;
       
   222 		 listBox = NULL;
       
   223     	}
       
   224 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::NewL returned: %d"), err);
       
   225     return err;
       
   226     }
       
   227 
       
   228 // -----------------------------------------------------------------------------
       
   229 // CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor
       
   230 // ?implementation_description
       
   231 // (other items were commented in a header).
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor( CStifItemParser& /*aItem*/ )
       
   235     {
       
   236     TInt err=KErrNone;
       
   237     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor begin:"));
       
   238     
       
   239     if( iMPXLbxExtendedFeatures != NULL )
       
   240     	{
       
   241 		 delete iMPXLbxExtendedFeatures;
       
   242 		 iMPXLbxExtendedFeatures = NULL;
       
   243     	}
       
   244     
       
   245 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::Destructor end."));
       
   246     return err;
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesHandleLbxKeyEventL
       
   251 // ?implementation_description
       
   252 // (other items were commented in a header).
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesHandleLbxKeyEventL( CStifItemParser& /*aItem*/ )
       
   256     {
       
   257     TInt err=KErrNone;
       
   258     TKeyEvent keyEvent;
       
   259     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesHandleLbxKeyEventL"));
       
   260     
       
   261     iMPXLbxExtendedFeatures->EnableSpeedScrollL(ETrue);
       
   262     TRAP( err , iMPXLbxExtendedFeatures->HandleLbxKeyEventL(keyEvent,EEventNull) );
       
   263     
       
   264 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest ::HandleLbxKeyEventL returned: %d"), err);
       
   265     return err;
       
   266     }
       
   267 
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesEnableSpeedScrollL
       
   271 // ?implementation_description
       
   272 // (other items were commented in a header).
       
   273 // -----------------------------------------------------------------------------
       
   274 //
       
   275 TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesEnableSpeedScrollL( CStifItemParser& /*aItem*/ )
       
   276     {
       
   277     TInt err=KErrNone;
       
   278     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesEnableSpeedScrollL"));
       
   279     
       
   280     TRAP( err,iMPXLbxExtendedFeatures->EnableSpeedScrollL(ETrue) );
       
   281     
       
   282 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::EnableSpeedScrollL returned: %d"), err);
       
   283     return err;
       
   284     }
       
   285 
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesSpeedNaviUpdating
       
   289 // ?implementation_description
       
   290 // (other items were commented in a header).
       
   291 // -----------------------------------------------------------------------------
       
   292 //
       
   293 TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesSpeedNaviUpdating( CStifItemParser& /*aItem*/ )
       
   294     {
       
   295     TInt err=KErrNone;
       
   296     iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesSpeedNaviUpdating begin:"));
       
   297     
       
   298     iMPXLbxExtendedFeatures->SpeedNaviUpdating(ETrue);
       
   299     
       
   300 	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::SpeedNaviUpdating end."));
       
   301     return err;
       
   302     }
       
   303 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   304 // None
       
   305 
       
   306 //  [End of File] - Do not remove