sl@0: /* sl@0: * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "FNTSTD.H" sl@0: #include "t_linkedfontscomparison.h" sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: @file sl@0: sl@0: @SYMPurpose structures used to define linked typefaces used in this test, create and sl@0: use linked typefaces, and check against a hash value sl@0: */ sl@0: sl@0: /** this is for the group entries sl@0: */ sl@0: struct TTGroup sl@0: { sl@0: CLinkedTypefaceGroup::TBaselineShift iBaselineShift; sl@0: CLinkedTypefaceGroup::TScalingOption iScalingOption; sl@0: TInt iAntiAliasThreshold; //KMinTInt for do not set; sl@0: TInt iBoldnessPercentage; //KMinTInt for do not set; sl@0: TInt iItalicAngle; //KMinTInt for do not set; sl@0: }; sl@0: sl@0: /** this is for linked font elements sl@0: */ sl@0: struct TTLinkedFontElement sl@0: { sl@0: const TPtrC iTypefaceName; sl@0: TInt iGroup; sl@0: TBool iIsCanonical; sl@0: }; sl@0: sl@0: /** this is for the linked typeface table sl@0: */ sl@0: struct TTLinkedTypeface sl@0: { sl@0: const TPtrC iTypefaceName; sl@0: const TTLinkedFontElement* iElements; sl@0: }; sl@0: sl@0: /** this is a plain group sl@0: */ sl@0: const TTGroup KPlainGroup = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: sl@0: const TTGroup KGroup1 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set - antialiased sl@0: KMinTInt, //this value means do not set - boldness percentage sl@0: KMinTInt, //this value means do not set - italic angle sl@0: }; sl@0: sl@0: const TTGroup KGroup2 = sl@0: { sl@0: CLinkedTypefaceGroup::EBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingUp, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup3 = sl@0: { sl@0: CLinkedTypefaceGroup::EBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingUpOrDown, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup4 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: 14, //antialiased sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup5 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: 10, //antialiased sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup6 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: 100, //boldness percentage sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup7 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: 10, //boldness percentage sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup8 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: 10, //italic angle sl@0: }; sl@0: const TTGroup KGroup9 = sl@0: { sl@0: CLinkedTypefaceGroup::EBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: }; sl@0: const TTGroup KGroup10 = sl@0: { sl@0: CLinkedTypefaceGroup::ENoBaselineShift, sl@0: CLinkedTypefaceGroup::EScalingNone, sl@0: KMinTInt, //this value means do not set sl@0: KMinTInt, //this value means do not set sl@0: 40, //large italic angle sl@0: }; sl@0: sl@0: /** all the groups are added to every linked typeface sl@0: if there are too many groups then there may be a need for a group list sl@0: per linked typeface. Can have a maximum of 12 groups sl@0: */ sl@0: const TTGroup* KGroupList[]= sl@0: { sl@0: &KPlainGroup, /* index 0 */ sl@0: &KGroup1, sl@0: &KGroup2, sl@0: &KGroup3, sl@0: &KGroup4, sl@0: &KGroup5, sl@0: &KGroup6, sl@0: &KGroup7, sl@0: &KGroup8, sl@0: &KGroup9, sl@0: &KGroup10, sl@0: }; sl@0: sl@0: /** typeface element definitions sl@0: */ sl@0: sl@0: /** Latin font sl@0: */ sl@0: const TTLinkedFontElement KLatinFontCanonical = sl@0: { sl@0: _L("DejaVu Sans Condensed"),0, ETrue //name, group zero, is canonical sl@0: }; sl@0: sl@0: /** sl@0: */ sl@0: const TTLinkedFontElement KJapaneseNotCanonical = sl@0: { sl@0: _L("TBKomachiG-R"), 0, EFalse //name, group zero, not canonical sl@0: }; sl@0: sl@0: /** Japanese - to be updated sl@0: */ sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup1 = sl@0: { sl@0: _L("TBKomachiG-R"), 1, EFalse //name, group , not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup3 = sl@0: { sl@0: _L("TBKomachiG-R"), 3, EFalse //name, group, not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup4 = sl@0: { sl@0: _L("TBKomachiG-R"), 4, EFalse //name, group, not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup6 = sl@0: { sl@0: _L("TBKomachiG-R"), 6, EFalse //name, group, not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup8 = sl@0: { sl@0: _L("TBKomachiG-R"), 8, EFalse //name, group, not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup9 = sl@0: { sl@0: _L("TBKomachiG-R"), 9, EFalse //name, group, not canonical sl@0: }; sl@0: const TTLinkedFontElement KJapaneseNotCanonicalGroup10 = sl@0: { sl@0: _L("TBKomachiG-R"), 10, EFalse //name, group, not canonical sl@0: }; sl@0: sl@0: const TTLinkedFontElement KLatinFontTTNotCanonicalGroup0 = sl@0: { sl@0: _L("LinkedFontTestFont"), 0, EFalse sl@0: }; sl@0: sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup0 = sl@0: { sl@0: _L("LinkedFontTestFont"), 0, ETrue sl@0: }; sl@0: sl@0: /* for use case testing */ sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup2 = sl@0: { sl@0: _L("LinkedFontTestFont"), 2, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup3 = sl@0: { sl@0: _L("LinkedFontTestFont"), 3, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup5 = sl@0: { sl@0: _L("LinkedFontTestFont"), 5, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup7 = sl@0: { sl@0: _L("LinkedFontTestFont"), 7, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup8 = sl@0: { sl@0: _L("LinkedFontTestFont"), 8, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup9 = sl@0: { sl@0: _L("LinkedFontTestFont"), 9, ETrue sl@0: }; sl@0: const TTLinkedFontElement KLatinFontTTCanonicalGroup10 = sl@0: { sl@0: _L("LinkedFontTestFont"), 10, ETrue sl@0: }; sl@0: sl@0: /** Chandas sl@0: */ sl@0: const TTLinkedFontElement KHindiCanonical = sl@0: { sl@0: _L("Chandas"), 0, ETrue sl@0: }; sl@0: sl@0: /** Chandas sl@0: */ sl@0: const TTLinkedFontElement KHindiNotCanonical = sl@0: { sl@0: _L("Chandas"), 0, EFalse sl@0: }; sl@0: sl@0: /** Information about linked fonts sl@0: TLinkedFont1.ttf sl@0: Typeface name: LinkedFont1 sl@0: This will be the dominant font. It contains 178 characters. sl@0: Some of the characters (13) are deleted from this file and separated in to other three files. sl@0: Characters missing are F, D, J, M, P, S, V, X, Z, a, n, l, y. sl@0: sl@0: TLinkedFont2.ttf sl@0: Typeface name: LinkedFont2 sl@0: Characters available (7): F, J, M, S, Z, a, y. sl@0: sl@0: TLinkedFont3.ttf sl@0: Typeface name: LinkedFont3 sl@0: Characters available (4): D, P, x, l sl@0: sl@0: TLinkedFont4.ttf sl@0: Typeface name: LinkedFont4 sl@0: Characters available (2): V, n sl@0: sl@0: TWithoutLinkedFont.ttf sl@0: Typeface name: WithoutLinkedFont sl@0: Characters available: It contains 191 characters U+0020-U+007E and U+00A0-U+00FF sl@0: */ sl@0: sl@0: /** LinkedFont1TT sl@0: */ sl@0: const TTLinkedFontElement KLinkedFont1TT = sl@0: { sl@0: _L("LinkedFont1TT"), 0, EFalse sl@0: }; sl@0: sl@0: /** LinkedFont2TT sl@0: */ sl@0: const TTLinkedFontElement KLinkedFont2TTCanonical = sl@0: { sl@0: _L("LinkedFont2TT"), 0, ETrue sl@0: }; sl@0: sl@0: /** LinkedFont3TT sl@0: */ sl@0: const TTLinkedFontElement KLinkedFont3TT = sl@0: { sl@0: _L("LinkedFont3TT"), 0, EFalse sl@0: }; sl@0: sl@0: /** LinkedFont4TT sl@0: */ sl@0: const TTLinkedFontElement KLinkedFont4TT = sl@0: { sl@0: _L("LinkedFont4TT"), 0, EFalse sl@0: }; sl@0: sl@0: /** KNullDesC sl@0: */ sl@0: const TTLinkedFontElement KNullElement = sl@0: { sl@0: _L(""), 0, EFalse sl@0: }; sl@0: sl@0: /** linked typeface, this list is terminated by KNullElement sl@0: */ sl@0: const TTLinkedFontElement KLatinFontHindi[]= sl@0: { sl@0: KLatinFontTTNotCanonicalGroup0, sl@0: KHindiCanonical, sl@0: KNullElement, sl@0: }; sl@0: /** linked typeface, this list is terminated by KNullElement sl@0: */ sl@0: const TTLinkedFontElement KLatinFontJapanese[]= sl@0: { sl@0: KLatinFontCanonical, sl@0: KJapaneseNotCanonical, sl@0: KNullElement sl@0: }; sl@0: /** linked typeface, this list is terminated by KNullElement sl@0: */ sl@0: const TTLinkedFontElement KLinkedFontTestFonts[]= sl@0: { sl@0: KLinkedFont1TT, sl@0: KLinkedFont2TTCanonical, sl@0: KLinkedFont3TT, sl@0: KLinkedFont4TT, sl@0: KNullElement sl@0: }; sl@0: sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface1[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup2, sl@0: KJapaneseNotCanonicalGroup1, sl@0: KNullElement sl@0: }; sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface2[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup3, sl@0: KJapaneseNotCanonicalGroup3, sl@0: KNullElement sl@0: }; sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface3[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup5, sl@0: KJapaneseNotCanonicalGroup4, sl@0: KNullElement sl@0: }; sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface4[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup7, sl@0: KJapaneseNotCanonicalGroup6, sl@0: KNullElement sl@0: }; sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface5[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup8, sl@0: KJapaneseNotCanonicalGroup8, sl@0: KNullElement sl@0: }; sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface6[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup9, sl@0: KJapaneseNotCanonicalGroup9, sl@0: KNullElement sl@0: }; sl@0: sl@0: const TTLinkedFontElement KJapaneseLatinFontTypeface7[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup10, sl@0: KJapaneseNotCanonicalGroup10, sl@0: KNullElement sl@0: }; sl@0: sl@0: const TTLinkedFontElement KEnglishJapanseHindiFont[]= sl@0: { sl@0: KLatinFontTTCanonicalGroup0, sl@0: KJapaneseNotCanonical, sl@0: KHindiNotCanonical, sl@0: KNullElement sl@0: }; sl@0: sl@0: /** the linked typeface set, no need to null terminate, sizeof is used for this array sl@0: */ sl@0: const TTLinkedTypeface KLinkedTypefaces[] = sl@0: { sl@0: //name, list of linked font elements sl@0: {_L("LinkedFontTestFont"), KLinkedFontTestFonts}, sl@0: {_L("LatinFontHindi"), KLatinFontHindi}, sl@0: {_L("LatinFontJapanese"), KLatinFontJapanese}, sl@0: {_L("EnglishJapaneseHindi"), KEnglishJapanseHindiFont}, sl@0: {_L("UseCaseFont1"), KJapaneseLatinFontTypeface1}, sl@0: {_L("UseCaseFont2"), KJapaneseLatinFontTypeface2}, sl@0: {_L("UseCaseFont3"), KJapaneseLatinFontTypeface3}, sl@0: {_L("UseCaseFont4"), KJapaneseLatinFontTypeface4}, sl@0: {_L("UseCaseFont5"), KJapaneseLatinFontTypeface5}, sl@0: {_L("UseCaseFont6"), KJapaneseLatinFontTypeface6}, sl@0: {_L("UseCaseFont7"), KJapaneseLatinFontTypeface7}, sl@0: }; sl@0: sl@0: /** Enum which constains bitwise flags for attrbutes which can be set for each font sl@0: */ sl@0: enum TFontEffectsFlags sl@0: { sl@0: ENoEffect = 0x0, sl@0: EDropShadowOn = 0x1, sl@0: EOutlineOn = 0x2, sl@0: ESetMonochromeGlyphBitmap = 0x4, sl@0: ESetAntiAliasedGlyphBitmap = 0x8, sl@0: ESetFourColourBlendGlyphBitmap = 0x10, sl@0: EVerticalDraw = 0x20, sl@0: ERotate90Degrees = 0x40, sl@0: EIsStrikethroughOn = 0x80, sl@0: EIsUnderlineOn = 0x100, sl@0: ESoftEdgeOn = 0x200, sl@0: EAlgorithmicBoldOn = 0x400, sl@0: EDrawUp = 0x800, sl@0: EItalicOn = 0x1000, sl@0: ERegularBoldOn = 0x2000, sl@0: EEndOfList = 0x80000000 //a meta flag sl@0: }; sl@0: sl@0: const TInt KLengthOfHashValue = 1000; sl@0: sl@0: /** table used to produce hash string from attributes sl@0: */ sl@0: const TPtrC KFontEffectsFlagsString[32]= sl@0: { sl@0: _L("ENoEffect"), sl@0: _L("EDropShadowOn"), sl@0: _L("EOutlineOn"), sl@0: _L("ESetMonochromeGlyphBitmap"), sl@0: _L("ESetAntiAliasedGlyphBitmap"), sl@0: _L("ESetFourColourBlendGlyphBitmap"), sl@0: _L("EVerticalDraw"), sl@0: _L("ERotate90Degrees"), sl@0: _L("EIsStrikethroughOn"), sl@0: _L("EIsUnderlineOn"), sl@0: _L("ESoftEdgeOn"), sl@0: _L("EAlgorithmicBoldOn"), sl@0: _L("EDrawUp"), sl@0: _L("EItalicOn"), sl@0: _L("ERegularBoldOn"), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L(""), sl@0: _L("EEndOfList"), sl@0: }; sl@0: sl@0: sl@0: /**this structure is used to define a test case sl@0: */ sl@0: struct TTestCase sl@0: { sl@0: const TPtrC iTypeFaceName; //typeface name sl@0: const TDesC* iOutputString; //the output string sl@0: const TDesC* iTestDecription; //test description sl@0: const TPoint iPosition; //the position sl@0: const TInt* iSizes; // a list of sizes sl@0: const TUint32* iFontAttributes; //a list of font attrbutes (bitwise flags, see above sl@0: }; sl@0: sl@0: /** an array of sizes used during testing, terminated by zero sl@0: */ sl@0: const TInt KFontSizeNormalTesting[]= sl@0: { sl@0: 10, sl@0: 20, sl@0: 35, sl@0: 0 sl@0: }; sl@0: sl@0: const TInt KFontSizeUseCaseTesting[]= sl@0: { sl@0: 8, sl@0: 12, sl@0: 16, sl@0: 35, sl@0: 0 sl@0: }; sl@0: sl@0: /** an array of attributes used during font testing, terminated by EEndOfList sl@0: */ sl@0: const TUint32 KFontAttributesNormalTest[] =// probably need to expand this with position sl@0: { sl@0: ENoEffect, sl@0: EIsUnderlineOn, sl@0: EIsStrikethroughOn, sl@0: ESetFourColourBlendGlyphBitmap, sl@0: EIsUnderlineOn| EIsStrikethroughOn, sl@0: EAlgorithmicBoldOn, sl@0: EVerticalDraw, sl@0: EVerticalDraw | EIsUnderlineOn, sl@0: EVerticalDraw | EIsUnderlineOn | ERotate90Degrees, sl@0: EEndOfList, sl@0: }; sl@0: sl@0: const TUint32 KFontAttributesUseCaseTest[] =// probably need to expand this with position sl@0: { sl@0: ENoEffect, sl@0: ERegularBoldOn, sl@0: ESetAntiAliasedGlyphBitmap, sl@0: EItalicOn, sl@0: EEndOfList, sl@0: }; sl@0: sl@0: // here are the output strings which are used for testing sl@0: _LIT(KHindiText,"\x0915\x094D\x0937\x0924\x094D\x0930\x093F\x092F\x0020"); sl@0: _LIT(KEnglishText,"The quick brown fox 123"); sl@0: _LIT(KEnglishHindiText,"TEST 123 \x0915\x094D\x0937\x0924\x094D\x0930\x093F\x092F\x0020"); sl@0: _LIT(KEnglishJapaneseText,"T\x308a\x3093\x3054 ESghy LINKED FONTS 123"); sl@0: _LIT(KEnglishJapaneseHindiText, "T\x308a\x3093\x3054\x306e EST FOnTS LINKED \x0915\x094D\x0937\x0924\x094D\x0930\x093F\x092F\x0020 123"); sl@0: _LIT(KLinkedFontTestString,"lInKED FOnTS"); sl@0: sl@0: sl@0: // test descriptions sl@0: _LIT(KEnglishTest,"EnglishTest"); sl@0: _LIT(KHindiTest,"HindiTest"); sl@0: _LIT(KEnglishHindiTest,"EnglishHindiTest"); sl@0: _LIT(KEnglishJapaneseTest,"EnglishJapaneseTest"); sl@0: _LIT(KLinkedFontTest1,"LinkedFontTest-withLinking"); sl@0: _LIT(KLinkedFontTest2,"LinkedFontTest-unlinkedFont"); sl@0: _LIT(KEnglishJapaneseHindiTest,"EnglishJapaneseHindiTest"); sl@0: _LIT(KUseCaseTest,"UseCaseTest"); sl@0: sl@0: sl@0: sl@0: _LIT(KTestName0001,"TestCase001"); sl@0: /** this table defines the test cases: sl@0: font name, string, position, sizes(array), attributes(array) sl@0: */ sl@0: const TTestCase KTestCases[]= sl@0: { sl@0: {_L("LatinFontHindi"), &KHindiText,&KHindiTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("LatinFontHindi"), &KEnglishText, &KEnglishTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("LatinFontHindi"), &KEnglishHindiText, &KEnglishHindiTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("LatinFontJapanese"),&KEnglishText, &KEnglishTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("LatinFontJapanese"),&KEnglishJapaneseText, &KEnglishJapaneseTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("LinkedFontTestFont"),&KLinkedFontTestString, &KLinkedFontTest1, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("WithoutLinkedFontTT"),&KLinkedFontTestString, &KLinkedFontTest2, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: {_L("EnglishJapaneseHindi"),&KEnglishJapaneseHindiText, &KEnglishJapaneseHindiTest, TPoint(50,50),KFontSizeNormalTesting, KFontAttributesNormalTest}, sl@0: sl@0: //use case testing sl@0: {_L("UseCaseFont1"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont2"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont3"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont4"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont5"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont6"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: {_L("UseCaseFont7"),&KEnglishJapaneseText, &KUseCaseTest, TPoint(50,50),KFontSizeUseCaseTesting, KFontAttributesUseCaseTest}, sl@0: }; sl@0: sl@0: /** Class used to register the linked typefaces sl@0: */ sl@0: class CTLinkedTypefaceCreator : public CBase sl@0: { sl@0: public: sl@0: static CTLinkedTypefaceCreator* NewL(CTestStep* aStep); sl@0: void CreateL(); //creates the linked typefaces - will not leave with a registration error, but try the next sl@0: ~CTLinkedTypefaceCreator(); sl@0: private: sl@0: CTLinkedTypefaceCreator(CTestStep* aStep); sl@0: void CreateGroupsL(const TTGroup* aElement[],TInt aNumberOfElements); sl@0: void CreateElementsL(const TTLinkedFontElement* aElements); sl@0: void ConstructL(); sl@0: sl@0: private: sl@0: CTestStep* iStep; //for recording failures, not owned sl@0: RPointerArray iGroups; //owned sl@0: RPointerArray iElements; //owned sl@0: CFbsScreenDevice* iDev; //owned sl@0: }; sl@0: sl@0: /** static NewL sl@0: @return CTLinkedTypefaceCreator* sl@0: */ sl@0: CTLinkedTypefaceCreator* CTLinkedTypefaceCreator::NewL(CTestStep* aStep) sl@0: { sl@0: CTLinkedTypefaceCreator* ptr = new (ELeave) CTLinkedTypefaceCreator(aStep); sl@0: CleanupStack::PushL(ptr); sl@0: ptr->ConstructL(); sl@0: CleanupStack::Pop(); sl@0: return ptr; sl@0: } sl@0: sl@0: CTLinkedTypefaceCreator::CTLinkedTypefaceCreator(CTestStep* aStep):iStep(aStep) sl@0: { sl@0: sl@0: } sl@0: sl@0: void CTLinkedTypefaceCreator::ConstructL() sl@0: { sl@0: TDisplayMode mode[4]= {EColor16MAP, EColor16MA, EColor16MU, EColor64K}; sl@0: sl@0: TInt err=KErrNone; sl@0: for (TInt count=0;count<(sizeof(mode)/sizeof(mode[0]));count++) sl@0: { sl@0: TRAP(err, iDev = CFbsScreenDevice::NewL(KNullDesC, mode[count])); sl@0: if (err!=KErrNotSupported) sl@0: { sl@0: return; sl@0: } sl@0: } sl@0: sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: CTLinkedTypefaceCreator::~CTLinkedTypefaceCreator() sl@0: { sl@0: delete iDev; sl@0: iGroups.ResetAndDestroy(); sl@0: iElements.ResetAndDestroy(); sl@0: } sl@0: sl@0: /** function used to create the linked typefaces sl@0: */ sl@0: void CTLinkedTypefaceCreator::CreateL() sl@0: { sl@0: CFbsTypefaceStore* store = CFbsTypefaceStore::NewL(iDev); sl@0: CleanupStack::PushL(store); sl@0: sl@0: for (TInt counter=0; counter< sizeof(KLinkedTypefaces)/sizeof(TTLinkedTypeface);counter++) sl@0: { sl@0: //creating the groups needs to be done for every typeface since ownwership is taken sl@0: //after adding the group to one linked typeface specification sl@0: //leave on any failure e.g. out of memory, which is not expected sl@0: CreateGroupsL(KGroupList, sizeof(KGroupList)/sizeof(TTGroup*)); sl@0: sl@0: //create the linked typeface elements for this linked typeface sl@0: CreateElementsL(KLinkedTypefaces[counter].iElements); sl@0: sl@0: //add the groups and elements, but first create the spec sl@0: CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KLinkedTypefaces[counter].iTypefaceName); sl@0: sl@0: //add the groups sl@0: for (TInt groupCounter=0; groupCounterAddLinkedTypefaceGroupL(*iGroups[groupCounter]);//ownership is taken sl@0: iGroups[groupCounter]=NULL; sl@0: } sl@0: sl@0: //add the elements sl@0: for (TInt elementCounter=0; elementCounterAddTypefaceAtBackL(*iElements[elementCounter]);//ownership is taken sl@0: iElements[elementCounter]=NULL; sl@0: } sl@0: iElements.ResetAndDestroy(); sl@0: iGroups.ResetAndDestroy(); sl@0: sl@0: //register sl@0: TInt err=KErrNone; sl@0: TRAP(err,spec->RegisterLinkedTypefaceL(*store)); //may fail if something is wrong with the tables, want to try to continue sl@0: sl@0: //do not report test failure if already registered sl@0: iStep->testBooleanTrue(err==KErrNone || err==KErrAlreadyExists, (TText8*)__FILE__, __LINE__); sl@0: sl@0: //delete spec sl@0: CleanupStack::PopAndDestroy(); sl@0: } sl@0: CleanupStack::PopAndDestroy();//store sl@0: } sl@0: sl@0: /** function used to create the groups, note all groups are created at once, and sl@0: added to all linked typefaces sl@0: sl@0: @param aElement array of pointers to groups sl@0: @param aNumberOfElements the number of elements in the group sl@0: */ sl@0: void CTLinkedTypefaceCreator::CreateGroupsL(const TTGroup* aElement[],TInt aNumberOfElements) sl@0: { sl@0: for (TInt counter =0; counterSetScalingOption(aElement[counter]->iScalingOption); sl@0: groupPtr->SetBaselineShift(aElement[counter]->iBaselineShift); sl@0: sl@0: if (aElement[counter]->iBoldnessPercentage!=KMinTInt) sl@0: { sl@0: groupPtr->SetBoldnessPercentage(aElement[counter]->iBoldnessPercentage); sl@0: } sl@0: if (aElement[counter]->iItalicAngle!=KMinTInt) sl@0: { sl@0: groupPtr->SetItalicAngle(aElement[counter]->iItalicAngle); sl@0: } sl@0: iGroups.AppendL(groupPtr); sl@0: CleanupStack::Pop();//ptr is now on the RArray sl@0: } sl@0: } sl@0: sl@0: /** creates all the elements for one typeface sl@0: iElements is updated sl@0: sl@0: @param aElements pointer to a list of elements, terminated by a typeface with null name sl@0: */ sl@0: sl@0: void CTLinkedTypefaceCreator::CreateElementsL(const TTLinkedFontElement* aElements) sl@0: { sl@0: const TTLinkedFontElement* ptrElementSpec = aElements; sl@0: sl@0: //need a loop to go through all the typefaces sl@0: for (;ptrElementSpec->iTypefaceName!=KNullDesC;ptrElementSpec++) sl@0: { sl@0: CLinkedTypefaceElementSpec* elementSpec = CLinkedTypefaceElementSpec::NewLC(ptrElementSpec->iTypefaceName,ptrElementSpec->iGroup); sl@0: elementSpec->SetCanonical(ptrElementSpec->iIsCanonical); sl@0: iElements.AppendL(elementSpec); sl@0: CleanupStack::Pop(); sl@0: } sl@0: } sl@0: sl@0: // Code for creating fonts, drawing text, and comparing hash value sl@0: sl@0: //Considering the intersection of the screen size for both hw and emulator so that same sl@0: //baselined hash can be used to test for both sl@0: #define KScreenWidth 320 sl@0: #define KScreenHeight 240 sl@0: sl@0: const TInt KNumOfDisplayModes = 12; sl@0: sl@0: /** table of strings of display modes sl@0: */ sl@0: const TPtrC KDisplayModeNames[KNumOfDisplayModes] = sl@0: { sl@0: _L("EGray2"), sl@0: _L("EGray4"), sl@0: _L("EGray16"), sl@0: _L("EGray256"), sl@0: _L("EColor16"), sl@0: _L("EColor256"), sl@0: _L("EColor64K"), sl@0: _L("EColor16M"), sl@0: _L("EColor4K"), sl@0: _L("EColor16MU"), sl@0: _L("EColor16MA"), sl@0: _L("EColor16MAP"), sl@0: }; sl@0: sl@0: /** a mapping table index from DisplayMode into the table of strings sl@0: for supported colour modes. sl@0: The tables of strings do not include ERgb, or ENone. The value in the table is also sl@0: needed for compatibility with CTHashReferenceImages sl@0: */ sl@0: const TInt KSupportDisplayStringIndex[14] = sl@0: { sl@0: 0, //ENone - use EGray2 output string sl@0: 0, //EGray2, sl@0: 1, //EGray4, sl@0: 2, //EGray16, sl@0: 3, //EGray256, sl@0: 4, //EColor16, sl@0: 5, //EColor256, sl@0: 6, //EColor64K, sl@0: 7, //EColor16M, sl@0: 7, //ERgb sl@0: 8, //EColor4K, sl@0: 9, //EColor16MU, sl@0: 10,//EColor16MA, sl@0: 11,//EColor16MAP, sl@0: }; sl@0: sl@0: /** a helper cleanup class sl@0: */ sl@0: typedef struct sl@0: { sl@0: CBitmapDevice* device; sl@0: CFont* font; sl@0: } SCleanFont; sl@0: sl@0: /** path where the output file are to be stored (if this is configured in chashreferenceimages.cpp sl@0: */ sl@0: _LIT(KPath,"c:\\fntstoretest\\%S.mbm"); sl@0: sl@0: /** constructor sl@0: @param aStep the test step sl@0: */ sl@0: CTLinkedFontsComparison::CTLinkedFontsComparison(CTestStep *aStep):CTGraphicsBase(aStep),iStep(aStep) sl@0: { sl@0: } sl@0: sl@0: /** ConstructL sl@0: */ sl@0: void CTLinkedFontsComparison::ConstructL() sl@0: { sl@0: iFbs = RFbsSession::GetSession(); sl@0: User::LeaveIfNull(iFbs); sl@0: iHashUtil = CTHashReferenceImages::NewL(iStep,iFbs,&KPath); sl@0: } sl@0: sl@0: /** Destructor sl@0: */ sl@0: CTLinkedFontsComparison::~CTLinkedFontsComparison() sl@0: { sl@0: FreeScreenDevice(); sl@0: delete iHashUtil; sl@0: if (iFbs) sl@0: iFbs->Disconnect(); sl@0: } sl@0: sl@0: /** sl@0: Auxilary function will be called in case of a leave to release the font sl@0: @param aCleanFont font to be released sl@0: */ sl@0: void CleanUpFont(TAny* aCleanFont) sl@0: { sl@0: SCleanFont* cleanFont= static_cast(aCleanFont); sl@0: (cleanFont->device)->ReleaseFont(cleanFont->font); sl@0: } sl@0: sl@0: sl@0: class CFbsFontEx : public CFbsFont sl@0: { sl@0: public: sl@0: static CBitmapFont* FontAddress(CFbsFont* aFont); sl@0: }; sl@0: sl@0: CBitmapFont* CFbsFontEx::FontAddress(CFbsFont* aFont) sl@0: { sl@0: return(((CFbsFontEx*)aFont)->Address()); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-FNTSTORE-LINKEDFONTS-0107 sl@0: sl@0: @SYMPREQ PREQ2146 sl@0: sl@0: @SYMREQ REQ10924, REQ10925, REQ10926, REQ10927, REQ10942, REQ10943, REQ10947, REQ10949 sl@0: sl@0: @SYMTestCaseDesc This test registers linked typefaces with defintions coming from tables. sl@0: sl@0: @SYMTestActions Register a number of linked typefaces which are defined in a set of tables. sl@0: sl@0: Groups can have the following attributes: sl@0: CLinkedTypefaceGroup::TBaselineShift sl@0: CLinkedTypefaceGroup::TScalingOption sl@0: AntiAliasingThreshold (integer value) sl@0: BoldnessPercentage (integer value) sl@0: ItalicAngle (integer value) sl@0: sl@0: Typeface elements can have the following attributes: sl@0: Name sl@0: Group sl@0: Is canonical sl@0: sl@0: Linked typefaces can have the following attributes: sl@0: Name sl@0: Linked typeface elements sl@0: Groups sl@0: sl@0: For each linked typeface to be created sl@0: create linked typeface specification sl@0: create groups sl@0: add groups to linked typeface specification sl@0: create linked typeface elements sl@0: add linked typeface elements to linked typeface specification sl@0: register the specification sl@0: sl@0: To produce new linked typefaces it should be possible to do this by updating sl@0: the table entries. sl@0: sl@0: The linked typefaces should be valid. This test requires that the internal test sl@0: fonts be present. sl@0: sl@0: @SYMTestPriority Critical sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions (1)For each linked typeface, create the groups, create the linked typeface elements, sl@0: create a linked typeface, add the groups and elements, and sl@0: register the linked typeface with the font and bitmap server. sl@0: sl@0: @SYMTestExpectedResults (1) - linked font registration succeeds with no panics or leaves. If the test is run a sl@0: second time then KErrAlreadyExists is returned, which is not a failure. sl@0: */ sl@0: void CTLinkedFontsComparison::RegisterLinkedTypefacesL() sl@0: { sl@0: CTLinkedTypefaceCreator* creator = CTLinkedTypefaceCreator::NewL(iStep); sl@0: CleanupStack::PushL(creator); sl@0: creator->CreateL(); sl@0: CleanupStack::PopAndDestroy(); sl@0: } sl@0: sl@0: /** Create the screen device. sl@0: @param aMode display mode for which device has to be created sl@0: */ sl@0: void CTLinkedFontsComparison::CreateBitmapDeviceL(TDisplayMode aMode) sl@0: { sl@0: iBitmap = new(ELeave) CFbsBitmap; sl@0: //Considering the intersection of the screen size for both hw and emulator so that same sl@0: //baselined hash can be used to test for both sl@0: iBitmap->Create(TSize(KScreenWidth, KScreenHeight), aMode); sl@0: iBitmapDevice = CFbsBitmapDevice::NewL(iBitmap); sl@0: User::LeaveIfError(iBitmapDevice->CreateContext((CGraphicsContext*&)iGc)); sl@0: iHashUtil->SetScreenDeviceAndBitmap(iBitmapDevice,iBitmap,iGc); sl@0: } sl@0: sl@0: /** sl@0: Delete the devices created and gc. sl@0: */ sl@0: void CTLinkedFontsComparison::FreeScreenDevice() sl@0: { sl@0: delete iBitmapDevice; sl@0: delete iBitmap; sl@0: delete iGc; sl@0: iBitmapDevice = NULL; sl@0: iBitmap = NULL; sl@0: iGc = NULL; sl@0: } sl@0: sl@0: /** Function to generate a meaningful hash string from the test attributes sl@0: sl@0: @param aSize the size of the font sl@0: @param aAttributes the attributes of the font sl@0: @see TFontEffectsFlags sl@0: @param aTypefaceName the typeface name sl@0: sl@0: @return the buffer with a text description, used for inclusion in the hash string sl@0: */ sl@0: HBufC* CTLinkedFontsComparison::GenerateTestDescriptionLC(TInt aSize,TUint32 aAttributes, const TPtrC &aTypefaceName, const TDesC &aTestDescription) sl@0: { sl@0: TBuf tempBuffer; sl@0: sl@0: //append the name sl@0: tempBuffer.Append(_L("_")); sl@0: tempBuffer.Append(aTypefaceName); sl@0: tempBuffer.Append(_L("_")); sl@0: tempBuffer.Append(aTestDescription); sl@0: tempBuffer.Append(_L("_")); sl@0: sl@0: //append the size sl@0: tempBuffer.AppendFormat(_L("_size-%d"),aSize); sl@0: if (aAttributes == 0) sl@0: { sl@0: //output no attributes sl@0: tempBuffer.Append(_L("_")); sl@0: tempBuffer.Append(KFontEffectsFlagsString[0]); //no attributes string sl@0: } sl@0: else sl@0: { sl@0: for (TInt counter=0;counter<31;counter++) sl@0: { sl@0: TInt bit = 1<Des()); sl@0: sl@0: //construct a desriptor string, function in hashutility KTestName0001 sl@0: HBufC* hashIdString = iHashUtil->GenerateHashIdStringLC( sl@0: KTestName0001,//general name for test sl@0: numberOfTestsRun, //number of sub test sl@0: &ptr, sl@0: 0, //fontFaceIndex, index into the name array above, must be zero sl@0: KSupportDisplayStringIndex[static_cast(displayMode)],//display mode, converted to text sl@0: //in the hash code this is an index to a string table, which is missing ENone and ERgb sl@0: attributes //was orientation, but just integer at end, no use attributes sl@0: ); sl@0: sl@0: DoTestDrawingOutputL(*hashIdString, KTestCases[testCounter].iTypeFaceName, *(KTestCases[testCounter].iOutputString), sl@0: KTestCases[testCounter].iPosition,size,attributes); sl@0: sl@0: numberOfTestsRun++; sl@0: CleanupStack::PopAndDestroy(2,testDescription); sl@0: } sl@0: }//sizes sl@0: }//test array sl@0: } sl@0: sl@0: /** sl@0: Function to create a font, draw the text, and compare the hash value sl@0: sl@0: @param aHashId a string with the hash ID. sl@0: @param aFont the font name sl@0: @param aOutputString the output string sl@0: @param aPosition the position where to draw the text sl@0: @param aSize the height of the font in pixels sl@0: @param aAttributes the attributes for the font sl@0: @see TFontEffectsFlags sl@0: */ sl@0: void CTLinkedFontsComparison::DoTestDrawingOutputL(const TDesC& aHashId, const TPtrC& aFont, const TDesC& aOutputString, sl@0: TPoint aPosition, TInt aSize, TUint32 aAttributes) sl@0: { sl@0: TFontSpec fontSpec; sl@0: PrepareTestEnvironment(fontSpec, aFont, aSize, aAttributes, ETrue, ETrue); sl@0: CFont* font; sl@0: TEST(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec) == KErrNone); sl@0: SCleanFont cleanupFont = {iBitmapDevice, font}; sl@0: CleanupStack::PushL(TCleanupItem(CleanUpFont, &cleanupFont)); sl@0: sl@0: //may need to add attributes for the font sl@0: CBitmapFont* bitmapFont=CFbsFontEx::FontAddress(static_cast(font)); sl@0: if (aAttributes& EItalicOn) sl@0: { sl@0: bitmapFont->iAlgStyle.SetIsItalic(ETrue); sl@0: } sl@0: if (aAttributes& ERegularBoldOn) sl@0: { sl@0: bitmapFont->iAlgStyle.SetIsBold(ETrue); sl@0: } sl@0: sl@0: iGc->SetBrushColor(KRgbWhite); sl@0: iGc->Clear(); sl@0: iGc->SetBrushColor(KRgbYellow); sl@0: iGc->UseFont(font); sl@0: if(EVerticalDraw & aAttributes) sl@0: { sl@0: iGc->DrawTextVertical(aOutputString, aPosition, ERotate90Degrees & aAttributes); sl@0: } sl@0: else sl@0: { sl@0: iGc->DrawText(aOutputString, aPosition); sl@0: } sl@0: iHashUtil->CompareHashValuesL(aHashId); sl@0: CleanupStack::Pop();//font sl@0: iBitmapDevice->ReleaseFont(font); sl@0: iGc->DiscardFont(); sl@0: } sl@0: sl@0: /** sl@0: Sets the fontspec and gc attributes according to the flags set in STestFontParameters for the test. sl@0: Before setting gc attributes it is cleared and reset. sl@0: @param aFontSpec holds all effective font settings sl@0: @param aSettings holds the flags for setting the fontspec and gc sl@0: @param aFontIndex the fonts index of KFontFace to be set as typeface sl@0: @param aSetEffects ETrue will set the effects on in fontspec if their flags are enabled. By default it is ETrue. sl@0: @param aSetColors ETrue will set the colours in gc from STestFontParameters. By default it is EFalse. sl@0: */ sl@0: void CTLinkedFontsComparison::PrepareTestEnvironment(TFontSpec &aFontSpec, const TPtrC& aFont, TInt aSize, TUint32 aAttributes, sl@0: TBool aSetEffects, TBool aSetColors) sl@0: { sl@0: //Set the typeface from the font face array sl@0: aFontSpec.iTypeface.iName = aFont; sl@0: aFontSpec.iHeight = aSize; sl@0: sl@0: //Set the effects on if any of flags for the effects are set in aSettings and aSetEffects is ETrue sl@0: if(aSetEffects) sl@0: { sl@0: aFontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, EDropShadowOn & aAttributes); sl@0: aFontSpec.iFontStyle.SetEffects(FontEffect::EOutline, EOutlineOn & aAttributes); sl@0: aFontSpec.iFontStyle.SetEffects(FontEffect::ESoftEdge, ESoftEdgeOn & aAttributes); sl@0: aFontSpec.iFontStyle.SetEffects(FontEffect::EAlgorithmicBold, EAlgorithmicBoldOn & aAttributes); sl@0: } sl@0: sl@0: iGc->Reset(); sl@0: iGc->Clear(); sl@0: iGc->SetPenColor(KRgbBlack); sl@0: iGc->SetStrikethroughStyle((EIsStrikethroughOn & aAttributes) ? EStrikethroughOn : EStrikethroughOff); sl@0: iGc->SetUnderlineStyle((EIsUnderlineOn & aAttributes) ? EUnderlineOn : EUnderlineOff); sl@0: sl@0: //Set the glyph bitmap type sl@0: if(ESetMonochromeGlyphBitmap & aAttributes) sl@0: { sl@0: aFontSpec.iFontStyle.SetBitmapType(EMonochromeGlyphBitmap); sl@0: } sl@0: else if(ESetAntiAliasedGlyphBitmap & aAttributes) sl@0: { sl@0: aFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: } sl@0: sl@0: //Set the colours in gc if asked for sl@0: if(aSetColors) sl@0: { sl@0: iGc->SetBrushColor(KRgbYellow); sl@0: iGc->SetPenColor(KRgbBlack); sl@0: iGc->SetShadowColor(KRgbGray); sl@0: } sl@0: } sl@0: sl@0: /** Function to determine if the rasterizer has the linked typeface extended interface. sl@0: sl@0: @return ETrue if the linked fonts rasterizer is present. EFalse otherwise sl@0: */ sl@0: TBool CTLinkedFontsComparison::CheckMonoTypeInstalledL() sl@0: { sl@0: CreateBitmapDeviceL(EColor16MU); //this is just for the bitmap device to get the font sl@0: sl@0: CFbsTypefaceStore* store = CFbsTypefaceStore::NewL(iBitmapDevice); sl@0: CleanupStack::PushL(store); sl@0: sl@0: // Create typeface to be linked sl@0: _LIT(KLinkedTypefaceTT, "LinkedFont1TT"); sl@0: sl@0: CLinkedTypefaceSpecification *typefaceSpec; sl@0: _LIT(KLinkedFont1TTLinkingTest, "LinkedFont1TTLinkingTest"); sl@0: sl@0: typefaceSpec = CLinkedTypefaceSpecification::NewLC(KLinkedFont1TTLinkingTest); sl@0: sl@0: CLinkedTypefaceGroup* group1 = CLinkedTypefaceGroup::NewLC(1); sl@0: typefaceSpec->AddLinkedTypefaceGroupL(*group1); sl@0: CleanupStack::Pop(); sl@0: sl@0: // Add first typeface sl@0: CLinkedTypefaceElementSpec *elementSpec1; sl@0: elementSpec1 = CLinkedTypefaceElementSpec::NewLC(KLinkedTypefaceTT, 1); sl@0: elementSpec1->SetCanonical(ETrue); sl@0: sl@0: typefaceSpec->AddTypefaceAtBackL(*elementSpec1); sl@0: CleanupStack::Pop(1, elementSpec1); sl@0: sl@0: // Now try regstering the linked typeface sl@0: TRAPD(ret, typefaceSpec->RegisterLinkedTypefaceL(*store)); sl@0: CleanupStack::PopAndDestroy(2, store); sl@0: sl@0: if (ret == KErrNone|| ret== KErrAlreadyExists) sl@0: { sl@0: return ETrue; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Linked fonts comparison: no linked fonts rasterizer found")); sl@0: return EFalse; sl@0: } sl@0: } sl@0: sl@0: /** regular RunTestCaseL, a virtual function called by the test framework sl@0: */ sl@0: void CTLinkedFontsComparison::RunTestCaseL(TInt aCurTestCase) sl@0: { sl@0: ((CTLinkedFontsComparisonStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch (aCurTestCase) sl@0: { sl@0: case 1: sl@0: { sl@0: ((CTLinkedFontsComparisonStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: if (!CheckMonoTypeInstalledL()) sl@0: { sl@0: TestComplete(); sl@0: }; sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: ((CTLinkedFontsComparisonStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-LINKEDFONTS-0107")); sl@0: RegisterLinkedTypefacesL(); sl@0: break; sl@0: } sl@0: case 3: sl@0: { sl@0: ((CTLinkedFontsComparisonStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-LINKEDFONTS-0108")); sl@0: TestDrawTextUsingLinkedFontsL(); sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ((CTLinkedFontsComparisonStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTLinkedFontsComparisonStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: } sl@0: ((CTLinkedFontsComparisonStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __CONSTRUCT_STEP__(LinkedFontsComparison)