messagingappbase/smsmtm/clientmtm/test/src/smcmstepforward.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 //
       
    15 
       
    16 /**
       
    17  @SYMTestCaseID MSG-SMSCLIENTMTM-0243-8
       
    18  @SYMTestType UT
       
    19  @SYMTestPriority High
       
    20  @SYMPREQ 234, other
       
    21  @SYMTestCaseDesc Creates a SMS with locale UTC offset 0, sets UTC offset to -8, forward the SMS
       
    22  @SYMTestActions  Checks the timestamps of original and forwarded SMS. (also check original test actions of T_SMCM1)
       
    23  @SYMTestExpectedResults The timestamp of the original SMS should be smaller than the timestamp of the forwarded SMS.
       
    24 */
       
    25 
       
    26 
       
    27 #include "smcmstepforward.h"
       
    28 
       
    29 #include <csmsaccount.h>
       
    30 #include <e32math.h>
       
    31 
       
    32 const TInt KDecreaseBodyLengthValue = 25;
       
    33 
       
    34 CSMCMStepForward::CSMCMStepForward( )
       
    35 	{
       
    36 	SetTestStepName( KSMCMStepForward );
       
    37 	}
       
    38 	
       
    39 CSMCMStepForward::~CSMCMStepForward( )
       
    40 	{
       
    41 	
       
    42 	}
       
    43 	
       
    44 TVerdict CSMCMStepForward::doTestStepL( )
       
    45 	{
       
    46 	INFO_PRINTF1( _L( "CSMCMStepForward::doTestStepL( )" ) );
       
    47 
       
    48 	// Easier to have default EPass. Otherwise a passing test may overwrite the
       
    49 	// result of earlier failed tests (unless we use an extra boolean which is set
       
    50 	// to false if a test fails )
       
    51 	SetTestStepResult( EPass );
       
    52 	
       
    53 	SetSettingsL( );
       
    54 	
       
    55 	TInt length = KMaxBodyLength;
       
    56 	while ( length > 0 )
       
    57 		{
       
    58 		TUint32 bioType = Math( ).Random( );
       
    59 		if ( doTestForwardL( length , bioType) == EFail )
       
    60 			{
       
    61 			SetTestStepResult( EFail );
       
    62 			}
       
    63 		length -= KDecreaseBodyLengthValue;
       
    64 		}
       
    65 		
       
    66 	ChangeLocale( KUTC0 );
       
    67 
       
    68 	return TestStepResult( );
       
    69 	
       
    70 	}
       
    71 	
       
    72 TVerdict CSMCMStepForward::doTestForwardL( TInt aBodyLength, TInt32 aBioType )
       
    73 	{
       
    74 	ChangeLocale( KUTC0 );
       
    75 	
       
    76 	HBufC* originalBody = CreateRandomLC( aBodyLength );
       
    77 	
       
    78 	TMessageSettings settings;
       
    79 	settings.iOperation = EOperationForward;
       
    80 	settings.iOriginalBoxId = KMsvGlobalOutBoxIndexEntryId;
       
    81 	settings.iOriginalSmsPDUType = CSmsPDU::ESmsDeliver;
       
    82 	settings.iOriginalBioType = aBioType;
       
    83 	
       
    84 	TMsvId entryId = CreateMessageAndEntryL( *originalBody, settings );
       
    85 	
       
    86 	ChangeLocale( KUTCMin8 );
       
    87 	
       
    88 	TVerdict verdict;
       
    89 	verdict = PerformTestL( entryId, KUserDataForward, settings );
       
    90 	
       
    91 	CleanupStack::PopAndDestroy( originalBody );
       
    92 	
       
    93 	return verdict;
       
    94 	
       
    95 	}