email/pop3andsmtpmtm/clientmtms/test/src/T_imcm02a.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 1998-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 // Name of test harness: T_IMCM02A
       
    15 // Component: IMCM
       
    16 // Owner: KP
       
    17 // Brief description of test harness:
       
    18 // Tests CImEmailOperation - creates new plaintext and html messages; Also 
       
    19 // tests adding VCard and signature from the SMTP settings.
       
    20 // Detailed description of test harness:
       
    21 // As above
       
    22 // Input files required to run test harness:
       
    23 // \MSG\IMCMTSRC\contacts.cdb					<DRIVE>:\system\data\contacts.cdb
       
    24 // \MSG\IMCMTSRC\T_IMCM02A_Entry_Structure.txt	<DRIVE>:\msgtest\IMCM\T_IMCM02a_Entry_Structure.txt
       
    25 // Intermediate files produced while running test harness:
       
    26 // <DRIVE>:\msglogs\T_IMCM02A\T_IMCM.log
       
    27 // <DRIVE>:\msglogs\T_IMCM02A\Entry_Structure.txt
       
    28 // Output files produced by running test harness:
       
    29 // <DRIVE>:\msglogs\T_IMCM02A.<PLATFORM>.<VARIANT>.LOG.txt
       
    30 // Description of how to build test harness:
       
    31 // cd \msg\imcm\
       
    32 // bldmake bldfiles
       
    33 // abld test build
       
    34 // Description of how to run test harness:
       
    35 // The following instructions are the same for all platforms:
       
    36 // 1. Build T_DB test harness from COMMDB component:
       
    37 // cd \commdb\group
       
    38 // bldmake bldfiles
       
    39 // abld test build t_db
       
    40 // 2. Build the test utilities:
       
    41 // cd \msg\testutils\group\
       
    42 // bldmake bldfiles
       
    43 // abld build
       
    44 // WINS running instructions:
       
    45 // 1. \epoc32\release\wins\<VARIANT>\T_IMCM02A.exe can be used at the command prompt
       
    46 // or executable can be run from Windows Explorer.
       
    47 // All other platform running instructions:
       
    48 // 1. Copy \epoc32\release\<PLATFORM>\<VARIANT>\T_IMCM02A.exe onto the other platform
       
    49 // 2. Copy \epoc32\release\<PLATFORM>\<VARIANT>\MSVTESTUTILS.DLL into 
       
    50 // <DRIVE>:\system\libs on the other platform
       
    51 // 3. Copy \epoc32\release\<PLATFORM>\<VARIANT>\EMAILTESTUTILS.DLL into 
       
    52 // <DRIVE>:\system\libs on the other platform
       
    53 // 4. Run T_IMCM02A.exe on the other platform
       
    54 // 
       
    55 //
       
    56 
       
    57 #include "emailtestutils.h"
       
    58 
       
    59 #include <miutlog.h>
       
    60 #include <miutmsg.h>
       
    61 
       
    62 
       
    63 #include <apfrec.h>
       
    64 #include <apgicnfl.h>
       
    65 #include <ecom/ecom.h>
       
    66 #include <cemailaccounts.h>
       
    67 #include <iapprefs.h>
       
    68 
       
    69 /*
       
    70 // These headers are required when generating the contacts.cdb file
       
    71 #include <cntdb.h>
       
    72 #include <cntfldst.h>
       
    73 #include <cntitem.h>
       
    74 */
       
    75 // local variables etc //
       
    76 
       
    77 #define KPeriod					10000	// period of timer
       
    78 
       
    79 _LIT(KImcm02Test, "T_IMCM02a - CImEmailOperation Tests");
       
    80 _LIT(KMsvServerPattern, "!MsvServer*");
       
    81 RTest test(KImcm02Test);
       
    82 
       
    83 LOCAL_D CTrapCleanup* theCleanup;
       
    84 
       
    85 LOCAL_D CImLog* log;
       
    86 
       
    87 LOCAL_D TMsvId messageId;
       
    88 LOCAL_D TMsvId smtpService;
       
    89 LOCAL_D TMsvId smtpService2;
       
    90 LOCAL_D CEmailTestUtils* testUtils;
       
    91 LOCAL_D CMsvEntrySelection* messageSelection;
       
    92 LOCAL_D TInt testNo = 1;
       
    93 
       
    94 #define KComponent				_L("IMCM")
       
    95 #define KTestMessageDir			_L("")
       
    96 #define KOkFileNameEntryStructure _L("T_IMCM02a_Entry_Structure.txt")
       
    97 
       
    98 class TestUiTimer : public CTimer
       
    99 	{
       
   100 public:
       
   101 	static TestUiTimer* NewLC(CConsoleBase* aConsole, CImEmailOperation* aEmailOperation);
       
   102 
       
   103 	void RunL();
       
   104 	void DoCancel();
       
   105 	void ConstructL();
       
   106 	void IssueRequest();
       
   107 	
       
   108 	CConsoleBase*				iConsole;
       
   109 	CImEmailOperation*			iEmailOperation;
       
   110 	TTimeIntervalMicroSeconds32 period;
       
   111 protected:
       
   112 	TInt iCount;
       
   113 	TBool iClosing;
       
   114 	TestUiTimer(CConsoleBase* aConsole, CImEmailOperation* aEmailOperation);
       
   115 	};
       
   116 
       
   117 //
       
   118 // Progress timer
       
   119 //	  
       
   120 TestUiTimer* TestUiTimer::NewLC(CConsoleBase* aConsole, CImEmailOperation* aEmailOperation)
       
   121 	{
       
   122 	TestUiTimer* self = new(ELeave) TestUiTimer(aConsole, aEmailOperation);
       
   123 	CleanupStack::PushL(self);
       
   124 	self->ConstructL();
       
   125 	return self;
       
   126 	}
       
   127 
       
   128 TestUiTimer::TestUiTimer(CConsoleBase* aConsole, CImEmailOperation* aEmailOperation)
       
   129 	: CTimer(EPriorityStandard+3), iEmailOperation(aEmailOperation)
       
   130 	{
       
   131 	iConsole = aConsole;
       
   132 	period = KPeriod;
       
   133 	iClosing = EFalse;
       
   134 	iCount = 0;
       
   135 	}
       
   136 
       
   137 void TestUiTimer::ConstructL()
       
   138 	{
       
   139 	CTimer::ConstructL();
       
   140 	CActiveScheduler::Add(this);
       
   141 	}
       
   142 
       
   143 void TestUiTimer::IssueRequest()
       
   144 	{
       
   145 	After(period);
       
   146 	}
       
   147 
       
   148 void TestUiTimer::DoCancel()
       
   149 	{
       
   150 	CTimer::DoCancel();
       
   151 	}
       
   152 
       
   153 void TestUiTimer::RunL()
       
   154 	{
       
   155 	// display the current progress
       
   156 	TMsvId temp;	
       
   157 	TPckgC<TMsvId> paramPack(temp);
       
   158 
       
   159 	const TDesC8& progBuf = iEmailOperation->ProgressL();	
       
   160 	paramPack.Set(progBuf);
       
   161 	TMsvId progress=paramPack();	
       
   162 
       
   163 	test.Console()->SetPos(0, 10);
       
   164 	test.Printf(_L("   MessageId %d		\n"),progress);
       
   165 
       
   166 	IssueRequest();
       
   167 	};
       
   168 
       
   169 //
       
   170 
       
   171 
       
   172 /*
       
   173 // Do not delete this function as it may be required to regenerate the contacts.cdb file
       
   174 // if there are any source/binary incompatible changes!
       
   175 
       
   176 LOCAL_C void CreateVCardL()
       
   177   	{
       
   178   	// create own card file.
       
   179   	CContactDatabase* db = CContactDatabase::ReplaceL();
       
   180  	CleanupStack::PushL(db);
       
   181   
       
   182   	CContactItemField* field=CContactItemField::NewLC(KStorageTypeText,KUidContactFieldFamilyName);
       
   183   	field->TextStorage()->SetTextL(_L("Symbian"));
       
   184   	CContactItem* item = CContactCard::NewLC();
       
   185   	item->AddFieldL(*field);
       
   186   	TContactItemId id;
       
   187   	id=db->AddNewContactL(*item);
       
   188   	db->SetOwnCardL(*item);
       
   189   	CleanupStack::PopAndDestroy(); // item
       
   190   	CleanupStack::Pop(); // field
       
   191   	CleanupStack::PopAndDestroy(); // db
       
   192 	}
       
   193 */
       
   194 
       
   195 LOCAL_C void InitL()
       
   196 	{
       
   197 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
   198 	CActiveScheduler::Install(scheduler);
       
   199 	CleanupStack::PushL(scheduler);
       
   200 
       
   201 	testUtils = CEmailTestUtils::NewLC(test);
       
   202 	testUtils->CreateAllTestDirectories();
       
   203 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
   204 	testUtils->ClearEmailAccountsL();
       
   205 	testUtils->CleanMessageFolderL();
       
   206 
       
   207 	testUtils->WriteComment(_L("CImEmailOperation Tests"));
       
   208 	log = CImLog::NewL(_L("c:\\logs\\email\\T_IMCM.log"), EAppend);
       
   209 	CleanupStack::PushL(log);
       
   210 	log->AppendComment(_L8("********* T_IMCM02a Test CImEmailOperation *********"));
       
   211 	TBuf8<80> buf;
       
   212 
       
   213 #if defined(__WINS__)	
       
   214 	buf.Append(_L8("WINS "));
       
   215 #else
       
   216 	buf.Append(_L8("MARM "));
       
   217 #endif
       
   218 #if defined(_UNICODE)
       
   219 	buf.Append(_L8("U"));
       
   220 #endif
       
   221 #if defined(_DEBUG)
       
   222 	buf.Append(_L8("DEB"));
       
   223 #else
       
   224 	buf.Append(_L8("REL"));
       
   225 #endif
       
   226 	log->AppendComment(buf);
       
   227 	}
       
   228 	
       
   229 LOCAL_C void Closedown()
       
   230 	{
       
   231 	log->AppendComment(_L8("**********    T_IMCM02a Tests Complete    **********"));
       
   232 	log->AppendComment(_L8(""));
       
   233 
       
   234 	CleanupStack::PopAndDestroy(3);  //testUtils, log, scheduler
       
   235 	User::After(5000000);
       
   236 	}
       
   237 
       
   238 LOCAL_C void TestMessageProgressL(CImEmailOperation& aEmailOperation, TMsvPartList aPartList, TMsvEmailTypeList aMsvEmailTypeList, TInt aTestNo, TMsvId aSmtpServiceId)
       
   239 	{
       
   240 	test.Console()->SetPos(26, 7);
       
   241 	TInt tempCount = aTestNo%4;
       
   242 	if (tempCount == 0)
       
   243 		test.Printf(_L("|"));
       
   244 	else if (tempCount == 1)
       
   245 		test.Printf(_L("/"));
       
   246 	else if (tempCount == 2)
       
   247 		test.Printf(_L("-"));
       
   248 	else if (tempCount == 3)
       
   249 		test.Printf(_L("\\"));
       
   250 	//check progress
       
   251 	TMsvId temp;	
       
   252 	TPckgC<TMsvId> paramPack(temp);
       
   253 	const TDesC8& progBuf = aEmailOperation.ProgressL();
       
   254 	paramPack.Set(progBuf);
       
   255 	messageId=paramPack();
       
   256 	TInt error = aEmailOperation.iStatus.Int();
       
   257 
       
   258 	TMsvEmailEntry entry;
       
   259 	TMsvId serviceId;
       
   260 	testUtils->iMsvSession->GetEntry(messageId, serviceId, entry);
       
   261 
       
   262 	if (aSmtpServiceId != KMsvNullIndexEntryId)
       
   263 		test(entry.iServiceId == aSmtpServiceId);
       
   264 
       
   265 	_LIT8(KPassed, "\t\tPASSED Test: %d");
       
   266 	_LIT8(KFailed, "\t\tFAILED Test: %d - Tried to Create message:");
       
   267 
       
   268 	TBuf8<80> buf;
       
   269 	if (messageId!=NULL)
       
   270 		{
       
   271 		buf.Format(KPassed, aTestNo, messageId);
       
   272 		log->AppendComment(buf);
       
   273 		testUtils->TestFinish(aTestNo);
       
   274 		}
       
   275 	else
       
   276 		{
       
   277 		buf.Format(KFailed, aTestNo, messageId);
       
   278 		log->AppendError(buf, error);
       
   279 		if (aMsvEmailTypeList & KMsvEmailTypeListMHTMLMessage)
       
   280 			log->AppendError(_L8("\t\t\tHTML message"), error);
       
   281 		if (aPartList & KMsvMessagePartBody)
       
   282 			log->AppendError(_L8("\t\t\t- With Body"), error);
       
   283 		if (aPartList & KMsvMessagePartAttachments)
       
   284 			log->AppendError(_L8("\t\t\t- With Attachments"), error);
       
   285 		if (aPartList & KMsvMessagePartDescription)
       
   286 			log->AppendError(_L8("\t\t\t- With Subject"), error);
       
   287 		if (aPartList & KMsvMessagePartOriginator)
       
   288 			log->AppendError(_L8("\t\t\t- With Originator"), error);
       
   289 		if (aPartList & KMsvMessagePartRecipient)
       
   290 			log->AppendError(_L8("\t\t\t- With Recipient"), error);
       
   291 		}
       
   292 	}
       
   293 
       
   294 LOCAL_C void CreateNewL(TMsvPartList aPartList, TMsvEmailTypeList aMsvEmailTypeList, TInt aTestNo, TMsvId aSmtpServiceId = KMsvNullIndexEntryId)
       
   295 	{
       
   296 	testUtils->TestStart(aTestNo);
       
   297 	CTestActive* testActive = new (ELeave) CTestActive();
       
   298 	CleanupStack::PushL(testActive);
       
   299 
       
   300 
       
   301 	CImEmailOperation* emailOperation;
       
   302 	if (aSmtpServiceId == KMsvNullIndexEntryId)
       
   303 		emailOperation = CImEmailOperation::CreateNewL(testActive->iStatus, *(testUtils->iMsvSession), KMsvGlobalOutBoxIndexEntryId, aPartList, aMsvEmailTypeList, KUidMsgTypeSMTP);
       
   304 	else
       
   305 		emailOperation = CImEmailOperation::CreateNewL(testActive->iStatus, *(testUtils->iMsvSession), KMsvGlobalOutBoxIndexEntryId, aSmtpServiceId, aPartList, aMsvEmailTypeList, KUidMsgTypeSMTP);
       
   306 	CleanupStack::PushL(emailOperation);
       
   307 
       
   308 	TestUiTimer* testUiTimer = TestUiTimer::NewLC(test.Console(), emailOperation);
       
   309 	testActive->StartL();
       
   310 	testUiTimer->IssueRequest();
       
   311 	CActiveScheduler::Start();
       
   312 
       
   313 	TestMessageProgressL(*emailOperation, aPartList, aMsvEmailTypeList, aTestNo, aSmtpServiceId);
       
   314 
       
   315 	CleanupStack::PopAndDestroy(3); // testActive, emailOperation, testUiTimer
       
   316 	}
       
   317 
       
   318 LOCAL_C void SetAddVCardToEmailL(TBool addVCard, TMsvId serviceId)
       
   319 	{
       
   320 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   321 
       
   322 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   323 	CleanupStack::PushL(smtpSettings);
       
   324 
       
   325 	TSmtpAccount smtpAccount;
       
   326  	accounts->GetSmtpAccountL(serviceId, smtpAccount);
       
   327  	accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
       
   328 	
       
   329 	smtpSettings->SetAddVCardToEmail(addVCard);
       
   330 	
       
   331 	accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
       
   332 	
       
   333 	CleanupStack::PopAndDestroy(2, accounts); // smtpSettings, accounts
       
   334 	}
       
   335 
       
   336 LOCAL_C void CreateSignatureL(TMsvId serviceId)
       
   337 	{
       
   338 	testUtils->iMsvEntry->SetEntryL(serviceId);
       
   339 	CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL();
       
   340 	CleanupStack::PushL(paraFormatLayer);
       
   341 
       
   342 	CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); 
       
   343 	CleanupStack::PushL(charFormatLayer);
       
   344 
       
   345 	CRichText* signature=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
       
   346 	CleanupStack::PushL(signature);
       
   347 
       
   348 	TBuf<100> bodyContents = _L("(Signature:) Symbian Ltd.");
       
   349 	signature->InsertL(0, bodyContents);
       
   350 
       
   351 	CMsvStore* msvStore = testUtils->iMsvEntry->EditStoreL();
       
   352 	CleanupStack::PushL(msvStore);
       
   353 	
       
   354 	msvStore->StoreBodyTextL(*signature);
       
   355 	msvStore->Commit();
       
   356 	CleanupStack::PopAndDestroy(4); // msvStore, signature, charFormatLayer, paraFormatLayer
       
   357 	}
       
   358 
       
   359 LOCAL_C void SetSignatureToEmailL(TBool addSignature, TMsvId serviceId)
       
   360 	{
       
   361 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   362 
       
   363 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   364 	CleanupStack::PushL(smtpSettings);
       
   365 
       
   366   	TSmtpAccount smtpAccount;
       
   367  	accounts->GetSmtpAccountL(serviceId, smtpAccount);
       
   368  	accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
       
   369 
       
   370 	smtpSettings->SetAddSignatureToEmail(addSignature);
       
   371 	
       
   372 	accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
       
   373 	
       
   374 	CleanupStack::PopAndDestroy(2, accounts); // smtpSettings, accounts
       
   375 	if (addSignature)
       
   376 		log->AppendComment(_L8("\tAdd VCard"));
       
   377 	}
       
   378 
       
   379 
       
   380 LOCAL_C void SetDefaultServiceL(TMsvId smtpService)
       
   381 	{
       
   382 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   383 	TSmtpAccount smtpAccount;
       
   384 	accounts->GetSmtpAccountL(smtpService, smtpAccount);
       
   385 	accounts->SetDefaultSmtpAccountL(smtpAccount);
       
   386 	CleanupStack::PopAndDestroy(accounts);
       
   387 	}
       
   388 
       
   389 LOCAL_C void DoPlaintextCreateNewTestsL()
       
   390 	{
       
   391 	TMsvPartList partList = 0;
       
   392 	TMsvEmailTypeList emailTypeList = 0;
       
   393 
       
   394 	//
       
   395 	// Plaintext messages
       
   396 	//
       
   397 	log->AppendComment(_L8("\tPlaintext Create New Message Tests"));
       
   398 
       
   399 	// basic new message with nothing!
       
   400 	CreateNewL(partList, emailTypeList, testNo++);
       
   401 
       
   402 	// only body
       
   403 	partList = KMsvMessagePartBody;
       
   404 	CreateNewL(partList, emailTypeList, testNo++);
       
   405 
       
   406 	// only attachment
       
   407 	partList = KMsvMessagePartAttachments;
       
   408 	CreateNewL(partList, emailTypeList, testNo++);
       
   409 
       
   410 	// only body and attachment
       
   411 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   412 	CreateNewL(partList, emailTypeList, testNo++);
       
   413 
       
   414 	// basic new message with subject
       
   415 	partList = KMsvMessagePartDescription;
       
   416 	CreateNewL(partList, emailTypeList, testNo++);
       
   417 
       
   418 	// only body and subject
       
   419 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   420 	CreateNewL(partList, emailTypeList, testNo++);
       
   421 
       
   422 	// only attachment and subject
       
   423 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   424 	CreateNewL(partList, emailTypeList, testNo++);
       
   425 
       
   426 	// only body, attachment and subject 
       
   427 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   428 	CreateNewL(partList, emailTypeList, testNo++);
       
   429 
       
   430 	// basic new message with originator
       
   431 	partList = KMsvMessagePartOriginator;
       
   432 	CreateNewL(partList, emailTypeList, testNo++);
       
   433 
       
   434 	// only body and originator
       
   435 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   436 	CreateNewL(partList, emailTypeList, testNo++);
       
   437 
       
   438 	// only attachment and originator
       
   439 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   440 	CreateNewL(partList, emailTypeList, testNo++);
       
   441 
       
   442 	// only body, attachment and originator
       
   443 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   444 	CreateNewL(partList, emailTypeList, testNo++);
       
   445 
       
   446 	// basic new message with subject and originator
       
   447 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   448 	CreateNewL(partList, emailTypeList, testNo++);
       
   449 
       
   450 	// only body, subject and originator
       
   451 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   452 	CreateNewL(partList, emailTypeList, testNo++);
       
   453 
       
   454 	// only attachment, subject and originator
       
   455 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   456 	CreateNewL(partList, emailTypeList, testNo++);
       
   457 
       
   458 	// only body, attachment, subject and originator
       
   459 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   460 	CreateNewL(partList, emailTypeList, testNo++);
       
   461 
       
   462 	// basic new message with recipients
       
   463 	partList = KMsvMessagePartRecipient;
       
   464 	CreateNewL(partList, emailTypeList, testNo++);
       
   465 
       
   466 	// only body and recipients
       
   467 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   468 	CreateNewL(partList, emailTypeList, testNo++);
       
   469 
       
   470 	// only attachment and recipients
       
   471 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   472 	CreateNewL(partList, emailTypeList, testNo++);
       
   473 
       
   474 	// only body, attachment and recipients
       
   475 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   476 	CreateNewL(partList, emailTypeList, testNo++);
       
   477 
       
   478 	// basic new message with subject and recipients
       
   479 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   480 	CreateNewL(partList, emailTypeList, testNo++);
       
   481 
       
   482 	// only body, subject and recipients
       
   483 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   484 	CreateNewL(partList, emailTypeList, testNo++);
       
   485 
       
   486 	// only attachment, subject and recipients
       
   487 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   488 	CreateNewL(partList, emailTypeList, testNo++);
       
   489 
       
   490 	// only body, attachment, subject and recipients
       
   491 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   492 	CreateNewL(partList, emailTypeList, testNo++);
       
   493 
       
   494 	// basic new message with originator and recipients
       
   495 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   496 	CreateNewL(partList, emailTypeList, testNo++);
       
   497 
       
   498 	// only body, originator and recipients
       
   499 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   500 	CreateNewL(partList, emailTypeList, testNo++);
       
   501 
       
   502 	// only attachment, originator and recipients
       
   503 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   504 	CreateNewL(partList, emailTypeList, testNo++);
       
   505 
       
   506 	// only body, attachment, originator and recipients
       
   507 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   508 	CreateNewL(partList, emailTypeList, testNo++);
       
   509 
       
   510 	// basic new message with subject, originator and recipients
       
   511 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   512 	CreateNewL(partList, emailTypeList, testNo++);
       
   513 
       
   514 	// only body, subject, originator and recipients
       
   515 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   516 	CreateNewL(partList, emailTypeList, testNo++);
       
   517 
       
   518 	// only attachment, subject, originator and recipients
       
   519 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   520 	CreateNewL(partList, emailTypeList, testNo++);
       
   521 
       
   522 	// only body, attachment, subject, originator and recipients
       
   523 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   524 	CreateNewL(partList, emailTypeList, testNo++);
       
   525 
       
   526 	// Create a VCard and store in the SMTP settings
       
   527 	SetAddVCardToEmailL(ETrue, smtpService);
       
   528 	log->AppendComment(_L8("\tPlaintext Create New Message with VCard Tests"));
       
   529 
       
   530 	// basic new message with VCard
       
   531 	partList = 0;
       
   532 	CreateNewL(partList, emailTypeList, testNo++);
       
   533 
       
   534 	// only body and VCard
       
   535 	partList = KMsvMessagePartBody;
       
   536 	CreateNewL(partList, emailTypeList, testNo++);
       
   537 
       
   538 	// only attachment and VCard
       
   539 	partList = KMsvMessagePartAttachments;
       
   540 	CreateNewL(partList, emailTypeList, testNo++);
       
   541 
       
   542 	// only body, attachment and VCard
       
   543 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   544 	CreateNewL(partList, emailTypeList, testNo++);
       
   545 
       
   546 	// basic new message with subject and VCard
       
   547 	partList = KMsvMessagePartDescription;
       
   548 	CreateNewL(partList, emailTypeList, testNo++);
       
   549 
       
   550 	// only body, subject and VCard
       
   551 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   552 	CreateNewL(partList, emailTypeList, testNo++);
       
   553 
       
   554 	// only attachment, subject and VCard
       
   555 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   556 	CreateNewL(partList, emailTypeList, testNo++);
       
   557 
       
   558 	// only body, attachment, subject and VCard
       
   559 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   560 	CreateNewL(partList, emailTypeList, testNo++);
       
   561 
       
   562 	// basic new message with originator and VCard
       
   563 	partList = KMsvMessagePartOriginator;
       
   564 	CreateNewL(partList, emailTypeList, testNo++);
       
   565 
       
   566 	// only body, originator and VCard
       
   567 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   568 	CreateNewL(partList, emailTypeList, testNo++);
       
   569 
       
   570 	// only attachment, originator and VCard
       
   571 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   572 	CreateNewL(partList, emailTypeList, testNo++);
       
   573 
       
   574 	// only body, attachment, originator and VCard
       
   575 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   576 	CreateNewL(partList, emailTypeList, testNo++);
       
   577 
       
   578 	// basic new message with subject, originator and VCard
       
   579 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   580 	CreateNewL(partList, emailTypeList, testNo++);
       
   581 
       
   582 	// only body, subject, originator and VCard
       
   583 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   584 	CreateNewL(partList, emailTypeList, testNo++);
       
   585 
       
   586 	// only attachment, subject, originator and VCard
       
   587 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   588 	CreateNewL(partList, emailTypeList, testNo++);
       
   589 
       
   590 	// only body, attachment, subject, originator and VCard
       
   591 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   592 	CreateNewL(partList, emailTypeList, testNo++);
       
   593 
       
   594 	// basic new message with recipients and VCard
       
   595 	partList = KMsvMessagePartRecipient;
       
   596 	CreateNewL(partList, emailTypeList, testNo++);
       
   597 
       
   598 	// only body, recipients and VCard
       
   599 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   600 	CreateNewL(partList, emailTypeList, testNo++);
       
   601 
       
   602 	// only attachment, recipients and VCard
       
   603 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   604 	CreateNewL(partList, emailTypeList, testNo++);
       
   605 
       
   606 	// only body, attachment, recipients and VCard
       
   607 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   608 	CreateNewL(partList, emailTypeList, testNo++);
       
   609 
       
   610 	// basic new message with subject, recipients and VCard
       
   611 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   612 	CreateNewL(partList, emailTypeList, testNo++);
       
   613 
       
   614 	// only body, subject, recipients and VCard
       
   615 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   616 	CreateNewL(partList, emailTypeList, testNo++);
       
   617 
       
   618 	// only attachment, subject, recipients and VCard
       
   619 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   620 	CreateNewL(partList, emailTypeList, testNo++);
       
   621 
       
   622 	// only body, attachment, subject, recipients and VCard
       
   623 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   624 	CreateNewL(partList, emailTypeList, testNo++);
       
   625 
       
   626 	// basic new message with originator, recipients and VCard
       
   627 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   628 	CreateNewL(partList, emailTypeList, testNo++);
       
   629 
       
   630 	// only body, originator, recipients and VCard
       
   631 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   632 	CreateNewL(partList, emailTypeList, testNo++);
       
   633 
       
   634 	// only attachment, originator, recipients and VCard
       
   635 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   636 	CreateNewL(partList, emailTypeList, testNo++);
       
   637 
       
   638 	// only body, attachment, originator, recipients and VCard
       
   639 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   640 	CreateNewL(partList, emailTypeList, testNo++);
       
   641 
       
   642 	// basic new message with subject, originator, recipients and VCard
       
   643 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   644 	CreateNewL(partList, emailTypeList, testNo++);
       
   645 
       
   646 	// only body, subject, originator, recipients and VCard
       
   647 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   648 	CreateNewL(partList, emailTypeList, testNo++);
       
   649 
       
   650 	// only attachment, subject, originator, recipients and VCard
       
   651 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   652 	CreateNewL(partList, emailTypeList, testNo++);
       
   653 
       
   654 	// only body, attachment, subject, originator, recipients and VCard
       
   655 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   656 	CreateNewL(partList, emailTypeList, testNo++);
       
   657 
       
   658 	// Store signature in the SMTP settings
       
   659 	log->AppendComment(_L8("\tPlaintext Create New Message with signature Tests"));
       
   660 	SetAddVCardToEmailL(EFalse, smtpService);
       
   661 	CreateSignatureL(smtpService);
       
   662 	SetSignatureToEmailL(ETrue, smtpService);
       
   663 
       
   664 	// basic new message with signature!
       
   665 	partList = 0;
       
   666 	CreateNewL(partList, emailTypeList, testNo++);
       
   667 
       
   668 	// only body and signature
       
   669 	partList = KMsvMessagePartBody;
       
   670 	CreateNewL(partList, emailTypeList, testNo++);
       
   671 
       
   672 	// only attachment and signature
       
   673 	partList = KMsvMessagePartAttachments;
       
   674 	CreateNewL(partList, emailTypeList, testNo++);
       
   675 
       
   676 	// only body, attachment and signature
       
   677 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   678 	CreateNewL(partList, emailTypeList, testNo++);
       
   679 
       
   680 	// basic new message with subject and signature
       
   681 	partList = KMsvMessagePartDescription;
       
   682 	CreateNewL(partList, emailTypeList, testNo++);
       
   683 
       
   684 	// only body, subject and signature
       
   685 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   686 	CreateNewL(partList, emailTypeList, testNo++);
       
   687 
       
   688 	// only attachment, subject and signature
       
   689 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   690 	CreateNewL(partList, emailTypeList, testNo++);
       
   691 
       
   692 	// only body, attachment, subject and signature
       
   693 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   694 	CreateNewL(partList, emailTypeList, testNo++);
       
   695 
       
   696 	// basic new message with originator and signature
       
   697 	partList = KMsvMessagePartOriginator;
       
   698 	CreateNewL(partList, emailTypeList, testNo++);
       
   699 
       
   700 	// only body, originator and signature
       
   701 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   702 	CreateNewL(partList, emailTypeList, testNo++);
       
   703 
       
   704 	// only attachment, originator and signature
       
   705 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   706 	CreateNewL(partList, emailTypeList, testNo++);
       
   707 
       
   708 	// only body, attachment, originator and signature
       
   709 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   710 	CreateNewL(partList, emailTypeList, testNo++);
       
   711 
       
   712 	// basic new message with subject, originator and signature
       
   713 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   714 	CreateNewL(partList, emailTypeList, testNo++);
       
   715 
       
   716 	// only body, subject, originator and signature
       
   717 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   718 	CreateNewL(partList, emailTypeList, testNo++);
       
   719 
       
   720 	// only attachment, subject, originator and signature
       
   721 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   722 	CreateNewL(partList, emailTypeList, testNo++);
       
   723 
       
   724 	// only body, attachment, subject, originator and signature
       
   725 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   726 	CreateNewL(partList, emailTypeList, testNo++);
       
   727 
       
   728 	// basic new message with recipients and signature
       
   729 	partList = KMsvMessagePartRecipient;
       
   730 	CreateNewL(partList, emailTypeList, testNo++);
       
   731 
       
   732 	// only body, recipients and signature
       
   733 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   734 	CreateNewL(partList, emailTypeList, testNo++);
       
   735 
       
   736 	// only attachment, recipients and signature
       
   737 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   738 	CreateNewL(partList, emailTypeList, testNo++);
       
   739 
       
   740 	// only body, attachment, recipients and signature
       
   741 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   742 	CreateNewL(partList, emailTypeList, testNo++);
       
   743 
       
   744 	// basic new message with subject, recipients and signature
       
   745 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   746 	CreateNewL(partList, emailTypeList, testNo++);
       
   747 
       
   748 	// only body, subject, recipients and signature
       
   749 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   750 	CreateNewL(partList, emailTypeList, testNo++);
       
   751 
       
   752 	// only attachment, subject, recipients and signature
       
   753 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   754 	CreateNewL(partList, emailTypeList, testNo++);
       
   755 
       
   756 	// only body, attachment, subject, recipients and signature
       
   757 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   758 	CreateNewL(partList, emailTypeList, testNo++);
       
   759 
       
   760 	// basic new message with originator, recipients and signature
       
   761 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   762 	CreateNewL(partList, emailTypeList, testNo++);
       
   763 
       
   764 	// only body, originator, recipients and signature
       
   765 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   766 	CreateNewL(partList, emailTypeList, testNo++);
       
   767 
       
   768 	// only attachment, originator, recipients and signature
       
   769 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   770 	CreateNewL(partList, emailTypeList, testNo++);
       
   771 
       
   772 	// only body, attachment, originator, recipients and signature
       
   773 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   774 	CreateNewL(partList, emailTypeList, testNo++);
       
   775 
       
   776 	// basic new message with subject, originator, recipients and signature
       
   777 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   778 	CreateNewL(partList, emailTypeList, testNo++);
       
   779 
       
   780 	// only body, subject, originator, recipients and signature
       
   781 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   782 	CreateNewL(partList, emailTypeList, testNo++);
       
   783 
       
   784 	// only attachment, subject, originator, recipients and signature
       
   785 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   786 	CreateNewL(partList, emailTypeList, testNo++);
       
   787 
       
   788 	// only body, attachment, subject, originator, recipients and signature
       
   789 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   790 	CreateNewL(partList, emailTypeList, testNo++);
       
   791 
       
   792 	// Create a VCard and store in the SMTP settings
       
   793 	log->AppendComment(_L8("\tPlaintext Create New Message with VCard and Signature Tests"));
       
   794 	SetAddVCardToEmailL(ETrue, smtpService);
       
   795 
       
   796 	// basic new message with VCard and Signature!
       
   797 	partList = 0;
       
   798 	CreateNewL(partList, emailTypeList, testNo++);
       
   799 
       
   800 	// only body, VCard and Signature
       
   801 	partList = KMsvMessagePartBody;
       
   802 	CreateNewL(partList, emailTypeList, testNo++);
       
   803 
       
   804 	// only attachment, VCard and Signature
       
   805 	partList = KMsvMessagePartAttachments;
       
   806 	CreateNewL(partList, emailTypeList, testNo++);
       
   807 
       
   808 	// only body, attachment, VCard and Signature
       
   809 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   810 	CreateNewL(partList, emailTypeList, testNo++);
       
   811 
       
   812 	// basic new message with subject, VCard and Signature
       
   813 	partList = KMsvMessagePartDescription;
       
   814 	CreateNewL(partList, emailTypeList, testNo++);
       
   815 
       
   816 	// only body, subject, VCard and Signature
       
   817 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   818 	CreateNewL(partList, emailTypeList, testNo++);
       
   819 
       
   820 	// only attachment, subject, VCard and Signature
       
   821 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   822 	CreateNewL(partList, emailTypeList, testNo++);
       
   823 
       
   824 	// only body, attachment, subject, VCard and Signature
       
   825 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   826 	CreateNewL(partList, emailTypeList, testNo++);
       
   827 
       
   828 	// basic new message with originator, VCard and Signature
       
   829 	partList = KMsvMessagePartOriginator;
       
   830 	CreateNewL(partList, emailTypeList, testNo++);
       
   831 
       
   832 	// only body, originator, VCard and Signature
       
   833 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   834 	CreateNewL(partList, emailTypeList, testNo++);
       
   835 
       
   836 	// only attachment, originator, VCard and Signature
       
   837 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   838 	CreateNewL(partList, emailTypeList, testNo++);
       
   839 
       
   840 	// only body, attachment, originator, VCard and Signature
       
   841 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   842 	CreateNewL(partList, emailTypeList, testNo++);
       
   843 
       
   844 	// basic new message with subject, originator, VCard and Signature
       
   845 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   846 	CreateNewL(partList, emailTypeList, testNo++);
       
   847 
       
   848 	// only body, subject, originator, VCard and Signature
       
   849 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   850 	CreateNewL(partList, emailTypeList, testNo++);
       
   851 
       
   852 	// only attachment, subject, originator, VCard and Signature
       
   853 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   854 	CreateNewL(partList, emailTypeList, testNo++);
       
   855 
       
   856 	// only body, attachment, subject, originator, VCard and Signature
       
   857 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   858 	CreateNewL(partList, emailTypeList, testNo++);
       
   859 
       
   860 	// basic new message with recipients, VCard and Signature
       
   861 	partList = KMsvMessagePartRecipient;
       
   862 	CreateNewL(partList, emailTypeList, testNo++);
       
   863 
       
   864 	// only body, recipients, VCard and Signature
       
   865 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   866 	CreateNewL(partList, emailTypeList, testNo++);
       
   867 
       
   868 	// only attachment, recipients, VCard and Signature
       
   869 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   870 	CreateNewL(partList, emailTypeList, testNo++);
       
   871 
       
   872 	// only body, attachment, recipients, VCard and Signature
       
   873 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   874 	CreateNewL(partList, emailTypeList, testNo++);
       
   875 
       
   876 	// basic new message with subject, recipients, VCard and Signature
       
   877 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   878 	CreateNewL(partList, emailTypeList, testNo++);
       
   879 
       
   880 	// only body, subject, recipients, VCard and Signature
       
   881 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   882 	CreateNewL(partList, emailTypeList, testNo++);
       
   883 
       
   884 	// only attachment, subject, recipients, VCard and Signature
       
   885 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   886 	CreateNewL(partList, emailTypeList, testNo++);
       
   887 
       
   888 	// only body, attachment, subject, recipients, VCard and Signature
       
   889 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   890 	CreateNewL(partList, emailTypeList, testNo++);
       
   891 
       
   892 	// basic new message with originator, recipients, VCard and Signature
       
   893 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   894 	CreateNewL(partList, emailTypeList, testNo++);
       
   895 
       
   896 	// only body, originator, recipients, VCard and Signature
       
   897 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   898 	CreateNewL(partList, emailTypeList, testNo++);
       
   899 
       
   900 	// only attachment, originator, recipients, VCard and Signature
       
   901 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   902 	CreateNewL(partList, emailTypeList, testNo++);
       
   903 
       
   904 	// only body, attachment, originator, recipients, VCard and Signature
       
   905 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   906 	CreateNewL(partList, emailTypeList, testNo++);
       
   907 
       
   908 	// basic new message with subject, originator, recipients, VCard and Signature
       
   909 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   910 	CreateNewL(partList, emailTypeList, testNo++);
       
   911 
       
   912 	// only body, subject, originator, recipients, VCard and Signature
       
   913 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   914 	CreateNewL(partList, emailTypeList, testNo++);
       
   915 
       
   916 	// only attachment, subject, originator, recipients, VCard and Signature
       
   917 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   918 	CreateNewL(partList, emailTypeList, testNo++);
       
   919 
       
   920 	// only body, attachment, subject, originator, recipients, VCard and Signature
       
   921 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   922 	CreateNewL(partList, emailTypeList, testNo++);
       
   923 	}
       
   924 
       
   925 LOCAL_C void DoHtmlCreateNewTestsL()
       
   926 	{
       
   927 	TMsvPartList partList = 0;
       
   928 	TMsvEmailTypeList emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
   929 
       
   930 	//
       
   931 	// HTML Messages
       
   932 	//
       
   933 	log->AppendComment(_L8("\tHTML Create New Message Tests"));
       
   934 
       
   935 	// basic new message with nothing!
       
   936 	partList = 0;
       
   937 	CreateNewL(partList, emailTypeList, testNo++);
       
   938 
       
   939 	// only body
       
   940 	partList = KMsvMessagePartBody;
       
   941 	CreateNewL(partList, emailTypeList, testNo++);
       
   942 
       
   943 	// only attachment
       
   944 	partList = KMsvMessagePartAttachments;
       
   945 	CreateNewL(partList, emailTypeList, testNo++);
       
   946 
       
   947 	// only body and attachment
       
   948 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   949 	CreateNewL(partList, emailTypeList, testNo++);
       
   950 
       
   951 	// basic new message with subject
       
   952 	partList = KMsvMessagePartDescription;
       
   953 	CreateNewL(partList, emailTypeList, testNo++);
       
   954 
       
   955 	// only body and subject
       
   956 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   957 	CreateNewL(partList, emailTypeList, testNo++);
       
   958 
       
   959 	// only attachment and subject
       
   960 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   961 	CreateNewL(partList, emailTypeList, testNo++);
       
   962 
       
   963 	// only body, attachment and subject 
       
   964 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   965 	CreateNewL(partList, emailTypeList, testNo++);
       
   966 
       
   967 	// basic new message with originator
       
   968 	partList = KMsvMessagePartOriginator;
       
   969 	CreateNewL(partList, emailTypeList, testNo++);
       
   970 
       
   971 	// only body and originator
       
   972 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   973 	CreateNewL(partList, emailTypeList, testNo++);
       
   974 
       
   975 	// only attachment and originator
       
   976 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   977 	CreateNewL(partList, emailTypeList, testNo++);
       
   978 
       
   979 	// only body, attachment and originator
       
   980 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   981 	CreateNewL(partList, emailTypeList, testNo++);
       
   982 
       
   983 	// basic new message with subject and originator
       
   984 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   985 	CreateNewL(partList, emailTypeList, testNo++);
       
   986 
       
   987 	// only body, subject and originator
       
   988 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   989 	CreateNewL(partList, emailTypeList, testNo++);
       
   990 
       
   991 	// only attachment, subject and originator
       
   992 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   993 	CreateNewL(partList, emailTypeList, testNo++);
       
   994 
       
   995 	// only body, attachment, subject and originator
       
   996 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   997 	CreateNewL(partList, emailTypeList, testNo++);
       
   998 
       
   999 	// basic new message with recipients
       
  1000 	partList = KMsvMessagePartRecipient;
       
  1001 	CreateNewL(partList, emailTypeList, testNo++);
       
  1002 
       
  1003 	// only body and recipients
       
  1004 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
  1005 	CreateNewL(partList, emailTypeList, testNo++);
       
  1006 
       
  1007 	// only attachment and recipients
       
  1008 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1009 	TRAPD(createErr, CreateNewL(partList, emailTypeList, testNo++));
       
  1010 
       
  1011 	// only body, attachment and recipients
       
  1012 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1013 	CreateNewL(partList, emailTypeList, testNo++);
       
  1014 
       
  1015 	// basic new message with subject and recipients
       
  1016 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1017 	CreateNewL(partList, emailTypeList, testNo++);
       
  1018 
       
  1019 	// only body, subject and recipients
       
  1020 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1021 	CreateNewL(partList, emailTypeList, testNo++);
       
  1022 
       
  1023 	// only attachment, subject and recipients
       
  1024 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1025 	CreateNewL(partList, emailTypeList, testNo++);
       
  1026 
       
  1027 	// only body, attachment, subject and recipients
       
  1028 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1029 	CreateNewL(partList, emailTypeList, testNo++);
       
  1030 
       
  1031 	// basic new message with originator and recipients
       
  1032 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1033 	CreateNewL(partList, emailTypeList, testNo++);
       
  1034 
       
  1035 	// only body, originator and recipients
       
  1036 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1037 	CreateNewL(partList, emailTypeList, testNo++);
       
  1038 
       
  1039 	// only attachment, originator and recipients
       
  1040 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1041 	CreateNewL(partList, emailTypeList, testNo++);
       
  1042 
       
  1043 	// only body, attachment, originator and recipients
       
  1044 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1045 	CreateNewL(partList, emailTypeList, testNo++);
       
  1046 
       
  1047 	// basic new message with subject, originator and recipients
       
  1048 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1049 	CreateNewL(partList, emailTypeList, testNo++);
       
  1050 
       
  1051 	// only body, subject, originator and recipients
       
  1052 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1053 	CreateNewL(partList, emailTypeList, testNo++);
       
  1054 
       
  1055 	// only attachment, subject, originator and recipients
       
  1056 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1057 	CreateNewL(partList, emailTypeList, testNo++);
       
  1058 
       
  1059 	// only body, attachment, subject, originator and recipients
       
  1060 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1061 	CreateNewL(partList, emailTypeList, testNo++);
       
  1062 
       
  1063 	// Create a VCard and store in the SMTP settings
       
  1064 	SetAddVCardToEmailL(ETrue, smtpService);
       
  1065 	log->AppendComment(_L8("\tHTML Create New Message with VCard Tests"));
       
  1066 
       
  1067 	// basic new message with VCard
       
  1068 	partList = 0;
       
  1069 	CreateNewL(partList, emailTypeList, testNo++);
       
  1070 
       
  1071 	// only body and VCard
       
  1072 	partList = KMsvMessagePartBody;
       
  1073 	CreateNewL(partList, emailTypeList, testNo++);
       
  1074 
       
  1075 	// only attachment and VCard
       
  1076 	partList = KMsvMessagePartAttachments;
       
  1077 	CreateNewL(partList, emailTypeList, testNo++);
       
  1078 
       
  1079 	// only body, attachment and VCard
       
  1080 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
  1081 	CreateNewL(partList, emailTypeList, testNo++);
       
  1082 
       
  1083 	// basic new message with subject and VCard
       
  1084 	partList = KMsvMessagePartDescription;
       
  1085 	CreateNewL(partList, emailTypeList, testNo++);
       
  1086 
       
  1087 	// only body, subject and VCard
       
  1088 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
  1089 	CreateNewL(partList, emailTypeList, testNo++);
       
  1090 
       
  1091 	// only attachment, subject and VCard
       
  1092 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1093 	CreateNewL(partList, emailTypeList, testNo++);
       
  1094 
       
  1095 	// only body, attachment, subject and VCard
       
  1096 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1097 	CreateNewL(partList, emailTypeList, testNo++);
       
  1098 
       
  1099 	// basic new message with originator and VCard
       
  1100 	partList = KMsvMessagePartOriginator;
       
  1101 	CreateNewL(partList, emailTypeList, testNo++);
       
  1102 
       
  1103 	// only body, originator and VCard
       
  1104 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
  1105 	CreateNewL(partList, emailTypeList, testNo++);
       
  1106 
       
  1107 	// only attachment, originator and VCard
       
  1108 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1109 	CreateNewL(partList, emailTypeList, testNo++);
       
  1110 
       
  1111 	// only body, attachment, originator and VCard
       
  1112 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1113 	CreateNewL(partList, emailTypeList, testNo++);
       
  1114 
       
  1115 	// basic new message with subject, originator and VCard
       
  1116 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1117 	CreateNewL(partList, emailTypeList, testNo++);
       
  1118 
       
  1119 	// only body, subject, originator and VCard
       
  1120 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1121 	CreateNewL(partList, emailTypeList, testNo++);
       
  1122 
       
  1123 	// only attachment, subject, originator and VCard
       
  1124 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1125 	CreateNewL(partList, emailTypeList, testNo++);
       
  1126 
       
  1127 	// only body, attachment, subject, originator and VCard
       
  1128 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1129 	CreateNewL(partList, emailTypeList, testNo++);
       
  1130 
       
  1131 	// basic new message with recipients and VCard
       
  1132 	partList = KMsvMessagePartRecipient;
       
  1133 	CreateNewL(partList, emailTypeList, testNo++);
       
  1134 
       
  1135 	// only body, recipients and VCard
       
  1136 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
  1137 	CreateNewL(partList, emailTypeList, testNo++);
       
  1138 
       
  1139 	// only attachment, recipients and VCard
       
  1140 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1141 	CreateNewL(partList, emailTypeList, testNo++);
       
  1142 
       
  1143 	// only body, attachment, recipients and VCard
       
  1144 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1145 	CreateNewL(partList, emailTypeList, testNo++);
       
  1146 
       
  1147 	// basic new message with subject, recipients and VCard
       
  1148 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1149 	CreateNewL(partList, emailTypeList, testNo++);
       
  1150 
       
  1151 	// only body, subject, recipients and VCard
       
  1152 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1153 	CreateNewL(partList, emailTypeList, testNo++);
       
  1154 
       
  1155 	// only attachment, subject, recipients and VCard
       
  1156 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1157 	CreateNewL(partList, emailTypeList, testNo++);
       
  1158 
       
  1159 	// only body, attachment, subject, recipients and VCard
       
  1160 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1161 	CreateNewL(partList, emailTypeList, testNo++);
       
  1162 
       
  1163 	// basic new message with originator, recipients and VCard
       
  1164 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1165 	CreateNewL(partList, emailTypeList, testNo++);
       
  1166 
       
  1167 	// only body, originator, recipients and VCard
       
  1168 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1169 	CreateNewL(partList, emailTypeList, testNo++);
       
  1170 
       
  1171 	// only attachment, originator, recipients and VCard
       
  1172 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1173 	CreateNewL(partList, emailTypeList, testNo++);
       
  1174 
       
  1175 	// only body, attachment, originator, recipients and VCard
       
  1176 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1177 	CreateNewL(partList, emailTypeList, testNo++);
       
  1178 
       
  1179 	// basic new message with subject, originator, recipients and VCard
       
  1180 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1181 	CreateNewL(partList, emailTypeList, testNo++);
       
  1182 
       
  1183 	// only body, subject, originator, recipients and VCard
       
  1184 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1185 	CreateNewL(partList, emailTypeList, testNo++);
       
  1186 
       
  1187 	// only attachment, subject, originator, recipients and VCard
       
  1188 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1189 	CreateNewL(partList, emailTypeList, testNo++);
       
  1190 
       
  1191 	// only body, attachment, subject, originator, recipients and VCard
       
  1192 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1193 	CreateNewL(partList, emailTypeList, testNo++);
       
  1194 
       
  1195 	// Store signature in the SMTP settings
       
  1196 	SetAddVCardToEmailL(EFalse, smtpService);
       
  1197 	CreateSignatureL(smtpService);
       
  1198 	SetSignatureToEmailL(ETrue, smtpService);
       
  1199 	log->AppendComment(_L8("\tHTML Create New Message with Signature Tests"));
       
  1200 
       
  1201 	// basic new message with signature!
       
  1202 	partList = 0;
       
  1203 	CreateNewL(partList, emailTypeList, testNo++);
       
  1204 
       
  1205 	// only body and signature
       
  1206 	partList = KMsvMessagePartBody;
       
  1207 	CreateNewL(partList, emailTypeList, testNo++);
       
  1208 
       
  1209 	// only attachment and signature
       
  1210 	partList = KMsvMessagePartAttachments;
       
  1211 	CreateNewL(partList, emailTypeList, testNo++);
       
  1212 
       
  1213 	// only body, attachment and signature
       
  1214 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
  1215 	CreateNewL(partList, emailTypeList, testNo++);
       
  1216 
       
  1217 	// basic new message with subject and signature
       
  1218 	partList = KMsvMessagePartDescription;
       
  1219 	CreateNewL(partList, emailTypeList, testNo++);
       
  1220 
       
  1221 	// only body, subject and signature
       
  1222 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
  1223 	CreateNewL(partList, emailTypeList, testNo++);
       
  1224 
       
  1225 	// only attachment, subject and signature
       
  1226 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1227 	CreateNewL(partList, emailTypeList, testNo++);
       
  1228 
       
  1229 	// only body, attachment, subject and signature
       
  1230 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1231 	CreateNewL(partList, emailTypeList, testNo++);
       
  1232 
       
  1233 	// basic new message with originator and signature
       
  1234 	partList = KMsvMessagePartOriginator;
       
  1235 	CreateNewL(partList, emailTypeList, testNo++);
       
  1236 
       
  1237 	// only body, originator and signature
       
  1238 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
  1239 	CreateNewL(partList, emailTypeList, testNo++);
       
  1240 
       
  1241 	// only attachment, originator and signature
       
  1242 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1243 	CreateNewL(partList, emailTypeList, testNo++);
       
  1244 
       
  1245 	// only body, attachment, originator and signature
       
  1246 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1247 	CreateNewL(partList, emailTypeList, testNo++);
       
  1248 
       
  1249 	// basic new message with subject, originator and signature
       
  1250 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1251 	CreateNewL(partList, emailTypeList, testNo++);
       
  1252 
       
  1253 	// only body, subject, originator and signature
       
  1254 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1255 	CreateNewL(partList, emailTypeList, testNo++);
       
  1256 
       
  1257 	// only attachment, subject, originator and signature
       
  1258 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1259 	CreateNewL(partList, emailTypeList, testNo++);
       
  1260 
       
  1261 	// only body, attachment, subject, originator and signature
       
  1262 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1263 	CreateNewL(partList, emailTypeList, testNo++);
       
  1264 
       
  1265 	// basic new message with recipients and signature
       
  1266 	partList = KMsvMessagePartRecipient;
       
  1267 	CreateNewL(partList, emailTypeList, testNo++);
       
  1268 
       
  1269 	// only body, recipients and signature
       
  1270 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
  1271 	CreateNewL(partList, emailTypeList, testNo++);
       
  1272 
       
  1273 	// only attachment, recipients and signature
       
  1274 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1275 	CreateNewL(partList, emailTypeList, testNo++);
       
  1276 
       
  1277 	// only body, attachment, recipients and signature
       
  1278 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1279 	CreateNewL(partList, emailTypeList, testNo++);
       
  1280 
       
  1281 	// basic new message with subject, recipients and signature
       
  1282 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1283 	CreateNewL(partList, emailTypeList, testNo++);
       
  1284 
       
  1285 	// only body, subject, recipients and signature
       
  1286 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1287 	CreateNewL(partList, emailTypeList, testNo++);
       
  1288 
       
  1289 	// only attachment, subject, recipients and signature
       
  1290 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1291 	CreateNewL(partList, emailTypeList, testNo++);
       
  1292 
       
  1293 	// only body, attachment, subject, recipients and signature
       
  1294 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1295 	CreateNewL(partList, emailTypeList, testNo++);
       
  1296 
       
  1297 	// basic new message with originator, recipients and signature
       
  1298 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1299 	CreateNewL(partList, emailTypeList, testNo++);
       
  1300 
       
  1301 	// only body, originator, recipients and signature
       
  1302 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1303 	CreateNewL(partList, emailTypeList, testNo++);
       
  1304 
       
  1305 	// only attachment, originator, recipients and signature
       
  1306 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1307 	CreateNewL(partList, emailTypeList, testNo++);
       
  1308 
       
  1309 	// only body, attachment, originator, recipients and signature
       
  1310 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1311 	CreateNewL(partList, emailTypeList, testNo++);
       
  1312 
       
  1313 	// basic new message with subject, originator, recipients and signature
       
  1314 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1315 	CreateNewL(partList, emailTypeList, testNo++);
       
  1316 
       
  1317 	// only body, subject, originator, recipients and signature
       
  1318 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1319 	CreateNewL(partList, emailTypeList, testNo++);
       
  1320 
       
  1321 	// only attachment, subject, originator, recipients and signature
       
  1322 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1323 	CreateNewL(partList, emailTypeList, testNo++);
       
  1324 
       
  1325 	// only body, attachment, subject, originator, recipients and signature
       
  1326 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1327 	CreateNewL(partList, emailTypeList, testNo++);
       
  1328 
       
  1329 	// Create a VCard and store in the SMTP settings
       
  1330 	SetAddVCardToEmailL(ETrue, smtpService);
       
  1331 	log->AppendComment(_L8("\tHTML Create New Message with signature and VCard Tests"));
       
  1332 
       
  1333 	// basic new message with VCard and Signature!
       
  1334 	partList = 0;
       
  1335 	CreateNewL(partList, emailTypeList, testNo++);
       
  1336 
       
  1337 	// only body, VCard and Signature
       
  1338 	partList = KMsvMessagePartBody;
       
  1339 	CreateNewL(partList, emailTypeList, testNo++);
       
  1340 
       
  1341 	// only attachment, VCard and Signature
       
  1342 	partList = KMsvMessagePartAttachments;
       
  1343 	CreateNewL(partList, emailTypeList, testNo++);
       
  1344 
       
  1345 	// only body, attachment, VCard and Signature
       
  1346 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
  1347 	CreateNewL(partList, emailTypeList, testNo++);
       
  1348 
       
  1349 	// basic new message with subject, VCard and Signature
       
  1350 	partList = KMsvMessagePartDescription;
       
  1351 	CreateNewL(partList, emailTypeList, testNo++);
       
  1352 
       
  1353 	// only body, subject, VCard and Signature
       
  1354 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
  1355 	CreateNewL(partList, emailTypeList, testNo++);
       
  1356 
       
  1357 	// only attachment, subject, VCard and Signature
       
  1358 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1359 	CreateNewL(partList, emailTypeList, testNo++);
       
  1360 
       
  1361 	// only body, attachment, subject, VCard and Signature
       
  1362 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
  1363 	CreateNewL(partList, emailTypeList, testNo++);
       
  1364 
       
  1365 	// basic new message with originator, VCard and Signature
       
  1366 	partList = KMsvMessagePartOriginator;
       
  1367 	CreateNewL(partList, emailTypeList, testNo++);
       
  1368 
       
  1369 	// only body, originator, VCard and Signature
       
  1370 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
  1371 	CreateNewL(partList, emailTypeList, testNo++);
       
  1372 
       
  1373 	// only attachment, originator, VCard and Signature
       
  1374 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1375 	CreateNewL(partList, emailTypeList, testNo++);
       
  1376 
       
  1377 	// only body, attachment, originator, VCard and Signature
       
  1378 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
  1379 	CreateNewL(partList, emailTypeList, testNo++);
       
  1380 
       
  1381 	// basic new message with subject, originator, VCard and Signature
       
  1382 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1383 	CreateNewL(partList, emailTypeList, testNo++);
       
  1384 
       
  1385 	// only body, subject, originator, VCard and Signature
       
  1386 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1387 	CreateNewL(partList, emailTypeList, testNo++);
       
  1388 
       
  1389 	// only attachment, subject, originator, VCard and Signature
       
  1390 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1391 	CreateNewL(partList, emailTypeList, testNo++);
       
  1392 
       
  1393 	// only body, attachment, subject, originator, VCard and Signature
       
  1394 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
  1395 	CreateNewL(partList, emailTypeList, testNo++);
       
  1396 
       
  1397 	// basic new message with recipients, VCard and Signature
       
  1398 	partList = KMsvMessagePartRecipient;
       
  1399 	CreateNewL(partList, emailTypeList, testNo++);
       
  1400 
       
  1401 	// only body, recipients, VCard and Signature
       
  1402 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
  1403 	CreateNewL(partList, emailTypeList, testNo++);
       
  1404 
       
  1405 	// only attachment, recipients, VCard and Signature
       
  1406 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1407 	CreateNewL(partList, emailTypeList, testNo++);
       
  1408 
       
  1409 	// only body, attachment, recipients, VCard and Signature
       
  1410 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
  1411 	CreateNewL(partList, emailTypeList, testNo++);
       
  1412 
       
  1413 	// basic new message with subject, recipients, VCard and Signature
       
  1414 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1415 	CreateNewL(partList, emailTypeList, testNo++);
       
  1416 
       
  1417 	// only body, subject, recipients, VCard and Signature
       
  1418 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1419 	CreateNewL(partList, emailTypeList, testNo++);
       
  1420 
       
  1421 	// only attachment, subject, recipients, VCard and Signature
       
  1422 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1423 	CreateNewL(partList, emailTypeList, testNo++);
       
  1424 
       
  1425 	// only body, attachment, subject, recipients, VCard and Signature
       
  1426 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
  1427 	CreateNewL(partList, emailTypeList, testNo++);
       
  1428 
       
  1429 	// basic new message with originator, recipients, VCard and Signature
       
  1430 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1431 	CreateNewL(partList, emailTypeList, testNo++);
       
  1432 
       
  1433 	// only body, originator, recipients, VCard and Signature
       
  1434 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1435 	CreateNewL(partList, emailTypeList, testNo++);
       
  1436 
       
  1437 	// only attachment, originator, recipients, VCard and Signature
       
  1438 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1439 	CreateNewL(partList, emailTypeList, testNo++);
       
  1440 
       
  1441 	// only body, attachment, originator, recipients, VCard and Signature
       
  1442 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1443 	CreateNewL(partList, emailTypeList, testNo++);
       
  1444 
       
  1445 	// basic new message with subject, originator, recipients, VCard and Signature
       
  1446 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1447 	CreateNewL(partList, emailTypeList, testNo++);
       
  1448 
       
  1449 	// only body, subject, originator, recipients, VCard and Signature
       
  1450 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1451 	CreateNewL(partList, emailTypeList, testNo++);
       
  1452 
       
  1453 	// only attachment, subject, originator, recipients, VCard and Signature
       
  1454 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1455 	CreateNewL(partList, emailTypeList, testNo++);
       
  1456 
       
  1457 	// only body, attachment, subject, originator, recipients, VCard and Signature
       
  1458 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1459 	CreateNewL(partList, emailTypeList, testNo++);
       
  1460 	}
       
  1461 
       
  1462 LOCAL_C void DoCreateNewUsingNonDefaultServiceTestsL()
       
  1463 	{
       
  1464 	TMsvPartList partList = 0;
       
  1465 	TMsvEmailTypeList emailTypeList = 0;
       
  1466 
       
  1467 	//
       
  1468 	// Plaintext Messages
       
  1469 	//
       
  1470 	log->AppendComment(_L8("\tCreate New Message using Non-default service Tests"));
       
  1471 
       
  1472 	// basic new message with nothing!
       
  1473 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1474 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1475 
       
  1476 	SetAddVCardToEmailL(ETrue, smtpService2);
       
  1477 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1478 
       
  1479 	CreateSignatureL(smtpService2);
       
  1480 	SetSignatureToEmailL(ETrue, smtpService2);
       
  1481 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1482 
       
  1483 	SetAddVCardToEmailL(EFalse, smtpService2);
       
  1484 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1485 
       
  1486 	//
       
  1487 	// HTML Messages
       
  1488 	//
       
  1489 	log->AppendComment(_L8("\tCreate New HTML Message using Non-default service Tests"));
       
  1490 
       
  1491 	// basic new message with nothing!
       
  1492 	emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
  1493 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1494 	SetSignatureToEmailL(EFalse, smtpService2);
       
  1495 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1496 
       
  1497 	SetAddVCardToEmailL(ETrue, smtpService2);
       
  1498 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1499 
       
  1500 	CreateSignatureL(smtpService2);
       
  1501 	SetSignatureToEmailL(ETrue, smtpService2);
       
  1502 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1503 
       
  1504 	SetAddVCardToEmailL(EFalse, smtpService2);
       
  1505 	CreateNewL(partList, emailTypeList, testNo++, smtpService2);
       
  1506 
       
  1507 	}
       
  1508 
       
  1509 LOCAL_C void DoSaveNonHTMLTestsL()
       
  1510 	{
       
  1511 	TMsvPartList partList = 0;
       
  1512 	TMsvEmailTypeList emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
  1513 
       
  1514 	//
       
  1515 	// HTML Messages
       
  1516 	//
       
  1517 	log->AppendComment(_L8("\tCreate New HTML Message using Non-default service Tests"));
       
  1518 
       
  1519 	// basic new message with nothing!
       
  1520 	emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
  1521 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1522 	CreateNewL(partList, emailTypeList, testNo++);
       
  1523 
       
  1524 	if( messageId != KMsvNullIndexEntryId )
       
  1525 		{
       
  1526 		// Change the message to be non-HTML
       
  1527 		CMsvEntry* msvEntry = testUtils->iMsvSession->GetEntryL(messageId);
       
  1528 		CleanupStack::PushL(msvEntry);
       
  1529 		TMsvEmailEntry entry = msvEntry->Entry();
       
  1530 	    entry.SetMHTMLEmail(EFalse);
       
  1531 		msvEntry->ChangeL(entry);
       
  1532 
       
  1533 		// Save the message - first create the CImEmailMessage object
       
  1534 		CImEmailMessage* message = CImEmailMessage::NewL(*msvEntry);
       
  1535 		CleanupStack::PushL(message);
       
  1536 
       
  1537 		// Create rich text object
       
  1538 		CParaFormatLayer* paraF = CParaFormatLayer::NewL(); 
       
  1539 		CleanupStack::PushL(paraF);
       
  1540 
       
  1541 		CCharFormatLayer* charF = CCharFormatLayer::NewL(); 
       
  1542 		CleanupStack::PushL(charF);
       
  1543 
       
  1544 		CRichText* body = CRichText::NewL(paraF, charF); 
       
  1545 		CleanupStack::PushL(body);
       
  1546 
       
  1547 		// Create the test active object
       
  1548 		CTestActive* testActive = new (ELeave) CTestActive();
       
  1549 		CleanupStack::PushL(testActive);
       
  1550 
       
  1551 		testActive->StartL();
       
  1552 		message->StoreBodyTextL(messageId, *body, testActive->iStatus);
       
  1553 		CActiveScheduler::Start();
       
  1554 
       
  1555 		CleanupStack::PopAndDestroy(6, msvEntry);
       
  1556 		}
       
  1557 	}
       
  1558 
       
  1559 /*LOCAL_C void DoMiscellaneousTestsL()
       
  1560 	{
       
  1561 //
       
  1562 //	Test functionality where the user requests VCard but contacts.cdb does not exist
       
  1563 //
       
  1564 	// rename contacts.cdb file so that it looks like it has been deleted or doesn't exist
       
  1565 	_LIT(KContactsDb, "C:\\system\\data\\contacts.cdb");
       
  1566 	_LIT(KOtherName, "C:\\system\\data\\contact.tmp");
       
  1567 	CFileMan* fileMan = CFileMan::NewL(testUtils->iMsvSession->FileSession());
       
  1568 	CleanupStack::PushL(fileMan);
       
  1569 	TInt error = fileMan->Rename(KContactsDb, KOtherName);
       
  1570 
       
  1571 	SetAddVCardToEmailL(ETrue, smtpService);
       
  1572 
       
  1573 	TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
  1574 	TMsvEmailTypeList emailTypeList = 0;
       
  1575 	TRAPD(err, CreateNewL(partList, emailTypeList, testNo++));
       
  1576 	test(err == KErrNotFound);
       
  1577 	
       
  1578 	emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
  1579 	TRAP(err, CreateNewL(partList, emailTypeList, testNo++));
       
  1580 	test(err == KErrNotFound);
       
  1581 
       
  1582 	SetAddVCardToEmailL(EFalse, smtpService);
       
  1583 
       
  1584 	// rename the contacts database file back to Contacts.cdb if it was changed!
       
  1585 	if (error != KErrNotFound)
       
  1586 		error = fileMan->Rename(KOtherName, KContactsDb);
       
  1587 	CleanupStack::PopAndDestroy(fileMan);
       
  1588 
       
  1589 //
       
  1590 //	Test functionality where the user requests signature but signature does not exist
       
  1591 //
       
  1592 	SetSignatureToEmailL(ETrue, smtpService);
       
  1593 	emailTypeList = 0;
       
  1594 	CreateNewL(partList, emailTypeList, testNo++);
       
  1595 	
       
  1596 	emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
  1597 	CreateNewL(partList, emailTypeList, testNo++);
       
  1598 	}
       
  1599 */
       
  1600 LOCAL_C void WaitForServerClose()
       
  1601 	{
       
  1602 	//Kill the message server if its running
       
  1603 	TFindProcess findprocess(KMsvServerPattern);
       
  1604 	TFullName name;
       
  1605 	if(findprocess.Next(name)==KErrNone)
       
  1606 		{
       
  1607 		RProcess process;
       
  1608     	User::LeaveIfError(process.Open(findprocess));
       
  1609      	process.Kill(KErrCancel) ;
       
  1610 		process.Close() ;
       
  1611 		}
       
  1612 		
       
  1613 	FOREVER
       
  1614 		{
       
  1615 		TFullName name;
       
  1616 		TFindProcess find(KMsvServerPattern);
       
  1617 		if (find.Next(name) != KErrNone)
       
  1618 			break;
       
  1619 		User::After(100000);
       
  1620 		}
       
  1621 	}
       
  1622 
       
  1623 LOCAL_C void CreateTwoSetsOfServicesL()
       
  1624 	{
       
  1625 	testUtils->GoClientSideL();
       
  1626 	
       
  1627 	// create service 1
       
  1628 	
       
  1629 	// creates a single set of smtp & pop services
       
  1630 	testUtils->CreatePopServiceL(); 
       
  1631 	
       
  1632 	// create smtp id
       
  1633 	smtpService = testUtils->CreateSmtpServiceL();
       
  1634 	SetDefaultServiceL(smtpService);
       
  1635 	
       
  1636 	TMsvId popService = testUtils->FindPopServiceL(); 
       
  1637 	
       
  1638 	// create service 2
       
  1639 
       
  1640 	// email account utility
       
  1641 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
  1642 
       
  1643 	// smtp settings	
       
  1644 	CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
       
  1645 	CleanupStack::PushL(settings);
       
  1646 	settings->Reset();
       
  1647 
       
  1648 	// dummy pop settings
       
  1649 	CImPop3Settings* pop3settings = new(ELeave) CImPop3Settings;
       
  1650 	CleanupStack::PushL(pop3settings);
       
  1651 
       
  1652 	// dummy preferences
       
  1653 	CImIAPPreferences* prefs = CImIAPPreferences::NewLC();
       
  1654 	
       
  1655 	// set defaults
       
  1656 	accounts->PopulateDefaultPopSettingsL(*pop3settings, *prefs);
       
  1657 	accounts->PopulateDefaultSmtpSettingsL(*settings, *prefs);
       
  1658 
       
  1659 	
       
  1660 	_LIT(KSmtpServer, "smtp.dial.pipex.com");
       
  1661 	settings->SetServerAddressL(KSmtpServer);
       
  1662 	settings->SetEmailAliasL(_L("Messaging Test1"));
       
  1663 	_LIT(KSmtpEmailAddress, "msgtest1@internet-test.plc.psion.com");
       
  1664 	settings->SetEmailAddressL(KSmtpEmailAddress);
       
  1665 	settings->SetReplyToAddressL(KSmtpEmailAddress);
       
  1666 	settings->SetBodyEncoding(EMsgOutboxMIME);
       
  1667 	settings->SetReceiptAddressL(KSmtpEmailAddress);
       
  1668 	settings->SetPort(25);
       
  1669 
       
  1670 	// create account
       
  1671  	TPopAccount popAccount = accounts->CreatePopAccountL(_L("SMTP Service 2"), *pop3settings, *prefs, EFalse);
       
  1672  	TSmtpAccount smtpAccountId = accounts->CreateSmtpAccountL(popAccount, *settings, *prefs, EFalse);
       
  1673 
       
  1674 //	accounts->SetDefaultPOPAccountL(id);
       
  1675 //	smtpService2 = accounts->DefaultSMTPServiceL();
       
  1676 	TSmtpAccount smtpAccountId2;
       
  1677 	accounts->DefaultSmtpAccountL(smtpAccountId2);
       
  1678 	smtpService2 = smtpAccountId2.iSmtpService;
       
  1679 
       
  1680 	// set default service back to service 1
       
  1681 //	accounts->ChangeDefaultPOPServiceL(popService);
       
  1682 //	accounts->ChangeDefaultSMTPServiceL(smtpService);
       
  1683 	SetDefaultServiceL(smtpService);
       
  1684 
       
  1685 	CleanupStack::PopAndDestroy(4, accounts); // prefs, pop3settings, settings, accounts
       
  1686 	}
       
  1687 
       
  1688 LOCAL_C void DeleteMessageFolderAndCreateMessagesL()
       
  1689 	{
       
  1690 	test.Console()->ClearScreen();
       
  1691 	testUtils->iMsvSession->CloseMessageServer();
       
  1692 	testUtils->Reset();
       
  1693 
       
  1694 	CTestTimer* timer = CTestTimer::NewL();
       
  1695 	timer->After(1000000); //1 second delay
       
  1696 	CActiveScheduler::Start();
       
  1697 	delete timer;
       
  1698 
       
  1699 	WaitForServerClose();
       
  1700 
       
  1701 	CleanupStack::PopAndDestroy(3); //testUtils, scheduler, log
       
  1702 
       
  1703 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
  1704 	CActiveScheduler::Install(scheduler);
       
  1705 	CleanupStack::PushL(scheduler);
       
  1706 
       
  1707 	testUtils = CEmailTestUtils::NewLC(test);
       
  1708 	testUtils->CreateAllTestDirectories();
       
  1709 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
  1710 	testUtils->ClearEmailAccountsL();
       
  1711 	testUtils->CleanMessageFolderL();
       
  1712 	CreateTwoSetsOfServicesL();
       
  1713 
       
  1714 	testUtils->WriteComment(_L("CImEmailOperation Tests"));
       
  1715 	log = CImLog::NewL(_L("c:\\logs\\email\\T_IMCM.log"), EAppend);
       
  1716 	CleanupStack::PushL(log);
       
  1717 
       
  1718 	SetDefaultServiceL(smtpService);
       
  1719 
       
  1720 	// get a list of all email messages in the Inbox
       
  1721 	testUtils->iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
       
  1722 	delete messageSelection;
       
  1723 	messageSelection = testUtils->iMsvEntry->ChildrenWithTypeL(KUidMsvMessageEntry);
       
  1724 
       
  1725 	test.Console()->ClearScreen();
       
  1726 	}
       
  1727 
       
  1728 LOCAL_C TBool CompareLogs(CEmailTestUtils* testUtils)
       
  1729 	{
       
  1730 	TBool errorOccured = EFalse;
       
  1731 
       
  1732 	CDesCArray* correctFile = new (ELeave) CDesCArrayFlat(1);
       
  1733 	CPtrCArray* resultFile = new (ELeave) CPtrCArray(1);
       
  1734 
       
  1735 	TParse parsedFileName;
       
  1736 	TParse parsedResultFileName;
       
  1737 	TFileName name;
       
  1738 	name.Append(KOkFileNameEntryStructure);
       
  1739 	testUtils->ResolveFile(KComponent, name, parsedFileName);
       
  1740 	correctFile->AppendL(parsedFileName.FullName());
       
  1741 	name.Zero();
       
  1742 	name.Copy(KFileNameEntryStructure);
       
  1743 	testUtils->ResolveLogFile(name, parsedResultFileName);
       
  1744 	resultFile->AppendL(parsedResultFileName.FullName());
       
  1745 
       
  1746 	RFileReadStream file1;
       
  1747 	RFileReadStream file2;
       
  1748 	HBufC8* line1Buffer = HBufC8::NewLC(1024);
       
  1749 	TPtr8 line1 = line1Buffer->Des();
       
  1750 	TBuf8<1> aChar1;
       
  1751 
       
  1752 	HBufC8* line2Buffer = HBufC8::NewLC(1024);
       
  1753 	TPtr8 line2 = line2Buffer->Des();
       
  1754 	TBuf8<1> aChar2;
       
  1755 
       
  1756 	for(TInt i=0; i<correctFile->MdcaCount(); i++)
       
  1757 		{
       
  1758 		TFileName file1Name = correctFile->MdcaPoint(i);
       
  1759 
       
  1760 		TFileName file2Name = resultFile->MdcaPoint(i);
       
  1761 
       
  1762 		TInt error1=KErrNone;
       
  1763 		TInt error2=KErrNone;
       
  1764 		
       
  1765 		test.Printf(_L("\n%s"), file2Name.PtrZ());
       
  1766 
       
  1767 		error1=file1.Open(testUtils->FileSession(), file1Name, EFileShareAny);
       
  1768 		if(error1!=KErrNone)
       
  1769 			{
       
  1770 			errorOccured = ETrue;
       
  1771 			}
       
  1772 		else
       
  1773 			{
       
  1774 			error2=file2.Open(testUtils->FileSession(), file2Name, EFileShareAny);
       
  1775 			if(error2!=KErrNone)
       
  1776 				{
       
  1777 				errorOccured = ETrue;
       
  1778 				}
       
  1779 			}
       
  1780 		
       
  1781 		if((error1==KErrNone)&&(error2==KErrNone))
       
  1782 			{
       
  1783 			// read the file into the conversion object
       
  1784 			TBool finished = EFalse;
       
  1785 	
       
  1786 			do	{
       
  1787 				line1.FillZ();
       
  1788 				line1.SetLength(0);
       
  1789 				// compile the lines one char at a time
       
  1790 				do	{
       
  1791 					TRAPD( error, file1.ReadL(aChar1, 1) ); 
       
  1792 					if (error!=KErrEof)
       
  1793 						line1.Append(aChar1);
       
  1794 					else
       
  1795 						{
       
  1796 						finished = ETrue;
       
  1797 						break;
       
  1798 						}
       
  1799 					// stop at the end of line or no more data
       
  1800 					}
       
  1801 				while((aChar1[0]!=0x0A)&&(line1.Length()<1024));
       
  1802 
       
  1803 				line2.FillZ();
       
  1804 				line2.SetLength(0);
       
  1805 				do	{
       
  1806 					TRAPD( error, file2.ReadL(aChar2, 1) ); 
       
  1807 					if (error!=KErrEof)
       
  1808 						line2.Append(aChar2);
       
  1809 					else
       
  1810 						{
       
  1811 						finished = ETrue;
       
  1812 						break;
       
  1813 						}
       
  1814 					// stop at the end of line or no more data
       
  1815 					}
       
  1816 				while((aChar2[0]!=0x0A)&&(line2.Length()<1024));
       
  1817 				
       
  1818 				// get rid of white space
       
  1819 				line1.TrimRight();
       
  1820 				line2.TrimRight();
       
  1821 
       
  1822 				if(line1.Compare(line2) != 0)
       
  1823 					{
       
  1824 					// error so no point in continuing to compare!!
       
  1825 					errorOccured = ETrue;
       
  1826 					file1.Close();
       
  1827 					file2.Close();
       
  1828 					delete correctFile;
       
  1829 					delete resultFile;
       
  1830 					CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
  1831 					return ETrue;
       
  1832 					}
       
  1833 				}
       
  1834 			while(!finished);
       
  1835 			}		
       
  1836 
       
  1837 		file1.Close();
       
  1838 		file2.Close();
       
  1839 		}
       
  1840 
       
  1841 	delete correctFile;
       
  1842 	delete resultFile;
       
  1843 	CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
  1844 	
       
  1845 	return errorOccured;
       
  1846 	}
       
  1847 
       
  1848 LOCAL_C void doMainL()
       
  1849 	{
       
  1850 	InitL();
       
  1851 
       
  1852 	CreateTwoSetsOfServicesL();
       
  1853 
       
  1854 	test.Console()->SetPos(0, 6);
       
  1855 	test.Printf(_L("Performing Tests:\n"));
       
  1856 	
       
  1857 	SetDefaultServiceL(smtpService);
       
  1858 
       
  1859 //	CreateVCardL();
       
  1860 	// get a list of all email messages in the Inbox
       
  1861 	testUtils->iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
       
  1862 	delete messageSelection;
       
  1863 	messageSelection = testUtils->iMsvEntry->ChildrenWithTypeL(KUidMsvMessageEntry);
       
  1864 
       
  1865 	TParse parsedFileName;
       
  1866 	TFileName name(KTestMessageDir);
       
  1867 	testUtils->ResolveLogFile(name, parsedFileName);
       
  1868 
       
  1869 //	
       
  1870 //	Create New tests
       
  1871 //
       
  1872 	test.Console()->SetPos(3, 7);
       
  1873 	test.Printf(_L("Create New Tests1:    "));
       
  1874 	testUtils->WriteComment(_L("Create New Plaintext Message Tests"));
       
  1875 	DoPlaintextCreateNewTestsL();
       
  1876 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), ETrue, EFalse); // writes message info (from Outbox) into files
       
  1877 	DeleteMessageFolderAndCreateMessagesL();
       
  1878 
       
  1879 	test.Console()->SetPos(3, 7);
       
  1880 	test.Printf(_L("Create New Tests2:    "));
       
  1881 	testUtils->WriteComment(_L("Create New HMTL Message Tests"));
       
  1882 	DoHtmlCreateNewTestsL();
       
  1883 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), EFalse, EFalse); // writes message info (from Outbox) into files
       
  1884 	DeleteMessageFolderAndCreateMessagesL();
       
  1885 
       
  1886 	test.Console()->SetPos(3, 7);
       
  1887 	test.Printf(_L("Create New Tests3:    "));
       
  1888 	testUtils->WriteComment(_L("Create New Message Using Non-default Service Tests"));
       
  1889 	DoCreateNewUsingNonDefaultServiceTestsL();
       
  1890 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), EFalse, EFalse); // writes message info (from Outbox) into files
       
  1891 	DeleteMessageFolderAndCreateMessagesL();
       
  1892 
       
  1893 	test.Console()->SetPos(3, 7);
       
  1894 	test.Printf(_L("Save New Tests4:    "));
       
  1895 	testUtils->WriteComment(_L("Test Saving a Non-HTML message."));
       
  1896 	DoSaveNonHTMLTestsL();
       
  1897 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), EFalse, EFalse); // writes message info (from Outbox) into files
       
  1898 
       
  1899 //
       
  1900 //	Make sure that we can create emails when there is no contacts database or no richtext 
       
  1901 //	for signature.
       
  1902 //
       
  1903 //	test.Console()->SetPos(3, 7);
       
  1904 //	test.Printf(_L("Create New Tests3:    "));
       
  1905 //	testUtils->WriteComment(_L("Doing Miscellaneous Tests"));
       
  1906 //	DoMiscellaneousTestsL();
       
  1907 //	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), EFalse, EFalse); // writes message info (from Outbox) into files
       
  1908 
       
  1909 	testUtils->TestFinish(testNo-1);
       
  1910 	testUtils->TestHarnessCompleted();
       
  1911 	
       
  1912 	delete messageSelection;
       
  1913 	testUtils->Reset();
       
  1914 	Closedown();
       
  1915 	
       
  1916 	// shouldn't have to do this, but convertor plugins aren't 
       
  1917 	// doing it yet so we get a false memory leak so remove this
       
  1918 	// when they fix that.
       
  1919 	REComSession::FinalClose();
       
  1920 	}
       
  1921 
       
  1922 GLDEF_C TInt E32Main()
       
  1923 	{	
       
  1924 	FbsStartup();
       
  1925 	TInt ret=RFbsSession::Connect();
       
  1926 		test(!ret);
       
  1927 
       
  1928 
       
  1929 	__UHEAP_MARK;
       
  1930 	test.Start(_L("T_IMCM02 Test CImEmailOperation class\n"));
       
  1931 	theCleanup=CTrapCleanup::New();
       
  1932 	TRAP(ret,doMainL());
       
  1933 	test(ret==KErrNone);
       
  1934 	delete theCleanup;	
       
  1935 	test.End();
       
  1936 	test.Close();
       
  1937 	__UHEAP_MARKEND;
       
  1938 	User::Heap().Check();
       
  1939 	return(KErrNone);
       
  1940 	}