instantmessagesalert/tsrc/testinstantmsgalert/src/testinstantmsgalertBlocks.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains testclass implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // [INCLUDE FILES] - do not remove
       
    19 #include <e32svr.h>
       
    20 #include <StifParser.h>
       
    21 #include <StifTestInterface.h>
       
    22 #include "testinstantmsgalert.h"
       
    23 
       
    24 
       
    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 // Ctestinstantmsgalert::Delete
       
    79 // Delete here all resources allocated and opened from test methods. 
       
    80 // Called from destructor. 
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void Ctestinstantmsgalert::Delete() 
       
    84     {
       
    85 
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // Ctestinstantmsgalert::RunMethodL
       
    90 // Run specified method. Contains also table of test mothods and their names.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 TInt Ctestinstantmsgalert::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", Ctestinstantmsgalert::ExampleL ),
       
   103         ENTRY( "CIMAlertManager_NewL", Ctestinstantmsgalert::CIMAlertManager_NewL ),
       
   104         ENTRY( "CIMAlertManager_PlayL", Ctestinstantmsgalert::CIMAlertManager_PlayL ),
       
   105         ENTRY( "CIMAlertManager_Stop", Ctestinstantmsgalert::CIMAlertManager_Stop ),
       
   106         ENTRY( "CIMAlertManager_SetVolume", Ctestinstantmsgalert::CIMAlertManager_SetVolume ),
       
   107         ENTRY( "CIMAlertManager_SetRingingType", Ctestinstantmsgalert::CIMAlertManager_SetRingingType ),
       
   108         ENTRY( "CIMAlertManager_SetVibra", Ctestinstantmsgalert::CIMAlertManager_SetVibra ),
       
   109         ENTRY( "CIMAlertManager_DoSetRingingType", Ctestinstantmsgalert::CIMAlertManager_DoSetRingingType ),
       
   110         ENTRY( "CIMAlertManager_ConvertVolume", Ctestinstantmsgalert::CIMAlertManager_ConvertVolume ),
       
   111         ENTRY( "CIMAlertManager_MapcInitComplete", Ctestinstantmsgalert::CIMAlertManager_MapcInitComplete ), 
       
   112         ENTRY( "CIMAlertManager_MapcPlayComplete", Ctestinstantmsgalert::CIMAlertManager_MapcPlayComplete ), 
       
   113         ENTRY( "CIMAlertManager_HandleKeyChange", Ctestinstantmsgalert::CIMAlertManager_HandleKeyChange ), 
       
   114         ENTRY( "CIMAlertManager_HandleNotifyInt", Ctestinstantmsgalert::CIMAlertManager_HandleNotifyInt ), 
       
   115         ENTRY( "CIMAlertManager_MatoPrepareComplete", Ctestinstantmsgalert::CIMAlertManager_MatoPrepareComplete ), 
       
   116         ENTRY( "CIMAlertManager_MatoPlayComplete", Ctestinstantmsgalert::CIMAlertManager_MatoPlayComplete ), 
       
   117         ENTRY( "CIMAlertManager_AddObserverL", Ctestinstantmsgalert::CIMAlertManager_AddObserverL ), 
       
   118         ENTRY( "CIMAlertManager_RemoveObserver", Ctestinstantmsgalert::CIMAlertManager_RemoveObserver ), 
       
   119         ENTRY( "CIMAlertManager_HandleError", Ctestinstantmsgalert::CIMAlertManager_HandleError ), 
       
   120 
       
   121         //ADD NEW ENTRY HERE
       
   122         // [test cases entries] - Do not remove
       
   123         };
       
   124 
       
   125     const TInt count = sizeof( KFunctions ) / 
       
   126                         sizeof( TStifFunctionInfo );
       
   127 
       
   128     return RunInternalL( KFunctions, count, aItem );
       
   129 
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // Ctestinstantmsgalert::ExampleL
       
   134 // Example test method function.
       
   135 // (other items were commented in a header).
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 TInt Ctestinstantmsgalert::ExampleL( CStifItemParser& aItem )
       
   139     {
       
   140 
       
   141     // Print to UI
       
   142     _LIT( Ktestinstantmsgalert, "testinstantmsgalert" );
       
   143     _LIT( KExample, "In Example" );
       
   144     TestModuleIf().Printf( 0, Ktestinstantmsgalert, KExample );
       
   145     // Print to log file
       
   146     iLog->Log( KExample );
       
   147 
       
   148     TInt i = 0;
       
   149     TPtrC string;
       
   150     _LIT( KParam, "Param[%i]: %S" );
       
   151     while ( aItem.GetNextString ( string ) == KErrNone )
       
   152         {
       
   153         TestModuleIf().Printf( i, Ktestinstantmsgalert, 
       
   154                                 KParam, i, &string );
       
   155         i++;
       
   156         }
       
   157 
       
   158     return KErrNone;
       
   159 
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // Ctestinstantmsgalert::CIMAlertManager_NewL
       
   164 // Example test method function.
       
   165 // (other items were commented in a header).
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 TInt Ctestinstantmsgalert::CIMAlertManager_NewL( CStifItemParser& aItem )
       
   169     {
       
   170     
       
   171     TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
       
   172     TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
       
   173     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   174     
       
   175     if(object)
       
   176         {
       
   177         delete object;
       
   178         return KErrNone;
       
   179         }
       
   180     else
       
   181         return KErrGeneral;
       
   182 
       
   183     }
       
   184 // -----------------------------------------------------------------------------
       
   185 // Ctestinstantmsgalert::CIMAlertManager_PlayL
       
   186 // Example test method function.
       
   187 // (other items were commented in a header).
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 TInt Ctestinstantmsgalert::CIMAlertManager_PlayL( CStifItemParser& aItem )
       
   191     {
       
   192     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   193     object->PlayL(5);
       
   194     delete object;
       
   195     return KErrNone;
       
   196 
       
   197     }
       
   198 // -----------------------------------------------------------------------------
       
   199 // Ctestinstantmsgalert::CIMAlertManager_SetVolume
       
   200 // Example test method function.
       
   201 // (other items were commented in a header).
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 TInt Ctestinstantmsgalert::CIMAlertManager_SetVolume( CStifItemParser& aItem )
       
   205     {
       
   206 
       
   207     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   208     object->SetVolume(5);
       
   209     delete object;
       
   210     return KErrNone;
       
   211 
       
   212 
       
   213     }
       
   214 // -----------------------------------------------------------------------------
       
   215 // Ctestinstantmsgalert::CIMAlertManager_SetRingingType
       
   216 // Example test method function.
       
   217 // (other items were commented in a header).
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 TInt Ctestinstantmsgalert::CIMAlertManager_SetRingingType( CStifItemParser& aItem )
       
   221     {
       
   222     
       
   223     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   224     object->SetRingingType(EProfileRingingTypeRingingOnce);
       
   225     delete object;
       
   226     return KErrNone;
       
   227 
       
   228     }
       
   229 // -----------------------------------------------------------------------------
       
   230 // Ctestinstantmsgalert::CIMAlertManager_SetVibra
       
   231 // Example test method function.
       
   232 // (other items were commented in a header).
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 TInt Ctestinstantmsgalert::CIMAlertManager_SetVibra( CStifItemParser& aItem )
       
   236     {
       
   237     
       
   238     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   239     object->SetVibra(ETrue);
       
   240     delete object;
       
   241     return KErrNone;
       
   242 
       
   243     }
       
   244 // -----------------------------------------------------------------------------
       
   245 // Ctestinstantmsgalert::CIMAlertManager_DoSetRingingType
       
   246 // Example test method function.
       
   247 // (other items were commented in a header).
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 TInt Ctestinstantmsgalert::CIMAlertManager_DoSetRingingType( CStifItemParser& aItem )
       
   251     {
       
   252     
       
   253     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   254     object->DoSetRingingType(EProfileRingingTypeRingingOnce);
       
   255     delete object;
       
   256     return KErrNone;
       
   257 
       
   258     }
       
   259 // -----------------------------------------------------------------------------
       
   260 // Ctestinstantmsgalert::CIMAlertManager_ConvertVolume
       
   261 // Example test method function.
       
   262 // (other items were commented in a header).
       
   263 // -----------------------------------------------------------------------------
       
   264 //
       
   265 TInt Ctestinstantmsgalert::CIMAlertManager_ConvertVolume( CStifItemParser& aItem )
       
   266     {
       
   267     
       
   268     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   269     object->ConvertVolume(5);
       
   270     delete object;
       
   271     return KErrNone;
       
   272 
       
   273     }
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // Ctestinstantmsgalert::CIMAlertManager_Stop
       
   277 // Example test method function.
       
   278 // (other items were commented in a header).
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 TInt Ctestinstantmsgalert::CIMAlertManager_Stop( CStifItemParser& aItem )
       
   282     {
       
   283     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   284     object->Stop();
       
   285     delete object;
       
   286     return KErrNone;
       
   287 
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // Ctestinstantmsgalert::CIMAlertManager_MapcInitComplete
       
   292 // Example test method function.
       
   293 // (other items were commented in a header).
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 TInt Ctestinstantmsgalert::CIMAlertManager_MapcInitComplete( CStifItemParser& aItem )
       
   297     {
       
   298     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   299     object->MapcInitComplete(KErrNone,5);
       
   300     delete object;
       
   301     return KErrNone;
       
   302 
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // Ctestinstantmsgalert::CIMAlertManager_MapcPlayComplete
       
   307 // Example test method function.
       
   308 // (other items were commented in a header).
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 TInt Ctestinstantmsgalert::CIMAlertManager_MapcPlayComplete( CStifItemParser& aItem )
       
   312     {
       
   313     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   314     object->MapcPlayComplete(KErrNone);
       
   315     delete object;
       
   316     return KErrNone;
       
   317 
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // Ctestinstantmsgalert::CIMAlertManager_HandleKeyChange
       
   322 // Example test method function.
       
   323 // (other items were commented in a header).
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 TInt Ctestinstantmsgalert::CIMAlertManager_HandleKeyChange( CStifItemParser& aItem )
       
   327     {
       
   328     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   329     TUpdatedKey temp;
       
   330     temp.iValue =  ECoreAppUIsStopTonePlaying;
       
   331     object->HandleKeyChange(temp);
       
   332     delete object;
       
   333     return KErrNone;
       
   334 
       
   335     }
       
   336 // -----------------------------------------------------------------------------
       
   337 // Ctestinstantmsgalert::CIMAlertManager_HandleNotifyInt
       
   338 // Example test method function.
       
   339 // (other items were commented in a header).
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 TInt Ctestinstantmsgalert::CIMAlertManager_HandleNotifyInt( CStifItemParser& aItem )
       
   343     {
       
   344     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   345     object->HandleNotifyInt(KProEngActiveRingingVolume,5);
       
   346     delete object;
       
   347     return KErrNone;
       
   348 
       
   349     }
       
   350 // -----------------------------------------------------------------------------
       
   351 // Ctestinstantmsgalert::CIMAlertManager_MatoPrepareComplete
       
   352 // Example test method function.
       
   353 // (other items were commented in a header).
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 TInt Ctestinstantmsgalert::CIMAlertManager_MatoPrepareComplete( CStifItemParser& aItem )
       
   357     {
       
   358     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   359     object->MatoPrepareComplete(KErrNone);
       
   360     delete object;
       
   361     return KErrNone;
       
   362 
       
   363     }
       
   364 // -----------------------------------------------------------------------------
       
   365 // Ctestinstantmsgalert::CIMAlertManager_MatoPlayComplete
       
   366 // Example test method function.
       
   367 // (other items were commented in a header).
       
   368 // -----------------------------------------------------------------------------
       
   369 //
       
   370 TInt Ctestinstantmsgalert::CIMAlertManager_MatoPlayComplete( CStifItemParser& aItem )
       
   371     {
       
   372     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   373     object->MatoPlayComplete(KErrNone);
       
   374     delete object;
       
   375     return KErrNone;
       
   376 
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // Ctestinstantmsgalert::CIMAlertManager_AddObserverL
       
   381 // Example test method function.
       
   382 // (other items were commented in a header).
       
   383 // -----------------------------------------------------------------------------
       
   384 //
       
   385 TInt Ctestinstantmsgalert::CIMAlertManager_AddObserverL( CStifItemParser& aItem )
       
   386     {
       
   387     CIMAlertManager* object  = CIMAlertManager::NewL(); 
       
   388     MIMAlertManagerObserver* observer = NULL;
       
   389     object->AddObserverL(observer);
       
   390     delete object;
       
   391     return KErrNone;
       
   392 
       
   393     }
       
   394 
       
   395 // -----------------------------------------------------------------------------
       
   396 // Ctestinstantmsgalert::CIMAlertManager_RemoveObserver
       
   397 // Example test method function.
       
   398 // (other items were commented in a header).
       
   399 // -----------------------------------------------------------------------------
       
   400 //
       
   401 TInt Ctestinstantmsgalert::CIMAlertManager_RemoveObserver( CStifItemParser& aItem )
       
   402     {
       
   403     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   404     MIMAlertManagerObserver* observer = NULL;
       
   405     object->RemoveObserver(observer);
       
   406     delete object;
       
   407     return KErrNone;
       
   408 
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // Ctestinstantmsgalert::CIMAlertManager_HandleError
       
   413 // Example test method function.
       
   414 // (other items were commented in a header).
       
   415 // -----------------------------------------------------------------------------
       
   416 //
       
   417 TInt Ctestinstantmsgalert::CIMAlertManager_HandleError( CStifItemParser& aItem )
       
   418     {
       
   419     CIMAlertManager* object  = CIMAlertManager::NewL();   
       
   420     MIMAlertManagerObserver* observer = NULL;
       
   421     object->HandleError(KErrNone);
       
   422     delete object;
       
   423     return KErrNone;
       
   424 
       
   425     }
       
   426 
       
   427 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   428 // None
       
   429 
       
   430 //  [End of File] - Do not remove