phonebookengines/contactsmodel/tsrc/Integration/TestImpExvCard/src/TestExRevUTC.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 "TestExRevUTC.h"
       
    17 
       
    18 CTestExRevUTC::~CTestExRevUTC()
       
    19 /**
       
    20  * Destructor
       
    21  */
       
    22 	{
       
    23 	}
       
    24 
       
    25 CTestExRevUTC::CTestExRevUTC()
       
    26 /**
       
    27  * Constructor
       
    28  */
       
    29 	{
       
    30 	// Call base class method to set up the human readable name for logging
       
    31 	SetTestStepName(KTestExRevUTC);
       
    32 	}
       
    33 
       
    34 TVerdict CTestExRevUTC::doTestStepPreambleL()
       
    35 /**
       
    36  * @return - TVerdict code
       
    37  * Override of base class virtual
       
    38  */
       
    39 	{
       
    40 	INFO_PRINTF1(_L("Start Export 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 CTestExRevUTC::doTestStepL()
       
    50 /**
       
    51  * @return - TVerdict code
       
    52  * Override of base class pure virtual
       
    53  */
       
    54 	{
       
    55 	SetTestStepResult(EFail);
       
    56 	
       
    57 	TBuf<90> pathVCF(KExportRevUTCFile);
       
    58 	ExportItemL(pathVCF, EFalse);
       
    59 	
       
    60 	// read from the disk.
       
    61 	ImportItemL(pathVCF,EFalse);
       
    62 	TDateTime t = iRecordedTime.DateTime();
       
    63 	TDateTime t1 = iTimeFromImport.DateTime();
       
    64 	
       
    65 	INFO_PRINTF7(_L("Recorded Last Modified Date Year: %d, Month: %d, Day: %d, Recorded Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second());
       
    66 	INFO_PRINTF7(_L("Imported Last Modified Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second());
       
    67 	
       
    68 	TTimeIntervalSeconds secondsDifference;
       
    69 	User::LeaveIfError(iTimeFromImport.SecondsFrom(iRecordedTime, secondsDifference));
       
    70 	TInt difference = secondsDifference.Int();
       
    71 	
       
    72 	if (difference < 2 && difference > -2)
       
    73 		{
       
    74 		INFO_PRINTF1(_L("Recorded and Imported DateTime match"));
       
    75 		SetTestStepResult(EPass);
       
    76 		}
       
    77 	else
       
    78 		{
       
    79 		INFO_PRINTF1(_L("Recorded and Imported DateTime does not match"));
       
    80 		SetTestStepResult(EFail);
       
    81 		}
       
    82 		
       
    83 	return TestStepResult();
       
    84 	}
       
    85 
       
    86 TVerdict CTestExRevUTC::doTestStepPostambleL()
       
    87 /**
       
    88  * @return - TVerdict code
       
    89  * Override of base class virtual
       
    90  */
       
    91 	{
       
    92 	CActiveScheduler::Install(NULL);
       
    93 	delete iScheduler;
       
    94 	INFO_PRINTF1(_L("Completed Export of vCards (Rev in UTC) Tests"));
       
    95 	return TestStepResult();
       
    96 	}
       
    97