loc_plat/location_centre_api/tsrc/src/testlocationappinfoarray.cpp
branchRCL_3
changeset 16 4721bd00d3da
parent 14 3a25f69541ff
child 21 e15b7f06eba6
equal deleted inserted replaced
14:3a25f69541ff 16:4721bd00d3da
     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:  Test Class which has the list of test cases for CLcLocationAppInfo
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // System Includes
       
    21 #include <lclocationappinfo.h>
       
    22 
       
    23 // User Includes
       
    24 #include "testlocationappinfoarray.h"
       
    25 
       
    26 
       
    27 // Constant Declarations
       
    28 
       
    29     
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // C++ Default Constructor
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CTestLocationAppInfoArray::CTestLocationAppInfoArray(CStifLogger* aLog)
       
    37     : iLcLocationAppInfoArray(NULL),iLog(aLog)
       
    38     {
       
    39 
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // C++ Destructor
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CTestLocationAppInfoArray::~CTestLocationAppInfoArray()
       
    47     {
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CTestLocationAppInfoArray::CheckArrayNewL
       
    52 //
       
    53 // (other items were commented in a header).
       
    54 // ---------------------------------------------------------
       
    55 //
       
    56 TInt CTestLocationAppInfoArray::CheckArrayNewL( )
       
    57 	{
       
    58 	TInt err = KErrNone;
       
    59 
       
    60 	TRAP(err, iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL());
       
    61 
       
    62 	iLog->Log(_L("CheckArrayNewL return with %d"), err);
       
    63 
       
    64 	delete iLcLocationAppInfoArray;
       
    65 	return err;
       
    66 	}
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CTestLocationAppInfoArray::CheckArrayNewLC
       
    70 //
       
    71 // (other items were commented in a header).
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 TInt CTestLocationAppInfoArray::CheckArrayNewLC( )
       
    75 	{
       
    76 	TInt err = KErrNone;
       
    77 
       
    78 	TRAP(err, iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewLC();
       
    79 		CleanupStack::Pop(iLcLocationAppInfoArray));
       
    80 
       
    81 	iLog->Log(_L("CheckArrayNewLC return with %d"), err);
       
    82 
       
    83 	delete iLcLocationAppInfoArray;
       
    84 	return err;
       
    85 	}
       
    86 	
       
    87 // ---------------------------------------------------------
       
    88 // CTestLocationAppInfoArray::CheckCount
       
    89 //
       
    90 // (other items were commented in a header).
       
    91 // ---------------------------------------------------------
       
    92 //
       
    93 TInt CTestLocationAppInfoArray::CheckCount( )
       
    94 	{
       
    95 	TInt err = KErrNone;
       
    96 
       
    97 	iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL();
       
    98 
       
    99 	if( 0 != iLcLocationAppInfoArray->Count() )
       
   100 		err = KErrGeneral;
       
   101 
       
   102 	iLog->Log(_L("CheckCount return with %d"), err);
       
   103 
       
   104 	delete iLcLocationAppInfoArray;
       
   105 	return err;
       
   106 	}	
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CTestLocationAppInfoArray::CheckAppendL
       
   110 //
       
   111 // (other items were commented in a header).
       
   112 // ---------------------------------------------------------
       
   113 //
       
   114 TInt CTestLocationAppInfoArray::CheckAppendL( )
       
   115 	{
       
   116 	TInt err = KErrNone;
       
   117 
       
   118 	iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL();
       
   119 	CLcLocationAppInfo* lcLocationAppInfo = CLcLocationAppInfo::NewL();
       
   120 	
       
   121 	iLcLocationAppInfoArray->AppendL(lcLocationAppInfo);
       
   122 
       
   123 	if( 1 != iLcLocationAppInfoArray->Count() )
       
   124 		err = KErrGeneral;
       
   125 
       
   126 	iLog->Log(_L("CheckCount return with %d"), err);
       
   127 
       
   128 	iLcLocationAppInfoArray->Reset();
       
   129 	delete iLcLocationAppInfoArray;
       
   130 	return err;
       
   131 	}
       
   132 
       
   133 // ---------------------------------------------------------
       
   134 // CTestLocationAppInfoArray::CheckRemoveL
       
   135 //
       
   136 // (other items were commented in a header).
       
   137 // ---------------------------------------------------------
       
   138 //
       
   139 TInt CTestLocationAppInfoArray::CheckRemoveL( )
       
   140 	{
       
   141 	TInt err = KErrNone;
       
   142 
       
   143 	iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL();
       
   144 	CLcLocationAppInfo* lcLocationAppInfo = CLcLocationAppInfo::NewL();
       
   145 	
       
   146 	iLcLocationAppInfoArray->AppendL(lcLocationAppInfo);
       
   147 
       
   148 	if( NULL == iLcLocationAppInfoArray->Remove( 0 ) )
       
   149 		err = KErrGeneral;
       
   150 
       
   151 	iLog->Log(_L("CheckCount return with %d"), err);
       
   152 
       
   153 	delete lcLocationAppInfo;
       
   154 	delete iLcLocationAppInfoArray;
       
   155 	return err;
       
   156 	}
       
   157 
       
   158 // ---------------------------------------------------------
       
   159 // CTestLocationAppInfoArray::CheckResetL
       
   160 //
       
   161 // (other items were commented in a header).
       
   162 // ---------------------------------------------------------
       
   163 //
       
   164 TInt CTestLocationAppInfoArray::CheckResetL( )
       
   165 	{
       
   166 	TInt err = KErrNone;
       
   167 
       
   168 	iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL();
       
   169 	CLcLocationAppInfo* lcLocationAppInfo = CLcLocationAppInfo::NewL();
       
   170 	
       
   171 	iLcLocationAppInfoArray->AppendL(lcLocationAppInfo);
       
   172 
       
   173 	if( 1 != iLcLocationAppInfoArray->Count() )
       
   174 		err = KErrGeneral;
       
   175 
       
   176 	iLog->Log(_L("CheckCount return with %d"), err);
       
   177 
       
   178 	iLcLocationAppInfoArray->Reset();
       
   179 	delete iLcLocationAppInfoArray;
       
   180 	return err;
       
   181 	}
       
   182 
       
   183 // ---------------------------------------------------------
       
   184 // CTestLocationAppInfoArray::CheckOperatorL
       
   185 //
       
   186 // (other items were commented in a header).
       
   187 // ---------------------------------------------------------
       
   188 //
       
   189 TInt CTestLocationAppInfoArray::CheckOperatorL( )
       
   190 	{
       
   191 	TInt err = KErrNone;
       
   192 
       
   193 	iLcLocationAppInfoArray = CLcLocationAppInfoArray::NewL();
       
   194 	CLcLocationAppInfo* lcLocationAppInfo = CLcLocationAppInfo::NewL();
       
   195 	
       
   196 	iLcLocationAppInfoArray->AppendL(lcLocationAppInfo);
       
   197 
       
   198 	CLcLocationAppInfo& lcLocationAppInfo1 = (*iLcLocationAppInfoArray)[0];
       
   199 
       
   200 	iLog->Log(_L("CheckCount return with %d"), err);
       
   201 
       
   202 	iLcLocationAppInfoArray->Reset();
       
   203 	delete iLcLocationAppInfoArray;
       
   204 	return err;
       
   205 	}
       
   206