textrendering/texthandling/ttext/TEtextDefect.cpp
branchRCL_3
changeset 54 748ec5531811
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
36:f902e87c146f 54:748ec5531811
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <e32test.h>
       
    20 #include <charconv.h>
    19 #include <charconv.h>
    21 #include <gdi.h>
    20 #include <gdi.h>
    22 #include <conpics.h>
    21 #include <conpics.h>
    23 #include <txtrich.h>
    22 #include <txtrich.h>
    24 #include <apadef.h>
    23 #include <apadef.h>
    25 
    24 
    26 #include "TXTPLAIN.H"
    25 #include "TXTPLAIN.H"
    27 #include "TxtWriter.h"
    26 #include "TxtWriter.h"
       
    27 #include "TETextDefect.h"
       
    28 
       
    29 LOCAL_D CTestStep *pTestStep = NULL;
       
    30 #define test(cond)								\
       
    31 	{											\
       
    32 	TBool __bb = (cond);						\
       
    33 	pTestStep->TEST(__bb);						\
       
    34 	if (!__bb)									\
       
    35 		{										\
       
    36 		ERR_PRINTF1(_L("ERROR: Test Failed"));	\
       
    37 		User::Leave(1);							\
       
    38 		}										\
       
    39 	}
       
    40 #define test2(cond, line)										\
       
    41 	{															\
       
    42 	TBool __bb = (cond);										\
       
    43 	pTestStep->TEST(__bb);										\
       
    44 	if (!__bb)													\
       
    45 		{														\
       
    46 		ERR_PRINTF2(_L("Line %d, ERROR: Test Failed"), line);	\
       
    47 		User::Leave(1);											\
       
    48 		}														\
       
    49 	}
       
    50 #undef INFO_PRINTF1
       
    51 #undef INFO_PRINTF2
       
    52 #undef ERR_PRINTF1
       
    53 #undef ERR_PRINTF2
       
    54 #undef ERR_PRINTF3
       
    55 // copy from tefexportconst.h
       
    56 #define INFO_PRINTF1(p1)        pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
       
    57 #define INFO_PRINTF2(p1, p2)    pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
       
    58 #define ERR_PRINTF1(p1)         pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1)) 
       
    59 #define ERR_PRINTF2(p1, p2)     pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2)) 
       
    60 #define ERR_PRINTF3(p1, p2, p3) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3)) ;
       
    61 
    28 
    62 
    29 //Used for supressing warning in OOM tests
    63 //Used for supressing warning in OOM tests
    30  #define __UNUSED_VAR(var) var = var
    64  #define __UNUSED_VAR(var) var = var
    31 
    65 
    32 // this fixes a MSVC link warning
    66 // this fixes a MSVC link warning
    33 #ifdef __VC32__
    67 #ifdef __VC32__
    34 #pragma comment (linker, "/opt:noref") 
    68 #pragma comment (linker, "/opt:noref") 
    35 #endif
    69 #endif
    36 
    70 
    37 _LIT(KTestName, "Start of Tests...");
    71 _LIT(KTestName, "Start of Tests...");
    38 RTest theTest(KTestName);
       
    39 
    72 
    40 ///////////////////////////////////////////////////////////////////////////////////////
    73 ///////////////////////////////////////////////////////////////////////////////////////
    41 ///////////////////////////////////////////////////////////////////////////////////////
    74 ///////////////////////////////////////////////////////////////////////////////////////
    42 //Test macroses and functions
    75 //Test macroses and functions
    43 LOCAL_C void Check(TInt aValue, TInt aLine)
    76 LOCAL_C void Check(TInt aValue, TInt aLine)
    44 	{
    77 	{
    45 	if(!aValue)
    78 	if(!aValue)
    46 		{
    79 		{
    47 		theTest(EFalse, aLine);
    80 		test2(EFalse, aLine);
    48 		}
    81 		}
    49 	}
    82 	}
    50 LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
    83 LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
    51 	{
    84 	{
    52 	if(aValue != aExpected)
    85 	if(aValue != aExpected)
    53 		{
    86 		{
    54 		theTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
    87 	    ERR_PRINTF3(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
    55 		theTest(EFalse, aLine);
    88 		test2(EFalse, aLine);
    56 		}
    89 		}
    57 	}
    90 	}
    58 #define TEST(arg) ::Check((arg), __LINE__)
    91 #define CHECK1(arg) ::Check((arg), __LINE__)
    59 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
    92 #define CHECK2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
    60 
    93 
    61 
    94 
    62 LOCAL_C void Inc049456L()
    95 LOCAL_C void Inc049456L()
    63 	{
    96 	{
    64    	theTest.Next(_L("Inc049456L"));
    97    	INFO_PRINTF1(_L("Inc049456L"));
    65 
    98 
    66 	CPlainTextConverter* converter = CPlainTextConverter::NewLC();
    99 	CPlainTextConverter* converter = CPlainTextConverter::NewLC();
    67 	CleanupStack::PopAndDestroy(converter);
   100 	CleanupStack::PopAndDestroy(converter);
    68 	}
   101 	}
    69 	
   102 	
    70 LOCAL_C void OOM049456L()
   103 LOCAL_C void OOM049456L()
    71 	{
   104 	{
    72    	theTest.Next(_L("OOM049456L"));
   105    	INFO_PRINTF1(_L("OOM049456L"));
    73 
   106 
    74 	TInt tryCount=0;
   107 	TInt tryCount=0;
    75  	TInt error = KErrNone;
   108  	TInt error = KErrNone;
    76  	__UNUSED_VAR(tryCount);
   109  	__UNUSED_VAR(tryCount);
    77  	
   110  	
    93  		// check that no handles have leaked
   126  		// check that no handles have leaked
    94  		TInt endProcessHandleCount;
   127  		TInt endProcessHandleCount;
    95  		TInt endThreadHandleCount;
   128  		TInt endThreadHandleCount;
    96  		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
   129  		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
    97  
   130  
    98  		TEST(startProcessHandleCount == endProcessHandleCount);
   131  		CHECK1(startProcessHandleCount == endProcessHandleCount);
    99  		TEST(startThreadHandleCount  == endThreadHandleCount);
   132  		CHECK1(startThreadHandleCount  == endThreadHandleCount);
   100  				
   133  				
   101  		__UHEAP_MARKEND;
   134  		__UHEAP_MARKEND;
   102  		
   135  		
   103  		}while(error==KErrNoMemory);
   136  		}while(error==KErrNoMemory);
   104  		
   137  		
   105  	TEST2(error, KErrNone);
   138  	CHECK2(error, KErrNone);
   106  	theTest.Printf(_L("- server succeeded at heap failure rate of %i\n"),tryCount);		
   139  	INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"),tryCount);		
   107 	}
   140 	}
   108 
   141 
   109 
   142 
   110 
   143 
   111 
   144 
   112 LOCAL_C void Inc051360L()
   145 LOCAL_C void Inc051360L()
   113 	{
   146 	{
   114    	theTest.Next(_L("Inc051360L"));
   147    	INFO_PRINTF1(_L("Inc051360L"));
   115    	
   148    	
   116 	// Test data to force a remainder of 2 from the charconv unicode conversion.
   149 	// Test data to force a remainder of 2 from the charconv unicode conversion.
   117 	// The etext buffer is 1024 bytes that truncates the last utf-8 character.
   150 	// The etext buffer is 1024 bytes that truncates the last utf-8 character.
   118 	// It needs three bytes but only has two, hence remainder 2.
   151 	// It needs three bytes but only has two, hence remainder 2.
   119 	const TUint8 KUtf8TextJapanese [] = 
   152 	const TUint8 KUtf8TextJapanese [] = 
   221 	// Can't use Copy as this will store each byte on a word boundary!
   254 	// Can't use Copy as this will store each byte on a word boundary!
   222 	TPtr8 ptr8 (outbuffer->Ptr(outbuffer->Size()-4));
   255 	TPtr8 ptr8 (outbuffer->Ptr(outbuffer->Size()-4));
   223 	const TUint16* ptr = (TUint16*) (ptr8.Ptr());
   256 	const TUint16* ptr = (TUint16*) (ptr8.Ptr());
   224 	TPtrC16 des16 (ptr, 2);
   257 	TPtrC16 des16 (ptr, 2);
   225 
   258 
   226 	TEST(unicodeConversion == des16);
   259 	CHECK1(unicodeConversion == des16);
   227 	
   260 	
   228 	CleanupStack::PopAndDestroy (&outputStr);	
   261 	CleanupStack::PopAndDestroy (&outputStr);	
   229 	CleanupStack::PopAndDestroy (outbuffer);	
   262 	CleanupStack::PopAndDestroy (outbuffer);	
   230 	CleanupStack::PopAndDestroy (&inputStr);	
   263 	CleanupStack::PopAndDestroy (&inputStr);	
   231 	CleanupStack::PopAndDestroy (inbuffer);	
   264 	CleanupStack::PopAndDestroy (inbuffer);	
   232 	CleanupStack::PopAndDestroy (plainText);
   265 	CleanupStack::PopAndDestroy (plainText);
   233 	}
   266 	}
   234 	
   267 	
   235 LOCAL_C void OOM051360L()
   268 LOCAL_C void OOM051360L()
   236 	{
   269 	{
   237    	theTest.Next(_L("OOM051360L"));
   270    	INFO_PRINTF1(_L("OOM051360L"));
   238 
   271 
   239 	TInt tryCount=0;
   272 	TInt tryCount=0;
   240  	TInt error = KErrNone;
   273  	TInt error = KErrNone;
   241  	__UNUSED_VAR(tryCount);
   274  	__UNUSED_VAR(tryCount);
   242  	
   275  	
   258  		// check that no handles have leaked
   291  		// check that no handles have leaked
   259  		TInt endProcessHandleCount;
   292  		TInt endProcessHandleCount;
   260  		TInt endThreadHandleCount;
   293  		TInt endThreadHandleCount;
   261  		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
   294  		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
   262  
   295  
   263  		TEST(startProcessHandleCount == endProcessHandleCount);
   296  		CHECK1(startProcessHandleCount == endProcessHandleCount);
   264  		TEST(startThreadHandleCount  == endThreadHandleCount);
   297  		CHECK1(startThreadHandleCount  == endThreadHandleCount);
   265  				
   298  				
   266  		__UHEAP_MARKEND;
   299  		__UHEAP_MARKEND;
   267  		
   300  		
   268  		}while(error==KErrNoMemory);
   301  		}while(error==KErrNoMemory);
   269  		
   302  		
   270  	TEST2(error, KErrNone);
   303  	CHECK2(error, KErrNone);
   271  	theTest.Printf(_L("- server succeeded at heap failure rate of %i\n"),tryCount);		
   304  	INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"),tryCount);		
   272 	}
   305 	}
   273 	
   306 	
   274 LOCAL_C void OOM056552L()
   307 LOCAL_C void OOM056552L()
   275 	{
   308 	{
   276 	theTest.Next(_L("OOM056552L"));
   309 	INFO_PRINTF1(_L("OOM056552L"));
   277 
   310 
   278 	TInt tryCount=0;
   311 	TInt tryCount=0;
   279  	TInt error = KErrNone;
   312  	TInt error = KErrNone;
   280  	__UNUSED_VAR(tryCount);
   313  	__UNUSED_VAR(tryCount);
   281  	
   314  	
   303  		
   336  		
   304  		__UHEAP_MARKEND;
   337  		__UHEAP_MARKEND;
   305  		
   338  		
   306  		}while(error==KErrNoMemory);
   339  		}while(error==KErrNoMemory);
   307  		
   340  		
   308  	theTest(error==KErrNone);
   341  	test(error==KErrNone);
   309  	theTest.Printf(_L("	richText->InsertL - succeeded at heap failure rate of %i\n"),tryCount);	
   342  	INFO_PRINTF2(_L("	richText->InsertL - succeeded at heap failure rate of %i\n"),tryCount);	
   310 	}
   343 	}
   311 /////////////////////////////////////////////////////////////////////////////////////////////////
   344 /////////////////////////////////////////////////////////////////////////////////////////////////
   312 // Testing the fix for
   345 // Testing the fix for
   313 // "INC055971  NTT - Received MMS with line break "CR" set does not cause line feed."
   346 // "INC055971  NTT - Received MMS with line break "CR" set does not cause line feed."
   314 // In order to make the testing easier, MOutputChar, MTextWriter, TSLBTransaltor, 
   347 // In order to make the testing easier, MOutputChar, MTextWriter, TSLBTransaltor, 
   350 static void INC055971L()
   383 static void INC055971L()
   351 	{
   384 	{
   352 	TBuf<32> testBuf;
   385 	TBuf<32> testBuf;
   353 	TOutputChar outputChar;
   386 	TOutputChar outputChar;
   354 
   387 
   355    	theTest.Next(_L("INC055971L - OrganiseByParagraph test"));
   388    	INFO_PRINTF1(_L("INC055971L - OrganiseByParagraph test"));
   356 
   389 
   357 		{
   390 		{
   358 		TParagraphTextWriter paragraphTextWriter(outputChar);
   391 		TParagraphTextWriter paragraphTextWriter(outputChar);
   359 		TSLBTransaltor slbTranslator(paragraphTextWriter);
   392 		TSLBTransaltor slbTranslator(paragraphTextWriter);
   360 
   393 
   361 		testBuf = _L("\xD");
   394 		testBuf = _L("\xD");
   362 		TheOutputTestBuf.Zero();
   395 		TheOutputTestBuf.Zero();
   363 		::TranslateToEofTestL(slbTranslator, testBuf);
   396 		::TranslateToEofTestL(slbTranslator, testBuf);
   364 		TEST(TheOutputTestBuf.Length() == 1);
   397 		CHECK1(TheOutputTestBuf.Length() == 1);
   365 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   398 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   366 
   399 
   367 		testBuf = _L("\xA");
   400 		testBuf = _L("\xA");
   368 		TheOutputTestBuf.Zero();
   401 		TheOutputTestBuf.Zero();
   369 		::TranslateToEofTestL(slbTranslator, testBuf);
   402 		::TranslateToEofTestL(slbTranslator, testBuf);
   370 		TEST(TheOutputTestBuf.Length() == 1);
   403 		CHECK1(TheOutputTestBuf.Length() == 1);
   371 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   404 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   372 
   405 
   373 		testBuf = _L("\xD\xA");
   406 		testBuf = _L("\xD\xA");
   374 		TheOutputTestBuf.Zero();
   407 		TheOutputTestBuf.Zero();
   375 		::TranslateToEofTestL(slbTranslator, testBuf);
   408 		::TranslateToEofTestL(slbTranslator, testBuf);
   376 		TEST(TheOutputTestBuf.Length() == 1);
   409 		CHECK1(TheOutputTestBuf.Length() == 1);
   377 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   410 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   378 
   411 
   379 		testBuf = _L("zz\xD\xA\xD\xA\xAz\xD");
   412 		testBuf = _L("zz\xD\xA\xD\xA\xAz\xD");
   380 		TheOutputTestBuf.Zero();
   413 		TheOutputTestBuf.Zero();
   381 		::TranslateToEofTestL(slbTranslator, testBuf);
   414 		::TranslateToEofTestL(slbTranslator, testBuf);
   382 		TEST(TheOutputTestBuf.Length() == 7);
   415 		CHECK1(TheOutputTestBuf.Length() == 7);
   383 		TEST(TheOutputTestBuf[0] == 'z');
   416 		CHECK1(TheOutputTestBuf[0] == 'z');
   384 		TEST(TheOutputTestBuf[1] == 'z');
   417 		CHECK1(TheOutputTestBuf[1] == 'z');
   385 		TEST(TheOutputTestBuf[2] == CEditableText::EParagraphDelimiter);
   418 		CHECK1(TheOutputTestBuf[2] == CEditableText::EParagraphDelimiter);
   386 		TEST(TheOutputTestBuf[3] == CEditableText::EParagraphDelimiter);
   419 		CHECK1(TheOutputTestBuf[3] == CEditableText::EParagraphDelimiter);
   387 		TEST(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
   420 		CHECK1(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
   388 		TEST(TheOutputTestBuf[5] == 'z');
   421 		CHECK1(TheOutputTestBuf[5] == 'z');
   389 		TEST(TheOutputTestBuf[6] == CEditableText::EParagraphDelimiter);
   422 		CHECK1(TheOutputTestBuf[6] == CEditableText::EParagraphDelimiter);
   390 
   423 
   391 		testBuf = _L("This\xDIs\xATest\xD\xAMessage");
   424 		testBuf = _L("This\xDIs\xATest\xD\xAMessage");
   392 		TheOutputTestBuf.Zero();
   425 		TheOutputTestBuf.Zero();
   393 		::TranslateToEofTestL(slbTranslator, testBuf);
   426 		::TranslateToEofTestL(slbTranslator, testBuf);
   394 		TEST(TheOutputTestBuf.Length() == 20);
   427 		CHECK1(TheOutputTestBuf.Length() == 20);
   395 		TEST(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
   428 		CHECK1(TheOutputTestBuf[4] == CEditableText::EParagraphDelimiter);
   396 		TEST(TheOutputTestBuf[7] == CEditableText::EParagraphDelimiter);
   429 		CHECK1(TheOutputTestBuf[7] == CEditableText::EParagraphDelimiter);
   397 		TEST(TheOutputTestBuf[12] == CEditableText::EParagraphDelimiter);
   430 		CHECK1(TheOutputTestBuf[12] == CEditableText::EParagraphDelimiter);
   398 		}
   431 		}
   399 
   432 
   400    	theTest.Next(_L("INC055971L - OrganiseByLine test"));
   433    	INFO_PRINTF1(_L("INC055971L - OrganiseByLine test"));
   401 
   434 
   402 		{
   435 		{
   403 		TLineTextWriter lineTextWriter(outputChar);
   436 		TLineTextWriter lineTextWriter(outputChar);
   404 		TSLBTransaltor slbTranslator(lineTextWriter);
   437 		TSLBTransaltor slbTranslator(lineTextWriter);
   405 
   438 
   406 		testBuf = _L("\xD");
   439 		testBuf = _L("\xD");
   407 		TheOutputTestBuf.Zero();
   440 		TheOutputTestBuf.Zero();
   408 		::TranslateToEofTestL(slbTranslator, testBuf);
   441 		::TranslateToEofTestL(slbTranslator, testBuf);
   409 		TEST(TheOutputTestBuf.Length() == 1);
   442 		CHECK1(TheOutputTestBuf.Length() == 1);
   410 		TEST(TheOutputTestBuf[0] == ' ');
   443 		CHECK1(TheOutputTestBuf[0] == ' ');
   411 
   444 
   412 		testBuf = _L("\xA");
   445 		testBuf = _L("\xA");
   413 		TheOutputTestBuf.Zero();
   446 		TheOutputTestBuf.Zero();
   414 		::TranslateToEofTestL(slbTranslator, testBuf);
   447 		::TranslateToEofTestL(slbTranslator, testBuf);
   415 		TEST(TheOutputTestBuf.Length() == 1);
   448 		CHECK1(TheOutputTestBuf.Length() == 1);
   416 		TEST(TheOutputTestBuf[0] == ' ');
   449 		CHECK1(TheOutputTestBuf[0] == ' ');
   417 
   450 
   418 		testBuf = _L("\xD\xA");
   451 		testBuf = _L("\xD\xA");
   419 		TheOutputTestBuf.Zero();
   452 		TheOutputTestBuf.Zero();
   420 		::TranslateToEofTestL(slbTranslator, testBuf);
   453 		::TranslateToEofTestL(slbTranslator, testBuf);
   421 		TEST(TheOutputTestBuf.Length() == 1);
   454 		CHECK1(TheOutputTestBuf.Length() == 1);
   422 		TEST(TheOutputTestBuf[0] == ' ');
   455 		CHECK1(TheOutputTestBuf[0] == ' ');
   423 
   456 
   424 		testBuf = _L("\xD\xA\xD\xA");
   457 		testBuf = _L("\xD\xA\xD\xA");
   425 		TheOutputTestBuf.Zero();
   458 		TheOutputTestBuf.Zero();
   426 		::TranslateToEofTestL(slbTranslator, testBuf);
   459 		::TranslateToEofTestL(slbTranslator, testBuf);
   427 		TEST(TheOutputTestBuf.Length() == 1);
   460 		CHECK1(TheOutputTestBuf.Length() == 1);
   428 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   461 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   429 
   462 
   430 		testBuf = _L("\xD\xD");
   463 		testBuf = _L("\xD\xD");
   431 		TheOutputTestBuf.Zero();
   464 		TheOutputTestBuf.Zero();
   432 		::TranslateToEofTestL(slbTranslator, testBuf);
   465 		::TranslateToEofTestL(slbTranslator, testBuf);
   433 		TEST(TheOutputTestBuf.Length() == 1);
   466 		CHECK1(TheOutputTestBuf.Length() == 1);
   434 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   467 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   435 
   468 
   436 		testBuf = _L("\xA\xA");
   469 		testBuf = _L("\xA\xA");
   437 		TheOutputTestBuf.Zero();
   470 		TheOutputTestBuf.Zero();
   438 		::TranslateToEofTestL(slbTranslator, testBuf);
   471 		::TranslateToEofTestL(slbTranslator, testBuf);
   439 		TEST(TheOutputTestBuf.Length() == 1);
   472 		CHECK1(TheOutputTestBuf.Length() == 1);
   440 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   473 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   441 
   474 
   442 		testBuf = _L("\xA\xD");
   475 		testBuf = _L("\xA\xD");
   443 		TheOutputTestBuf.Zero();
   476 		TheOutputTestBuf.Zero();
   444 		::TranslateToEofTestL(slbTranslator, testBuf);
   477 		::TranslateToEofTestL(slbTranslator, testBuf);
   445 		TEST(TheOutputTestBuf.Length() == 1);
   478 		CHECK1(TheOutputTestBuf.Length() == 1);
   446 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   479 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   447 
   480 
   448 		testBuf = _L("\xD\xA\xA");
   481 		testBuf = _L("\xD\xA\xA");
   449 		TheOutputTestBuf.Zero();
   482 		TheOutputTestBuf.Zero();
   450 		::TranslateToEofTestL(slbTranslator, testBuf);
   483 		::TranslateToEofTestL(slbTranslator, testBuf);
   451 		TEST(TheOutputTestBuf.Length() == 1);
   484 		CHECK1(TheOutputTestBuf.Length() == 1);
   452 		TEST(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   485 		CHECK1(TheOutputTestBuf[0] == CEditableText::EParagraphDelimiter);
   453 
   486 
   454 		testBuf = _L("\xD\xAz\xAzz\xA\xD");
   487 		testBuf = _L("\xD\xAz\xAzz\xA\xD");
   455 		TheOutputTestBuf.Zero();
   488 		TheOutputTestBuf.Zero();
   456 		::TranslateToEofTestL(slbTranslator, testBuf);
   489 		::TranslateToEofTestL(slbTranslator, testBuf);
   457 		TEST(TheOutputTestBuf.Length() == 6);
   490 		CHECK1(TheOutputTestBuf.Length() == 6);
   458 		TEST(TheOutputTestBuf[0] == ' ');
   491 		CHECK1(TheOutputTestBuf[0] == ' ');
   459 		TEST(TheOutputTestBuf[1] == 'z');
   492 		CHECK1(TheOutputTestBuf[1] == 'z');
   460 		TEST(TheOutputTestBuf[2] == ' ');
   493 		CHECK1(TheOutputTestBuf[2] == ' ');
   461 		TEST(TheOutputTestBuf[3] == 'z');
   494 		CHECK1(TheOutputTestBuf[3] == 'z');
   462 		TEST(TheOutputTestBuf[4] == 'z');
   495 		CHECK1(TheOutputTestBuf[4] == 'z');
   463 		TEST(TheOutputTestBuf[5] == CEditableText::EParagraphDelimiter);
   496 		CHECK1(TheOutputTestBuf[5] == CEditableText::EParagraphDelimiter);
   464 		}
   497 		}
   465 	}
   498 	}
   466 
   499 
   467 /**
   500 /**
   468 @SYMTestCaseID SYSLIB-ETEXT-CT-3346
   501 @SYMTestCaseID SYSLIB-ETEXT-CT-3346
   477 the text formatting.
   510 the text formatting.
   478 @SYMDEF INC097216: When font size is set as small, bottom of a text is clipped on wk38 (MOAP)
   511 @SYMDEF INC097216: When font size is set as small, bottom of a text is clipped on wk38 (MOAP)
   479 */
   512 */
   480 LOCAL_C void INC097216L()
   513 LOCAL_C void INC097216L()
   481 	{
   514 	{
   482 	theTest.Next(_L(" @SYMTestCaseID:SYSLIB-ETEXT-CT-3346 INC097216L - Test EOD character is formatted with rest of text "));
   515 	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-CT-3346 INC097216L - Test EOD character is formatted with rest of text "));
   483 	
   516 	
   484 	__UHEAP_MARK;
   517 	__UHEAP_MARK;
   485 
   518 
   486     CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
   519     CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
   487     CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
   520     CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
   502 	TInt characterFontHeight = charFormat.iFontSpec.iHeight; 
   535 	TInt characterFontHeight = charFormat.iFontSpec.iHeight; 
   503 	
   536 	
   504 	richText->GetCharFormat(charFormat, formatMask, textLength, 1); // get format info for EOD character
   537 	richText->GetCharFormat(charFormat, formatMask, textLength, 1); // get format info for EOD character
   505 	TInt EodFontHeight = charFormat.iFontSpec.iHeight;	
   538 	TInt EodFontHeight = charFormat.iFontSpec.iHeight;	
   506 	
   539 	
   507 	TEST(characterFontHeight == EodFontHeight);
   540 	CHECK1(characterFontHeight == EodFontHeight);
   508 	
   541 	
   509 	delete paraLayer; paraLayer = NULL;
   542 	delete paraLayer; paraLayer = NULL;
   510 	delete charLayer; charLayer = NULL;
   543 	delete charLayer; charLayer = NULL;
   511 	delete richText; richText = NULL;	
   544 	delete richText; richText = NULL;	
   512 	
   545 	
   524  				and the rest of the string should remain unchanged 
   557  				and the rest of the string should remain unchanged 
   525 @SYMDEF INC101996
   558 @SYMDEF INC101996
   526 */
   559 */
   527 LOCAL_C void INC101996L()
   560 LOCAL_C void INC101996L()
   528 	{
   561 	{
   529 	theTest.Next(_L("@SYMTestCaseID:SYSLIB-ETEXT-CT-3386 INC101996 CEikRichTextEditor control don't support anti-aliasing font"));
   562 	INFO_PRINTF1(_L("@SYMTestCaseID:SYSLIB-ETEXT-CT-3386 INC101996 CEikRichTextEditor control don't support anti-aliasing font"));
   530 
   563 
   531 	__UHEAP_MARK;
   564 	__UHEAP_MARK;
   532 
   565 
   533     CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
   566     CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
   534     CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
   567     CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
   563 	richText->GetChars(defaultString, defaultCharFormat,0);
   596 	richText->GetChars(defaultString, defaultCharFormat,0);
   564 	
   597 	
   565 	TGlyphBitmapType startBitmapType = defaultCharFormat.iFontSpec.iFontStyle.BitmapType(); 
   598 	TGlyphBitmapType startBitmapType = defaultCharFormat.iFontSpec.iFontStyle.BitmapType(); 
   566 	
   599 	
   567 	//Verify the formatting and the contents of the string
   600 	//Verify the formatting and the contents of the string
   568 	TEST2(startBitmapType, EDefaultGlyphBitmap);
   601 	CHECK2(startBitmapType, EDefaultGlyphBitmap);
   569 	TEST(defaultString == KDefaulFormattedText);
   602 	CHECK1(defaultString == KDefaulFormattedText);
   570 		
   603 		
   571 	//Get the string portion with antialiased formatting
   604 	//Get the string portion with antialiased formatting
   572 	TPtrC antialiasedString;
   605 	TPtrC antialiasedString;
   573 	richText->GetChars(antialiasedString, antiAliasedCharFormat,halfLength);		
   606 	richText->GetChars(antialiasedString, antiAliasedCharFormat,halfLength);		
   574 
   607 
   575 	TGlyphBitmapType endBitmapType = antiAliasedCharFormat.iFontSpec.iFontStyle.BitmapType(); 	
   608 	TGlyphBitmapType endBitmapType = antiAliasedCharFormat.iFontSpec.iFontStyle.BitmapType(); 	
   576 	
   609 	
   577 	//Verify the formatting and the contents of the string
   610 	//Verify the formatting and the contents of the string
   578 	TEST2(endBitmapType,EAntiAliasedGlyphBitmap);
   611 	CHECK2(endBitmapType,EAntiAliasedGlyphBitmap);
   579 	TEST(antialiasedString == KAntiAliasedText);
   612 	CHECK1(antialiasedString == KAntiAliasedText);
   580 	
   613 	
   581 	delete paraLayer; paraLayer = NULL;
   614 	delete paraLayer; paraLayer = NULL;
   582 	delete charLayer; charLayer = NULL;
   615 	delete charLayer; charLayer = NULL;
   583 	delete richText; richText = NULL;	
   616 	delete richText; richText = NULL;	
   584 	
   617 	
   601 	INC097216L();
   634 	INC097216L();
   602 	INC101996L();
   635 	INC101996L();
   603 	
   636 	
   604 	__UHEAP_MARKEND;	
   637 	__UHEAP_MARKEND;	
   605    	}
   638    	}
       
   639 
       
   640 CTEtextDefect::CTEtextDefect()
       
   641     {
       
   642     SetTestStepName(KTestStep_TEtextDefect);
       
   643     pTestStep = this;
       
   644     }
       
   645 
       
   646 TVerdict CTEtextDefect::doTestStepL()
       
   647     {
       
   648     SetTestStepResult(EFail);
       
   649 
       
   650     CTrapCleanup* trapCleanup=CTrapCleanup::New();
   606    
   651    
   607 /***
   652     INFO_PRINTF1(KTestName);
   608 Main
   653     TRAPD(error, DoTestsL());
   609 */
   654 
   610 GLDEF_C TInt E32Main()
   655     delete trapCleanup;
   611 	{
   656 
   612    	CTrapCleanup* trapCleanup=CTrapCleanup::New();
   657     if (error == KErrNone)
   613    
   658         {
   614    	theTest.Start(KTestName);
   659         SetTestStepResult(EPass);
   615 	TRAPD(error, DoTestsL());
   660         }
   616 	TEST2(error, KErrNone);
   661 
   617  	
   662     return TestStepResult();
   618 	delete trapCleanup;
   663     }
   619  	
       
   620 	theTest.End();
       
   621 	theTest.Close();
       
   622 
       
   623    	return KErrNone;
       
   624    	}
       
   625    	
       
   626    	
       
   627    	
       
   628 
       
   629 
       
   630