graphicsdeviceinterface/directgdi/test/tdrawtext.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 #include "tdrawtext.h"
       
    17 #include <graphics/directgdiengine.h>
       
    18 #include <graphics/directgdicontext.h>
       
    19 
       
    20 
       
    21 LOCAL_C void CleanCache(TAny* aPtr)
       
    22 	{
       
    23 	MFontGlyphImageStorage* glyphImageStorage = reinterpret_cast<MFontGlyphImageStorage*> (aPtr);
       
    24 	glyphImageStorage->CleanGlyphImageCache();
       
    25 	}
       
    26 
       
    27 /**
       
    28 Default text drawing target size
       
    29 */
       
    30 const TSize KDrawTextDefaultSize(640, 400);
       
    31 
       
    32 /**
       
    33 Test text
       
    34 */
       
    35 _LIT16(KPangram, "The quick brown fox jumps over the lazy dog");
       
    36 _LIT16(KAbcd,"Abcd");
       
    37 
       
    38 
       
    39 CTDrawText::CTDrawText()
       
    40 	{
       
    41 	SetTestStepName(KTDirectGdiDrawTextStep);
       
    42 	}
       
    43 
       
    44 CTDrawText::~CTDrawText()
       
    45 	{
       
    46 	if(iFont)
       
    47 		{
       
    48 		ReleaseFont(iFont);		
       
    49 		}
       
    50 	}
       
    51 
       
    52 
       
    53 /** 
       
    54 Override of base class pure virtual
       
    55 Our implementation only gets called if the base class doTestStepPreambleL() did
       
    56 not leave. That being the case, the current test result value will be EPass.
       
    57 @leave Gets system wide error code
       
    58 @return TVerdict code
       
    59 */	
       
    60 TVerdict CTDrawText::doTestStepL()
       
    61 	{
       
    62 	// Test for each target pixel format
       
    63 	for(TInt targetPixelFormatIndex = iTargetPixelFormatArray.Count() - 1; targetPixelFormatIndex >= 0 ; targetPixelFormatIndex--)
       
    64 		{
       
    65 		iTestParams.iTargetPixelFormat = iTargetPixelFormatArray[targetPixelFormatIndex];
       
    66 			
       
    67 		SetTargetL(iTestParams.iTargetPixelFormat, EOneContextOneTarget, KDrawTextDefaultSize);
       
    68 
       
    69 		iFont = GetFont();
       
    70 		User::LeaveIfNull(iFont);
       
    71 			
       
    72 		RunTestsL();
       
    73 		// only run OOM tests for one target pixel format to prevent duplication of tests
       
    74 		if (targetPixelFormatIndex == 0)
       
    75 			{
       
    76 			RunOomTestsL();  //from base class
       
    77 			}
       
    78 
       
    79 		if(iFont)
       
    80 			{
       
    81 			ReleaseFont(iFont);
       
    82 			iFont = NULL;
       
    83 			}
       
    84 		}
       
    85 	CloseTMSGraphicsStep();
       
    86 	return TestStepResult();
       
    87 	}
       
    88 
       
    89 /**
       
    90 Override of base class virtual
       
    91 @leave Gets system wide error code
       
    92 @return - TVerdict code
       
    93 */
       
    94 TVerdict CTDrawText::doTestStepPreambleL()
       
    95 	{			
       
    96 	CTDirectGdiStepBase::doTestStepPreambleL();	
       
    97 	return TestStepResult();
       
    98 	}
       
    99 
       
   100 /**
       
   101 @SYMTestCaseID  	
       
   102 	GRAPHICS-DIRECTGDI-TEXT-0001
       
   103 	
       
   104 @SYMPREQ 			
       
   105 	PREQ39
       
   106 
       
   107 @SYMREQ
       
   108 	REQ9195
       
   109 	REQ9201 
       
   110 	REQ9202 
       
   111 	REQ9222 
       
   112 	REQ9223 
       
   113 	REQ9236 
       
   114 	REQ9237
       
   115 	
       
   116 @SYMTestCaseDesc	
       
   117 	Basic test for text drawing with basic and valid parameters.
       
   118 	
       
   119 @SYMTestPriority	
       
   120 	Critical
       
   121 	
       
   122 @SYMTestStatus 		
       
   123 	Implemented
       
   124 	  
       
   125 @SYMTestActions 	
       
   126 	Test the DrawText() and DrawTextVertical() functions for text drawing using either BitGDI or DirectGDI gc.
       
   127 	  
       
   128 @SYMTestExpectedResults 
       
   129 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   130 	
       
   131 */
       
   132 void CTDrawText::TestBasicFunctionality()
       
   133 	{
       
   134 	_LIT(KTestName, "Text-Basic"); 
       
   135 	if(!iRunningOomTests)
       
   136 		{
       
   137 		INFO_PRINTF1(KTestName);
       
   138 		}
       
   139 	
       
   140 	ResetGc();
       
   141 	
       
   142 	iGc->SetFont(iFont);
       
   143 	TEST(iGc->HasFont());
       
   144 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   145 	
       
   146 	//1.down
       
   147 	
       
   148 	iGc->DrawTextVertical(KPangram,NULL,TPoint(10,10),EFalse);
       
   149 	
       
   150 	iGc->DrawTextVertical(KAbcd, NULL, EFalse);
       
   151 	
       
   152 	TRect rect(30,10,50,400);
       
   153 	TInt baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
   154 	iGc->DrawTextVertical(KPangram,NULL,rect,baseline,EFalse);
       
   155 	
       
   156 	rect.SetRect(50,10,80,400);
       
   157 	baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
   158 	iGc->DrawTextVertical(KPangram,NULL,rect,baseline,10,EFalse);
       
   159 	
       
   160 	rect.SetRect(50,100,80,400);
       
   161 	iGc->DrawTextVertical(KAbcd,NULL,rect,EFalse);
       
   162 	
       
   163 	//2.up
       
   164 	
       
   165 	iGc->DrawTextVertical(KPangram,NULL,TPoint(105,390),ETrue);
       
   166 	
       
   167 	iGc->DrawTextVertical(KAbcd,NULL,ETrue);
       
   168 	
       
   169 	rect.SetRect(110,10,140,390);
       
   170 	baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
   171 	iGc->DrawTextVertical(KPangram,NULL,rect,baseline,ETrue);
       
   172 	
       
   173 	rect.SetRect(140,10,160,390);
       
   174 	baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
   175 	iGc->DrawTextVertical(KPangram,NULL,rect,baseline,10,ETrue);
       
   176 	
       
   177 	rect.SetRect(140,10,160,200);
       
   178 	iGc->DrawTextVertical(KAbcd,NULL,rect,ETrue);
       
   179 	
       
   180 	//horizontal
       
   181 	iGc->DrawText(KPangram,NULL,TPoint(170, 25));
       
   182 	
       
   183 	iGc->DrawText(KAbcd,NULL);
       
   184 	
       
   185 	rect.SetRect(170,30,640,50);
       
   186 	baseline = rect.Height() / 2 + iFont->AscentInPixels() / 2;
       
   187 	iGc->DrawText(KPangram,NULL,rect,baseline);
       
   188 		
       
   189 	rect.SetRect(170,30,640,50);
       
   190 	iGc->DrawText(KAbcd,NULL,rect);
       
   191 	
       
   192 	
       
   193 	iGc->ResetFont();
       
   194 
       
   195 	TESTNOERROR(iGc->GetError());
       
   196 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   197 	}
       
   198 
       
   199 /**
       
   200 @SYMTestCaseID  	
       
   201 	GRAPHICS-DIRECTGDI-TEXT-0002
       
   202 	
       
   203 @SYMPREQ 			
       
   204 	PREQ39
       
   205 
       
   206 @SYMREQ
       
   207 	REQ9195
       
   208 	REQ9201 
       
   209 	REQ9202 
       
   210 	REQ9222 
       
   211 	REQ9223 
       
   212 	REQ9236 
       
   213 	REQ9237
       
   214 	
       
   215 @SYMTestCaseDesc	
       
   216 	Test for text positioning and clipping in a rendering target. 
       
   217 	Only horizontal drawing direction is taken into consideration.
       
   218 	
       
   219 @SYMTestPriority	
       
   220 	Critical
       
   221 	
       
   222 @SYMTestStatus 		
       
   223 	Implemented  
       
   224 	
       
   225 @SYMTestActions 	
       
   226 	 Loop over all versions od DrawText() method.
       
   227 	 Using each one draw a text "text" on screen at various positions.
       
   228 	 Increment position from (-50,-50) up to target width+50 and target heigh+50
       
   229 	 to test boundary cases as well. 
       
   230 	 
       
   231 @SYMTestExpectedResults 
       
   232 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   233 */
       
   234 void CTDrawText::TestTextPositioning()
       
   235 	{
       
   236 	_LIT(KTestName, "Text-Positioning"); 
       
   237 	if(!iRunningOomTests)
       
   238 		{
       
   239 		INFO_PRINTF1(KTestName);
       
   240 		}
       
   241 	
       
   242 	_LIT(KText, "test");
       
   243 	for(TInt funcNum=0; funcNum<4; funcNum++)
       
   244 		{
       
   245 		
       
   246 		ResetGc();
       
   247 		
       
   248 		iGc->SetFont(iFont);
       
   249 		TEST(iGc->HasFont());
       
   250 		iGc->SetPenColor(TRgb(0, 0, 0));
       
   251 		
       
   252 		TPositionIterator posIterator(-50, KDrawTextDefaultSize.iWidth+50, 30, -50, KDrawTextDefaultSize.iHeight+50, 13);
       
   253 		posIterator.Begin();
       
   254 		
       
   255 		do
       
   256 			{
       
   257 			switch(funcNum)
       
   258 				{
       
   259 				case 0:
       
   260 					{
       
   261 					// void DrawText(const TDesC& aText);
       
   262 					iGc->Reset();
       
   263 					iGc->SetFont(iFont);
       
   264 					TEST(iGc->HasFont());
       
   265 					iGc->SetPenColor(TRgb(0, 0, 0));
       
   266 					iGc->SetOrigin(TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX));
       
   267 					iGc->DrawText(KText,NULL);
       
   268 					break;
       
   269 					}
       
   270 
       
   271 				case 1:
       
   272 					{
       
   273 					// void DrawText(const TDesC& aText, const TPoint& aPosition)
       
   274 					iGc->DrawText(KText,NULL,TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX));
       
   275 					break;
       
   276 					}
       
   277 
       
   278 				case 2:
       
   279 					{
       
   280 					// void DrawText(const TDesC& aText, const TRect& aBox)
       
   281 					iGc->Reset();
       
   282 					iGc->SetFont(iFont);
       
   283 					TEST(iGc->HasFont());
       
   284 					iGc->SetPenColor(TRgb(0, 0, 0));
       
   285 					TPoint pos(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX);
       
   286 					iGc->SetOrigin(pos);
       
   287 					TRect box(-pos, KDrawTextDefaultSize);
       
   288 					iGc->DrawText(KText,NULL,box);
       
   289 					break;
       
   290 					}
       
   291 					
       
   292 				case 3:
       
   293 					{
       
   294 					// void DrawText(const TDesC& aText, const TRect& aBox, TInt aBaselineOffset, 
       
   295 					//		DirectGdi::TTextAlign aAlignment = DirectGdi::ELeft, TInt aMargin = 0)
       
   296 					TRect rect(TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX), TSize(32, 13) );
       
   297 					iGc->DrawText(KText, NULL, rect, 13, DirectGdi::ELeft, 1);
       
   298 					break;
       
   299 					}
       
   300 				}
       
   301 			}
       
   302 		while(posIterator.Next());
       
   303 		
       
   304 		TESTNOERROR(iGc->GetError());
       
   305 		TBuf<40> tname;
       
   306 		tname.Format(_L("%S%d"), &KTestName, funcNum);
       
   307 		TEST(KErrNone == WriteTargetOutput(iTestParams, tname));
       
   308 		
       
   309 		iGc->ResetFont();
       
   310 		}
       
   311 	}
       
   312 
       
   313 
       
   314 /**
       
   315 @SYMTestCaseID  	
       
   316 	GRAPHICS-DIRECTGDI-TEXT-0003
       
   317 	
       
   318 @SYMPREQ 			
       
   319 	PREQ39
       
   320 
       
   321 @SYMREQ
       
   322 	REQ9195
       
   323 	REQ9201 
       
   324 	REQ9202 
       
   325 	REQ9222 
       
   326 	REQ9223 
       
   327 	REQ9236 
       
   328 	REQ9237
       
   329 	
       
   330 @SYMTestCaseDesc	
       
   331 	Test for clipping text based on the box parameter.
       
   332 	
       
   333 @SYMTestPriority	
       
   334 	Critical
       
   335 	
       
   336 @SYMTestStatus 		
       
   337 	Implemented  
       
   338 	
       
   339 @SYMTestActions
       
   340 	Set the origin to a non-zero position. 
       
   341 	Draw a text "text" on screen at various positions using
       
   342 	incremented box size.
       
   343 	
       
   344 @SYMTestExpectedResults 
       
   345 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   346 */
       
   347 void CTDrawText::TestTextBox()
       
   348 	{	
       
   349 	_LIT(KTestName, "Text-BoxClipping"); 
       
   350 	if(!iRunningOomTests)
       
   351 		{
       
   352 		INFO_PRINTF1(KTestName);
       
   353 		}
       
   354 	
       
   355 	ResetGc();
       
   356 
       
   357 	iGc->SetOrigin(TPoint(2, -2));
       
   358 	iGc->SetFont(iFont);
       
   359 	TEST(iGc->HasFont());
       
   360 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   361 	iGc->SetBrushStyle(DirectGdi::ESolidBrush);
       
   362 	iGc->SetBrushColor(TRgb(150, 150, 150));
       
   363 
       
   364 	_LIT(KText, "test");
       
   365 
       
   366 	TInt baseline = 2 + iFont->FontMaxAscent()/2;
       
   367 	TPositionIterator posIterator(0, KDrawTextDefaultSize.iWidth, 50, 0, KDrawTextDefaultSize.iHeight, 13);
       
   368 	posIterator.Begin();
       
   369 	
       
   370 	do
       
   371 		{
       
   372 		TRect rect(TPoint(posIterator.iPosX, posIterator.iPosY), TSize(posIterator.iIndexY, posIterator.iIndexX));
       
   373 		if(!rect.IsEmpty())
       
   374 			{
       
   375 			iGc->DrawText(KText, NULL, rect, baseline);
       
   376 			}
       
   377 		}
       
   378 	while(posIterator.Next());
       
   379 	
       
   380 	iGc->ResetFont();
       
   381 
       
   382 	TESTNOERROR(iGc->GetError());
       
   383 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   384 	}
       
   385 
       
   386 
       
   387 /**
       
   388 @SYMTestCaseID  	
       
   389 	GRAPHICS-DIRECTGDI-TEXT-0004
       
   390 	
       
   391 @SYMPREQ 			
       
   392 	PREQ39
       
   393 
       
   394 @SYMREQ
       
   395 	REQ9195
       
   396 	REQ9201 
       
   397 	REQ9202 
       
   398 	REQ9222 
       
   399 	REQ9223 
       
   400 	REQ9236 
       
   401 	REQ9237
       
   402 	
       
   403 @SYMTestCaseDesc	
       
   404 	Test for positioning vertical text in a rendering target.
       
   405 	Only vertical drawing direction is taken into consideration.
       
   406 	
       
   407 @SYMTestPriority	
       
   408 	Critical
       
   409 	
       
   410 @SYMTestStatus 		
       
   411 	Implemented  
       
   412 	
       
   413 @SYMTestActions
       
   414  	Loop over all versions od DrawTextVertical() method.
       
   415 	Using each one draw a text "text" on screen at various positions.
       
   416 	Increment position from (-50,-70) up to target width+50 and target heigh+70
       
   417 	to test boundary cases as well. 
       
   418 	
       
   419 @SYMTestExpectedResults 
       
   420 	Test should perform graphics operations successfully.
       
   421 */
       
   422 void CTDrawText::TestTextPositioningVertical(TBool aUp)
       
   423 	{	
       
   424 	_LIT(KTestName, "Text-PositioningVertical"); 
       
   425 	if(!iRunningOomTests)
       
   426 		{
       
   427 		INFO_PRINTF1(KTestName);
       
   428 		}
       
   429 	
       
   430 	_LIT(KText, "test");
       
   431 
       
   432 	for(TInt funcNum = 0; funcNum<5; funcNum++)
       
   433 		{
       
   434 		
       
   435 		ResetGc();
       
   436 
       
   437 		iGc->SetFont(iFont);
       
   438 		TEST(iGc->HasFont());
       
   439 		iGc->SetPenColor(TRgb(0, 0, 0));
       
   440 		
       
   441 		TPositionIterator posIterator(-50, KDrawTextDefaultSize.iWidth+50, 10, -70, KDrawTextDefaultSize.iHeight+70, 30);
       
   442 		posIterator.Begin();
       
   443 		
       
   444 		do
       
   445 			{
       
   446 			switch(funcNum)
       
   447 				{
       
   448 				case 0:
       
   449 					{
       
   450 					// void DrawTextVertical(const TDesC& aText, TBool aUp)
       
   451 					iGc->Reset();
       
   452 					iGc->SetFont(iFont);
       
   453 					TEST(iGc->HasFont());
       
   454 					iGc->SetPenColor(TRgb(0, 0, 0));
       
   455 					iGc->SetOrigin(TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX));
       
   456 					iGc->DrawTextVertical(KText, NULL, aUp);
       
   457 					break;
       
   458 					}
       
   459 
       
   460 				case 1:
       
   461 					{
       
   462 					// void DrawTextVertical(const TDesC& aText, const TPoint& aPosition, TBool aUp)
       
   463 					iGc->DrawTextVertical(KText, NULL, TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX), aUp);
       
   464 					break;
       
   465 					}
       
   466 
       
   467 				case 2:
       
   468 					{
       
   469 					// void DrawTextVertical(const TDesC& aText, const TRect& aBox, TBool aUp)
       
   470 					iGc->Reset();
       
   471 					iGc->SetFont(iFont);
       
   472 					TEST(iGc->HasFont());
       
   473 					iGc->SetPenColor(TRgb(0, 0, 0));
       
   474 					TPoint pos(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX);
       
   475 					iGc->SetOrigin(pos);
       
   476 					TRect box(-pos, KDrawTextDefaultSize);
       
   477 					iGc->DrawTextVertical(KText, NULL, box, aUp);
       
   478 					break;
       
   479 					}
       
   480 					
       
   481 				case 3:
       
   482 					{
       
   483 					// void DrawTextVertical(const TDesC& aText, const TRect& aBox, TInt aBaselineOffset, 
       
   484 					//		TBool aUp, DirectGdi::TTextAlign aVerticalAlignment = DirectGdi::ELeft, TInt aMargin = 0)
       
   485 					TRect rect(TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX),TSize(13, 32));
       
   486 					iGc->DrawTextVertical(KText, NULL, rect, 12, aUp,DirectGdi::ELeft, 0);
       
   487 					break;
       
   488 					}
       
   489 					
       
   490 				case 4:
       
   491 					{
       
   492 					// void DrawTextVertical(const TDesC& aText, const TRect& aBox, TInt aBaselineOffset, 
       
   493 					//		TInt aTextWidth, TBool aUp, DirectGdi::TTextAlign aVerticalAlignment = DirectGdi::ELeft, TInt aMargin = 0)
       
   494 					TRect rect(TPoint(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX),TSize(13, 32));
       
   495 					iGc->DrawTextVertical(KText, NULL, rect, 12, 4, aUp, DirectGdi::ELeft, 0);
       
   496 					break;
       
   497 					}
       
   498 				}
       
   499 			}
       
   500 		while(posIterator.Next());
       
   501 		
       
   502 		TESTNOERROR(iGc->GetError());
       
   503 	
       
   504 		_LIT(KUp, "up");
       
   505 		_LIT(KDown, "down");
       
   506 	
       
   507 		TBuf<40> tname;
       
   508 		tname.Format(_L("%S%d%S"), &KTestName, funcNum, aUp ? &KUp : &KDown);
       
   509 		TESTNOERROR(WriteTargetOutput(iTestParams, tname));
       
   510 		
       
   511 		iGc->ResetFont();
       
   512 		}
       
   513 	}
       
   514 
       
   515 
       
   516 /**
       
   517 @SYMTestCaseID  	
       
   518 	GRAPHICS-DIRECTGDI-TEXT-0005
       
   519 	
       
   520 @SYMPREQ 			
       
   521 	PREQ39
       
   522 
       
   523 @SYMREQ
       
   524 	REQ9195
       
   525 	REQ9201 
       
   526 	REQ9202 
       
   527 	REQ9222 
       
   528 	REQ9223 
       
   529 	REQ9236 
       
   530 	REQ9237
       
   531 	
       
   532 @SYMTestCaseDesc	
       
   533 	Test for clipping text based on the clipping rectangle parameter.
       
   534 	
       
   535 @SYMTestPriority	
       
   536 	Critical
       
   537 	
       
   538 @SYMTestStatus 		
       
   539 	Implemented  
       
   540 	
       
   541 @SYMTestActions
       
   542     Set the origin to a non-zero position.
       
   543  	Draw a text "text" on screen at various positions using
       
   544 	incremented box size.
       
   545 	
       
   546 @SYMTestExpectedResults 
       
   547 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   548 */
       
   549 void CTDrawText::TestTextBoxVertical()
       
   550 	{	
       
   551 	_LIT(KTestName, "Text-BoxClippingVertical"); 
       
   552 	if(!iRunningOomTests)
       
   553 		{
       
   554 		INFO_PRINTF1(KTestName);
       
   555 		}
       
   556 	
       
   557 	ResetGc();
       
   558 
       
   559 	iGc->SetFont(iFont);
       
   560 	TEST(iGc->HasFont());
       
   561 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   562 	iGc->SetBrushStyle(DirectGdi::ESolidBrush);
       
   563 	iGc->SetBrushColor(TRgb(150, 150, 150));
       
   564 	iGc->SetOrigin(TPoint(2, -2));
       
   565 
       
   566 	_LIT(KText, "test");
       
   567 
       
   568 	TInt baseline = 2 + iFont->FontMaxAscent()/2;
       
   569 	
       
   570 	TPositionIterator posIterator(0, KDrawTextDefaultSize.iWidth, 14, 0, KDrawTextDefaultSize.iHeight, 40);
       
   571 	posIterator.Begin();
       
   572 	
       
   573 	do
       
   574 		{
       
   575 		TRect rect(TPoint(posIterator.iPosX, posIterator.iPosY), TSize(posIterator.iIndexY, posIterator.iIndexX));
       
   576 		if(!rect.IsEmpty())
       
   577 			{
       
   578 			iGc->DrawTextVertical(KText, NULL, rect, baseline, EFalse);
       
   579 			}
       
   580 		}
       
   581 	while(posIterator.Next());
       
   582 	
       
   583 	iGc->ResetFont();
       
   584 
       
   585 	TESTNOERROR(iGc->GetError());
       
   586 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   587 	}
       
   588 
       
   589 
       
   590 /**
       
   591 @SYMTestCaseID  	
       
   592 	GRAPHICS-DIRECTGDI-TEXT-0006
       
   593 	
       
   594 @SYMPREQ 			
       
   595 	PREQ39
       
   596 
       
   597 @SYMREQ
       
   598 	REQ9195
       
   599 	REQ9201 
       
   600 	REQ9202 
       
   601 	REQ9222 
       
   602 	REQ9223 
       
   603 	REQ9236 
       
   604 	REQ9237
       
   605 	
       
   606 @SYMTestCaseDesc	
       
   607 	Testing usage of pen colour, brush colour, style and pattern.
       
   608 	
       
   609 @SYMTestPriority	
       
   610 	Critical
       
   611 	
       
   612 @SYMTestStatus 		
       
   613 	Implemented 
       
   614 	
       
   615 @SYMTestActions 	
       
   616 	Test pen and brush parameters with text drawing methods.
       
   617 	Use color and brush style tables to generate various combinations
       
   618 	of pen color, brush color and brush style. Text drawing on screen
       
   619 	describes current color and style settings.  
       
   620 	*NOTE extended for DEF133363-Zero length text causes no brush pattern to be drawn
       
   621 	
       
   622 @SYMTestExpectedResults 
       
   623 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   624 */
       
   625 void CTDrawText::TestPenBrushL()
       
   626 	{
       
   627 	_LIT(KTestName, "Text-PenBrush"); 
       
   628 	if(!iRunningOomTests)
       
   629 		{
       
   630 		INFO_PRINTF1(KTestName);
       
   631 		}
       
   632 
       
   633 	_LIT(KTxtPenBrushStyle,"PenColor-BrushColor-BrushStyle");
       
   634 	_LIT(KTxtDash,"-");
       
   635 	
       
   636 	CFbsBitmap* bitmap = CreateCheckedBoardBitmapL(iTestParams.iTargetPixelFormat, (TSize(100, 100)));
       
   637 	TESTL(bitmap != NULL);
       
   638 	CleanupStack::PushL(bitmap);
       
   639 
       
   640 	ResetGc();
       
   641 	
       
   642 	iGc->SetBrushPattern(*bitmap);
       
   643 	
       
   644 	iGc->SetFont(iFont);
       
   645 	TEST(iGc->HasFont());
       
   646 
       
   647 	TPoint point(22,10);
       
   648 	TRect rect;
       
   649 	TInt ii,baseline;
       
   650 	
       
   651 	//vertical
       
   652 	for(ii = 0; ii<16; ii++)
       
   653 		{
       
   654 		iGc->SetPenColor(KColor16Table[ii%16]);
       
   655 		point.iX =26 + ii*17;
       
   656 		iGc->DrawTextVertical(KColor16TableNames[ii%16],NULL,point,EFalse);
       
   657 		}
       
   658 
       
   659 	point.SetXY(3,110);
       
   660 	iGc->SetPenColor(KRgbBlack);
       
   661 	iGc->DrawTextVertical(KTxtPenBrushStyle,NULL,point,EFalse);
       
   662 	point.SetXY(20,110);
       
   663 	for(ii = 0; ii<16; ii++)
       
   664 		{
       
   665 		point.iX =20+ii*17;
       
   666 		TBuf<200> txtbuf;
       
   667 		iGc->SetPenColor(KColor16Table[ii%16]);
       
   668 		txtbuf.Append(KColor16TableNames[ii%16]);
       
   669 		txtbuf.Append(KTxtDash);
       
   670 		
       
   671 		iGc->SetBrushColor(KColor16Table[(5*ii+1)%16]);
       
   672 		txtbuf.Append(KColor16TableNames[(5*ii+1)%16]);
       
   673 		txtbuf.Append(KTxtDash);
       
   674 		
       
   675 		iGc->SetBrushStyle(KBrushStyleTable[(2*ii+1)%9]);
       
   676 		txtbuf.Append(KBrushStyleTableNames[(2*ii+1)%9]);
       
   677 		
       
   678 		if (ii == 6 || ii == 7 || ii == 8)
       
   679 			{	//for DEF133363
       
   680 			txtbuf.SetLength(0);
       
   681 			}
       
   682 		
       
   683 		rect.SetRect(point.iX,point.iY,point.iX+17,point.iY+290);
       
   684 		baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
   685 		iGc->DrawTextVertical(txtbuf,NULL,rect,baseline,EFalse);
       
   686 		}
       
   687 
       
   688 	//horizontal
       
   689 	point.SetXY(300,17);
       
   690 	iGc->SetPenColor(KRgbBlack);
       
   691 	iGc->DrawText(KTxtPenBrushStyle,NULL,point);
       
   692 	for(ii=0; ii<16; ii++)
       
   693 		{
       
   694 		point.iY = 20+ii*17;
       
   695 		TBuf<200> txtbuf;
       
   696 		iGc->SetPenColor(KColor16Table[ii%16]);
       
   697 		txtbuf.Append(KColor16TableNames[ii%16]);
       
   698 		txtbuf.Append(KTxtDash);
       
   699 
       
   700 		iGc->SetBrushColor(KColor16Table[(3*ii+5)%16]);
       
   701 		txtbuf.Append(KColor16TableNames[(3*ii+5)%16]);
       
   702 		txtbuf.Append(KTxtDash);
       
   703 
       
   704 		iGc->SetBrushStyle(KBrushStyleTable[(5*ii+3)%9]);
       
   705 		txtbuf.Append(KBrushStyleTableNames[(5*ii+3)%9]);
       
   706 		
       
   707 		if (ii == 9 || ii == 10 || ii == 11)
       
   708 			{	//for DEF133363
       
   709 			txtbuf.SetLength(0);
       
   710 			}
       
   711 
       
   712 		rect.SetRect(point.iX,point.iY,point.iX+290,point.iY+17);
       
   713 		baseline = rect.Height() / 2 + iFont->AscentInPixels() / 2;
       
   714 		iGc->DrawText(txtbuf,NULL,rect,baseline);	
       
   715 		}
       
   716 
       
   717 	for(ii=0; ii<16; ii++)
       
   718 		{
       
   719 		point.iX = 300 + (ii%4)*80;
       
   720 		point.iY = 310 + (ii/4)*17;
       
   721 		iGc->SetPenColor(KColor16Table[ii%16]);
       
   722 		iGc->DrawText(KColor16TableNames[ii%16],NULL,point);
       
   723 		}
       
   724 
       
   725 
       
   726 	iGc->ResetFont();
       
   727 
       
   728 	CleanupStack::PopAndDestroy(bitmap);
       
   729 
       
   730 	TESTNOERROR(iGc->GetError());
       
   731 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   732 	}
       
   733 
       
   734 /**
       
   735 @SYMTestCaseID  	
       
   736 	GRAPHICS-DIRECTGDI-TEXT-0007
       
   737 	
       
   738 @SYMPREQ 			
       
   739 	PREQ39
       
   740 
       
   741 @SYMREQ
       
   742 	REQ9195
       
   743 	REQ9201 
       
   744 	REQ9202 
       
   745 	REQ9222 
       
   746 	REQ9223 
       
   747 	REQ9236 
       
   748 	REQ9237
       
   749 	
       
   750 @SYMTestCaseDesc	
       
   751 	Test for alignment of text inside drawing box.
       
   752 	
       
   753 @SYMTestPriority	
       
   754 	Critical
       
   755 	
       
   756 @SYMTestStatus 		
       
   757 	Implemented 
       
   758 	
       
   759 @SYMTestActions 	
       
   760 	Call functions testing all combinations of parameters values given below:
       
   761 	aAlignment:
       
   762 		DGDI::ELeft,
       
   763 		DGDI::ECenter,
       
   764 		DGDI::ERight
       
   765 	aMargin:
       
   766 		-50,
       
   767 		0,
       
   768 		50
       
   769 	aUp:
       
   770 		ETrue,
       
   771 		EFalse
       
   772 	Use gray background box to show arguments impact. 
       
   773 
       
   774 @SYMTestExpectedResults 
       
   775 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   776 */
       
   777 void CTDrawText::TestAlign()
       
   778 	{
       
   779 	_LIT(KTestName, "Text-Alignment");
       
   780 	if(!iRunningOomTests)
       
   781 		{
       
   782 		INFO_PRINTF1(KTestName);
       
   783 		}
       
   784 
       
   785 	ResetGc();
       
   786 
       
   787 	iGc->SetFont(iFont);
       
   788 	TEST(iGc->HasFont());
       
   789 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   790 	iGc->SetBrushStyle(DirectGdi::ESolidBrush);
       
   791 	iGc->SetBrushColor(KRgbGray);
       
   792 
       
   793 	_LIT(KMargin," Margin = ");
       
   794 	_LIT(KAlign,"Align = ");
       
   795 	TRect rect;
       
   796 	TInt baseline;
       
   797 
       
   798 	//vertical
       
   799 	for(TInt kk=0; kk<2; kk++) //loop over up and down directions
       
   800 		{
       
   801 		for(TInt ii=0; ii<3; ii++) // negative, zero and positive margin value
       
   802 			{
       
   803 			TInt margin = (-ii+1)*50;
       
   804 			for(TInt jj=0; jj<3; jj++) // ELeft, ECenter and ERight alignment values
       
   805 				{
       
   806 				rect.SetRect(kk*185+5+(3*ii+jj)*20 +1, 10, kk*185+25+(3*ii+jj)*20-1, 390);
       
   807 				baseline = rect.Width()/2 + iFont->AscentInPixels()/2 ;
       
   808 				TBuf<128> textbuf;
       
   809 				textbuf.Copy(KAlign);
       
   810 				textbuf.Append(KTextAlignTableNames[jj%3]);
       
   811 				textbuf.Append(KMargin);
       
   812 				textbuf.AppendNum(margin);
       
   813 				iGc->DrawTextVertical(textbuf,NULL,rect,baseline,kk!=0,KTextAlignTable[jj%3],margin);
       
   814 				}
       
   815 			}
       
   816 		}
       
   817 
       
   818 	//horizontal
       
   819 	for(TInt ii=0; ii<3; ii++) // negative, zero and positive margin value
       
   820 		{
       
   821 		TInt margin = (-ii+1)*40;
       
   822 		for(TInt jj=0; jj<3; jj++) // ELeft, ECenter and ERight alignment values
       
   823 			{
       
   824 			rect.SetRect(373, 30+(3*ii+jj)*20+1, 635, 50+(3*ii+jj)*20-1);
       
   825 			baseline = rect.Height()/2 + iFont->AscentInPixels()/2;
       
   826 			TBuf<128> textbuf;
       
   827 			textbuf.Copy(KAlign);
       
   828 			textbuf.Append(KTextAlignTableNames[jj%3]);
       
   829 			textbuf.Append(KMargin);
       
   830 			textbuf.AppendNum(margin);
       
   831 			iGc->DrawText(textbuf,NULL,rect,baseline,KTextAlignTable[jj%3],margin);
       
   832 			}
       
   833 		}
       
   834 
       
   835 	iGc->ResetFont();
       
   836 
       
   837 	TESTNOERROR(iGc->GetError());
       
   838 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   839 	}
       
   840 
       
   841 /**
       
   842 @SYMTestCaseID  	
       
   843 	GRAPHICS-DIRECTGDI-TEXT-0008
       
   844 	
       
   845 @SYMPREQ 			
       
   846 	PREQ39
       
   847 
       
   848 @SYMREQ
       
   849 	REQ9195
       
   850 	REQ9201 
       
   851 	REQ9202 
       
   852 	REQ9222 
       
   853 	REQ9223 
       
   854 	REQ9236 
       
   855 	REQ9237
       
   856 	
       
   857 @SYMTestCaseDesc	
       
   858 	Testing justification of a text.
       
   859 	
       
   860 @SYMTestPriority	
       
   861 	Critical
       
   862 	
       
   863 @SYMTestStatus 		
       
   864 	Initial version 
       
   865 	
       
   866 @SYMTestActions 	
       
   867 	Test the effect of the following functions:
       
   868 	SetCharJustification()
       
   869 	SetWordJustification()
       
   870 	UpdateJustification()
       
   871 	UpdateJustificationVertical()
       
   872 	NoJustifyAutoUpdate() 
       
   873 	
       
   874 @SYMTestExpectedResults 
       
   875 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   876 
       
   877 */
       
   878 void CTDrawText::TestJustification()
       
   879 	{
       
   880 	_LIT(KTestName, "Text-Justification"); 
       
   881 	if(!iRunningOomTests)
       
   882 		{
       
   883 		INFO_PRINTF1(KTestName);
       
   884 		}
       
   885 
       
   886 	ResetGc();
       
   887 
       
   888 	iGc->SetFont(iFont);
       
   889 	TEST(iGc->HasFont());
       
   890 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   891 
       
   892 	//vertical
       
   893 	TInt charExcessWidth = 30;
       
   894 	TInt charNumGaps = 30;
       
   895 	TInt wordExcessWidth = 100;
       
   896 	TInt wordNumChars = 5;
       
   897 
       
   898 	TRect rect;
       
   899 	TInt baseline, kk, jj;
       
   900 	for( kk=0; kk<2; kk++) //loop over up and down directions
       
   901 		{
       
   902 		for( jj=0; jj<4; jj++) 
       
   903 			{
       
   904 			iGc->SetCharJustification(charExcessWidth*(jj%2) , charNumGaps*(jj%2));
       
   905 			iGc->SetWordJustification(wordExcessWidth*(jj>>1), wordNumChars*(jj>>1));
       
   906 			rect.SetRect(10+(5*kk+jj)*20+1, 10, 30+(5*kk+jj)*20-1, 390);
       
   907 			baseline = rect.Width()/2 + iFont->AscentInPixels()/2;
       
   908 			iGc->DrawTextVertical(KPangram,NULL,rect,baseline,kk!=0);
       
   909 			}
       
   910 		}
       
   911 
       
   912 	//horizontal
       
   913 	for( jj=0; jj<4; jj++)
       
   914 		{
       
   915 		iGc->SetCharJustification(charExcessWidth*(jj%2) , charNumGaps*(jj%2));
       
   916 		iGc->SetWordJustification(wordExcessWidth*(jj>>1), wordNumChars*(jj>>1));
       
   917 		rect.SetRect(210, 10+jj*20+1, 640, 30+jj*20-1);
       
   918 		baseline = rect.Height()/2 + iFont->AscentInPixels()/2;
       
   919 		iGc->DrawText(KPangram,NULL,rect,baseline);
       
   920 		}
       
   921 
       
   922 	iGc->ResetFont();
       
   923 
       
   924 	TESTNOERROR(iGc->GetError());
       
   925 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
   926 	}
       
   927 
       
   928 /**
       
   929 @SYMTestCaseID  	
       
   930 	GRAPHICS-DIRECTGDI-TEXT-0009
       
   931 	
       
   932 @SYMPREQ 			
       
   933 	PREQ39
       
   934 
       
   935 @SYMREQ
       
   936 	REQ9195
       
   937 	REQ9201 
       
   938 	REQ9202 
       
   939 	REQ9222 
       
   940 	REQ9223 
       
   941 	REQ9236 
       
   942 	REQ9237
       
   943 	
       
   944 @SYMTestCaseDesc	
       
   945 	Testing usage of shadow colour, underline and strikethrough rendering using either BitGDI or DirectGDI gc.
       
   946 	
       
   947 @SYMTestPriority	
       
   948 	Critical
       
   949 	
       
   950 @SYMTestStatus 		
       
   951 	Implemented 
       
   952 	
       
   953 @SYMTestActions 	
       
   954 	Test the shadow colour, underline and strikethrough parameters for text drawing. 
       
   955 	
       
   956 @SYMTestExpectedResults 
       
   957 	Valid bitmap should be created. This bitmap should be the same as a reference bitmap.
       
   958 */
       
   959 void CTDrawText::TestShadowUnderStrike()
       
   960 	{
       
   961 	_LIT(KTestName, "Text-ShadowUnderlineStrikethrough"); 
       
   962 	if(!iRunningOomTests)
       
   963 		{
       
   964 		INFO_PRINTF1(KTestName);
       
   965 		}
       
   966 	
       
   967 	ResetGc();
       
   968 
       
   969 	iGc->SetFont(iFont);
       
   970 	TEST(iGc->HasFont());
       
   971 	iGc->SetPenColor(TRgb(0, 0, 0));
       
   972 
       
   973 	//look-up tables, simplifies below loops
       
   974 	const DirectGdi::TFontUnderline KFontUnderlineTable[]=
       
   975 		{
       
   976 		DirectGdi::EUnderlineOn,
       
   977 		DirectGdi::EUnderlineOff,
       
   978 		DirectGdi::EUnderlineOn,
       
   979 		DirectGdi::EUnderlineOff,
       
   980 		DirectGdi::EUnderlineOn,
       
   981 		};
       
   982 
       
   983 	const DirectGdi::TFontStrikethrough KFontStrikethroughTable[]=
       
   984 		{
       
   985 		DirectGdi::EStrikethroughOff,
       
   986 		DirectGdi::EStrikethroughOn,
       
   987 		DirectGdi::EStrikethroughOn,
       
   988 		DirectGdi::EStrikethroughOff,
       
   989 		DirectGdi::EStrikethroughOn,
       
   990 		};
       
   991 	
       
   992 	//vertical
       
   993 	TPoint position;
       
   994 	for(TInt ii=0; ii<2; ii++ ) //loop over up and down directions
       
   995 		{
       
   996 		position.SetXY(10+ii*100,10+ii*380);
       
   997 		for(TInt jj=0; jj<5; jj++)
       
   998 			{
       
   999 			iGc->SetUnderlineStyle(KFontUnderlineTable[jj%5]);
       
  1000 			iGc->SetStrikethroughStyle(KFontStrikethroughTable[jj%5]);
       
  1001 			if(jj==3)
       
  1002 				{
       
  1003 				iGc->SetTextShadowColor(TRgb(100,10,10));
       
  1004 				}
       
  1005 			iGc->DrawTextVertical(KPangram,NULL,position,ii!=0);
       
  1006 			position.iX+=20;
       
  1007 			}
       
  1008 		}
       
  1009 
       
  1010 	//horizontal
       
  1011 	position.SetXY(210,30);
       
  1012 	for(TInt jj=0; jj<5; jj++)
       
  1013 		{
       
  1014 		iGc->SetUnderlineStyle(KFontUnderlineTable[jj%5]);
       
  1015 		iGc->SetStrikethroughStyle(KFontStrikethroughTable[jj%5]);
       
  1016 		if(jj==3)
       
  1017 			{
       
  1018 			iGc->SetTextShadowColor(TRgb(100,10,10));
       
  1019 			}
       
  1020 		iGc->DrawText(KPangram,NULL,position);
       
  1021 		position.iY+=20;
       
  1022 		}
       
  1023 
       
  1024 	iGc->ResetFont();
       
  1025 
       
  1026 	TESTNOERROR(iGc->GetError());
       
  1027 	TEST(KErrNone == WriteTargetOutput(iTestParams, TPtrC(KTestName)));
       
  1028 	}
       
  1029 
       
  1030 /**
       
  1031 @SYMTestCaseID  	
       
  1032 	GRAPHICS-DIRECTGDI-TEXT-0010
       
  1033 	
       
  1034 @SYMPREQ 			
       
  1035 	PREQ39
       
  1036 
       
  1037 @SYMREQ
       
  1038 	REQ9195
       
  1039 	REQ9201 
       
  1040 	REQ9202 
       
  1041 	REQ9222 
       
  1042 	REQ9223 
       
  1043 	REQ9236 
       
  1044 	REQ9237
       
  1045 	
       
  1046 @SYMTestCaseDesc	
       
  1047 	Test for propper handling invalid arguments using either BitGDI or DirectGDI gc.
       
  1048 	
       
  1049 @SYMTestPriority	
       
  1050 	Critical
       
  1051 	
       
  1052 @SYMTestStatus 		
       
  1053 	Implemented 
       
  1054 	
       
  1055 @SYMTestActions 	
       
  1056 	Test for propper handling invalid arguments for text drawing using either BitGDI or DirectGDI gc.  
       
  1057 	
       
  1058 @SYMTestExpectedResults 
       
  1059 	Function shall detect invalid parameters and return. Nothing will be drawn on the target surface.
       
  1060 */
       
  1061 void CTDrawText::TestInvalidParamsL()
       
  1062 	{
       
  1063 	_LIT(KTestName, "Text-InvalidParameters"); 
       
  1064 	if(!iRunningOomTests)
       
  1065 		{
       
  1066 		INFO_PRINTF1(KTestName);
       
  1067 		}
       
  1068 	
       
  1069 	ResetGc();
       
  1070 
       
  1071 	iGc->SetFont(iFont);
       
  1072 	TEST(iGc->HasFont());
       
  1073 	iGc->SetPenColor(TRgb(0, 0, 0));
       
  1074 	
       
  1075 	//NullDescriptor - drawing an empty descriptor is not an error, DrawText()
       
  1076 	//and DrawTextVertical() should return silently in this case.
       
  1077 	//horizontal
       
  1078 	iGc->DrawText(KNullDesC, NULL, TPoint(10, 30));
       
  1079 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1080 	iGc->DrawText(KNullDesC, NULL);
       
  1081 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1082 	
       
  1083 	TRect rect(10,50,300,70);
       
  1084 	TInt baseline = rect.Height() / 2 + iFont->AscentInPixels() / 2;
       
  1085 	iGc->DrawText(KNullDesC,NULL,rect,baseline);
       
  1086 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1087 	rect.SetRect(10,70,550,90);
       
  1088 	iGc->DrawText(KNullDesC,NULL,rect);
       
  1089 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1090 
       
  1091 	//vertical
       
  1092 	iGc->DrawTextVertical(KNullDesC,NULL,TPoint(10,10),EFalse);
       
  1093 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1094 	iGc->DrawTextVertical(KNullDesC,NULL,EFalse);
       
  1095 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1096 	rect.SetRect(30,10,50,300);
       
  1097 	baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
  1098 	iGc->DrawTextVertical(KNullDesC,NULL,rect,baseline,EFalse);
       
  1099 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1100 	rect.SetRect(50,10,80,300);
       
  1101 	baseline = rect.Width() / 2 + iFont->AscentInPixels() / 2;
       
  1102 	iGc->DrawTextVertical(KNullDesC,NULL,rect,baseline,10,EFalse);
       
  1103 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1104 	rect.SetRect(50,100,80,400);
       
  1105 	iGc->DrawTextVertical(KNullDesC,NULL,rect,EFalse);
       
  1106 	CheckErrorsL(KErrNone, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1107 
       
  1108 	//invalid box
       
  1109 	for(TInt ii=1; ii<9; ii++)
       
  1110 		{
       
  1111 		rect.SetRect(220+(ii%3)*100, 100+(ii/3)*100, 320, 200);
       
  1112 		baseline = Abs(rect.Height())/2 + iFont->AscentInPixels()/2;
       
  1113 		iGc->DrawText(KPangram,NULL,rect,baseline);
       
  1114 		CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1115 		iGc->DrawText(KPangram,NULL,rect);
       
  1116 		CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1117 
       
  1118 		baseline = Abs(rect.Width())/2 + iFont->AscentInPixels() /2;
       
  1119 		iGc->DrawTextVertical(KPangram,NULL,rect,baseline,EFalse);
       
  1120 		CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1121 
       
  1122 		iGc->DrawTextVertical(KPangram,NULL,rect,EFalse);
       
  1123 		CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1124 
       
  1125 		iGc->DrawTextVertical(KPangram,NULL,rect,baseline,10,EFalse);
       
  1126 		CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1127 		}
       
  1128 		
       
  1129 	//invalid aAlignment
       
  1130 	rect.SetRect(10,320,300,540);
       
  1131 	baseline = rect.Height() / 2 + iFont->AscentInPixels() / 2;
       
  1132 	iGc->DrawText(KPangram,NULL,rect,baseline, (DirectGdi::TTextAlign) 5 );
       
  1133 	CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1134 
       
  1135 	rect.SetRect(540,10,560,350);
       
  1136 	baseline = rect.Width() /2 + iFont->AscentInPixels() / 2;
       
  1137 	iGc->DrawTextVertical(KPangram,NULL,rect,baseline,10, EFalse , (DirectGdi::TTextAlign) 5 );
       
  1138 	CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
       
  1139 	iGc->ResetFont();	
       
  1140 	}
       
  1141 	
       
  1142 /**
       
  1143 Override of base class pure virtual
       
  1144 Lists the tests to be run
       
  1145 */
       
  1146 void CTDrawText::RunTestsL()
       
  1147 	{
       
  1148 	MFontGlyphImageStorage* glyphStorage = NULL;
       
  1149 	iGc->GetInterface(TUid::Uid(KDirectGdiGetGlyphStorageUid), (TAny*&) glyphStorage);
       
  1150 	if(glyphStorage)
       
  1151 		{
       
  1152 		glyphStorage->CleanGlyphImageCache();
       
  1153 		CleanupStack::PushL(TCleanupItem(CleanCache, glyphStorage));
       
  1154 		}
       
  1155 	SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0001"));
       
  1156 	TestBasicFunctionality();
       
  1157 	RecordTestResultL();
       
  1158 	if(!iRunningOomTests)
       
  1159 		{
       
  1160 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0002"));
       
  1161 		TestTextPositioning();
       
  1162 		RecordTestResultL();
       
  1163 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0003"));
       
  1164 		TestTextBox();
       
  1165 		RecordTestResultL();
       
  1166 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0004"));
       
  1167 		TestTextPositioningVertical(EFalse);
       
  1168 		RecordTestResultL();
       
  1169 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0004"));
       
  1170 		TestTextPositioningVertical(ETrue);
       
  1171 		RecordTestResultL();
       
  1172 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0005"));
       
  1173 		TestTextBoxVertical();
       
  1174 		RecordTestResultL();
       
  1175 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0008"));
       
  1176 		TestJustification();
       
  1177 		RecordTestResultL();
       
  1178 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0009"));
       
  1179 		TestShadowUnderStrike();
       
  1180 		RecordTestResultL();
       
  1181 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0007"));
       
  1182 		TestAlign();
       
  1183 		RecordTestResultL();
       
  1184 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0006"));
       
  1185 		TestPenBrushL();
       
  1186 		RecordTestResultL();
       
  1187 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-TEXT-0010"));
       
  1188 		TestInvalidParamsL();
       
  1189 		RecordTestResultL();
       
  1190 		}
       
  1191 
       
  1192 	if(glyphStorage)
       
  1193 		{
       
  1194 		glyphStorage->CleanGlyphImageCache();
       
  1195 		CleanupStack::Pop(glyphStorage);
       
  1196 		}
       
  1197 	}
       
  1198 
       
  1199 
       
  1200