messagingappbase/smsmtm/clientmtm/test/src/smcmstepfind.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 // All the others should pass.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @SYMTestCaseID MSG-SMSCLIENTMTM-0243-4
       
    20  @SYMTestType UT
       
    21  @SYMTestPriority High
       
    22  @SYMPREQ unknown
       
    23  @SYMTestCaseDesc Search for text strings in SMS (body and header fields) (ported from T_SMCM1)
       
    24  @SYMTestActions  Create an SMS and search for text strings in it
       
    25  @SYMTestExpectedResults Some find operations are not supported and thse should return the appropriate error. 
       
    26 */
       
    27 
       
    28 #include "smcmstepfind.h"
       
    29 #include <mtmdef.h>
       
    30 
       
    31 CSMCMStepFind::CSMCMStepFind( )
       
    32 	{
       
    33 	SetTestStepName( KSMCMStepFind );
       
    34 	}
       
    35 
       
    36 CSMCMStepFind::~CSMCMStepFind( )
       
    37 	{
       
    38 	
       
    39 	}
       
    40 
       
    41 TVerdict CSMCMStepFind::doTestStepL( )
       
    42 	{
       
    43 	INFO_PRINTF1( _L( "CSMCMStepFind::doTestStepL( )" ) );
       
    44 	
       
    45 	SetTestStepResult( EPass );
       
    46 	
       
    47 	TMsvPartList partList;
       
    48 	
       
    49 	TMessageSettings settings;
       
    50 	settings.iOperation = EOperationNone;
       
    51 	settings.iOriginalBoxId = KMsvGlobalInBoxIndexEntryId;
       
    52 	settings.iOriginalSmsPDUType = CSmsPDU::ESmsSubmit;
       
    53 	settings.iOriginalBioType = 0;
       
    54 	TMsvId entryId = CreateMessageAndEntryL( KUserDataFind, settings );
       
    55 	
       
    56 	iSmsClientMtm->SwitchCurrentEntryL( entryId );
       
    57 	iSmsClientMtm->LoadMessageL( );
       
    58 	
       
    59 	// Add some recipients
       
    60 	iSmsClientMtm->AddAddresseeL( _L( "+358503367709" ), _L( "Mico3" ) );
       
    61 	iSmsClientMtm->AddAddresseeL( _L( "+358503367709" ), _L( "Mico4" ) );
       
    62 	iSmsClientMtm->AddAddresseeL( _L( "//\\" ), _L( "\n" ) );
       
    63 	iSmsClientMtm->AddAddresseeL( _L( "\n0" ), _L( "^" ) );
       
    64 	iSmsClientMtm->AddAddresseeL( _L("1234"), _L("~¨") );
       
    65 	iSmsClientMtm->AddAddresseeL( _L("äöåÖÅÖÖ¤"), _L("fdsa4324521{[]}") );
       
    66 	iSmsClientMtm->AddAddresseeL( _L("äöåÖÅÖÖ¤"), _L("") );
       
    67 	iSmsClientMtm->AddAddresseeL( _L("äöåÖÅÖÖ¤") );
       
    68 	
       
    69 	// remove recipient
       
    70 	iSmsClientMtm->RemoveAddressee( 2 );
       
    71 	
       
    72 	// Validate Message
       
    73 	partList = KMsvMessagePartRecipient;
       
    74 	
       
    75 	if ( iSmsClientMtm->ValidateMessage( partList ) == KErrNone )
       
    76 		{
       
    77 		// all the addressees should be invalid
       
    78 		SetTestStepResult( EFail );
       
    79 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartRecipient" ) );
       
    80 		}
       
    81 	
       
    82 	iSmsClientMtm->RemoveAddressee( iSmsClientMtm->AddresseeList( ).Count( ) - 1 );
       
    83 	iSmsClientMtm->RemoveAddressee( iSmsClientMtm->AddresseeList( ).Count( ) - 1 );
       
    84 	iSmsClientMtm->RemoveAddressee( iSmsClientMtm->AddresseeList( ).Count( ) - 1 );
       
    85 	iSmsClientMtm->RemoveAddressee( iSmsClientMtm->AddresseeList( ).Count( ) - 2 );
       
    86 	iSmsClientMtm->RemoveAddressee( iSmsClientMtm->AddresseeList( ).Count( ) - 2 );
       
    87 	
       
    88 	partList=KMsvMessagePartRecipient;			// supported
       
    89 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
    90 		{
       
    91 		SetTestStepResult( EFail );
       
    92 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartRecipient" ) );
       
    93 		}
       
    94 		
       
    95 	partList=KMsvMessagePartBody;				// not supported, returns 0
       
    96 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
    97 		{
       
    98 		SetTestStepResult( EFail );
       
    99 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartBody" ) );
       
   100 		}
       
   101 	
       
   102 	partList=KMsvMessagePartOriginator;			// not supported, returns 0
       
   103 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
   104 		{
       
   105 		SetTestStepResult( EFail );
       
   106 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartOriginator" ) );		
       
   107 		}
       
   108 	
       
   109 	partList=KMsvMessagePartDescription;		// not supported, returns 0
       
   110 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
   111 		{
       
   112 		SetTestStepResult( EFail );
       
   113 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartDescription" ) );
       
   114 		}
       
   115 	
       
   116 	partList=KMsvMessagePartDate;				// not supported, returns 0
       
   117 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
   118 		{
       
   119 		SetTestStepResult( EFail );
       
   120 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartDate" ) );
       
   121 		}
       
   122 	
       
   123 	partList=KMsvMessagePartAttachments;		// not supported, returns 0
       
   124 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
   125 		{
       
   126 		SetTestStepResult( EFail );
       
   127 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartAttachments" ) );
       
   128 		}
       
   129 	
       
   130 	partList=KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   131 	if ( iSmsClientMtm->ValidateMessage( partList ) != 0 )
       
   132 		{
       
   133 		SetTestStepResult( EFail );
       
   134 		ERR_PRINTF1( _L( "Invalid message context or not supported: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   135 		}
       
   136 	
       
   137 	// Find in body and recipients
       
   138 	iSmsClientMtm->AddAddresseeL( _L( "+358503367709" ), _L( "Mr. Tester" ) );
       
   139 	
       
   140 	partList=KMsvMessagePartRecipient;
       
   141 	if ( iSmsClientMtm->Find( _L( "est" ), partList ) != partList ) 
       
   142 		{
       
   143 		SetTestStepResult( EFail );
       
   144 		ERR_PRINTF1( _L( "Cannot find \"est\" in message context: KMsvMessagePartRecipient" ) );
       
   145 		}
       
   146 		
       
   147 	partList = KMsvMessagePartBody;
       
   148 	
       
   149 	if ( iSmsClientMtm->Find( _L( "end" ), partList ) != KMsvMessagePartBody )
       
   150 		{
       
   151 		SetTestStepResult( EFail );
       
   152 		ERR_PRINTF1( _L( "Cannot find \"end\" in message context: KMsvMessagePartBody" ) );
       
   153 		}
       
   154 		
       
   155 	partList = KMsvMessagePartOriginator;
       
   156 	if ( iSmsClientMtm->Find( _L( "end" ), partList ) != 0 )
       
   157 		{
       
   158 		SetTestStepResult( EFail );
       
   159 		ERR_PRINTF1( _L( "Found \"end\" in message context: KMsvMessagePartOriginator" ) );
       
   160 		}
       
   161 	
       
   162 	partList = KMsvMessagePartDescription;		// not supported, returns 0
       
   163 	if ( iSmsClientMtm->Find( _L( "end" ), partList ) != 0 )
       
   164 		{
       
   165 		SetTestStepResult( EFail );
       
   166 		ERR_PRINTF1( _L( "Found \"end\" in message context: KMsvMessagePartDescription" ) );
       
   167 		}
       
   168 	
       
   169 	partList = KMsvMessagePartDate;				// not supported, returns 0
       
   170 	if ( iSmsClientMtm->Find( _L( "end" ), partList ) != 0 )
       
   171 		{
       
   172 		SetTestStepResult( EFail );
       
   173 		ERR_PRINTF1( _L( "Found \"end\" in message context: KMsvMessagePartDate" ) );
       
   174 		}
       
   175 	
       
   176 	partList = KMsvMessagePartAttachments;		// not supported, returns 0
       
   177 	if ( iSmsClientMtm->Find( _L( "end" ), partList ) != 0 )
       
   178 		{
       
   179 		SetTestStepResult( EFail );
       
   180 		ERR_PRINTF1( _L( "Found \"end\" in message context: KMsvMessagePartAttachments" ) );
       
   181 		}
       
   182 
       
   183 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   184 	if ( iSmsClientMtm->Find( _L( "\n" ), partList ) == partList )
       
   185 		{
       
   186 		SetTestStepResult( EFail );
       
   187 		ERR_PRINTF1( _L( "Found \"\\n\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   188 		}
       
   189 
       
   190 	if ( iSmsClientMtm->Find( _L( "äöå" ), partList ) == partList )
       
   191 		{
       
   192 		SetTestStepResult( EFail );
       
   193 		ERR_PRINTF1( _L( "Found \"äöå\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   194 		}
       
   195 
       
   196 	if ( iSmsClientMtm->Find( _L( "{[}]" ), partList ) != 0 )
       
   197 		{
       
   198 		SetTestStepResult( EFail );
       
   199 		ERR_PRINTF1( _L( "Found \"{[}]\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   200 		}
       
   201 
       
   202 	if ( iSmsClientMtm->Find( _L( "\\" ), partList ) != 0 )
       
   203 		{
       
   204 		SetTestStepResult( EFail );
       
   205 		ERR_PRINTF1( _L( "Found \"\\\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   206 		}
       
   207 
       
   208 	if ( iSmsClientMtm->Find( _L( "4352316542631753dfgfdgs4t6543w563vsd4" ), partList ) != 0 )
       
   209 		{
       
   210 		SetTestStepResult( EFail );
       
   211 		ERR_PRINTF1( _L( "Found \"4352316542631753dfgfdgs4t6543w563vsd4\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   212 		}
       
   213 
       
   214 	if ( iSmsClientMtm->Find( _L( "~" ), partList ) == 0 )
       
   215 		{
       
   216 		SetTestStepResult( EFail );
       
   217 		ERR_PRINTF1( _L( "Cannot find \"~\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   218 		}
       
   219 
       
   220 	if ( iSmsClientMtm->Find( _L( " " ), partList ) == 0 )
       
   221 		{
       
   222 		SetTestStepResult( EFail );
       
   223 		ERR_PRINTF1( _L( "Cannot find \" \" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   224 		}
       
   225 
       
   226 	if ( iSmsClientMtm->Find( _L( "^" ), partList ) != 0 )
       
   227 		{
       
   228 		SetTestStepResult( EFail );
       
   229 		ERR_PRINTF1( _L( "Found \"^\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   230 		}
       
   231 
       
   232 	if ( iSmsClientMtm->Find( _L( "   \"dsasaf¤;¨" ), partList ) != 0 )
       
   233 		{
       
   234 		SetTestStepResult( EFail );
       
   235 		ERR_PRINTF1( _L( "Found \"   \\\"dsasaf¤;¨\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   236 		}
       
   237 
       
   238 	if ( iSmsClientMtm->Find( _L( " " ), partList ) != 0 ) // alt+255
       
   239 		{
       
   240 		SetTestStepResult( EFail );
       
   241 		ERR_PRINTF1( _L( "Found \" \" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   242 		}
       
   243 
       
   244 	if ( iSmsClientMtm->Find( _L( "¨" ), partList ) == 0 )
       
   245 		{
       
   246 		SetTestStepResult( EFail );
       
   247 		ERR_PRINTF1( _L( "Found \"¨\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   248 		}
       
   249 		
       
   250 	if ( iSmsClientMtm->Find( _L( "/\\" ), partList ) != 0 )
       
   251 		{
       
   252 		SetTestStepResult( EFail );
       
   253 		ERR_PRINTF1( _L( "Found \"/\\\" in message context: KMsvMessagePartBody|KMsvMessagePartRecipient" ) );
       
   254 		}
       
   255 		
       
   256 	return TestStepResult( );
       
   257 	
       
   258 	}
       
   259