phonebookengines/contactsmodel/tsrc/Integration/TestImpExvCard/src/TestImpRevUTC.cpp
changeset 0 e686773b3f54
child 24 0ba2181d7c28
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 "TestImpRevUTC.h"
       
    17 
       
    18 CTestImpRevUTC::~CTestImpRevUTC()
       
    19 /**
       
    20  * Destructor
       
    21  */
       
    22 	{
       
    23 	}
       
    24 
       
    25 CTestImpRevUTC::CTestImpRevUTC()
       
    26 /**
       
    27  * Constructor
       
    28  */
       
    29 	{
       
    30 	// Call base class method to set up the human readable name for logging
       
    31 	SetTestStepName(KTestImpRevUTC);
       
    32 	}
       
    33 
       
    34 TVerdict CTestImpRevUTC::doTestStepPreambleL()
       
    35 /**
       
    36  * @return - TVerdict code
       
    37  * Override of base class virtual
       
    38  */
       
    39 	{
       
    40 	INFO_PRINTF1(_L("Start Import of vCards (REV in UTC) Tests"));
       
    41 	
       
    42 	iScheduler = new (ELeave) CActiveScheduler;
       
    43 	CActiveScheduler::Install(iScheduler);
       
    44 	
       
    45 	SetTestStepResult(EPass);
       
    46 	return TestStepResult();
       
    47 	}
       
    48 
       
    49 TVerdict CTestImpRevUTC::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(KImportRevUTC);
       
    62 		TPtrC ptrexpUTC = GetExpectedUTCFromIniL(numberOfCases, config, EFalse);
       
    63 		if(ptrexpUTC==KNullDesC)
       
    64 			{
       
    65 			break;	
       
    66 			}
       
    67 			
       
    68 		INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1);
       
    69 		iExpectedUTC = FormatDateTime(ptrexpUTC);
       
    70 		TBuf<90> pathVCF(KPathImportRevUTC);
       
    71 		OpenVCFAndImportItemL(pathVCF, iFsSession, numberOfCases); // Imports vcf 
       
    72 	
       
    73 		TDateTime t = iTimeFromImport.DateTime();
       
    74 		TDateTime t1 = iExpectedUTC.DateTime();
       
    75 		INFO_PRINTF7(_L("Imported Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second());
       
    76 		INFO_PRINTF7(_L("Expected Date Year: %d, Month: %d, Day: %d, Expected Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second());
       
    77 	
       
    78 		if (iExpectedUTC==iTimeFromImport) // checks if imported time is correct
       
    79 			{
       
    80 			INFO_PRINTF1(_L("Imported Time as UTC (correct)"));
       
    81 			SetTestStepResult(EPass);	
       
    82 			}
       
    83 		else
       
    84 			{
       
    85 			INFO_PRINTF1(_L("Imported Time not imported as UTC (NOT CORRECT)"));
       
    86 			SetTestStepResult(EFail);
       
    87 			return TestStepResult();
       
    88 			}
       
    89 			
       
    90 		numberOfCases++;
       
    91 		}
       
    92 	
       
    93 	return TestStepResult();
       
    94 	}
       
    95 
       
    96 TVerdict CTestImpRevUTC::doTestStepPostambleL()
       
    97 /**
       
    98  * @return - TVerdict code
       
    99  * Override of base class virtual
       
   100  */
       
   101 	{
       
   102 	CActiveScheduler::Install(NULL);
       
   103 	delete iScheduler;
       
   104 	INFO_PRINTF1(_L("Completed Import of vCards (REV in UTC) Tests"));
       
   105 	return TestStepResult();
       
   106 	}
       
   107