phonebookengines/contactsmodel/tsrc/Integration/TestImpExvCard/src/TestImpBDay.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "TestImpBDay.h"
       
    17 
       
    18 CTestImpBDay::~CTestImpBDay()
       
    19 /**
       
    20  * Destructor
       
    21  */
       
    22 	{
       
    23 	}
       
    24 
       
    25 CTestImpBDay::CTestImpBDay()
       
    26 /**
       
    27  * Constructor
       
    28  */
       
    29 	{
       
    30 	// Call base class method to set up the human readable name for logging
       
    31 	SetTestStepName(KTestImpBDay);
       
    32 	}
       
    33 
       
    34 TVerdict CTestImpBDay::doTestStepPreambleL()
       
    35 /**
       
    36  * @return - TVerdict code
       
    37  * Override of base class virtual
       
    38  */
       
    39 	{
       
    40 	INFO_PRINTF1(_L("Start Import of vCards (Birthday present) Tests"));
       
    41 	
       
    42 	iScheduler = new (ELeave) CActiveScheduler;
       
    43 	CActiveScheduler::Install(iScheduler);
       
    44 	
       
    45 	SetTestStepResult(EPass);
       
    46 	return TestStepResult();
       
    47 	}
       
    48 			
       
    49 TVerdict CTestImpBDay::doTestStepL()
       
    50 /**
       
    51  * @return - TVerdict code
       
    52  * Override of base class pure virtual
       
    53  */
       
    54 	{
       
    55 	SetTestStepResult(EFail);
       
    56 	
       
    57 	TInt numberOfCases = 0;
       
    58 	
       
    59 	while(ETrue)
       
    60 		{
       
    61 		TBuf<90> config(KImportBDay);
       
    62 		TPtrC ptrexpUTC = GetExpectedUTCFromIniL(numberOfCases, config, ETrue);
       
    63 		if(ptrexpUTC==KNullDesC)
       
    64 			{
       
    65 			break;	
       
    66 			}
       
    67 			
       
    68 		INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1);
       
    69 		iExpectedBDay = FormatDateTime(ptrexpUTC);
       
    70 		TBuf<90> pathVCF(KPathImportBDay);
       
    71 		OpenBDAYVCFAndImportItemL(pathVCF, numberOfCases); // Imports vcf 
       
    72 	
       
    73 		TDateTime importedDateTime = iBDayFromImport.DateTime();
       
    74 		TDateTime expectedDateTime = iExpectedBDay.DateTime();
       
    75 	
       
    76 		// If birthday does not match, test will fail
       
    77 		if((importedDateTime.Year() != expectedDateTime.Year()) ||     
       
    78 		   (importedDateTime.Month() != expectedDateTime.Month()) ||
       
    79 		   (importedDateTime.Day() != expectedDateTime.Day()) )
       
    80 			{
       
    81 			INFO_PRINTF1(_L("Imported Birthday not correct"));
       
    82 		   	SetTestStepResult(EFail);
       
    83 		   	return TestStepResult();
       
    84 			}
       
    85 		else
       
    86 			{
       
    87 			INFO_PRINTF1(_L("Imported Birthday as expected"));
       
    88 			SetTestStepResult(EPass);
       
    89 			}
       
    90 			
       
    91 		numberOfCases++;
       
    92 		}
       
    93 		
       
    94 	return TestStepResult();
       
    95 	}
       
    96 
       
    97 TVerdict CTestImpBDay::doTestStepPostambleL()
       
    98 /**
       
    99  * @return - TVerdict code
       
   100  * Override of base class virtual
       
   101  */
       
   102 	{
       
   103 	CActiveScheduler::Install(NULL);
       
   104 	delete iScheduler;
       
   105 	INFO_PRINTF1(_L("Completed Import of vCards (Birthday present) Tests"));
       
   106 	return TestStepResult();
       
   107 	}