messagingappbase/smsmtm/clientmtm/test/src/smcmstepinitialise.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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 // The UTC offset is et to -8 and the timestamp of the SMS service is compared against the current time
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @SYMTestCaseID MSG-SMSCLIENTMTM-0243-1
       
    20  @SYMTestType UT
       
    21  @SYMTestPriority High
       
    22  @SYMPREQ 234
       
    23  @SYMTestCaseDesc Initialise a new SMS service and check the UTC timestamp
       
    24  @SYMTestActions  UTC offset is set to 0, then any existing SMS service is removed and a new one is created.
       
    25  @SYMTestExpectedResults The timestamp of the SMS service should be smaller than the current time.
       
    26 */
       
    27 
       
    28 #include "smcmstepinitialise.h"
       
    29 
       
    30 CSMCMStepInitialise::CSMCMStepInitialise( )
       
    31 	{
       
    32 	SetTestStepName( KSMCMStepInitialise );
       
    33 	}
       
    34 	
       
    35 	
       
    36 CSMCMStepInitialise::~CSMCMStepInitialise( )
       
    37 	{
       
    38 		
       
    39 	}
       
    40 	
       
    41 TVerdict CSMCMStepInitialise::doTestStepL( )
       
    42 	{
       
    43 	INFO_PRINTF1( _L( "CSMCMStepInitialise::doTestStepL( )" ) );
       
    44 	
       
    45 	SetTestStepResult( EFail );
       
    46 	
       
    47 	ChangeLocale( KUTC0 );
       
    48 	
       
    49 	// first delete any old SMS service
       
    50 	iSmsTestUtils->DeleteSmsServiceL( );
       
    51 	
       
    52 	// create a new SMS service (this will be time stamped UTC)
       
    53 	TMsvId serviceId = KMsvNullIndexEntryId;
       
    54 	serviceId = iSmsTestUtils->CreateSmsServiceL( );
       
    55 	
       
    56 	iSmsTestUtils->iSmsClientMtm->SwitchCurrentEntryL( serviceId );
       
    57 	TMsvEntry serviceEntry = iSmsTestUtils->iSmsClientMtm->Entry( ).Entry( );
       
    58 
       
    59 	// Change locale to UTC -8
       
    60 	ChangeLocale( KUTCMin8 );
       
    61 	TTime now;
       
    62 	now.UniversalTime( );
       
    63 
       
    64 	// Check if current time is bigger than time when service was created
       
    65 	if ( serviceEntry.iDate < now )
       
    66 		{
       
    67 		SetTestStepResult( EPass );	
       
    68 		
       
    69 		}
       
    70 	
       
    71 	// if locale isn't changed the log file timestamps will be out of order 
       
    72 	// as they are in local time
       
    73 	ChangeLocale( KUTC0 );
       
    74 	
       
    75 	return TestStepResult( );
       
    76 	
       
    77 	}