locsrv_plat/map_and_navigation_api/tsrc/src/testmapandnavapiblocks.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     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: Entry point for test cases in stif module
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32svr.h>
       
    22 #include <StifParser.h>
       
    23 #include <Stiftestinterface.h>
       
    24 #include "testmapandnavapi.h"
       
    25 
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CTestMapAndNavApi::Delete
       
    32 // Delete here all resources allocated and opened from test methods. 
       
    33 // Called from destructor. 
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 void CTestMapAndNavApi::Delete() 
       
    37     {
       
    38 
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CTestMapAndNavApi::RunMethodL
       
    43 // Run specified method. Contains also table of test mothods and their names.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TInt CTestMapAndNavApi::RunMethodL( 
       
    47     CStifItemParser& aItem ) 
       
    48     {
       
    49 
       
    50     static TStifFunctionInfo const KFunctions[] =
       
    51         {  
       
    52         // Navigator
       
    53         ENTRY( "CreateNavigator", CTestMapAndNavApi::CreateNavigatorL ),
       
    54         ENTRY( "CreateChainedNavigator", CTestMapAndNavApi::CreateChainedNavigatorL ),
       
    55         ENTRY( "SetNavigatorExitObserver", CTestMapAndNavApi::SetExitObserverL ),
       
    56         ENTRY( "RemoveNavigatorExitObserver", CTestMapAndNavApi::RemoveExitObserverL ),
       
    57         
       
    58         // Map View
       
    59         ENTRY( "CreateMapView", CTestMapAndNavApi::CreateMapViewL ),
       
    60         ENTRY( "CreateChainedMapView", CTestMapAndNavApi::CreateChainedMapViewL ),
       
    61         ENTRY( "AddLinkedLmksToShow", CTestMapAndNavApi::AddLinkedLmksToShowL ),
       
    62         ENTRY( "AddLmksToShow", CTestMapAndNavApi::AddLmksToShowL ),
       
    63         ENTRY( "AddPackedLmksToShow", CTestMapAndNavApi::AddPackedLmksToShowL ),
       
    64         ENTRY( "ResetLmksToShow", CTestMapAndNavApi::ResetLmksToShowL ),
       
    65         ENTRY( "SetMapArea", CTestMapAndNavApi::SetMapAreaL ),
       
    66         ENTRY( "ResetMapArea", CTestMapAndNavApi::ResetMapAreaL ),
       
    67         ENTRY( "SetCustomRequestText", CTestMapAndNavApi::SetCustomRequestTextL ),
       
    68         ENTRY( "SetUseDefaultRequestText", CTestMapAndNavApi::SetUseDefaultRequestTextL ),
       
    69         ENTRY( "SetCurrentLocationOption", CTestMapAndNavApi::SetCurrentLocationOptionL ),
       
    70         ENTRY( "GetCurrentLocationOption", CTestMapAndNavApi::GetCurrentLocationOptionL ),
       
    71         ENTRY( "SetAndGetOptions", CTestMapAndNavApi::SetAndGetOptionsL ),
       
    72         ENTRY( "SelectionResultType", CTestMapAndNavApi::SelectionResultTypeL ),
       
    73         ENTRY( "SelectFromMap", CTestMapAndNavApi::SelectFromMapL ),
       
    74         ENTRY( "SetViewExitObserver", CTestMapAndNavApi::SetViewExitObserverL ),
       
    75         ENTRY( "RemoveViewExitObserver", CTestMapAndNavApi::RemoveViewExitObserverL ),
       
    76         
       
    77         };
       
    78 
       
    79     const TInt count = sizeof( KFunctions ) / 
       
    80                         sizeof( TStifFunctionInfo );
       
    81 	
       
    82 	TInt ret = KErrNone;
       
    83 	TRAPD( error, ret = RunInternalL( KFunctions, count, aItem ));
       
    84 	if ( error != KErrNone )
       
    85 		{
       
    86 		return error;
       
    87 		}
       
    88 	return ret;	
       
    89 	    
       
    90     }
       
    91    
       
    92 // -----------------------------------------------------------------------------
       
    93 // CTestMapAndNavApi::CreateNavigatorL
       
    94 // 
       
    95 // 
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 TInt CTestMapAndNavApi::CreateNavigatorL( CStifItemParser& aItem )
       
    99     {
       
   100     CTestMnNavigator* testNavigator = CTestMnNavigator::NewL( iLog );
       
   101 	CleanupStack::PushL( testNavigator );
       
   102 	TInt err = testNavigator->CreateNavigatorL( aItem );
       
   103 	CleanupStack::PopAndDestroy( testNavigator );
       
   104 	return err;	
       
   105     }   
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CTestMapAndNavApi::CreateChainedNavigatorL
       
   109 // 
       
   110 // 
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 TInt CTestMapAndNavApi::CreateChainedNavigatorL( CStifItemParser& aItem )
       
   114     {
       
   115     CTestMnNavigator* testNavigator = CTestMnNavigator::NewL( iLog );
       
   116 	CleanupStack::PushL( testNavigator );
       
   117 	TInt err = testNavigator->CreateChainedNavigatorL( aItem );
       
   118 	CleanupStack::PopAndDestroy( testNavigator );
       
   119 	return err;	
       
   120     } 
       
   121     
       
   122 // -----------------------------------------------------------------------------
       
   123 // CTestMapAndNavApi::SetExitObserverL
       
   124 // 
       
   125 // 
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TInt CTestMapAndNavApi::SetExitObserverL( CStifItemParser& aItem )
       
   129     {
       
   130     CTestMnNavigator* testNavigator = CTestMnNavigator::NewL( iLog );
       
   131 	CleanupStack::PushL( testNavigator );
       
   132 	TInt err = testNavigator->SetExitObserverL( aItem );
       
   133 	CleanupStack::PopAndDestroy( testNavigator );
       
   134 	return err;	
       
   135     }     
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CTestMapAndNavApi::RemoveExitObserverL
       
   139 // 
       
   140 // 
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 TInt CTestMapAndNavApi::RemoveExitObserverL( CStifItemParser& aItem )
       
   144     {
       
   145     CTestMnNavigator* testNavigator = CTestMnNavigator::NewL( iLog );
       
   146 	CleanupStack::PushL( testNavigator );
       
   147 	TInt err = testNavigator->RemoveExitObserverL( aItem );
       
   148 	CleanupStack::PopAndDestroy( testNavigator );
       
   149 	return err;	
       
   150     }     
       
   151 
       
   152     
       
   153 // -----------------------------------------------------------------------------
       
   154 // CTestMapAndNavApi::CreateMapViewL
       
   155 // 
       
   156 // 
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 TInt CTestMapAndNavApi::CreateMapViewL( CStifItemParser& aItem )
       
   160     {
       
   161     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   162 	CleanupStack::PushL( testMapView );
       
   163 	TInt err = testMapView->CreateMapViewL( aItem );
       
   164 	CleanupStack::PopAndDestroy( testMapView );
       
   165 	return err;	
       
   166     }     
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CTestMapAndNavApi::CreateChainedMapViewL
       
   170 // 
       
   171 // 
       
   172 // -----------------------------------------------------------------------------
       
   173 //
       
   174 TInt CTestMapAndNavApi::CreateChainedMapViewL( CStifItemParser& aItem )
       
   175     {
       
   176     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   177 	CleanupStack::PushL( testMapView );
       
   178 	TInt err = testMapView->CreateChainedMapViewL( aItem );
       
   179 	CleanupStack::PopAndDestroy( testMapView );
       
   180 	return err;	
       
   181     } 
       
   182     
       
   183 // -----------------------------------------------------------------------------
       
   184 // CTestMapAndNavApi::AddLinkedLmksToShowL
       
   185 // 
       
   186 // 
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 TInt CTestMapAndNavApi::AddLinkedLmksToShowL( CStifItemParser& aItem )
       
   190     {
       
   191     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   192 	CleanupStack::PushL( testMapView );
       
   193 	TInt err = testMapView->AddLinkedLmksToShowL( aItem );
       
   194 	CleanupStack::PopAndDestroy( testMapView );
       
   195 	return err;	
       
   196     }   
       
   197     
       
   198 // -----------------------------------------------------------------------------
       
   199 // CTestMapAndNavApi::AddLmksToShowL
       
   200 // 
       
   201 // 
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 TInt CTestMapAndNavApi::AddLmksToShowL( CStifItemParser& aItem )
       
   205     {
       
   206     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   207 	CleanupStack::PushL( testMapView );
       
   208 	TInt err = testMapView->AddLmksToShowL( aItem );
       
   209 	CleanupStack::PopAndDestroy( testMapView );
       
   210 	return err;	
       
   211     }
       
   212     
       
   213 // -----------------------------------------------------------------------------
       
   214 // CTestMapAndNavApi::AddPackedLmksToShowL
       
   215 // 
       
   216 // 
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 TInt CTestMapAndNavApi::AddPackedLmksToShowL( CStifItemParser& aItem )
       
   220     {
       
   221     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   222 	CleanupStack::PushL( testMapView );
       
   223 	TInt err = testMapView->AddPackedLmksToShowL( aItem );
       
   224 	CleanupStack::PopAndDestroy( testMapView );
       
   225 	return err;	
       
   226     }    
       
   227     
       
   228 // -----------------------------------------------------------------------------
       
   229 // CTestMapAndNavApi::ResetLmksToShowL
       
   230 // 
       
   231 // 
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 TInt CTestMapAndNavApi::ResetLmksToShowL( CStifItemParser& aItem )
       
   235     {
       
   236     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   237 	CleanupStack::PushL( testMapView );
       
   238 	TInt err = testMapView->ResetLmksToShowL( aItem );
       
   239 	CleanupStack::PopAndDestroy( testMapView );
       
   240 	return err;	
       
   241     }     
       
   242     
       
   243 // -----------------------------------------------------------------------------
       
   244 // CTestMapAndNavApi::SetMapAreaL
       
   245 // 
       
   246 // 
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 TInt CTestMapAndNavApi::SetMapAreaL( CStifItemParser& aItem )
       
   250     {
       
   251     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   252 	CleanupStack::PushL( testMapView );
       
   253 	TInt err = testMapView->SetMapAreaL( aItem );
       
   254 	CleanupStack::PopAndDestroy( testMapView );
       
   255 	return err;	
       
   256     }            
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CTestMapAndNavApi::ResetMapAreaL
       
   260 // 
       
   261 // 
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 TInt CTestMapAndNavApi::ResetMapAreaL( CStifItemParser& aItem )
       
   265     {
       
   266     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   267 	CleanupStack::PushL( testMapView );
       
   268 	TInt err = testMapView->ResetMapAreaL( aItem );
       
   269 	CleanupStack::PopAndDestroy( testMapView );
       
   270 	return err;	
       
   271     }   
       
   272 
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // CTestMapAndNavApi::SetCustomRequestTextL
       
   276 // 
       
   277 // 
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 TInt CTestMapAndNavApi::SetCustomRequestTextL( CStifItemParser& aItem )
       
   281     {
       
   282     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   283 	CleanupStack::PushL( testMapView );
       
   284 	TInt err = testMapView->SetCustomRequestTextL( aItem );
       
   285 	CleanupStack::PopAndDestroy( testMapView );
       
   286 	return err;	
       
   287     }   
       
   288 
       
   289 // -----------------------------------------------------------------------------
       
   290 // CTestMapAndNavApi::SetUseDefaultRequestTextL
       
   291 // 
       
   292 // 
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 TInt CTestMapAndNavApi::SetUseDefaultRequestTextL( CStifItemParser& aItem )
       
   296     {
       
   297     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   298 	CleanupStack::PushL( testMapView );
       
   299 	TInt err = testMapView->SetUseDefaultRequestTextL( aItem );
       
   300 	CleanupStack::PopAndDestroy( testMapView );
       
   301 	return err;	
       
   302     }   
       
   303     
       
   304 // -----------------------------------------------------------------------------
       
   305 // CTestMapAndNavApi::SetCurrentLocationOptionL
       
   306 // 
       
   307 // 
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 TInt CTestMapAndNavApi::SetCurrentLocationOptionL( CStifItemParser& aItem )
       
   311     {
       
   312     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   313 	CleanupStack::PushL( testMapView );
       
   314 	TInt err = testMapView->SetCurrentLocationOptionL( aItem );
       
   315 	CleanupStack::PopAndDestroy( testMapView );
       
   316 	return err;	
       
   317     } 
       
   318     
       
   319 // -----------------------------------------------------------------------------
       
   320 // CTestMapAndNavApi::GetCurrentLocationOptionL
       
   321 // 
       
   322 // 
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 TInt CTestMapAndNavApi::GetCurrentLocationOptionL( CStifItemParser& aItem )
       
   326     {
       
   327     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   328 	CleanupStack::PushL( testMapView );
       
   329 	TInt err = testMapView->GetCurrentLocationOptionL( aItem );
       
   330 	CleanupStack::PopAndDestroy( testMapView );
       
   331 	return err;	
       
   332     } 
       
   333     
       
   334 // -----------------------------------------------------------------------------
       
   335 // CTestMapAndNavApi::SetAndGetOptionsL
       
   336 // 
       
   337 // 
       
   338 // -----------------------------------------------------------------------------
       
   339 //
       
   340 TInt CTestMapAndNavApi::SetAndGetOptionsL( CStifItemParser& aItem )
       
   341     {
       
   342     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   343 	CleanupStack::PushL( testMapView );
       
   344 	TInt err = testMapView->SetAndGetOptionsL( aItem );
       
   345 	CleanupStack::PopAndDestroy( testMapView );
       
   346 	return err;	
       
   347     }
       
   348     
       
   349 // -----------------------------------------------------------------------------
       
   350 // CTestMapAndNavApi::SelectionResultTypeL
       
   351 // 
       
   352 // 
       
   353 // -----------------------------------------------------------------------------
       
   354 //
       
   355 TInt CTestMapAndNavApi::SelectionResultTypeL( CStifItemParser& aItem )
       
   356     {
       
   357     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   358 	CleanupStack::PushL( testMapView );
       
   359 	TInt err = testMapView->SelectionResultTypeL( aItem );
       
   360 	CleanupStack::PopAndDestroy( testMapView );
       
   361 	return err;	
       
   362     }           
       
   363 
       
   364 // -----------------------------------------------------------------------------
       
   365 // CTestMapAndNavApi::SelectFromMapL
       
   366 // 
       
   367 // 
       
   368 // -----------------------------------------------------------------------------
       
   369 //
       
   370 TInt CTestMapAndNavApi::SelectFromMapL( CStifItemParser& aItem )
       
   371     {
       
   372     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   373 	CleanupStack::PushL( testMapView );
       
   374 	TInt err = testMapView->SelectFromMapL( aItem );
       
   375 	CleanupStack::PopAndDestroy( testMapView );
       
   376 	return err;	
       
   377     }
       
   378     
       
   379 // -----------------------------------------------------------------------------
       
   380 // CTestMapAndNavApi::SetViewExitObserverL
       
   381 // 
       
   382 // 
       
   383 // -----------------------------------------------------------------------------
       
   384 //
       
   385 TInt CTestMapAndNavApi::SetViewExitObserverL( CStifItemParser& aItem )
       
   386     {
       
   387     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   388 	CleanupStack::PushL( testMapView );
       
   389 	TInt err = testMapView->SetViewExitObserverL( aItem );
       
   390 	CleanupStack::PopAndDestroy( testMapView );
       
   391 	return err;	
       
   392     }                   
       
   393     
       
   394 // -----------------------------------------------------------------------------
       
   395 // CTestMapAndNavApi::RemoveViewExitObserverL
       
   396 // 
       
   397 // 
       
   398 // -----------------------------------------------------------------------------
       
   399 //
       
   400 TInt CTestMapAndNavApi::RemoveViewExitObserverL( CStifItemParser& aItem )
       
   401     {
       
   402     CTestMnMapView* testMapView = CTestMnMapView::NewL( iLog );
       
   403 	CleanupStack::PushL( testMapView );
       
   404 	TInt err = testMapView->RemoveViewExitObserverL( aItem );
       
   405 	CleanupStack::PopAndDestroy( testMapView );
       
   406 	return err;	
       
   407     }                   
       
   408 
       
   409 //  End of File