Update contrib.
1 // Copyright (c) 2006-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
33 #include <graphics/fbsdefs.h>
37 const TInt KTextBufferLength = 256;
39 //If you want to do font tests with scaled device - change KScalingFactorX, KScalingFactorY, KScalingOriginPt.
40 const TInt KScalingFactorX = 1;
41 const TInt KScalingFactorY = 1;
42 const TPoint KScalingOriginPt(0, 0);
44 //--------------------------------------------------------------
46 CBitmapFont* CFbsFontEx::FontAddress(CFbsFont* aFont)
48 return(((CFbsFontEx*)aFont)->Address());
51 //--------------------------------------------------------------
54 template<class C> XTCallCounter<C>::XTCallCounter(CTGraphicsBase& aTestBase)
55 : iTestBase(aTestBase), iVFCallsOutsideFBServ(0)
58 template<class C> void XTCallCounter<C>::ExecuteShellcode(TInt aFromFunction)
60 const TUint32 KFBServId = 0x10003A16;
61 const TUint32 KTBitgdiServerId = 0x10273362;
62 TSecureId id = RProcess().SecureId();
65 User::LockedInc(iVFCallsOutsideFBServ);
66 if (id == KTBitgdiServerId)
69 XVtableInjector<C>::GetVirtualFunctionName(aFromFunction, name);
70 iTestBase.INFO_PRINTF2(_L("Virtual function call to %S from outside FBServ"), &name);
76 //--------------------------------------------------------------
78 CTFont::CTFont(CTestStep* aStep) :
79 CTGraphicsBase(aStep),
84 , iFontCallCounter(*this), iOpenFontCallCounter(*this)
95 void CTFont::ConstructL()
97 TRAPD(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor256));
98 if (err == KErrNotSupported)
99 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor16MU));
100 if (err == KErrNotSupported)
101 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor4K));
102 if (err == KErrNotSupported)
103 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor16M));
104 if (err == KErrNotSupported)
105 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor64K));
106 if (err == KErrNotSupported)
107 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EGray256));
108 if (err == KErrNotSupported)
109 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EGray16));
110 if (err == KErrNotSupported)
111 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EGray4));
112 if (err == KErrNotSupported)
113 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EGray2));
114 if (err == KErrNotSupported)
115 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor16));
116 if (err == KErrNotSupported)
117 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor16MA));
118 if (err == KErrNotSupported)
119 TRAP(err,iDev = CFbsScreenDevice::NewL(KNullDesC,EColor16MAP));
122 _LIT(KLog,"Failed to create screen device, last returned error %d");
123 INFO_PRINTF2(KLog,err);
126 User::LeaveIfError(err);
127 iDev->ChangeScreenDevice(NULL);
128 iDev->SetAutoUpdate(ETrue);
129 iDev->CreateContext(iGc);
130 iDev->SetScalingFactor(KScalingOriginPt, KScalingFactorX, KScalingFactorY, 1, 1);
135 @SYMTestCaseID GRAPHICS-BITGDI-0074
139 @SYMTestCaseDesc Anti-aliased text
141 @SYMTestPriority High
143 @SYMTestStatus Implemented
145 @SYMTestActions Draws some text in an antialiased manner
147 @SYMTestExpectedResults Test should perform graphics operations succesfully.
149 void CTFont::DoAntiAliasedTextL()
151 int typefaces = iDev->NumTypefaces();
152 static const TUint32 colour[15] =
170 int colour_index = 0;
171 for (int i = 0; i < typefaces; i++)
173 TTypefaceSupport typeface_support;
174 iDev->TypefaceSupport(typeface_support,i);
175 if (typeface_support.iIsScalable)
179 int vertical_x = 300;
180 for (int j = 6; j < 32; j += 2)
182 iGc->SetPenColor(colour[colour_index]);
183 colour_index = (++colour_index) % 15;
185 fs.iTypeface = typeface_support.iTypeface;
187 fs.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
188 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
189 int ascent = iFont->AscentInPixels();
190 int descent = iFont->DescentInPixels();
193 iGc->DrawText(_L("pack my box with five dozen liquor jugs"),pos);
195 vertical_x -= ascent;
196 TPoint down_pos(vertical_x,0);
197 iGc->DrawTextVertical(_L("pack my box with five dozen liquor jugs"),down_pos,FALSE);
198 vertical_x -= descent * 2;
199 TPoint up_pos(vertical_x,iDev->SizeInPixels().iHeight);
200 iGc->DrawTextVertical(_L("pack my box with five dozen liquor jugs"),up_pos,TRUE);
201 vertical_x -= ascent;
202 iDev->ReleaseFont(iFont);
210 @SYMTestCaseID GRAPHICS-BITGDI-0075
214 @SYMTestCaseDesc tests all fonts
216 @SYMTestPriority High
218 @SYMTestStatus Implemented
220 @SYMTestActions tests all fonts (typeface and heights) by writing them to a gc
222 @SYMTestExpectedResults Test should perform graphics operations succesfully.
224 void CTFont::DoAllFontsL()
227 TInt typefaces = iDev->NumTypefaces();
228 TTypefaceSupport info;
230 //used below in for loop (line 177)
236 // Maximum height of font allowed by iType rasteriser
237 const TInt KMaxITypeHeightInPixels = 256;
239 for (TInt count = 0; count < typefaces; count++)
241 iDev->TypefaceSupport(info,count);
243 for (TInt index = 0; index < info.iNumHeights; index++)
245 TInt height = iDev->FontHeightInPixels(count,index);
246 if (height > KMaxITypeHeightInPixels)
250 fs.iTypeface = info.iTypeface;
253 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
254 TInt heightInPixels = iFont->HeightInPixels();
255 if ( heightInPixels == height )
261 TOpenFontFaceAttrib attrib;
262 if( iFont->GetFaceAttrib( attrib ) )
264 _LIT(KErrorMessageWithFontName, "Font: %S, pixel height requested: %d, pixel height of font: %d");
265 INFO_PRINTF4(KErrorMessageWithFontName, &attrib.FullName(), height, heightInPixels);
269 _LIT(KErrorMessage, "Pixel height requested: %d, pixel height of font: %d");
270 INFO_PRINTF3(KErrorMessage, height, heightInPixels);
279 //Testing the new replaced GetUnderlineMetrics
280 //Debug can be used to monitor underline sizes as font chanegs
281 iGc->GetUnderlineMetrics(top, bottom);
282 TEST( top !=0 && bottom !=0 );
283 /*cast the pointer iGc to the base class CGraphicsContext
284 should still behave correctly meaning any valid class can
285 GetUnderlineMetrics through CGC as is exported and public.*/
286 CGraphicsContext* baseGc = (CGraphicsContext*)iGc;
287 baseGc->GetUnderlineMetrics(topNew, bottomNew);
288 TEST( top !=0 && bottom !=0 );
289 TEST( topNew == top && bottomNew == bottom );
291 DisplayAsciiCharSet(info.iTypeface.iName);
292 DisplayBoldItalic(info.iTypeface.iName);
297 iDev->ReleaseFont(iFont);
299 height = iDev->FontHeightInTwips(count,index);
301 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fs));
302 // Commented out test because it fails for true type fonts
303 // if (Abs(iFont->FontSpecInTwips().iHeight - height) > 1)
304 // User::Panic(_L("Heights don't match"),KErrGeneral);
305 iDev->ReleaseFont(iFont);
310 TInt CTFont::TestFontL(const TFontSpec &aFontSpec)
312 const TSize devSize(iDev->SizeInPixels());
313 TInt midHgtOffset=devSize.iHeight/2;
314 TRect devRect1(0,0,devSize.iWidth,midHgtOffset);
315 TRect devRect2(0,midHgtOffset,devSize.iWidth,midHgtOffset*2);
318 TInt loadErr=GetNearestFontToDesignHeightInTwips(iFont,aFontSpec);
321 CBufStore *store=CBufStore::NewLC(1024);
322 TFontSpec fSpec1=iFont->FontSpecInTwips();
323 TEST(fSpec1.iHeight>0); // If returns zero height will fail on externalize/internalize
324 const TInt ascent=iFont->AscentInPixels();
326 iDev->ReleaseFont(iFont);
327 // Useful when watching test code, but too much logging for actual test runs
328 // INFO_PRINTF4(_L("Testing, %S hgt=%d/%d"), &aFontSpec.iTypeface.iName,aFontSpec.iHeight,fSpec1.iHeight);
330 iGc->SetClippingRect(devRect1);
331 iGc->DrawText(_L("0123456789abcdefghiABCDEFGHI"),TPoint(0,ascent));
333 RStoreWriteStream writeStream;
334 TStreamId id=writeStream.CreateLC(*store);
335 iGc->ExternalizeL(writeStream);
336 CleanupStack::PopAndDestroy(&writeStream);
339 RStoreReadStream readStream;
340 readStream.OpenLC(*store,id);
341 iGc->InternalizeL(readStream);
342 CleanupStack::PopAndDestroy(&readStream);
343 TBool fontUsed=iGc->IsFontUsed();
344 if (!iGc->IsFontUsed())
346 INFO_PRINTF3(_L("Font externalize/internalize used check failed, %S hgt=%d"), &aFontSpec.iTypeface.iName,aFontSpec.iHeight);
351 iGc->SetClippingRect(devRect2);
352 iGc->DrawText(_L("0123456789abcdefghiABCDEFGHI"),TPoint(0,midHgtOffset+ascent));
353 TBool rectCompare=iDev->RectCompare(devRect1,*iDev,devRect2);
356 INFO_PRINTF3(_L("Font externalize/internalize screen check failed, %S hgt=%d"), &aFontSpec.iTypeface.iName,aFontSpec.iHeight);
360 CleanupStack::PopAndDestroy(store);
361 iGc->CancelClippingRect();
366 void CTFont::FontExternalizeL()
369 const TInt typefaceCount=iDev->NumTypefaces();
370 for (TInt typeface=0;typeface<typefaceCount;typeface++)
372 TTypefaceSupport info;
373 iDev->TypefaceSupport(info,typeface);
374 fsp.iTypeface = info.iTypeface;
375 TInt baseHeight=iDev->FontHeightInTwips(typeface,0);
376 _LIT(KTxtNotScalable,"");
377 _LIT(KTxtScalable,"Scalable");
378 INFO_PRINTF5(_L("Testing, %S min/max=%d/%d %S"), &fsp.iTypeface.iName,info.iMinHeightInTwips,info.iMaxHeightInTwips,info.iIsScalable?&KTxtScalable:&KTxtNotScalable);
379 for(TInt hgtIndex=0;hgtIndex<info.iNumHeights;hgtIndex++)
380 { // Test official specced heights
381 fsp.iHeight=iDev->FontHeightInTwips(typeface,hgtIndex);
382 TEST(TestFontL(fsp)==KErrNone);
384 for(fsp.iHeight=0;fsp.iHeight<info.iMaxHeightInTwips*2;fsp.iHeight=(fsp.iHeight+1)*11/10)
386 TInt err=TestFontL(fsp);
388 { // Should not get an error within allowable font size
389 TEST(fsp.iHeight>info.iMaxHeightInTwips); // Over speced max size is ok to get error loading.
395 void CTFont::DisplayAsciiCharSet(const TDesC& aTypefaceName)
399 TBuf<KTextBufferLength> textBuffer;
400 textBuffer.SetLength(KTextBufferLength);
401 for (TInt count = 0; count < KTextBufferLength; count++)
402 textBuffer[count] = TText(count);
404 TPoint textPos = TPoint(50,iFont->AscentInPixels() + 5);
405 iGc->DrawText(aTypefaceName,textPos);
406 TInt fontHeight = iFont->HeightInPixels() + 5;
408 textPos.iY += fontHeight;
410 TInt screenWidth = iDev->SizeInPixels().iWidth;
412 while (start < KTextBufferLength)
414 TInt numChars = iFont->TextCount(textBuffer.Mid(start),screenWidth);
415 iGc->DrawText(textBuffer.Mid(start,numChars),textPos);
416 textPos.iY += fontHeight;
421 void CTFont::DisplayBoldItalic(const TDesC& aTypefaceName)
426 TInt height = iFont->HeightInPixels();
427 CBitmapFont* bmpfon=CFbsFontEx::FontAddress(iFont);
429 TInt level=iFont->AscentInPixels();
430 iGc->DrawText(aTypefaceName,TPoint(50,level));
432 textBuffer=_L("0123456789abcdefghiABCDEFGHI");
434 iGc->DrawText(textBuffer,TPoint(0,level));
435 iGc->DrawLine(TPoint(iFont->TextWidthInPixels(textBuffer),level-8),TPoint(iFont->TextWidthInPixels(textBuffer),level+2));
437 bmpfon->iAlgStyle.SetIsBold(ETrue);
439 iGc->DrawText(textBuffer,TPoint(0,level));
440 iGc->DrawLine(TPoint(iFont->TextWidthInPixels(textBuffer),level-8),TPoint(iFont->TextWidthInPixels(textBuffer),level+2));
442 bmpfon->iAlgStyle.SetIsBold(EFalse);
443 bmpfon->iAlgStyle.SetIsItalic(ETrue);
445 iGc->DrawText(textBuffer,TPoint(0,level));
446 iGc->DrawLine(TPoint(iFont->TextWidthInPixels(textBuffer),level-8),TPoint(iFont->TextWidthInPixels(textBuffer),level+2));
448 bmpfon->iAlgStyle.SetIsBold(ETrue);
450 iGc->DrawText(textBuffer,TPoint(0,level));
451 iGc->DrawLine(TPoint(iFont->TextWidthInPixels(textBuffer),level-8),TPoint(iFont->TextWidthInPixels(textBuffer),level+2));
455 @SYMTestCaseID GRAPHICS-BITGDI-0076
459 @SYMTestCaseDesc Text formatting
461 @SYMTestPriority High
463 @SYMTestStatus Implemented
465 @SYMTestActions Tests drawing of justified/clipped/underlined text to a gc
467 @SYMTestExpectedResults Test should perform graphics operations succesfully.
469 void CTFont::DoTextFormatsL()
474 fsp.iTypeface.iName=_L("Swiss");
477 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
493 iDev->ReleaseFont(iFont);
498 iGc->SetPenSize(TSize(0,0));
499 iGc->SetBrushColor(KRgbWhite);
500 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
502 iGc->DrawText(_L("Font test code:"),TPoint(20,20));
503 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,40));
504 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
505 iGc->DrawText(_L("Box text (left aligned)"),TRect(20,50,320,70),14,CGraphicsContext::ELeft);
506 iGc->DrawText(_L("Box text (left aligned with margin)"),TRect(20,70,320,90),14,CGraphicsContext::ELeft,50);
507 iGc->DrawText(_L("Box text (centred)"),TRect(20,90,320,110),14,CGraphicsContext::ECenter);
508 iGc->DrawText(_L("Box text (right aligned)"),TRect(20,110,320,130),14,CGraphicsContext::ERight);
509 iGc->DrawText(_L("Box text (right aligned with margin)"),TRect(20,130,320,150),14,CGraphicsContext::ERight,30);
510 iGc->DrawText(_L("(Boxes drawn afterwards)"),TPoint(20,165));
511 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
512 iGc->DrawRect(TRect(20,50,320,70));
513 iGc->DrawRect(TRect(20,70,320,90));
514 iGc->DrawRect(TRect(20,90,320,110));
515 iGc->DrawRect(TRect(20,110,320,130));
517 iGc->SetBrushColor(TRgb(128,128,128));
518 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
519 iGc->DrawText(_L("Box text (left aligned)"),TRect(320,50,620,70),14,CGraphicsContext::ELeft);
520 iGc->DrawText(_L("Box text (left aligned with margin)"),TRect(320,70,620,90),14,CGraphicsContext::ELeft,50);
521 iGc->DrawText(_L("Box text (centred)"),TRect(320,90,620,110),14,CGraphicsContext::ECenter);
522 iGc->DrawText(_L("Box text (right aligned)"),TRect(320,110,620,130),14,CGraphicsContext::ERight);
523 iGc->DrawText(_L("Box text (right aligned with margin)"),TRect(320,130,620,150),14,CGraphicsContext::ERight,30);
524 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
525 iGc->DrawRect(TRect(320,50,620,70));
526 iGc->DrawRect(TRect(320,70,620,90));
527 iGc->DrawRect(TRect(320,90,620,110));
528 iGc->DrawRect(TRect(320,110,620,130));
530 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
531 TInt width=iFont->TextWidthInPixels(_L("Box text followed by positionless text."));
532 iGc->DrawText(_L("Box text"),TRect(20,150,620,170),14,width);
533 iGc->DrawText(_L(" followed by positionless text."));
534 iGc->DrawText(_L("Box text"),TRect(20,170,620,190),14,width,CGraphicsContext::ELeft,20);
535 iGc->DrawText(_L(" followed by positionless text."));
536 iGc->DrawText(_L("Box text"),TRect(20,190,620,210),14,width,CGraphicsContext::ECenter);
537 iGc->DrawText(_L(" followed by positionless text."));
538 iGc->DrawText(_L("Box text"),TRect(20,210,620,230),14,width,CGraphicsContext::ERight,20);
539 iGc->DrawText(_L(" followed by positionless text."));
540 iGc->DrawText(_L(""),TRect(20,230,620,250),14,width);
541 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
542 iGc->DrawRect(TRect(20,150,620,170));
543 iGc->DrawRect(TRect(20,170,620,190));
544 iGc->DrawRect(TRect(20,190,620,210));
545 iGc->DrawRect(TRect(20,210,620,230));
548 void CTFont::Underline()
552 iGc->SetUnderlineStyle(EUnderlineOn);
553 iGc->SetStrikethroughStyle(EStrikethroughOn);
555 iGc->DrawText(_L("Font test code:"),TPoint(20,20));
556 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,40));
557 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
558 iGc->DrawText(_L("Box text (left aligned)"),TRect(20,50,320,70),14,CGraphicsContext::ELeft);
559 iGc->DrawText(_L("Box text (left aligned with margin)"),TRect(20,70,320,90),14,CGraphicsContext::ELeft,50);
560 iGc->DrawText(_L("Box text (centred)"),TRect(20,90,320,110),14,CGraphicsContext::ECenter);
561 iGc->DrawText(_L("Box text (right aligned)"),TRect(20,110,320,130),14,CGraphicsContext::ERight);
562 iGc->DrawText(_L("Box text (left aligned)"),TRect(320,50,620,70),14,CGraphicsContext::ELeft);
563 iGc->DrawText(_L("Box text (left aligned with margin)"),TRect(320,70,620,90),14,CGraphicsContext::ELeft,50);
564 iGc->DrawText(_L("Box text (centred)"),TRect(320,90,620,110),14,CGraphicsContext::ECenter);
565 iGc->DrawText(_L("Box text (right aligned)"),TRect(320,110,620,130),14,CGraphicsContext::ERight);
566 TInt width=iFont->TextWidthInPixels(_L("Box text followed by positionless text."));
567 iGc->DrawText(_L("Box text"),TRect(20,130,620,150),14,width);
568 iGc->DrawText(_L(" followed by positionless text."));
569 iGc->DrawText(_L("Box text"),TRect(20,150,620,170),14,width,CGraphicsContext::ELeft,20);
570 iGc->DrawText(_L(" followed by positionless text."));
571 iGc->DrawText(_L("Box text"),TRect(20,170,620,190),14,width,CGraphicsContext::ECenter);
572 iGc->DrawText(_L(" followed by positionless text."));
573 iGc->DrawText(_L("Box text"),TRect(20,190,620,210),14,width,CGraphicsContext::ERight);
574 iGc->DrawText(_L(" followed by positionless text."));
575 iGc->DrawText(_L(""),TRect(20,210,620,230),14,width);
577 iGc->SetUnderlineStyle(EUnderlineOff);
578 iGc->SetStrikethroughStyle(EStrikethroughOff);
581 void CTFont::Justification()
583 iGc->SetUnderlineStyle(EUnderlineOff);
584 iGc->SetStrikethroughStyle(EStrikethroughOff);
585 iGc->SetPenSize(TSize(0,0));
586 iGc->SetBrushColor(KRgbWhite);
587 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
589 iGc->DrawText(_L("Font test code:"),TPoint(20,20));
590 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,40));
591 iGc->SetCharJustification(18,6);
592 iGc->SetWordJustification(0,0);
593 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,60));
594 iGc->SetCharJustification(0,0);
595 iGc->SetWordJustification(30,6);
596 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,80));
597 iGc->SetCharJustification(18,6);
598 iGc->SetWordJustification(30,6);
599 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,100));
600 iGc->UpdateJustification(_L("Normal text printing in one whole line"));
602 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,120));
603 iGc->UpdateJustification(_L("Normal text printing, followed by posi"));
604 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
605 iGc->UpdateJustification(_L("tionless printing (halfway thro' posi-tionless)."));
606 iGc->SetCharJustification(18,6);
607 iGc->SetWordJustification(0,0);
608 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,140));
609 iGc->UpdateJustification(_L("Normal text printing, followed by posi"));
610 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
611 iGc->SetCharJustification(0,0);
612 iGc->SetWordJustification(30,6);
613 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,160));
614 iGc->UpdateJustification(_L("Normal text printing, followed by posi"));
615 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
616 iGc->SetCharJustification(18,6);
617 iGc->SetWordJustification(30,6);
618 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,180));
619 iGc->UpdateJustification(_L("Normal text printing, followed by posi"));
620 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
621 iGc->SetCharJustification(150,50);
622 iGc->SetWordJustification(50,10);
623 iGc->DrawText(_L("Normal text printing in one whole line,"),TPoint(20,200));
624 iGc->UpdateJustification(_L("Normal text printing in one whole line,"));
625 iGc->DrawText(_L("followed by more text, carrying over justification."),TPoint(20,220));
626 iGc->SetCharJustification(0,0);
627 iGc->SetWordJustification(0,0);
630 void CTFont::Clipping()
632 iGc->SetUnderlineStyle(EUnderlineOff);
633 iGc->SetStrikethroughStyle(EStrikethroughOff);
634 iGc->SetPenSize(TSize(0,0));
635 iGc->SetBrushColor(KRgbWhite);
636 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
638 iGc->DrawText(_L("Font test code:"),TPoint(20,20));
639 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,40));
640 iGc->SetCharJustification(-6,6);
641 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,60));
642 iGc->SetCharJustification(-12,6);
643 iGc->DrawText(_L("Normal text printing in one whole line"),TPoint(20,80));
644 iGc->SetCharJustification(0,0);
646 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,120));
647 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
648 iGc->SetCharJustification(-50,50);
649 iGc->DrawText(_L("Normal text printing, followed by posi"),TPoint(20,140));
650 iGc->UpdateJustification(_L("Normal text printing, followed by posi"));
651 iGc->DrawText(_L("tionless printing (halfway thro' posi-tionless)."));
652 iGc->SetCharJustification(0,0);
653 iGc->DrawText(_L("Normal text printing in one whole line,"),TPoint(20,160));
654 iGc->DrawText(_L("followed by more text, carrying over justification."),TPoint(20,180));
655 iGc->SetCharJustification(-90,90);
656 iGc->DrawText(_L("Normal text printing in one whole line,"),TPoint(20,200));
657 iGc->UpdateJustification(_L("Normal text printing in one whole line,"));
658 iGc->DrawText(_L("followed by more text, carrying over justification."),TPoint(20,220));
659 iGc->SetCharJustification(0,0);
663 @SYMTestCaseID GRAPHICS-BITGDI-0077
667 @SYMTestCaseDesc Check text drawing
669 @SYMTestPriority High
671 @SYMTestStatus Implemented
673 @SYMTestActions Tests aspects of drawing text to the screen
675 @SYMTestExpectedResults Test should perform graphics operations succesfully.
677 void CTFont::DoBitAlignmentL()
682 const TUint8 testchars[2]={'M', 'W'};
687 fsp.iTypeface.iName=_L("Swiss");
689 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
691 TInt ascent=iFont->AscentInPixels();
692 TInt descent=iFont->DescentInPixels();
693 TInt charvertpos=ascent+descent+20;
694 TRgb refcolour(0,0,0);
695 TRgb charcolour(0,0,0);
698 letterdesc.SetLength(1);
699 for(;charnum<2;charnum++)
701 letterdesc[0]=testchars[charnum];
702 TInt letterwidth=iFont->TextWidthInPixels(letterdesc);
703 if(!letterwidth) continue;
704 for(xpos=10;xpos<43;xpos++)
707 TPoint refpt(10,ascent+10);
708 TPoint charpt(xpos,ascent+charvertpos);
709 iGc->SetDitherOrigin(refpt);
710 iGc->DrawText(letterdesc,refpt);
711 iGc->SetDitherOrigin(charpt);
712 iGc->DrawText(letterdesc,charpt);
713 for(TInt ycheck=0;ycheck<ascent+descent;ycheck+=2)
714 for(TInt xcheck=0;xcheck<letterwidth;xcheck+=2)
716 iDev->GetPixel(refcolour,TPoint(xcheck+10,ycheck+10));
717 iDev->GetPixel(charcolour,TPoint(xcheck+xpos,ycheck+charvertpos));
718 TEST(refcolour==charcolour);
719 if(refcolour!=charcolour)
727 iGc->SetPenColor(TRgb(128,128,128));
728 for(charnum=0;charnum<2;charnum++)
730 letterdesc[0]=testchars[charnum];
731 TInt letterwidth=iFont->TextWidthInPixels(letterdesc);
732 if(!letterwidth) continue;
733 for(xpos=10;xpos<43;xpos++)
736 TPoint refpt(10,ascent+10);
737 TPoint charpt(xpos,ascent+charvertpos);
738 iGc->SetDitherOrigin(TPoint(refpt.iX,0));
739 iGc->DrawText(letterdesc,refpt);
740 iGc->SetDitherOrigin(TPoint(charpt.iX,0));
741 iGc->DrawText(letterdesc,charpt);
742 for(TInt ycheck=0;ycheck<ascent+descent;ycheck+=2)
743 for(TInt xcheck=0;xcheck<letterwidth;xcheck+=2)
745 iDev->GetPixel(refcolour,TPoint(xcheck+10,ycheck+10));
746 iDev->GetPixel(charcolour,TPoint(xcheck+xpos,ycheck+charvertpos));
747 TEST(refcolour==charcolour);
748 if(refcolour!=charcolour)
756 iGc->SetPenColor(KRgbBlack);
757 letters.SetLength(224);
758 for(charnum=32;charnum<256;charnum++)
759 letters[charnum-32]=TUint8(charnum);
760 letters.SetLength(iFont->TextCount(letters,iDev->SizeInPixels().iWidth-45));
761 stringwidth=iFont->TextWidthInPixels(letters);
762 for(xpos=10;xpos<43;xpos++)
765 TPoint refpt(10,ascent+10);
766 TPoint charpt(xpos,ascent+charvertpos);
767 iGc->DrawText(letters,refpt);
769 letterdesc[0]=letters[charnum];
771 iGc->DrawText(letterdesc,charpt);
772 for(;charnum<letters.Length();charnum++)
774 letterdesc[0]=letters[charnum];
775 iGc->DrawText(letterdesc);
777 for(TInt ycheck=0;ycheck<ascent+descent;ycheck+=2)
778 for(TInt xcheck=0;xcheck<stringwidth;xcheck+=2)
780 iDev->GetPixel(refcolour,TPoint(xcheck+10,ycheck+10));
781 iDev->GetPixel(charcolour,TPoint(xcheck+xpos,ycheck+charvertpos));
782 TEST(refcolour==charcolour);
783 if(refcolour!=charcolour)
790 for(charnum=0;charnum<2;charnum++)
792 letterdesc[0]=testchars[charnum];
793 TInt letterwidth=iFont->TextWidthInPixels(letterdesc);
794 if(!letterwidth) continue;
795 for(xpos=10;xpos<43;xpos++)
798 TPoint refpt(10,ascent+10);
799 TPoint charpt(xpos,ascent+charvertpos);
800 iGc->DrawText(letterdesc,TRect(refpt.iX,refpt.iY-ascent,refpt.iX+letterwidth,refpt.iY+descent),ascent);
801 iGc->DrawText(letterdesc,TRect(charpt.iX,charpt.iY-ascent,charpt.iX+letterwidth,charpt.iY+descent),ascent);
802 for(TInt ycheck=0;ycheck<ascent+descent;ycheck+=2)
803 for(TInt xcheck=0;xcheck<letterwidth;xcheck+=2)
805 iDev->GetPixel(refcolour,TPoint(xcheck+10,ycheck+10));
806 iDev->GetPixel(charcolour,TPoint(xcheck+xpos,ycheck+charvertpos));
807 TEST(refcolour==charcolour);
808 if(refcolour!=charcolour)
816 iGc->SetPenColor(TRgb(128,128,128));
817 for(charnum=0;charnum<2;charnum++)
819 letterdesc[0]=testchars[charnum];
820 TInt letterwidth=iFont->TextWidthInPixels(letterdesc);
821 if(!letterwidth) continue;
822 for(xpos=10;xpos<43;xpos++)
825 TPoint refpt(10,ascent+10);
826 TPoint charpt(xpos,ascent+charvertpos);
827 iGc->SetDitherOrigin(TPoint(refpt.iX,0));
828 iGc->DrawText(letterdesc,TRect(refpt.iX,refpt.iY-ascent,refpt.iX+letterwidth,refpt.iY+descent),ascent);
829 iGc->SetDitherOrigin(TPoint(charpt.iX,0));
830 iGc->DrawText(letterdesc,TRect(charpt.iX,charpt.iY-ascent,charpt.iX+letterwidth,charpt.iY+descent),ascent);
831 for(TInt ycheck=0;ycheck<ascent+descent;ycheck+=2)
832 for(TInt xcheck=0;xcheck<letterwidth;xcheck+=2)
834 iDev->GetPixel(refcolour,TPoint(xcheck+10,ycheck+10));
835 iDev->GetPixel(charcolour,TPoint(xcheck+xpos,ycheck+charvertpos));
836 TEST(refcolour==charcolour);
837 if(refcolour!=charcolour)
847 iDev->ReleaseFont(iFont);
849 User::LeaveIfError(ret);
853 @SYMTestCaseID GRAPHICS-BITGDI-0078
857 @SYMTestCaseDesc Large fonts
859 @SYMTestPriority High
861 @SYMTestStatus Implemented
863 @SYMTestActions draws text to a gc with different weight and posture with a large height
865 @SYMTestExpectedResults Test should perform graphics operations succesfully.
867 void CTFont::DoLargeFontsL()
869 TInt typefaces = iDev->NumTypefaces();
872 for (TInt count = 0; count < typefaces; count++)
874 TTypefaceSupport info;
875 iDev->TypefaceSupport(info,count);
877 for (TInt index = 0; index < info.iNumHeights; index++)
879 height = iDev->FontHeightInPixels(count,index);
884 fs.iTypeface=info.iTypeface;
886 fs.iFontStyle.SetPosture(EPostureUpright);
887 fs.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
889 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
891 iDev->ReleaseFont(iFont);
894 fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
895 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
897 iDev->ReleaseFont(iFont);
900 fs.iFontStyle.SetPosture(EPostureItalic);
901 fs.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
902 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
904 iDev->ReleaseFont(iFont);
907 fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
908 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
910 iDev->ReleaseFont(iFont);
916 // Draw a character and its glyph and character bounding boxes. Return the rightmost point drawn.
917 TInt CTFont::DisplayCharAndBounds(TInt aChar,TPoint aPos,TBool aVertical,TBool aUp)
919 TOpenFontCharMetrics cm;
920 const TUint8* bitmap;
922 if (!iFont->GetCharacterData(aChar,cm,bitmap,size))
925 if (!iFont->GetFontMetrics(fm))
927 TRect glyph_bounds, char_bounds;
932 glyph_bounds.iTl.iX = aPos.iX - cm.HorizBearingY();
933 char_bounds.iTl.iX = aPos.iX - fm.MaxHeight();
934 glyph_bounds.iTl.iY = aPos.iY - cm.HorizBearingX() - cm.Width();
935 char_bounds.iTl.iY = aPos.iY - cm.HorizAdvance();
939 glyph_bounds.iTl.iX = aPos.iX + cm.HorizBearingY() - cm.Height() + 1;
940 char_bounds.iTl.iX = aPos.iX - fm.MaxDepth() + 1;
941 glyph_bounds.iTl.iY = aPos.iY + cm.HorizBearingX();
942 char_bounds.iTl.iY = aPos.iY;
944 glyph_bounds.iBr = glyph_bounds.iTl + TSize(cm.Height(),cm.Width());
945 char_bounds.iBr = char_bounds.iTl + TSize(fm.MaxHeight() + fm.MaxDepth(),cm.HorizAdvance());
949 glyph_bounds.iTl.iX = aPos.iX + cm.HorizBearingX();
950 char_bounds.iTl.iX = aPos.iX;
951 glyph_bounds.iTl.iY = aPos.iY - cm.HorizBearingY();
952 char_bounds.iTl.iY = aPos.iY - fm.MaxHeight();
953 glyph_bounds.iBr = glyph_bounds.iTl + TSize(cm.Width(),cm.Height());
954 char_bounds.iBr = char_bounds.iTl + TSize(cm.HorizAdvance(),fm.MaxHeight() + fm.MaxDepth());
957 TInt x_offset = aPos.iX - Min(glyph_bounds.iTl.iX,char_bounds.iTl.iX);
959 glyph_bounds.Move(x_offset,0);
960 char_bounds.Move(x_offset,0);
961 TText text_buffer[1];
962 text_buffer[0] = (TText)aChar;
963 TPtrC text(text_buffer,1);
965 iGc->DrawTextVertical(text,aPos,aUp);
967 iGc->DrawText(text,aPos);
968 iGc->DrawRect(glyph_bounds);
969 iGc->DrawRect(char_bounds);
971 return Max(glyph_bounds.iBr.iX,char_bounds.iBr.iX);
974 void CTFont::DisplayLargeChars()
979 TPoint pos(20,iDev->SizeInPixels().iHeight / 2);
981 pos.iX = DisplayCharAndBounds('G',pos,FALSE,FALSE) + 20;
982 pos.iX = DisplayCharAndBounds('p',pos,FALSE,FALSE) + 20;
983 pos.iX = DisplayCharAndBounds('G',pos,TRUE,TRUE) + 20;
984 pos.iX = DisplayCharAndBounds('p',pos,TRUE,TRUE) + 20;
985 pos.iX = DisplayCharAndBounds('G',pos,TRUE,FALSE) + 20;
986 pos.iX = DisplayCharAndBounds('p',pos,TRUE,FALSE) + 20;
988 iGc->SetPenStyle(CGraphicsContext::EDottedPen);
989 iGc->SetPenColor(KRgbGray);
995 @SYMTestCaseID GRAPHICS-BITGDI-0079
999 @SYMTestCaseDesc Vertical text
1001 @SYMTestPriority High
1003 @SYMTestStatus Implemented
1005 @SYMTestActions Draws text in varied weight and typeface to a gc in a vertical manner
1007 @SYMTestExpectedResults Test should perform graphics operations succesfully.
1009 void CTFont::DoVerticalText()
1012 TInt typefaces=iDev->NumTypefaces();
1013 TTypefaceSupport info;
1017 for(;count<typefaces;count++)
1019 iDev->TypefaceSupport(info,count);
1023 for(TInt index=0;index<info.iNumHeights;index++)
1025 TInt height=iDev->FontHeightInPixels(count,index);
1026 if(height<5) continue;
1027 fs.iTypeface=info.iTypeface;
1029 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
1030 iGc->UseFont(iFont);
1031 if(dir) pos.iY=iDev->SizeInPixels().iHeight;
1034 pos.iX+=iFont->AscentInPixels()+1;
1036 pos.iX+=iFont->HeightInPixels()-1-iFont->AscentInPixels();
1037 iGc->DrawTextVertical(_L("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),pos,dir);
1039 pos.iX+=iFont->HeightInPixels()+1-iFont->AscentInPixels();
1041 pos.iX+=iFont->AscentInPixels()+3;
1043 iDev->ReleaseFont(iFont);
1045 if (pos.iX > iDev->SizeInPixels().iWidth)
1051 for(count=0;count<typefaces;count++)
1053 iDev->TypefaceSupport(info,count);
1057 iGc->SetUnderlineStyle(EUnderlineOn);
1058 iGc->SetStrikethroughStyle(EStrikethroughOn);
1059 for(TInt index=0;index<info.iNumHeights;index++)
1061 TInt height=iDev->FontHeightInPixels(count,index);
1062 if(height<5) continue;
1063 fs.iTypeface=info.iTypeface;
1065 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
1066 iGc->UseFont(iFont);
1067 if(dir) pos.iY=iDev->SizeInPixels().iHeight;
1070 pos.iX+=iFont->AscentInPixels()+3;
1072 pos.iX+=iFont->HeightInPixels()+1-iFont->AscentInPixels();
1073 iGc->DrawTextVertical(_L("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),pos,dir);
1075 pos.iX+=iFont->HeightInPixels()+3-iFont->AscentInPixels();
1077 pos.iX+=iFont->AscentInPixels()+5;
1079 iDev->ReleaseFont(iFont);
1081 if (pos.iX > iDev->SizeInPixels().iWidth)
1089 @SYMTestCaseID GRAPHICS-BITGDI-0080
1093 @SYMTestCaseDesc Vertical Text in a box
1095 @SYMTestPriority High
1097 @SYMTestStatus Implemented
1099 @SYMTestActions Draws text in varied weight and typeface to a gc in a vertical manner within a rect
1101 @SYMTestExpectedResults Test should perform graphics operations succesfully.
1103 void CTFont::DoVerticalBoxL()
1108 fsp.iTypeface.iName=_L("Swiss");
1110 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1111 iGc->UseFont(iFont);
1114 TInt b = iDev->SizeInPixels().iHeight - 20;
1115 TRect r1(60,t,80,b);
1116 TRect r2(100,t,120,b);
1117 TRect r3(140,t,160,b);
1118 TRect r4(180,t,200,b);
1119 TRect r5(220,t,240,b);
1121 TRect r6(440,t,460,b);
1122 TRect r7(400,t,420,b);
1123 TRect r8(360,t,380,b);
1124 TRect r9(320,t,340,b);
1125 TRect r10(280,t,300,b);
1127 iGc->DrawTextVertical(_L("Font test code:"),TPoint(t,b),ETrue);
1128 iGc->DrawTextVertical(_L("Left aligned"),r1,14,ETrue,CGraphicsContext::ELeft);
1129 iGc->DrawTextVertical(_L("With margin"),r2,14,ETrue,CGraphicsContext::ELeft,50);
1130 iGc->DrawTextVertical(_L("Centred"),r3,14,ETrue,CGraphicsContext::ECenter);
1131 iGc->DrawTextVertical(_L("Right aligned"),r4,14,ETrue,CGraphicsContext::ERight);
1132 iGc->DrawTextVertical(_L("With margin"),r5,14,ETrue,CGraphicsContext::ERight,30);
1134 iGc->DrawTextVertical(_L("Font test code:"),TPoint(r6.iBr.iX + t,t),EFalse);
1135 iGc->DrawTextVertical(_L("Left aligned"),r6,14,EFalse,CGraphicsContext::ELeft);
1136 iGc->DrawTextVertical(_L("With margin"),r7,14,EFalse,CGraphicsContext::ELeft,50);
1137 iGc->DrawTextVertical(_L("Centred"),r8,14,EFalse,CGraphicsContext::ECenter);
1138 iGc->DrawTextVertical(_L("Right aligned"),r9,14,EFalse,CGraphicsContext::ERight);
1139 iGc->DrawTextVertical(_L("With margin"),r10,14,EFalse,CGraphicsContext::ERight,30);
1141 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
1142 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1143 iGc->SetPenSize(TSize(1,1));
1156 iDev->ReleaseFont(iFont);
1161 @SYMTestCaseID GRAPHICS-BITGDI-0081
1165 @SYMTestCaseDesc Super/subscript
1167 @SYMTestPriority High
1169 @SYMTestStatus Implemented
1171 @SYMTestActions tests the drawing of super and subscript fonts to the gc
1173 @SYMTestExpectedResults Test should perform graphics operations succesfully.
1175 void CTFont::DoSuperSubScriptL()
1179 TInt separation = iDev->SizeInPixels().iHeight / 6;
1180 TPoint textPos(20,separation);
1182 CFbsFont* fnorm=NULL;
1183 CFbsFont* fsuper=NULL;
1184 CFbsFont* fsub=NULL;
1187 fsp.iTypeface.iName=_L("Swiss");
1190 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(fnorm,fsp));
1191 fsp.iFontStyle.SetPrintPosition(EPrintPosSuperscript);
1192 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(fsuper,fsp));
1193 fsp.iFontStyle.SetPrintPosition(EPrintPosSubscript);
1194 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(fsub,fsp));
1196 iGc->UseFont(fnorm);
1197 iGc->DrawText(_L("H"),textPos);
1199 iGc->DrawText(_L("2"));
1200 iGc->UseFont(fnorm);
1201 iGc->DrawText(_L("O"));
1203 textPos.iY += separation;
1204 iGc->DrawText(_L("X"),textPos);
1205 iGc->UseFont(fsuper);
1206 iGc->DrawText(_L("2"));
1207 iGc->UseFont(fnorm);
1208 iGc->DrawText(_L("+Y"));
1209 iGc->UseFont(fsuper);
1210 iGc->DrawText(_L("2"));
1211 iGc->UseFont(fnorm);
1212 iGc->DrawText(_L("=Z"));
1213 iGc->UseFont(fsuper);
1214 iGc->DrawText(_L("2"));
1216 textPos.iY += separation;
1217 iGc->UseFont(fnorm);
1218 iGc->DrawText(_L("S"),textPos);
1219 iGc->UseFont(fsuper);
1220 iGc->DrawText(_L("uper"));
1221 iGc->UseFont(fnorm);
1222 iGc->DrawText(_L("S"));
1223 iGc->UseFont(fsuper);
1224 iGc->DrawText(_L("cript"));
1226 textPos.iY += separation;
1227 iGc->UseFont(fnorm);
1228 iGc->DrawText(_L("S"),textPos);
1230 iGc->DrawText(_L("ub"));
1231 iGc->UseFont(fnorm);
1232 iGc->DrawText(_L("S"));
1234 iGc->DrawText(_L("cript"));
1236 textPos.iY += separation;
1237 iGc->UseFont(fnorm);
1238 iGc->DrawText(_L("Normal"),textPos);
1241 iDev->ReleaseFont(fnorm);
1242 iDev->ReleaseFont(fsuper);
1243 iDev->ReleaseFont(fsub);
1248 @SYMTestCaseID GRAPHICS-BITGDI-0082
1252 @SYMTestCaseDesc Underlining/strikethrough
1254 @SYMTestPriority High
1256 @SYMTestStatus Implemented
1258 @SYMTestActions tests the drawing of Underlining and strikethrough fonts to the gc
1260 @SYMTestExpectedResults Test should perform graphics operations succesfully.
1262 void CTFont::DoUlStL()
1264 iGc->SetPenColor(KRgbBlack);
1265 iGc->SetBrushColor(KRgbWhite);
1266 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1268 iGc->SetUnderlineStyle(EUnderlineOn);
1269 iGc->SetStrikethroughStyle(EStrikethroughOn);
1271 fsp.iTypeface.iName=_L("Swiss");
1273 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1274 iGc->UseFont(iFont);
1275 iDev->ReleaseFont(iFont);
1276 iGc->DrawText(_L(" "),TPoint(10,iDev->SizeInPixels().iHeight/3));
1278 for(;height<1000;height+=50)
1281 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1282 iGc->UseFont(iFont);
1283 iDev->ReleaseFont(iFont);
1286 iGc->DrawText(_L(" "));
1290 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1291 iGc->UseFont(iFont);
1292 iDev->ReleaseFont(iFont);
1293 iGc->DrawText(_L(" "),TPoint(10,iDev->SizeInPixels().iHeight*3/4));
1294 for(;height<2000;height+=50)
1297 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1298 iGc->UseFont(iFont);
1299 iDev->ReleaseFont(iFont);
1302 iGc->DrawText(_L(" "));
1305 iGc->SetUnderlineStyle(EUnderlineOff);
1306 iGc->SetStrikethroughStyle(EStrikethroughOff);
1312 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4006
1316 @SYMTestCaseDesc Text drawing in context
1318 @SYMTestPriority High
1320 @SYMTestStatus Implemented
1322 @SYMTestActions Tests drawing ,mainly punctuation marks in context to a gc
1324 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn to the screen, and all punctuations should be drawn to the horizontal baseline of the script of the character that preceded the punctuation marks.
1326 void CTFont::DrawTextInContext()
1331 fsp.iTypeface.iName=_L("Series 60 Sans");
1333 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1334 iGc->UseFont(iFont);
1336 TInt ascent=iFont->AscentInPixels();
1337 TPoint pt(10,ascent+10);
1338 CGraphicsContext::TTextParameters param;
1341 iGc->DrawText(_L("Punctuations in various scripts:"),¶m,pt);
1345 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1346 iGc->UseFont(iFont);
1351 iGc->DrawText(_L("This text will not be drawnK.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Latin This text will not be drawn"),¶m,pt);
1354 iGc->DrawText(_L("This text will not be drawn\x0915.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Hindi This text will not be drawn"),¶m,pt);
1357 iGc->DrawText(_L("This text will not be drawn\x0C85.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Kannada This text will not be drawn"),¶m,pt);
1360 iDev->ReleaseFont(iFont);
1364 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4005
1368 @SYMTestCaseDesc Text drawing in a box in context - 1
1370 @SYMTestPriority High
1372 @SYMTestStatus Implemented
1374 @SYMTestActions Tests drawing of boxed text,mainly punctuation marks in context to a gc
1376 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn in boxes to the screen, and all punctuations should be drawn to the horizontal baseline of the script of the character that preceded the punctuation marks.
1378 void CTFont::DrawTextInContextBox()
1383 fsp.iTypeface.iName=_L("Series 60 Sans");
1385 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1386 iGc->UseFont(iFont);
1388 TInt ascent=iFont->AscentInPixels();
1389 TPoint pt(10,ascent+10);
1390 CGraphicsContext::TTextParameters param;
1393 iGc->DrawText(_L("Punctuations in various scripts in a box:"),¶m,pt);
1396 iDev->ReleaseFont(iFont);
1398 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1399 iGc->UseFont(iFont);
1403 iGc->DrawText(_L("This text will not be drawnK.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Latin This text will not be drawn"),¶m,TRect(10,50,640,120),40,CGraphicsContext::ELeft);
1405 iGc->DrawText(_L("This text will not be drawn\x0915.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Hindi This text will not be drawn"),¶m,TRect(10,100,640,170),40,CGraphicsContext::ELeft);
1407 iGc->DrawText(_L("This text will not be drawn\x0C85.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Kannada This text will not be drawn"),¶m,TRect(10,150,640,220),40,CGraphicsContext::ELeft);
1408 User::After(TTimeIntervalMicroSeconds32(8000000));
1411 iDev->ReleaseFont(iFont);
1415 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4004
1419 @SYMTestCaseDesc Vertical drawing of text in context
1421 @SYMTestPriority High
1423 @SYMTestStatus Implemented
1425 @SYMTestActions Tests vertical drawing of text, mainly punctuation marks, in context to a gc
1427 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn vertically to the screen, and all punctuations should be drawn to the vertical baseline of the script of the character that preceded the punctuation marks.
1429 void CTFont::DrawTextInContextVertical()
1434 fsp.iTypeface.iName=_L("Series 60 Sans");
1436 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1437 iGc->UseFont(iFont);
1439 TInt descent=iFont->DescentInPixels();
1440 TPoint pt(descent+10,10);
1441 CGraphicsContext::TTextParameters param;
1445 iGc->DrawTextVertical(_L("This text will not be drawnK.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Latin This text will not be drawn"),¶m,pt,EFalse);
1446 User::After(TTimeIntervalMicroSeconds32(400000));
1449 iGc->DrawTextVertical(_L("This text will not be drawn\x0915.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Hindi This text will not be drawn"),¶m,pt,EFalse);
1450 User::After(TTimeIntervalMicroSeconds32(400000));
1453 iGc->DrawTextVertical(_L("This text will not be drawn\x0C85.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Kannada This text will not be drawn"),¶m,pt,EFalse);
1456 iDev->ReleaseFont(iFont);
1460 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4003
1464 @SYMTestCaseDesc Text drawing in a box in context - 2
1466 @SYMTestPriority High
1468 @SYMTestStatus Implemented
1470 @SYMTestActions Tests drawing of boxed text in context to a gc
1472 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn in boxes to the screen
1474 void CTFont::BoxInContext()
1476 iGc->SetPenSize(TSize(0,0));
1477 iGc->SetBrushColor(KRgbWhite);
1478 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1480 CGraphicsContext::TTextParameters param;
1483 iGc->DrawText(_L("(This text will not be drawn)Font test code:(This text will not be drawn)"),¶m,TPoint(20,20));
1485 iGc->DrawText(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m,TPoint(20,40));
1487 iGc->DrawText(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1489 iGc->DrawText(_L("(This text will not be drawn)Box text (left aligned)(This text will not be drawn)"),¶m,TRect(20,50,320,70),14,CGraphicsContext::ELeft);
1491 iGc->DrawText(_L("(This text will not be drawn)Box text (left aligned with margin)(This text will not be drawn)"),¶m,TRect(20,70,320,90),14,CGraphicsContext::ELeft,50);
1493 iGc->DrawText(_L("(This text will not be drawn)Box text (centred)(This text will not be drawn)"),¶m,TRect(20,90,320,110),14,CGraphicsContext::ECenter);
1495 iGc->DrawText(_L("(This text will not be drawn)Box text (right aligned)(This text will not be drawn)"),¶m,TRect(20,110,320,130),14,CGraphicsContext::ERight);
1497 iGc->DrawText(_L("(This text will not be drawn)Box text (right aligned with margin)(This text will not be drawn)"),¶m,TRect(20,130,320,150),14,CGraphicsContext::ERight,30);
1499 iGc->DrawText(_L("(This text will not be drawn)(Boxes drawn afterwards)(This text will not be drawn)"),¶m,TPoint(20,165));
1500 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1501 iGc->DrawRect(TRect(20,50,320,70));
1502 iGc->DrawRect(TRect(20,70,320,90));
1503 iGc->DrawRect(TRect(20,90,320,110));
1504 iGc->DrawRect(TRect(20,110,320,130));
1506 iGc->SetBrushColor(TRgb(128,128,128));
1507 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1509 iGc->DrawText(_L("(This text will not be drawn)Box text (left aligned)(This text will not be drawn)"),¶m,TRect(320,50,620,70),14,CGraphicsContext::ELeft);
1511 iGc->DrawText(_L("(This text will not be drawn)Box text (left aligned with margin)(This text will not be drawn)"),¶m,TRect(320,70,620,90),14,CGraphicsContext::ELeft,50);
1513 iGc->DrawText(_L("(This text will not be drawn)Box text (centred)(This text will not be drawn)"),¶m,TRect(320,90,620,110),14,CGraphicsContext::ECenter);
1515 iGc->DrawText(_L("(This text will not be drawn)Box text (right aligned)(This text will not be drawn)"),¶m,TRect(320,110,620,130),14,CGraphicsContext::ERight);
1517 iGc->DrawText(_L("(This text will not be drawn)Box text (right aligned with margin)(This text will not be drawn)"),¶m,TRect(320,130,620,150),14,CGraphicsContext::ERight,30);
1518 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1519 iGc->DrawRect(TRect(320,50,620,70));
1520 iGc->DrawRect(TRect(320,70,620,90));
1521 iGc->DrawRect(TRect(320,90,620,110));
1522 iGc->DrawRect(TRect(320,110,620,130));
1523 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1524 TInt width=iFont->TextWidthInPixels(_L("Box text followed by positionless text."));
1526 iGc->DrawText(_L("(This text will not be drawn)Box text(This text will not be drawn)"),¶m,TRect(20,150,620,170),14,width);
1528 iGc->DrawText(_L("(This text will not be drawn) followed by positionless text.(This text will not be drawn)"),¶m);
1530 iGc->DrawText(_L("(This text will not be drawn)Box text(This text will not be drawn)"),¶m,TRect(20,170,620,190),14,width,CGraphicsContext::ELeft,20);
1532 iGc->DrawText(_L("(This text will not be drawn) followed by positionless text.(This text will not be drawn)"),¶m);
1534 iGc->DrawText(_L("(This text will not be drawn)Box text(This text will not be drawn)"),¶m,TRect(20,190,620,210),14,width,CGraphicsContext::ECenter);
1536 iGc->DrawText(_L("(This text will not be drawn) followed by positionless text.(This text will not be drawn)"),¶m);
1538 iGc->DrawText(_L("(This text will not be drawn)Box text(This text will not be drawn)"),¶m,TRect(20,210,620,230),14,width,CGraphicsContext::ERight,20);
1540 iGc->DrawText(_L("(This text will not be drawn) followed by positionless text.(This text will not be drawn)"),¶m);
1541 iGc->DrawText(_L(""),TRect(20,230,620,250),14,width);
1542 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1543 iGc->DrawRect(TRect(20,150,620,170));
1544 iGc->DrawRect(TRect(20,170,620,190));
1545 iGc->DrawRect(TRect(20,190,620,210));
1546 iGc->DrawRect(TRect(20,210,620,230));
1550 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4002
1554 @SYMTestCaseDesc Text drawing and justification in context
1556 @SYMTestPriority High
1558 @SYMTestStatus Implemented
1560 @SYMTestActions Tests drawing of justified text in context to a gc
1562 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn to the screen, and it should be justified within the context
1564 void CTFont::JustificationInContext()
1566 iGc->SetUnderlineStyle(EUnderlineOff);
1567 iGc->SetStrikethroughStyle(EStrikethroughOff);
1568 iGc->SetPenSize(TSize(0,0));
1569 iGc->SetBrushColor(KRgbWhite);
1570 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1572 CGraphicsContext::TTextParameters param;
1575 iGc->DrawText(_L("(This text will not be drawn)Font test code:(This text will not be drawn)"),¶m,TPoint(20,20));
1577 iGc->DrawText(_L("(This text will not be drawn)Normal text printing in one whole line(This text will not be drawn)"),¶m,TPoint(20,40));
1578 iGc->SetCharJustification(18,6);
1579 iGc->SetWordJustification(0,0);
1581 iGc->DrawText(_L("(This text will not be drawn)Normal text printing in one whole line(This text will not be drawn)"),¶m,TPoint(20,60));
1582 iGc->SetCharJustification(0,0);
1583 iGc->SetWordJustification(30,6);
1585 iGc->DrawText(_L("(This text will not be drawn)Normal text printing in one whole line(This text will not be drawn)"),¶m,TPoint(20,80));
1586 iGc->SetCharJustification(18,6);
1587 iGc->SetWordJustification(30,6);
1589 iGc->DrawText(_L("(This text will not be drawn)Normal text printing in one whole line(This text will not be drawn)"),¶m,TPoint(20,100));
1590 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing in one whole line(This text will not be drawn)"));
1592 iGc->DrawText(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m,TPoint(20,120));
1593 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m);
1595 iGc->DrawText(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1596 iGc->UpdateJustification(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1597 iGc->SetCharJustification(18,6);
1598 iGc->SetWordJustification(0,0);
1600 iGc->DrawText(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m,TPoint(20,140));
1601 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m);
1603 iGc->DrawText(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1604 iGc->SetCharJustification(0,0);
1605 iGc->SetWordJustification(30,6);
1607 iGc->DrawText(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m,TPoint(20,160));
1608 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m);
1610 iGc->DrawText(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1611 iGc->SetCharJustification(18,6);
1612 iGc->SetWordJustification(30,6);
1614 iGc->DrawText(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m,TPoint(20,180));
1615 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing, followed by posi(This text will not be drawn)"),¶m);
1617 iGc->DrawText(_L("(This text will not be drawn)tionless printing (halfway thro' posi-tionless).(This text will not be drawn)"),¶m);
1618 iGc->SetCharJustification(150,50);
1619 iGc->SetWordJustification(50,10);
1621 iGc->DrawText(_L("(This text will not be drawn)Normal text printing in one whole line,(This text will not be drawn)"),¶m,TPoint(20,200));
1622 iGc->UpdateJustification(_L("(This text will not be drawn)Normal text printing in one whole line,(This text will not be drawn)"),¶m);
1624 iGc->DrawText(_L("(This text will not be drawn)followed by more text, carrying over justification.(This text will not be drawn)"),¶m,TPoint(20,220));
1625 iGc->SetCharJustification(0,0);
1626 iGc->SetWordJustification(0,0);
1630 @SYMTestCaseID GRAPHICS-SYSLIB-BITGDI-UT-4001
1634 @SYMTestCaseDesc Text drawing in context
1636 @SYMTestPriority High
1638 @SYMTestStatus Implemented
1640 @SYMTestActions Tests drawing of normal/justified/vertical/boxed text in context to a gc
1642 @SYMTestExpectedResults Test should perform graphics operations succesfully, i.e. only text within the context should be drawn to the screen
1644 void CTFont::DoTextFormatsInContextL()
1649 fsp.iTypeface.iName=_L("Series 60 Sans");
1651 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1652 iGc->UseFont(iFont);
1654 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4006"));
1655 DrawTextInContext();
1656 ((CTFontStep*)iStep)->RecordTestResultL();
1658 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4005"));
1659 DrawTextInContextBox();
1660 ((CTFontStep*)iStep)->RecordTestResultL();
1662 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4004"));
1663 DrawTextInContextVertical();
1664 ((CTFontStep*)iStep)->RecordTestResultL();
1668 iDev->ReleaseFont(iFont);
1670 fsp.iTypeface.iName=_L("Swiss");
1673 User::LeaveIfError(GetNearestFontToDesignHeightInTwips(iFont,fsp));
1674 iGc->UseFont(iFont);
1676 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4003"));
1678 ((CTFontStep*)iStep)->RecordTestResultL();
1681 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4002"));
1682 JustificationInContext();
1683 ((CTFontStep*)iStep)->RecordTestResultL();
1687 iDev->ReleaseFont(iFont);
1688 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4001"));
1691 void CTFont::ResetGc()
1693 iGc->SetUnderlineStyle(EUnderlineOff);
1694 iGc->SetStrikethroughStyle(EStrikethroughOff);
1695 iGc->SetPenSize(TSize(1,1));
1696 iGc->SetPenColor(KRgbBlack);
1697 iGc->SetBrushColor(KRgbWhite);
1698 iGc->SetPenStyle(CGraphicsContext::ENullPen);
1699 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1701 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
1702 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1705 TInt CTFont::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
1707 TInt ret = iDev->GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec);
1708 if (ret != KErrNone)
1713 CBitmapFont* bitmapFont = CFbsFontEx::FontAddress(aFont);
1714 iFontCallCounter.iInjector.InjectShellcode(bitmapFont, &iFontCallCounter);
1715 if (bitmapFont->IsOpenFont())
1717 iOpenFontCallCounter.iInjector.InjectShellcode(bitmapFont->OpenFont(), &iOpenFontCallCounter);
1723 TInt CTFont::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
1725 TInt ret = iDev->GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec);
1726 if (ret != KErrNone)
1731 CBitmapFont* bitmapFont = CFbsFontEx::FontAddress(aFont);
1732 iFontCallCounter.iInjector.InjectShellcode(bitmapFont, &iFontCallCounter);
1733 if (bitmapFont->IsOpenFont())
1735 iOpenFontCallCounter.iInjector.InjectShellcode(bitmapFont->OpenFont(), &iOpenFontCallCounter);
1741 void CTFont::RunTestCaseL(TInt aCurTestCase)
1743 ((CTFontStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1744 switch(aCurTestCase)
1748 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0075"));
1749 INFO_PRINTF1(_L("All fonts"));
1750 TRAPD(ret, DoAllFontsL());
1751 TEST(ret == KErrNone);
1752 INFO_PRINTF2(_L("Test case 'All fonts' ended with ret='%d'\n"), ret);
1757 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0076"));
1758 INFO_PRINTF1(_L("Text formatting"));
1759 TRAPD(ret, DoTextFormatsL());
1760 TEST(ret == KErrNone);
1761 INFO_PRINTF2(_L("Test case 'Text formatting' ended with ret='%d'\n"), ret);
1766 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0077"));
1767 INFO_PRINTF1(_L("Check text drawing"));
1768 TRAPD(ret, DoBitAlignmentL());
1769 TEST(ret == KErrNone);
1770 INFO_PRINTF2(_L("Test case 'Check text drawing' ended with ret='%d'\n"), ret);
1775 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0078"));
1776 INFO_PRINTF1(_L("Large fonts"));
1777 TRAPD(ret, DoLargeFontsL());
1778 TEST(ret == KErrNone);
1779 INFO_PRINTF2(_L("Test case 'Large fonts' ended with ret='%d'\n"), ret);
1784 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0080"));
1785 INFO_PRINTF1(_L("Vertical text"));
1786 TRAPD(ret, DoVerticalText();
1787 ((CTFontStep*)iStep)->RecordTestResultL();
1788 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0079"));
1790 TEST(ret == KErrNone);
1791 INFO_PRINTF2(_L("Test case 'Vertical text' ended with ret='%d'\n"), ret);
1796 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0081"));
1797 INFO_PRINTF1(_L("Super/subscript"));
1798 TRAPD(ret, DoSuperSubScriptL());
1799 TEST(ret == KErrNone);
1800 INFO_PRINTF2(_L("Test case 'Super/subscript' ended with ret='%d'\n"), ret);
1805 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0082"));
1806 INFO_PRINTF1(_L("Underlining/strikethrough"));
1807 TRAPD(ret, DoUlStL());
1808 TEST(ret == KErrNone);
1809 INFO_PRINTF2(_L("Test case 'Underlining/strikethrough' ended with ret='%d'\n"), ret);
1814 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0074"));
1815 INFO_PRINTF1(_L("Anti-aliased text"));
1816 TRAPD(ret, DoAntiAliasedTextL());
1817 TEST(ret == KErrNone);
1818 INFO_PRINTF2(_L("Test case 'Anti-aliased text' ended with ret='%d'\n"), ret);
1823 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0075"));
1824 INFO_PRINTF1(_L("FaceCache Performance text"));
1826 TInt64 starttime = User::FastCounter();
1827 TRAPD(ret, DoAllFontsL());
1828 TInt64 endtime = User::FastCounter();
1829 TEST(ret == KErrNone);
1832 User::LeaveIfError(HAL::Get(HALData::EFastCounterFrequency, freq));
1833 TInt64 diff = (1000000*(endtime - starttime)) / (TInt64)freq;
1835 INFO_PRINTF3(_L("Test case 'FaceCache Performance text' ended in '%Ld' usec with ret='%d'\n"), diff, ret);
1841 @SYMTestCaseID GRAPHICS-BITGDI-0116
1843 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0116"));
1844 INFO_PRINTF1(_L("Font Externalize/Internalize"));
1845 TRAPD(ret, FontExternalizeL());
1846 TEST(ret==KErrNone);
1847 INFO_PRINTF2(_L("Test case 'Font Externalize/Internalize' ended with ret='%d'\n"), ret);
1852 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-SYSLIB-BITGDI-UT-4001"));
1853 INFO_PRINTF1(_L("Text formatting"));
1854 TRAPD(ret, DoTextFormatsInContextL());
1855 TEST(ret == KErrNone);
1856 INFO_PRINTF2(_L("Test case 'Text formatting' ended with ret='%d'\n"), ret);
1862 @SYMTestCaseID GRAPHICS-BITGDI-0118
1863 @SYMTestPriority High
1865 @SYMTestStatus Implemented
1869 Tests that there are no virtual function calls to objects in FBServ's shared heap from outside
1870 the FBServ process. Such function calls only work if DLLs are guaranteed to be mapped at the
1871 same logical address in every process. This is not necessarily true for all memory models.
1874 Intercepts the VF table in the CBitmapFont and COpenFont objects corresponding to the fonts used in the
1875 preceding BitGDI tests so that virtual function calls from outside the FBServ process are recorded.
1877 @SYMTestExpectedResults
1878 Number of virtual function calls to CBitmapFont and COpenFont from outside FBServ is 0
1880 ((CTFontStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0118"));
1881 // this one should always be the last test, since it checks the final virtual function call count
1883 INFO_PRINTF1(_L("Test no virtual function calls to objects in FBServ's shared heap from outside FBServ process"));
1884 TEST(iFontCallCounter.iVFCallsOutsideFBServ == 0);
1885 TEST(iOpenFontCallCounter.iVFCallsOutsideFBServ == 0);
1887 INFO_PRINTF1(_L("Test no virtual function calls to objects in FBServ's shared heap from outside FBServ process - skipped on target"));
1893 ((CTFontStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1894 ((CTFontStep*)iStep)->CloseTMSGraphicsStep();
1899 ((CTFontStep*)iStep)->RecordTestResultL();
1903 //--------------------------------------------------------------
1905 __CONSTRUCT_STEP__(Font)
1907 void CTFontStep::TestSetupL()
1910 User::LeaveIfError(RFbsSession::Connect());
1913 void CTFontStep::TestClose()
1915 RFbsSession::Disconnect();