musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/ui_mpxmusicplayertest.cpp
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 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:  Cmpxmusicplayertest test class for STIF Test Framework TestScripter.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <Stiftestinterface.h>
       
    21 #include <SettingServerClient.h>
       
    22 #include "ui_mpxmusicplayertest.h"
       
    23 
       
    24 #include <COEAUI.H>
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // Cmpxmusicplayertest::Cmpxmusicplayertest
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 Cmpxmusicplayertest::Cmpxmusicplayertest(
       
    34     CTestModuleIf& aTestModuleIf ):
       
    35         CScriptBase( aTestModuleIf )
       
    36     {
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Cmpxmusicplayertest::ConstructL
       
    41 // Symbian 2nd phase constructor can leave.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 void Cmpxmusicplayertest::ConstructL()
       
    45     {
       
    46     iLog = CStifLogger::NewL( KmpxmusicplayertestLogPath,
       
    47                           KmpxmusicplayertestLogFile,
       
    48                           CStifLogger::ETxt,
       
    49                           CStifLogger::EFile,
       
    50                           EFalse );
       
    51 
       
    52 	// Print title of the test case
       
    53     TName title;
       
    54     TestModuleIf().GetTestCaseTitleL(title);
       
    55     iLog->Log(_L(" "));
       
    56     iLog->Log(_L("[Title] %S"), &title);
       
    57     
       
    58     //=================================added UI controler
       
    59     iEdwinTestControl = CEdwinTestControl::NewL();
       
    60 //    CleanupStack::PushL( iEdwinTestControl );
       
    61     CCoeEnv::Static()->AppUi()->AddToStackL( iEdwinTestControl );
       
    62     iEdwinTestControl->MakeVisible(ETrue);
       
    63 //    CleanupStack::Pop( iEdwinTestControl );
       
    64     //=================================added UI controler
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Cmpxmusicplayertest::NewL
       
    69 // Two-phased constructor.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 Cmpxmusicplayertest* Cmpxmusicplayertest::NewL(
       
    73     CTestModuleIf& aTestModuleIf )
       
    74     {
       
    75     Cmpxmusicplayertest* self = new (ELeave) Cmpxmusicplayertest( aTestModuleIf );
       
    76 
       
    77     CleanupStack::PushL( self );
       
    78     self->ConstructL();
       
    79     CleanupStack::Pop();
       
    80     return self;
       
    81     }
       
    82 // function from MMPXCHelperObserver
       
    83 void Cmpxmusicplayertest::DialogDismissedL( TInt aButtonId )
       
    84     {
       
    85     iLog->Log(_L("MProgressDialogCallback::DialogDismissedL is called,with a TInt aButtonId %d pressed."),aButtonId);
       
    86     switch(aButtonId)
       
    87     	{
       
    88     	case EAknSoftkeyOk:
       
    89     	case EAknSoftkeySelect:
       
    90     	case EAknSoftkeyYes:
       
    91     		if(iEdwinTestControl)
       
    92     			{
       
    93     			iEdwinTestControl->DrawDeferred();
       
    94     			}
       
    95     		break;
       
    96     	case EAknSoftkeyCancel:
       
    97     		//TInt err = UiHelperDismissWaitNoteL();
       
    98     		TInt err = KErrNone;  
       
    99 		    TRAP(err,iUiHelper->DismissWaitNoteL());
       
   100     		iLog->Log(_L("EAknSoftkeyCancel is pressed. %d returned."),err);
       
   101     		break;		
       
   102     	default:
       
   103     		iLog->Log(_L("Nothing is done."));
       
   104     		break;	
       
   105     	}
       
   106     }
       
   107 
       
   108 // function from MEikCommandObserver
       
   109 void Cmpxmusicplayertest::ProcessCommandL(TInt aCommandId)
       
   110     {
       
   111     iLog->Log(_L("MEikCommandObserver::ProcessCommandL is called,with a TInt aCommandId %d"),aCommandId);
       
   112     }
       
   113 
       
   114 // function from MMPXCHelperObserver
       
   115 void Cmpxmusicplayertest::HandleOperationCompleteL( TCHelperOperation aOperation,
       
   116         											TInt aErr,
       
   117         											void* /*aArgument*/ )
       
   118     {
       
   119     switch( aOperation )
       
   120     	{
       
   121     	case EAddOp:
       
   122     		iLog->Log(_L("A playlist is created with an error %d returned."),		aErr);
       
   123     		break;
       
   124     	case EDeleteOp:	
       
   125     		iLog->Log(_L("A playlist is deleted with an error %d returned."),		aErr);
       
   126     		break;
       
   127     	case ESetOp:	
       
   128     	    iLog->Log(_L("A playlist is set with an error %d returned."),			aErr);
       
   129     	    break;
       
   130     	case EEmbeddedOpenOp:	
       
   131     	    iLog->Log(_L("A playlist is embeded open with an error %d returned."),	aErr);
       
   132     	    break;
       
   133     	case EMoveOp:	
       
   134     	    iLog->Log(_L("A playlist is moved with an error %d returned."),			aErr);
       
   135     	    break;   
       
   136     	case EExportPlaylistOp:	
       
   137     	    iLog->Log(_L("A playlist is exported with an error %d returned."),		aErr);
       
   138     	    break;  
       
   139     	case ERenameOp:	
       
   140     	    iLog->Log(_L("A playlist is renamed with an error %d returned."),		aErr);
       
   141     	    break;
       
   142     	case EReorderPlaylistOp:	
       
   143     	    iLog->Log(_L("A playlist is reordered with an error %d returned."),		aErr);
       
   144     	    break;
       
   145     	default:
       
   146     		iLog->Log(_L("Nothing is done."));
       
   147     		break;
       
   148     	}     
       
   149     }
       
   150 
       
   151 
       
   152 // Destructor
       
   153 Cmpxmusicplayertest::~Cmpxmusicplayertest()
       
   154     {
       
   155     // Delete resources allocated from test methods
       
   156     Delete();
       
   157     // Delete logger
       
   158     delete iLog;
       
   159     
       
   160     //added 28,10,2008
       
   161     if(iEdwinTestControl)
       
   162     	{
       
   163     	CCoeEnv::Static()->AppUi()->RemoveFromStack( iEdwinTestControl );
       
   164     	delete iEdwinTestControl;
       
   165     	}
       
   166    
       
   167     }
       
   168 
       
   169 // ======== GLOBAL FUNCTIONS ========
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // LibEntryL is a polymorphic Dll entry point.
       
   173 // Returns: CScriptBase: New CScriptBase derived object
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 EXPORT_C CScriptBase* LibEntryL(
       
   177     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   178     {
       
   179     return ( CScriptBase* ) Cmpxmusicplayertest::NewL( aTestModuleIf );
       
   180     }