Update contrib.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 // the only way to get at the local to file static function MatchFontSpecsInPixels
19 #include "FNTSTORE.CPP"
20 #include "T_MatchFonts.h"
22 _LIT( KDjvMono, "DejaVu Sans Mono" );
23 _LIT( KDjvSerif, "DejaVu Serif Condensed" );
24 _LIT( KDjvSans, "DejaVu Sans Condensed" );
26 class CTMatchFonts : public CTGraphicsBase
29 CTMatchFonts(CTestStep* aStep);
33 virtual void RunTestCaseL(TInt aCurTestCase);
34 virtual void ConstructL();
36 TOpenFontSpec iIdealFontSpec1;
37 TOpenFontSpec iIdealFontSpec2;
38 TOpenFontSpec iIdealFontSpec3;
39 TOpenFontSpec iDjvMonoFontSpec;
40 TOpenFontSpec iDjvSerifFontSpec;
41 TOpenFontSpec iDjvSansFontSpec;
44 CTMatchFonts::CTMatchFonts(CTestStep* aStep) :
50 void CTMatchFonts::ConstructL()
53 iIdealFontSpec1.SetName( KNullDesC );
54 iIdealFontSpec1.SetHeight( 10 );
55 iIdealFontSpec1.SetItalic( EFalse );
56 iIdealFontSpec1.SetSlantFactor( 0 );
57 iIdealFontSpec1.SetBold( EFalse );
58 iIdealFontSpec1.SetBitmapType( EMonochromeGlyphBitmap );
59 iIdealFontSpec1.SetMonoWidth( ETrue );
60 iIdealFontSpec1.SetSerif( ETrue );
62 iDjvMonoFontSpec.SetName( KDjvMono );
63 iDjvMonoFontSpec.SetHeight( 10 );
64 iDjvMonoFontSpec.SetItalic( EFalse );
65 iDjvMonoFontSpec.SetSlantFactor( 0 );
66 iDjvMonoFontSpec.SetBold( EFalse );
67 iDjvMonoFontSpec.SetBitmapType( EMonochromeGlyphBitmap );
68 iDjvMonoFontSpec.SetMonoWidth( ETrue );
69 iDjvMonoFontSpec.SetSerif( ETrue );
71 iIdealFontSpec2.SetName( KNullDesC );
72 iIdealFontSpec2.SetHeight( 10 );
73 iIdealFontSpec2.SetItalic( EFalse );
74 iIdealFontSpec2.SetSlantFactor( 0 );
75 iIdealFontSpec2.SetBold( EFalse );
76 iIdealFontSpec2.SetBitmapType( EMonochromeGlyphBitmap );
77 iIdealFontSpec2.SetMonoWidth( EFalse );
78 iIdealFontSpec2.SetSerif( ETrue );
80 iDjvSerifFontSpec.SetName( KDjvSerif );
81 iDjvSerifFontSpec.SetHeight( 10 );
82 iDjvSerifFontSpec.SetItalic( EFalse );
83 iDjvSerifFontSpec.SetSlantFactor( 0 );
84 iDjvSerifFontSpec.SetBold( EFalse );
85 iDjvSerifFontSpec.SetBitmapType( EMonochromeGlyphBitmap );
86 iDjvSerifFontSpec.SetMonoWidth( EFalse );
87 iDjvSerifFontSpec.SetSerif( ETrue );
89 iIdealFontSpec3.SetName( KNullDesC );
90 iIdealFontSpec3.SetHeight( 10 );
91 iIdealFontSpec3.SetItalic( EFalse );
92 iIdealFontSpec3.SetSlantFactor( 0 );
93 iIdealFontSpec3.SetBold( EFalse );
94 iIdealFontSpec3.SetBitmapType( EMonochromeGlyphBitmap );
95 iIdealFontSpec3.SetMonoWidth( EFalse );
96 iIdealFontSpec3.SetSerif( EFalse );
98 iDjvSansFontSpec.SetName( KDjvSans );
99 iDjvSansFontSpec.SetHeight( 10 );
100 iDjvSansFontSpec.SetItalic( EFalse );
101 iDjvSansFontSpec.SetSlantFactor( 0 );
102 iDjvSansFontSpec.SetBold( EFalse );
103 iDjvSansFontSpec.SetBitmapType( EMonochromeGlyphBitmap );
104 iDjvSansFontSpec.SetMonoWidth( EFalse );
105 iDjvSansFontSpec.SetSerif( EFalse );
111 GRAPHICS-FNTSTORE-0035
114 Creates a reference font and compares it to different fonts
115 and sees which font matches the reference font the best.
118 1. Reference font: monospaced serif
119 Compared fonts: DejaVu Sans Mono, DejaVu Serif Condensed, DejaVu Sans Condensed
120 2. Reference font: proporional serif font
121 Compared fonts: DejaVu Sans Mono, DejaVu Serif Condensed, DejaVu Sans Condensed
122 3. Reference font: proporional sans serif
123 Compared fonts: DejaVu Sans Mono, DejaVu Serif Condensed, DejaVu Sans Condensed
125 @SYMTestExpectedResults
126 1. Should choose DejaVu Sans Mono above DejaVu Serif Condensed above DejaVu Sans Condensed
127 2. Should choose DejaVu Serif Condensed above DejaVu Sans Condensed above DejaVu Sans Mono
128 3. Should choose DejaVu Sans Condensed above DejaVu Serif Condensed above DejaVu Sans Mono
130 void CTMatchFonts::RunTestCaseL( TInt aCurTestCase )
135 ((CTMatchFontsStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
137 switch ( aCurTestCase )
140 ((CTMatchFontsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0035"));
141 // Looking for a monospaced serif font (like DejaVu Sans Mono)
142 weighting1 = MatchFontSpecsInPixels( iDjvMonoFontSpec, iIdealFontSpec1 );
143 weighting2 = MatchFontSpecsInPixels( iDjvSerifFontSpec, iIdealFontSpec1 );
144 weighting3 = MatchFontSpecsInPixels( iDjvSansFontSpec, iIdealFontSpec1 );
145 // Should choose DejaVu Sans Mono above DejaVu Serif Condensed above DejaVu Sans Condensed
146 TEST( ( weighting1 > weighting2 ) && ( weighting2 > weighting3 ) );
149 ((CTMatchFontsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0035"));
150 // Looking for a proporional serif font (like DejaVu Serif Condensed)
151 weighting1 = MatchFontSpecsInPixels( iDjvMonoFontSpec, iIdealFontSpec2 );
152 weighting2 = MatchFontSpecsInPixels( iDjvSerifFontSpec, iIdealFontSpec2 );
153 weighting3 = MatchFontSpecsInPixels( iDjvSansFontSpec, iIdealFontSpec2 );
154 // Should choose DejaVu Serif Condensed above DejaVu Sans Condensed above DejaVu Sans Mono
155 TEST( ( weighting2 > weighting3 ) && ( weighting3 > weighting1 ) );
158 ((CTMatchFontsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0035"));
159 // Looking for a proporional sans serif font (like DejaVu Sans Condensed)
160 weighting1 = MatchFontSpecsInPixels( iDjvMonoFontSpec, iIdealFontSpec3 );
161 weighting2 = MatchFontSpecsInPixels( iDjvSerifFontSpec, iIdealFontSpec3 );
162 weighting3 = MatchFontSpecsInPixels( iDjvSansFontSpec, iIdealFontSpec3 );
163 // Should choose DejaVu Sans Condensed above DejaVu Serif Condensed above DejaVu Sans Mono
164 TEST( ( weighting3 > weighting2 ) && ( weighting2 > weighting1 ) );
167 ((CTMatchFontsStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
168 ((CTMatchFontsStep*)iStep)->CloseTMSGraphicsStep();
172 ((CTMatchFontsStep*)iStep)->RecordTestResultL();
176 __CONSTRUCT_STEP__(MatchFonts)