email/pop3andsmtpmtm/clientmtms/test/src/T_MIUT04.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_MIUT04
       
    15 // Component: IMCM
       
    16 // Owner: KP
       
    17 // Brief description of test harness:
       
    18 // Tests storing/retrieving data from TMsvEmailEntry - most of the 
       
    19 // functionality is tested - some new functions may not be tested!
       
    20 // Detailed description of test harness:
       
    21 // As above.
       
    22 // Input files required to run test harness:
       
    23 // None
       
    24 // Intermediate files produced while running test harness:
       
    25 // <DRIVE>:\msgtest\T_MIUT04\T_IMCM.log
       
    26 // Output files produced by running test harness:
       
    27 // <DRIVE>:\msglogs\T_MIUT04.<PLATFORM>.<VARIANT>.LOG.txt
       
    28 // Description of how to build test harness:
       
    29 // cd \msg\imcm\
       
    30 // bldmake bldfiles
       
    31 // abld test build
       
    32 // Description of how to run test harness:
       
    33 // The following instructions are the same for all platforms:
       
    34 // 1. Build T_DB test harness from COMMDB component:
       
    35 // cd \commdb\group
       
    36 // bldmake bldfiles
       
    37 // abld test build t_db
       
    38 // 2. Build the test utilities:
       
    39 // cd \msg\testutils\group\
       
    40 // bldmake bldfiles
       
    41 // abld build
       
    42 // WINS running instructions:
       
    43 // 1. \epoc32\release\wins\<VARIANT>\T_MIUT04.exe can be used at the command prompt
       
    44 // or executable can be run from Windows Explorer.
       
    45 // All other platform running instructions:
       
    46 // 1. Copy \epoc32\release\<PLATFORM>\<VARIANT>\T_MIUT04.exe onto the other platform
       
    47 // 2. Copy \epoc32\release\<PLATFORM>\<VARIANT>\MSVTESTUTILS.DLL into 
       
    48 // <DRIVE>:\system\libs on the other platform
       
    49 // 3. Copy \epoc32\release\<PLATFORM>\<VARIANT>\EMAILTESTUTILS.DLL into 
       
    50 // <DRIVE>:\system\libs on the other platform
       
    51 // 4. Run T_MIUT04.exe on the other platform
       
    52 // 
       
    53 //
       
    54 
       
    55 #include "emailtestutils.h"
       
    56 #include "MIUTHDR.H"    // CImHeader
       
    57 #include <miutlog.h>
       
    58 #include <imapset.h>
       
    59 #include <msvids.h>
       
    60 
       
    61 // local variables etc //
       
    62 
       
    63 RTest test(_L("MIUT04 - Test TMsvEmailEntry class"));
       
    64 LOCAL_D CTrapCleanup* theCleanup;
       
    65 LOCAL_D CImLog* log;
       
    66 LOCAL_D CEmailTestUtils* testUtils;
       
    67 
       
    68 _LIT8(KNoDisconnectedOperations, "NoDisconnectedOperations");
       
    69 _LIT8(KDisconnectedCreateOperation, "DisconnectedCreateOperation");
       
    70 _LIT8(KDisconnectedDeleteOperation, "DisconnectedDeleteOperation");
       
    71 _LIT8(KDisconnectedChangeOperation, "DisconnectedChangeOperation");
       
    72 _LIT8(KDisconnectedCopyToOperation, "DisconnectedCopyToOperation");
       
    73 _LIT8(KDisconnectedCopyFromOperation, "DisconnectedCopyFromOperation");
       
    74 _LIT8(KDisconnectedCopyWithinServiceOperation, "DisconnectedCopyWithinServiceOp");
       
    75 _LIT8(KDisconnectedMoveToOperation, "DisconnectedMoveToOperation");
       
    76 _LIT8(KDisconnectedMoveFromOperation, "DisconnectedMoveFromOperation");
       
    77 _LIT8(KDisconnectedMoveWithinServiceOperation, "DisconnectedMoveWithinServiceOp");
       
    78 _LIT8(KDisconnectedSpecialOperation, "DisconnectedSpecialOperation");
       
    79 _LIT8(KDisconnectedUnknownOperation, "DisconnectedUnknownOperation");
       
    80 _LIT8(KDisconnectedMultipleOperation, "DisconnectedMultipleOperation");
       
    81 
       
    82 //
       
    83 
       
    84 LOCAL_C void ResultOfTest(TBool aResult,TInt aTestNo)
       
    85 	{
       
    86 	if (aResult)
       
    87 		{
       
    88 		test.Printf(_L("Passed test %d\n"),aTestNo);
       
    89 		}
       
    90 	else
       
    91 		{
       
    92 		test.Printf(_L("Failed test %d\n"),aTestNo);
       
    93 		}
       
    94 	}
       
    95 
       
    96 /*LOCAL_C TBool CompareBooleans(TBool aBoolean1, TBool aBoolean2, TDesC8 aTestDescription)
       
    97 	{
       
    98 	_LIT8(KErrorReason, "\t\tSettings not set correctly for %S");
       
    99 	TBuf8<80> buf;
       
   100 	TBool result = (aBoolean1 == aBoolean2);
       
   101 	if (!result)
       
   102 		{
       
   103 		buf.AppendFormat(KErrorReason, &aTestDescription);
       
   104 		log->AppendError(buf ,-1);
       
   105 		}
       
   106 	return result;
       
   107 	}
       
   108 
       
   109 LOCAL_C TBool CompareDescriptors(TDesC16& aDesC1, TDesC16& aDesC2, TDesC8 aTestDescription)
       
   110 	{
       
   111 	_LIT8(KErrorReason, "\t\tSettings not set correctly for %S");
       
   112 	TBuf8<80> buf;
       
   113 	TBool result = (aDesC1 == aDesC2);
       
   114 	if (!result)
       
   115 		{
       
   116 		buf.AppendFormat(KErrorReason, &aTestDescription);
       
   117 		log->AppendError(buf ,-1);
       
   118 		}
       
   119 	return result;
       
   120 	}
       
   121 
       
   122 LOCAL_C TBool CompareDescriptors(TDesC8& aDesC1, TDesC8& aDesC2, TDesC8 aTestDescription)
       
   123 	{
       
   124 	_LIT8(KErrorReason, "\t\tSettings not set correctly for %S");
       
   125 	TBuf8<80> buf;
       
   126 	TBool result = (aDesC1 == aDesC2);
       
   127 	if (!result)
       
   128 		{
       
   129 		buf.AppendFormat(KErrorReason, &aTestDescription);
       
   130 		log->AppendError(buf ,-1);
       
   131 		}
       
   132 	return result;
       
   133 	}
       
   134 */
       
   135 
       
   136 LOCAL_C TBool CompareDisconnectedOptions(TImDisconnectedOperationType type1, TImDisconnectedOperationType type2, const TDesC8* aTestDescription)
       
   137 	{
       
   138 	_LIT8(KErrorReason, "\t\tDisconnected Options not set correctly for %S");
       
   139 	TBuf8<80> buf;
       
   140 	TBool result = (type1 == type2);
       
   141 	if (!result)
       
   142 		{
       
   143 		buf.AppendFormat(KErrorReason, &aTestDescription);
       
   144 		log->AppendError(buf ,-1);
       
   145 		}
       
   146 	return result;
       
   147 	}
       
   148 
       
   149 //
       
   150 
       
   151 LOCAL_C TBool TMsvEmailEntrySelectionL(TInt aTestNo)
       
   152 	{
       
   153 	log->AppendComment(_L8("\tEmail Entry Selection Test"));
       
   154 	TMsvEntry* genericEntry = new (ELeave) TMsvEntry;
       
   155 	genericEntry->iType = KUidMsvMessageEntry;
       
   156 	genericEntry->iMtm = KUidMsgTypeIMAP4;
       
   157 	genericEntry->iServiceId = 0x1087643;
       
   158 	genericEntry->SetPriority(EMsvHighPriority);
       
   159 	genericEntry->SetComplete(ETrue);
       
   160 	genericEntry->SetVisible(ETrue);
       
   161 
       
   162 	TBool result=ETrue;
       
   163 
       
   164 	// test that iMtmDatax member variables have been reset
       
   165 	TMsvEmailEntry* newEmailEntry = new (ELeave) TMsvEmailEntry();
       
   166 	result &= !(newEmailEntry->MtmData1() && newEmailEntry->MtmData2() && newEmailEntry->MtmData3());
       
   167 	if (!result)
       
   168 		log->AppendError(_L8("\t\tTMsvEmailEntry Constructor hasn't reset iMtmData members"),-1);
       
   169 
       
   170 	delete newEmailEntry;
       
   171 
       
   172 	// test copy constructor...
       
   173 	TMsvEmailEntry* EmailEntry = new (ELeave) TMsvEmailEntry(*genericEntry);
       
   174 
       
   175 
       
   176 	EmailEntry->SetEncrypted(ETrue);
       
   177 	TBool result1=(EmailEntry->Encrypted()!=EFalse);
       
   178 	EmailEntry->SetEncrypted(EFalse);
       
   179 	result1&=(EmailEntry->Encrypted()==EFalse);
       
   180 	if (!result1)
       
   181 		log->AppendError(_L8("\t\tSetEncrypted() not setting correct values"),-1);
       
   182 	result&=result1;
       
   183 
       
   184 	EmailEntry->SetSigned(ETrue);
       
   185 	TBool result2=(EmailEntry->Signed()!=EFalse);
       
   186 	EmailEntry->SetSigned(EFalse);
       
   187 	result2&=(EmailEntry->Signed()==EFalse);
       
   188 	if (!result2)
       
   189 		log->AppendError(_L8("\t\tSetSigned() not setting correct values"),-1);
       
   190 	result&=result2;
       
   191 
       
   192 	EmailEntry->SetReceipt(ETrue);
       
   193 	TBool result3=(EmailEntry->Receipt()!=EFalse);
       
   194 	EmailEntry->SetReceipt(EFalse);
       
   195 	result3&=(EmailEntry->Receipt()==EFalse);
       
   196 	if (!result3)
       
   197 		log->AppendError(_L8("\t\tSetReceipt() not setting correct values"),-1);
       
   198 	result&=result3;
       
   199 
       
   200 	
       
   201 	// check MHTML flag
       
   202 	EmailEntry->SetMHTMLEmail(ETrue);
       
   203 	TBool resultp=(EmailEntry->MHTMLEmail()!=EFalse);
       
   204 	EmailEntry->SetMHTMLEmail(EFalse);
       
   205 	resultp&=(EmailEntry->MHTMLEmail()==EFalse);
       
   206 	if (!resultp)
       
   207 		log->AppendError(_L8("\t\tSetMHTMLEmail() not setting correct values"),-1);
       
   208 	result&=resultp;
       
   209 
       
   210 	EmailEntry->SetOrphan(ETrue);
       
   211 	TBool result4=(EmailEntry->Orphan()!=EFalse);
       
   212 	EmailEntry->SetOrphan(EFalse);
       
   213 	result4&=(EmailEntry->Orphan()==EFalse);
       
   214 	if (!result4)
       
   215 		log->AppendError(_L8("\t\tSetOrphan() not setting correct values"),-1);
       
   216 	result&=result4;
       
   217 
       
   218 	EmailEntry->SetVCard(ETrue);
       
   219 	TBool result5=(EmailEntry->VCard()!=EFalse);
       
   220 	EmailEntry->SetVCard(EFalse);
       
   221 	result5&=(EmailEntry->VCard()==EFalse);
       
   222 	if (!result5)
       
   223 		log->AppendError(_L8("\t\tSetVCard() not setting correct values"),-1);
       
   224 	result&=result5;
       
   225 
       
   226 	EmailEntry->SetVCalendar(ETrue);
       
   227 	TBool result6=(EmailEntry->VCalendar()!=EFalse);
       
   228 	EmailEntry->SetVCalendar(EFalse);
       
   229 	result6&=(EmailEntry->VCalendar()==EFalse);
       
   230 	if (!result6)
       
   231 		log->AppendError(_L8("\t\tSetVCalendar() not setting correct values"),-1);
       
   232 	result&=result6;
       
   233 
       
   234 	EmailEntry->SetSubscribed(ETrue);
       
   235 	TBool result7=(EmailEntry->Subscribed()!=EFalse);
       
   236 	EmailEntry->SetSubscribed(EFalse);
       
   237 	result7&=(EmailEntry->Subscribed()==EFalse);
       
   238 	if (!result7)
       
   239 		log->AppendError(_L8("\t\tSetSubscribed() not setting correct values"),-1);
       
   240 	result&=result7;
       
   241 
       
   242 	EmailEntry->SetUnreadIMAP4Flag(ETrue);
       
   243 	TBool result8=(EmailEntry->UnreadIMAP4Flag()!=EFalse);
       
   244 	EmailEntry->SetUnreadIMAP4Flag(EFalse);
       
   245 	result8&=(EmailEntry->UnreadIMAP4Flag()==EFalse);
       
   246 	if (!result8)
       
   247 		log->AppendError(_L8("\t\tSetUnreadIMAP4Flag() not setting correct values"),-1);
       
   248 	result&=result8;
       
   249 
       
   250 	EmailEntry->SetSeenIMAP4Flag(ETrue);
       
   251 	TBool result9=(EmailEntry->SeenIMAP4Flag()!=EFalse);
       
   252 	EmailEntry->SetSeenIMAP4Flag(EFalse);
       
   253 	result9&=(EmailEntry->SeenIMAP4Flag()==EFalse);
       
   254 	if (!result9)
       
   255 		log->AppendError(_L8("\t\tSetSeenIMAP4Flag() not setting correct values"),-1);
       
   256 	result&=result9;
       
   257 
       
   258 	EmailEntry->SetAnsweredIMAP4Flag(ETrue);
       
   259 	TBool result10=(EmailEntry->AnsweredIMAP4Flag()!=EFalse);
       
   260 	EmailEntry->SetAnsweredIMAP4Flag(EFalse);
       
   261 	result10&=(EmailEntry->AnsweredIMAP4Flag()==EFalse);
       
   262 	if (!result10)
       
   263 		log->AppendError(_L8("\t\tSetAnsweredIMAP4Flag() not setting correct values"),-1);
       
   264 	result&=result10;
       
   265 
       
   266 	EmailEntry->SetFlaggedIMAP4Flag(ETrue);
       
   267 	TBool result11=(EmailEntry->FlaggedIMAP4Flag()!=EFalse);
       
   268 	EmailEntry->SetFlaggedIMAP4Flag(EFalse);
       
   269 	result11&=(EmailEntry->FlaggedIMAP4Flag()==EFalse);
       
   270 	if (!result11)
       
   271 		log->AppendError(_L8("\t\tSetFlaggedIMAP4Flag() not setting correct values"),-1);
       
   272 	result&=result11;
       
   273 
       
   274 	EmailEntry->SetDeletedIMAP4Flag(ETrue);
       
   275 	TBool result12=(EmailEntry->DeletedIMAP4Flag()!=EFalse);
       
   276 	EmailEntry->SetDeletedIMAP4Flag(EFalse);
       
   277 	result12&=(EmailEntry->DeletedIMAP4Flag()==EFalse);
       
   278 	if (!result12)
       
   279 		log->AppendError(_L8("\t\tSetDeletedIMAP4Flag() not setting correct values"),-1);
       
   280 	result&=result12;
       
   281 
       
   282 	EmailEntry->SetDraftIMAP4Flag(ETrue);
       
   283 	TBool result13=(EmailEntry->DraftIMAP4Flag()!=EFalse);
       
   284 	EmailEntry->SetDraftIMAP4Flag(EFalse);
       
   285 	result13&=(EmailEntry->DraftIMAP4Flag()==EFalse);
       
   286 	if (!result13)
       
   287 		log->AppendError(_L8("\t\tSetDraftIMAP4Flag() not setting correct values"),-1);
       
   288 	result&=result13;
       
   289 
       
   290 	EmailEntry->SetRecentIMAP4Flag(ETrue);
       
   291 	TBool result14=(EmailEntry->RecentIMAP4Flag()!=EFalse);
       
   292 	EmailEntry->SetRecentIMAP4Flag(EFalse);
       
   293 	result14&=(EmailEntry->RecentIMAP4Flag()==EFalse);
       
   294 	if (!result14)
       
   295 		log->AppendError(_L8("\t\tSetRecentIMAP4Flag() not setting correct values"),-1);
       
   296 	result&=result14;
       
   297 
       
   298 	EmailEntry->SetValidUID(ETrue);
       
   299 	TBool result15=(EmailEntry->ValidUID()!=EFalse);
       
   300 	EmailEntry->SetValidUID(EFalse);
       
   301 	result15&=(EmailEntry->ValidUID()==EFalse);
       
   302 	if (!result15)
       
   303 		log->AppendError(_L8("\t\tSetValidUID() not setting correct values"),-1);
       
   304 	result&=result15;
       
   305 
       
   306 	EmailEntry->SetMailbox(ETrue);
       
   307 	TBool result16=(EmailEntry->Mailbox()!=EFalse);
       
   308 	EmailEntry->SetMailbox(EFalse);
       
   309 	result16&=(EmailEntry->Mailbox()==EFalse);
       
   310 	if (!result16)
       
   311 		log->AppendError(_L8("\t\tSetMailbox() not setting correct values"),-1);
       
   312 	result&=result16;
       
   313 
       
   314 	EmailEntry->SetLocalSubscription(ETrue);
       
   315 	TBool result17=(EmailEntry->LocalSubscription()!=EFalse);
       
   316 	EmailEntry->SetLocalSubscription(EFalse);
       
   317 	result17&=(EmailEntry->LocalSubscription()==EFalse);
       
   318 	if (!result17)
       
   319 		log->AppendError(_L8("\t\tSetLocalSubscription() not setting correct values"),-1);
       
   320 	result&=result17;
       
   321 
       
   322 	EmailEntry->SetIMAP4Flags(ETrue,EFalse,EFalse,EFalse,EFalse,EFalse,EFalse);
       
   323 	TBool result18=(EmailEntry->UnreadIMAP4Flag()!=EFalse);
       
   324 	EmailEntry->SetIMAP4Flags(EFalse,ETrue,EFalse,EFalse,EFalse,EFalse,EFalse);
       
   325 	result18&=(EmailEntry->SeenIMAP4Flag()!=EFalse);
       
   326 	EmailEntry->SetIMAP4Flags(EFalse,EFalse,ETrue,EFalse,EFalse,EFalse,EFalse);
       
   327 	result18&=(EmailEntry->AnsweredIMAP4Flag()!=EFalse);
       
   328 	EmailEntry->SetIMAP4Flags(EFalse,EFalse,EFalse,ETrue,EFalse,EFalse,EFalse);
       
   329 	result18&=(EmailEntry->FlaggedIMAP4Flag()!=EFalse);
       
   330 	EmailEntry->SetIMAP4Flags(EFalse,EFalse,EFalse,EFalse,ETrue,EFalse,EFalse);
       
   331 	result18&=(EmailEntry->DeletedIMAP4Flag()!=EFalse);
       
   332 	EmailEntry->SetIMAP4Flags(EFalse,EFalse,EFalse,EFalse,EFalse,ETrue,EFalse);
       
   333 	result18&=(EmailEntry->DraftIMAP4Flag()!=EFalse);
       
   334 	EmailEntry->SetIMAP4Flags(EFalse,EFalse,EFalse,EFalse,EFalse,EFalse,ETrue);
       
   335 	result18&=(EmailEntry->RecentIMAP4Flag()!=EFalse);
       
   336 	if (!result18)
       
   337 		log->AppendError(_L8("\t\tSetIMAP4Flags() not setting correct values"),-1);
       
   338 	result&=result18;
       
   339 
       
   340 	// check folder Set/Get functions
       
   341 	EmailEntry->SetMessageFolderType(EFolderTypeRelated);
       
   342 	TBool result19=(EmailEntry->MessageFolderType()==EFolderTypeRelated);
       
   343 	if (!result19)
       
   344 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeRelated) not setting correct values"),-1);
       
   345 	result&=result19;
       
   346 
       
   347 	EmailEntry->SetMessageFolderType(EFolderTypeAlternative);
       
   348 	TBool result20=(EmailEntry->MessageFolderType()==EFolderTypeAlternative);
       
   349 	if (!result20)
       
   350 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeAlternative) not setting correct values"),-1);
       
   351 	result&=result20;
       
   352 
       
   353 	EmailEntry->SetMessageFolderType(EFolderTypeMixed);
       
   354 	TBool result21=(EmailEntry->MessageFolderType()==EFolderTypeMixed);
       
   355 	if (!result21)
       
   356 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeMixed) not setting correct values"),-1);
       
   357 	result&=result21;
       
   358 	
       
   359 	EmailEntry->SetMessageFolderType(EFolderTypeParallel);
       
   360 	TBool result22=(EmailEntry->MessageFolderType()==EFolderTypeParallel);
       
   361 	if (!result22)
       
   362 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeParallel) not setting correct values"),-1);
       
   363 	result&=result22;
       
   364 	
       
   365 	EmailEntry->SetMessageFolderType(EFolderTypeDigest);
       
   366 	TBool result23=(EmailEntry->MessageFolderType()==EFolderTypeDigest);
       
   367 	if (!result23)
       
   368 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeDigest) not setting correct values"),-1);
       
   369 	result&=result23;
       
   370 
       
   371 	EmailEntry->SetMessageFolderType(EFolderTypePartial);
       
   372 	TBool result24=(EmailEntry->MessageFolderType()==EFolderTypePartial);
       
   373 	if (!result24)
       
   374 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypePartial) not setting correct values"),-1);
       
   375 	result&=result24;
       
   376 
       
   377 	EmailEntry->SetMessageFolderType(EFolderTypeExternal);
       
   378 	TBool result25=(EmailEntry->MessageFolderType()==EFolderTypeExternal);
       
   379 	if (!result25)
       
   380 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeExternal) not setting correct values"),-1);
       
   381 	result&=result25;
       
   382 
       
   383 	EmailEntry->SetMessageFolderType(EFolderTypeUnknown);
       
   384 	TBool result26=(EmailEntry->MessageFolderType()==EFolderTypeUnknown);
       
   385 	if (!result26)
       
   386 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeUnknown) not setting correct values"),-1);
       
   387 	result&=result26;
       
   388 
       
   389 	EmailEntry->SetMessageFolderType(EFolderTypeDirectory);
       
   390 	TBool result27=(EmailEntry->MessageFolderType()==EFolderTypeDirectory);
       
   391 	if (!result27)
       
   392 		log->AppendError(_L8("\t\tSetMessageFolderType(EFolderTypeDirectory) not setting correct values"),-1);
       
   393 	result&=result27;
       
   394 
       
   395 	TBool result28 = ETrue;
       
   396 	// Huge test for all combinations of flag settings using the Get/Set inlines...
       
   397 	for (TInt a=0;a<2;++a)
       
   398 		{
       
   399 		for (TInt b=0;b<2;++b)
       
   400 			{
       
   401 			for(TInt c=0;c<2;++c)
       
   402 				{
       
   403 				for (TInt d=0 ; d<2 ;++d)
       
   404 					{
       
   405 					for (TInt e=0;e<2 ;++e)
       
   406 						{
       
   407 						for (TInt f=0; f<2 ; ++f)
       
   408 							{
       
   409 							for (TInt g=0; g<2 ; ++g)
       
   410 								{
       
   411 								TBool ia=a==1;
       
   412 								TBool ib=a==1;
       
   413 								TBool ic=c==1;
       
   414 								TBool id=d==1;
       
   415 								TBool ie=e==1;
       
   416 								TBool iff=f==1;
       
   417 								TBool ig=g==1;
       
   418 								EmailEntry->SetIMAP4Flags (ia,ib,ic,id,ie,iff,ig);
       
   419 								TBool ra,rb,rc,rd,re,rf,rg;
       
   420 								EmailEntry->GetIMAP4Flags (ra,rb,rc,rd,re,rf,rg);
       
   421 								result28 &= (ia==(ra>0)) && ((rb>0)==ib) && (ic==(rc>0)) && (id==(rd>0)) && (ie==(re>0)) && (iff==(rf>0)) && ((rg>0)==ig);
       
   422 								}	// g
       
   423 							}	//f 
       
   424 						}	// e
       
   425 					}	// d
       
   426 				}	// c
       
   427 			}	// b
       
   428 		}	// a
       
   429 	if (!result28)
       
   430 		log->AppendError(_L8("\t\tError in test for all combinations of flag settings using Get/Set inlines"),-1);
       
   431 	result&=result28;
       
   432 
       
   433 	const TUint32 KMyUID=8723640;
       
   434 
       
   435 	TUint32 myUID=KMyUID;
       
   436 	EmailEntry->SetUID(myUID);
       
   437 	myUID=99;
       
   438 	TBool result29=(EmailEntry->UID()==KMyUID);
       
   439 
       
   440 	EmailEntry->SetIMAP4Flags(ETrue,EFalse,EFalse,ETrue,EFalse,ETrue,EFalse);
       
   441 	TInt32 myInt = EmailEntry->MtmData1();
       
   442 	delete genericEntry;
       
   443 	TMsvEntry msvEntry=*EmailEntry;
       
   444 	genericEntry=&msvEntry;
       
   445 	result29&=(genericEntry->MtmData1()==myInt);
       
   446 
       
   447 	msvEntry.SetMtmData2(KMyUID);
       
   448 	TMsvEmailEntry msvEmailEntry1(msvEntry);
       
   449 	TMsvEmailEntry msvEmailEntry2(msvEmailEntry1);
       
   450 
       
   451 	result29 &= (msvEmailEntry2.UID()==KMyUID);	// test whether the copy constructors work ok...
       
   452 	if (!result29)
       
   453 		log->AppendError(_L8("\t\tCopy constructors do not work"),-1);
       
   454 	result&=result29;
       
   455 
       
   456 	TMsvEmailEntry msvEmailEntry3=msvEmailEntry1;	// test assignment operator
       
   457 	TBool result30=(msvEmailEntry3.UID()==KMyUID);
       
   458 	if (!result30)
       
   459 		log->AppendError(_L8("\t\tTest Assignment Operator does not work"),-1);
       
   460 	result&=result30;
       
   461 
       
   462 	//test equality operator
       
   463 	TBool result31=msvEmailEntry2==msvEmailEntry3;
       
   464 	if (!result31)
       
   465 		log->AppendError(_L8("\t\tTest Equality Operator does not work"),-1);
       
   466 	result&=result31;
       
   467 
       
   468 	TMsvEntry a2=msvEntry;
       
   469 
       
   470 	// assignment TMsvEmailEntry->TMsvEntry
       
   471 	a2 = msvEmailEntry1;
       
   472 
       
   473 	TBool result32=(TUint32(a2.MtmData2())==KMyUID);
       
   474 	result&=result32;
       
   475 	
       
   476 	// check ICalendar flag
       
   477 	EmailEntry->SetICalendar(ETrue);
       
   478 	TBool result33=(EmailEntry->ICalendar()!=EFalse);
       
   479 	EmailEntry->SetICalendar(EFalse);
       
   480 	result33&=(EmailEntry->ICalendar()==EFalse);
       
   481 	if (!result33)
       
   482 		log->AppendError(_L8("\t\tSetICalendar() not setting correct values"),-1);
       
   483 	result&=result33;
       
   484 
       
   485 	delete EmailEntry;
       
   486 
       
   487 	ResultOfTest(result, aTestNo);
       
   488 	return result;
       
   489 	}
       
   490 
       
   491 LOCAL_C TBool DisconnectedOperationTests(TInt aTestNo)
       
   492 	{
       
   493 	log->AppendComment(_L8("\tDisconnected Operation Tests"));
       
   494 
       
   495 	TMsvEntry* genericEntry = new (ELeave) TMsvEntry;
       
   496 	genericEntry->iType = KUidMsvMessageEntry;
       
   497 	genericEntry->iMtm = KUidMsgTypePOP3;
       
   498 	genericEntry->iServiceId = 0x1087643;
       
   499 	genericEntry->SetPriority(EMsvHighPriority);
       
   500 	genericEntry->SetComplete(ETrue);
       
   501 	genericEntry->SetVisible(ETrue);
       
   502 
       
   503 	TBool result=ETrue;
       
   504 
       
   505 	TMsvEmailEntry* EmailEntry = new (ELeave) TMsvEmailEntry(*genericEntry);
       
   506 
       
   507 	// check folder Set/Get functions
       
   508 	EmailEntry->SetDisconnectedOperation(ENoDisconnectedOperations);
       
   509 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), ENoDisconnectedOperations, &KNoDisconnectedOperations);
       
   510 	
       
   511 	EmailEntry->SetDisconnectedOperation(EDisconnectedCreateOperation);
       
   512 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedCreateOperation, &KDisconnectedCreateOperation);
       
   513 
       
   514 	EmailEntry->SetDisconnectedOperation(EDisconnectedDeleteOperation);
       
   515 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedDeleteOperation, &KDisconnectedDeleteOperation);
       
   516 
       
   517 	EmailEntry->SetDisconnectedOperation(EDisconnectedChangeOperation);
       
   518 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedChangeOperation, &KDisconnectedChangeOperation);
       
   519 
       
   520 	EmailEntry->SetDisconnectedOperation(EDisconnectedCopyToOperation);
       
   521 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedCopyToOperation, &KDisconnectedCopyToOperation);
       
   522 
       
   523 	EmailEntry->SetDisconnectedOperation(EDisconnectedCopyFromOperation);
       
   524 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedCopyFromOperation, &KDisconnectedCopyFromOperation);
       
   525 
       
   526 	EmailEntry->SetDisconnectedOperation(EDisconnectedCopyWithinServiceOperation);
       
   527 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedCopyWithinServiceOperation, &KDisconnectedCopyWithinServiceOperation);
       
   528 
       
   529 	EmailEntry->SetDisconnectedOperation(EDisconnectedMoveToOperation);
       
   530 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedMoveToOperation, &KDisconnectedMoveToOperation);
       
   531 
       
   532 	EmailEntry->SetDisconnectedOperation(EDisconnectedMoveFromOperation);
       
   533 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedMoveFromOperation, &KDisconnectedMoveFromOperation);
       
   534 
       
   535 	EmailEntry->SetDisconnectedOperation(EDisconnectedMoveWithinServiceOperation);
       
   536 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedMoveWithinServiceOperation, &KDisconnectedMoveWithinServiceOperation);
       
   537 
       
   538 	EmailEntry->SetDisconnectedOperation(EDisconnectedSpecialOperation);
       
   539 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedSpecialOperation, &KDisconnectedSpecialOperation);
       
   540 
       
   541 	EmailEntry->SetDisconnectedOperation(EDisconnectedUnknownOperation);
       
   542 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedUnknownOperation, &KDisconnectedUnknownOperation);
       
   543 
       
   544 	EmailEntry->SetDisconnectedOperation(EDisconnectedMultipleOperation);
       
   545 	result &= CompareDisconnectedOptions(EmailEntry->DisconnectedOperation(), EDisconnectedMultipleOperation, &KDisconnectedMultipleOperation);
       
   546 
       
   547 	delete genericEntry;
       
   548 	delete EmailEntry;
       
   549 
       
   550 	ResultOfTest(result, aTestNo);
       
   551 	return result;
       
   552 	}
       
   553 
       
   554 
       
   555 //
       
   556 
       
   557 LOCAL_C void InitL()
       
   558 	{
       
   559 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
   560 	CActiveScheduler::Install(scheduler);
       
   561 	CleanupStack::PushL(scheduler);
       
   562 
       
   563 	testUtils = CEmailTestUtils::NewLC(test);
       
   564 	testUtils->CreateAllTestDirectories();
       
   565 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
   566 	testUtils->CleanMessageFolderL();
       
   567 
       
   568 	log = CImLog::NewL(_L("c:\\logs\\email\\T_IMCM.log"), EAppend);
       
   569 	CleanupStack::PushL(log);
       
   570 	log->AppendComment(_L8("********** T_MIUT04 Test TMsvEmailEntry class **********"));
       
   571 	TBuf8<80> buf;
       
   572 
       
   573 #if defined(__WINS__)	
       
   574 	buf.Append(_L8("WINS "));
       
   575 #else
       
   576 	buf.Append(_L8("MARM "));
       
   577 #endif
       
   578 #if defined(_UNICODE)
       
   579 	buf.Append(_L8("U"));
       
   580 #endif
       
   581 #if defined(_DEBUG)
       
   582 	buf.Append(_L8("DEB"));
       
   583 #else
       
   584 	buf.Append(_L8("REL"));
       
   585 #endif
       
   586 	log->AppendComment(buf);
       
   587 	}
       
   588 
       
   589 LOCAL_C void Closedown()
       
   590 	{
       
   591 	log->AppendComment(_L8("************    T_MIUT04 Tests Complete    *************"));
       
   592 	log->AppendComment(_L8(""));
       
   593 
       
   594 	CleanupStack::PopAndDestroy(3);  //testUtils, log, scheduler
       
   595 	}
       
   596 
       
   597 //
       
   598 
       
   599 LOCAL_C void doMainL()
       
   600 	{
       
   601 	InitL();
       
   602 	testUtils->GoClientSideL();
       
   603 	test.Printf(_L("Performing Header Tests"));
       
   604 
       
   605 	TBool result = ETrue;
       
   606 	testUtils->TestStart(1);
       
   607 	TBool result1 = TMsvEmailEntrySelectionL(1);
       
   608 	result &= result1;
       
   609 	if (result1)
       
   610 		log->AppendComment(_L8("PASSED Test 1"));
       
   611 	else
       
   612 		log->AppendError(_L8("FAILED Test 1"),-1);
       
   613 	testUtils->TestFinish(1);
       
   614 
       
   615 	testUtils->TestStart(2);
       
   616 	TBool result2 = DisconnectedOperationTests(2);
       
   617 	result &= result2;
       
   618 	if (result2)
       
   619 		log->AppendComment(_L8("PASSED Test 2"));
       
   620 	else
       
   621 		log->AppendError(_L8("FAILED Test 2"),-1);
       
   622 	testUtils->TestFinish(2);
       
   623 
       
   624 	if (result)
       
   625 		{
       
   626 		log->AppendComment(_L8("PASSED All tests"));
       
   627 		test.Printf(_L("PASSED all Tests"));
       
   628 		testUtils->TestHarnessCompleted();
       
   629 		}
       
   630 	else
       
   631 		{
       
   632 		test.Printf(_L("FAILED Tests"));
       
   633 		log->AppendError(_L8("FAILED At Least one test"),-1);
       
   634 		testUtils->TestHarnessFailed(KErrGeneral);
       
   635 		}
       
   636 
       
   637 	Closedown();
       
   638 	}
       
   639 
       
   640 GLDEF_C TInt E32Main()
       
   641 	{	
       
   642 	__UHEAP_MARK;
       
   643 	test.Start(_L("MIUT04 - Test TMsvEmailEntry class"));
       
   644 	theCleanup=CTrapCleanup::New();
       
   645 	TRAPD(ret,doMainL());		
       
   646 	test(ret==KErrNone);
       
   647 	delete theCleanup;	
       
   648 	test.End();
       
   649 	test.Close();
       
   650 	__UHEAP_MARKEND;
       
   651 	return(KErrNone);
       
   652 	}