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