sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@test
|
sl@0
|
22 |
@internalComponent Internal Symbian test code
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <ecom/ecom.h>
|
sl@0
|
26 |
#include <gdi.h>
|
sl@0
|
27 |
#include "T_FontMetrics.h"
|
sl@0
|
28 |
#include <graphics/openfontrasterizer.h>
|
sl@0
|
29 |
#include <graphics/openfontconstants.h>
|
sl@0
|
30 |
#include <graphics/gdi/glyphsample.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
const TInt CTFontMetrics::KRequiredHeight = 24;
|
sl@0
|
33 |
_LIT(KTypefaceName, "DejaVu Sans Condensed");
|
sl@0
|
34 |
_LIT(KFontFilePath, "z:\\resource\\fonts\\DejaVuSansCondensed.ttf");
|
sl@0
|
35 |
|
sl@0
|
36 |
LOCAL_C void ResetAndDestroyRImplInfoPtrArray(TAny* aPtr)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
RImplInfoPtrArray* array = reinterpret_cast <RImplInfoPtrArray*> (aPtr);
|
sl@0
|
39 |
array->ResetAndDestroy();
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
CTFontMetrics::CTFontMetrics(CTestStep* aStep) :
|
sl@0
|
43 |
CTGraphicsBase(aStep)
|
sl@0
|
44 |
{
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
void CTFontMetrics::ConstructL()
|
sl@0
|
48 |
{
|
sl@0
|
49 |
iHeap = UserHeap::ChunkHeap(NULL, 0x10000, 0x10000);
|
sl@0
|
50 |
if (NULL == iHeap)
|
sl@0
|
51 |
User::Leave(KErrNoMemory);
|
sl@0
|
52 |
iHeap->__DbgMarkStart();
|
sl@0
|
53 |
iFontStore = CFontStore::NewL(iHeap);
|
sl@0
|
54 |
InstallRasterizerL();
|
sl@0
|
55 |
AddFileL();
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
CTFontMetrics::~CTFontMetrics()
|
sl@0
|
59 |
{
|
sl@0
|
60 |
delete iFontStore;
|
sl@0
|
61 |
iHeap->__DbgMarkEnd(0);
|
sl@0
|
62 |
iHeap->Close();
|
sl@0
|
63 |
User::Heap().Check();
|
sl@0
|
64 |
REComSession::FinalClose();
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
/**
|
sl@0
|
68 |
Create a rasterizer and install it in the font store.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
void CTFontMetrics::InstallRasterizerL()
|
sl@0
|
71 |
{
|
sl@0
|
72 |
RImplInfoPtrArray implementationArray;
|
sl@0
|
73 |
TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray);
|
sl@0
|
74 |
CleanupStack::PushL(cleanup);
|
sl@0
|
75 |
const TUid uid = {KUidOpenFontRasterizerPlunginInterface};
|
sl@0
|
76 |
|
sl@0
|
77 |
TRAPD(error, REComSession::ListImplementationsL(uid, implementationArray));
|
sl@0
|
78 |
TEST(error == KErrNone);
|
sl@0
|
79 |
TEST(0 < implementationArray.Count());
|
sl@0
|
80 |
|
sl@0
|
81 |
COpenFontRasterizer* rasterizer =
|
sl@0
|
82 |
COpenFontRasterizer::NewL(implementationArray[0]->ImplementationUid());
|
sl@0
|
83 |
TRAP(error, iFontStore->InstallRasterizerL(rasterizer));
|
sl@0
|
84 |
if (error)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
delete rasterizer;
|
sl@0
|
87 |
TEST(error == KErrNone);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
CleanupStack::PopAndDestroy(&implementationArray);
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
void CTFontMetrics::AddFileL()
|
sl@0
|
93 |
{
|
sl@0
|
94 |
iFontStore->AddFileL(KFontFilePath);
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
TOpenFontSpec CTFontMetrics::GetTOpenFontSpec()
|
sl@0
|
98 |
{
|
sl@0
|
99 |
TOpenFontSpec openFontSpec;
|
sl@0
|
100 |
openFontSpec.SetName(KTypefaceName);
|
sl@0
|
101 |
openFontSpec.SetHeight(KRequiredHeight);
|
sl@0
|
102 |
openFontSpec.SetItalic(EFalse);
|
sl@0
|
103 |
openFontSpec.SetBold(EFalse);
|
sl@0
|
104 |
return openFontSpec;
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
void CTFontMetrics::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
((CTFontMetricsStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
110 |
switch ( aCurTestCase )
|
sl@0
|
111 |
{
|
sl@0
|
112 |
case 1:
|
sl@0
|
113 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0029"));
|
sl@0
|
114 |
FontAccessInCTypefaceStore();
|
sl@0
|
115 |
break;
|
sl@0
|
116 |
case 2:
|
sl@0
|
117 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0002"));
|
sl@0
|
118 |
TLanguage2GlyphSample();
|
sl@0
|
119 |
break;
|
sl@0
|
120 |
case 3:
|
sl@0
|
121 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0003"));
|
sl@0
|
122 |
GetNearestFontToDesignHeightInPixels();
|
sl@0
|
123 |
break;
|
sl@0
|
124 |
case 4:
|
sl@0
|
125 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0004"));
|
sl@0
|
126 |
GetNearestFontToMaxHeightInPixels();
|
sl@0
|
127 |
break;
|
sl@0
|
128 |
case 5:
|
sl@0
|
129 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0030"));
|
sl@0
|
130 |
TestINC086513();
|
sl@0
|
131 |
break;
|
sl@0
|
132 |
case 6:
|
sl@0
|
133 |
((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0020"));
|
sl@0
|
134 |
TestGetNearestFontToMaxHeightInPixels();
|
sl@0
|
135 |
break;
|
sl@0
|
136 |
case 7:
|
sl@0
|
137 |
((CTFontMetricsStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
138 |
((CTFontMetricsStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
139 |
TestComplete();
|
sl@0
|
140 |
break;
|
sl@0
|
141 |
}
|
sl@0
|
142 |
((CTFontMetricsStep*)iStep)->RecordTestResultL();
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
/**
|
sl@0
|
146 |
@SYMTestCaseID GRAPHICS-FNTSTORE-0002
|
sl@0
|
147 |
|
sl@0
|
148 |
@SYMPREQ PREQ533
|
sl@0
|
149 |
|
sl@0
|
150 |
@SYMREQ REQ3800
|
sl@0
|
151 |
|
sl@0
|
152 |
@SYMTestCaseDesc Verifying GlyphSample::TLanguage2TScript and GlyphSample::TScript2GlyphSample
|
sl@0
|
153 |
with different TLanguage values.
|
sl@0
|
154 |
|
sl@0
|
155 |
@SYMTestPriority Critical
|
sl@0
|
156 |
|
sl@0
|
157 |
@SYMTestStatus Implemented
|
sl@0
|
158 |
|
sl@0
|
159 |
@SYMTestActions (1) Call TLanguage2TScript and then TScript2GlyphSample
|
sl@0
|
160 |
with boundary cases ELangTest, ELangNone, ELangMaximum.
|
sl@0
|
161 |
(2) Call TLanguage2TScript and then TScript2GlyphSample
|
sl@0
|
162 |
with languages belonging to unsupported scripts.
|
sl@0
|
163 |
(3) Call TLanguage2TScript and then TScript2GlyphSample
|
sl@0
|
164 |
with languages belonging to Latin script.
|
sl@0
|
165 |
(4) Repeat (3) for all other supported scripts.
|
sl@0
|
166 |
|
sl@0
|
167 |
@SYMTestExpectedResults (1) and (2) - NULL
|
sl@0
|
168 |
(3) and (4) - Languages belonging to the same script should return
|
sl@0
|
169 |
the same address value pointing to the same set of glyph samples.
|
sl@0
|
170 |
*/
|
sl@0
|
171 |
void CTFontMetrics::TLanguage2GlyphSample()
|
sl@0
|
172 |
{
|
sl@0
|
173 |
// boundary cases
|
sl@0
|
174 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTest)).Ptr());
|
sl@0
|
175 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNone)).Ptr());
|
sl@0
|
176 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMaximum)).Ptr());
|
sl@0
|
177 |
// Not yet supported
|
sl@0
|
178 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAmharic)).Ptr());
|
sl@0
|
179 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTigrinya)).Ptr());
|
sl@0
|
180 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArmenian)).Ptr());
|
sl@0
|
181 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTagalog)).Ptr());
|
sl@0
|
182 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBengali)).Ptr());
|
sl@0
|
183 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBurmese)).Ptr());
|
sl@0
|
184 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGeorgian)).Ptr());
|
sl@0
|
185 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGujarati)).Ptr());
|
sl@0
|
186 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKannada)).Ptr());
|
sl@0
|
187 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKhmer)).Ptr());
|
sl@0
|
188 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLao)).Ptr());
|
sl@0
|
189 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMalayalam)).Ptr());
|
sl@0
|
190 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMongolian)).Ptr());
|
sl@0
|
191 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPunjabi)).Ptr());
|
sl@0
|
192 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSinhalese)).Ptr());
|
sl@0
|
193 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTamil)).Ptr());
|
sl@0
|
194 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTelugu)).Ptr());
|
sl@0
|
195 |
TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTibetan)).Ptr());
|
sl@0
|
196 |
// Latin
|
sl@0
|
197 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFrench)));
|
sl@0
|
198 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGerman)));
|
sl@0
|
199 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSpanish)));
|
sl@0
|
200 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangItalian)));
|
sl@0
|
201 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwedish)));
|
sl@0
|
202 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangDanish)));
|
sl@0
|
203 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNorwegian)));
|
sl@0
|
204 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFinnish)));
|
sl@0
|
205 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAmerican)));
|
sl@0
|
206 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissFrench)));
|
sl@0
|
207 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissGerman)));
|
sl@0
|
208 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPortuguese)));
|
sl@0
|
209 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTurkish)));
|
sl@0
|
210 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIcelandic)));
|
sl@0
|
211 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHungarian)));
|
sl@0
|
212 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangDutch)));
|
sl@0
|
213 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelgianFlemish)));
|
sl@0
|
214 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAustralian)));
|
sl@0
|
215 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelgianFrench)));
|
sl@0
|
216 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAustrian)));
|
sl@0
|
217 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNewZealand)));
|
sl@0
|
218 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalFrench)));
|
sl@0
|
219 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCzech)));
|
sl@0
|
220 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSlovak)));
|
sl@0
|
221 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPolish)));
|
sl@0
|
222 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSlovenian)));
|
sl@0
|
223 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAfrikaans)));
|
sl@0
|
224 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAlbanian)));
|
sl@0
|
225 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCatalan)));
|
sl@0
|
226 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCroatian)));
|
sl@0
|
227 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCanadianEnglish)));
|
sl@0
|
228 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalEnglish)));
|
sl@0
|
229 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSouthAfricanEnglish)));
|
sl@0
|
230 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEstonian)));
|
sl@0
|
231 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCanadianFrench)));
|
sl@0
|
232 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangScotsGaelic)));
|
sl@0
|
233 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIndonesian)));
|
sl@0
|
234 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIrish)));
|
sl@0
|
235 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissItalian)));
|
sl@0
|
236 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLatvian)));
|
sl@0
|
237 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLithuanian)));
|
sl@0
|
238 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMalay)));
|
sl@0
|
239 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMoldavian)));
|
sl@0
|
240 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNorwegianNynorsk)));
|
sl@0
|
241 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBrazilianPortuguese)));
|
sl@0
|
242 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRomanian)));
|
sl@0
|
243 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSomali)));
|
sl@0
|
244 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalSpanish)));
|
sl@0
|
245 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLatinAmericanSpanish)));
|
sl@0
|
246 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwahili)));
|
sl@0
|
247 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFinlandSwedish)));
|
sl@0
|
248 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCyprusTurkish)));
|
sl@0
|
249 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangVietnamese)));
|
sl@0
|
250 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangWelsh)));
|
sl@0
|
251 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangZulu)));
|
sl@0
|
252 |
// Greek
|
sl@0
|
253 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGreek)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCyprusGreek)));
|
sl@0
|
254 |
// Cyrillic
|
sl@0
|
255 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelarussian)));
|
sl@0
|
256 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBulgarian)));
|
sl@0
|
257 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKazakh)));
|
sl@0
|
258 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMacedonian)));
|
sl@0
|
259 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSerbian)));
|
sl@0
|
260 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTurkmen)));
|
sl@0
|
261 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangUkrainian)));
|
sl@0
|
262 |
// Hebrew
|
sl@0
|
263 |
TEST(NULL != GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHebrew)).Ptr());
|
sl@0
|
264 |
// Arabic
|
sl@0
|
265 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArabic)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFarsi)));
|
sl@0
|
266 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArabic)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangUrdu)));
|
sl@0
|
267 |
// Devanagari
|
sl@0
|
268 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHindi)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMarathi)));
|
sl@0
|
269 |
// Thai
|
sl@0
|
270 |
TEST(NULL != GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangThai)).Ptr());
|
sl@0
|
271 |
// HanIdeographs
|
sl@0
|
272 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHongKongChinese)));
|
sl@0
|
273 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPrcChinese)));
|
sl@0
|
274 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangJapanese)));
|
sl@0
|
275 |
TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKorean)));
|
sl@0
|
276 |
}
|
sl@0
|
277 |
|
sl@0
|
278 |
/**
|
sl@0
|
279 |
@SYMTestCaseID GRAPHICS-FNTSTORE-0003
|
sl@0
|
280 |
|
sl@0
|
281 |
@SYMPREQ PREQ533
|
sl@0
|
282 |
|
sl@0
|
283 |
@SYMREQ REQ3800
|
sl@0
|
284 |
|
sl@0
|
285 |
@SYMTestCaseDesc Verifying font's metrics created by CFontStore::GetNearestFontToDesignHeightInPixels
|
sl@0
|
286 |
with different TLanguage values.
|
sl@0
|
287 |
|
sl@0
|
288 |
@SYMTestPriority Critical
|
sl@0
|
289 |
|
sl@0
|
290 |
@SYMTestStatus Implemented
|
sl@0
|
291 |
|
sl@0
|
292 |
@SYMTestActions (1) Call GetNearestFontToDesignHeightInPixels with ELangNone.
|
sl@0
|
293 |
(2) Call CFont's HeightInPixels, AscentInPixels, DescentInPixels, FontCapitalAscent,
|
sl@0
|
294 |
FontStandardDescent, FontMaxAscent, FontMaxDescent, FontMaxHeight, and FontLineGap
|
sl@0
|
295 |
to verify the font metrics of the returned font object.
|
sl@0
|
296 |
(3) Repeat (1) and (2) with a Latin-based language, a Greek-based language, and a
|
sl@0
|
297 |
Cyrillic-based language for the TLanguage parameter.
|
sl@0
|
298 |
|
sl@0
|
299 |
@SYMTestExpectedResults See returned values in Verify_GetNearestFontToDesignHeightInPixels.
|
sl@0
|
300 |
*/
|
sl@0
|
301 |
void CTFontMetrics::GetNearestFontToDesignHeightInPixels()
|
sl@0
|
302 |
{
|
sl@0
|
303 |
INFO_PRINTF3(_L("iKPixelWidthInTwips = %d; iKPixelHeightInTwips = %d"),
|
sl@0
|
304 |
iFontStore->iKPixelWidthInTwips, iFontStore->iKPixelHeightInTwips);
|
sl@0
|
305 |
|
sl@0
|
306 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
307 |
|
sl@0
|
308 |
INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangNone"));
|
sl@0
|
309 |
CFont* font = NULL;
|
sl@0
|
310 |
openFontSpec.SetScriptTypeForMetrics(ELangNone);
|
sl@0
|
311 |
iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
|
sl@0
|
312 |
Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
313 |
iFontStore->ReleaseFont(font);
|
sl@0
|
314 |
|
sl@0
|
315 |
INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangFinnish"));
|
sl@0
|
316 |
font = NULL;
|
sl@0
|
317 |
openFontSpec.SetScriptTypeForMetrics(ELangFinnish);
|
sl@0
|
318 |
iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
|
sl@0
|
319 |
Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
320 |
iFontStore->ReleaseFont(font);
|
sl@0
|
321 |
|
sl@0
|
322 |
INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangGreek"));
|
sl@0
|
323 |
font = NULL;
|
sl@0
|
324 |
openFontSpec.SetScriptTypeForMetrics(ELangGreek);
|
sl@0
|
325 |
iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
|
sl@0
|
326 |
Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
327 |
iFontStore->ReleaseFont(font);
|
sl@0
|
328 |
|
sl@0
|
329 |
INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangRussian"));
|
sl@0
|
330 |
font = NULL;
|
sl@0
|
331 |
openFontSpec.SetScriptTypeForMetrics(ELangRussian);
|
sl@0
|
332 |
iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
|
sl@0
|
333 |
Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
334 |
iFontStore->ReleaseFont(font);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
|
sl@0
|
337 |
void CTFontMetrics::Verify_GetNearestFontToDesignHeightInPixels(const CFont& aFont, TInt aScript)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
VerifyTypefaceNameAndID(aFont);
|
sl@0
|
340 |
INFO_PRINTF4(_L("HeightInPixels() = %d; AscentInPixels() = %d; DescentInPixels() = %d"),
|
sl@0
|
341 |
aFont.HeightInPixels(), aFont.AscentInPixels(), aFont.DescentInPixels());
|
sl@0
|
342 |
INFO_PRINTF4(_L("FontCapitalAscent() = %d; FontStandardDescent() = %d; FontMaxAscent() = %d"),
|
sl@0
|
343 |
aFont.FontCapitalAscent(), aFont.FontStandardDescent(), aFont.FontMaxAscent());
|
sl@0
|
344 |
INFO_PRINTF4(_L("FontMaxDescent() = %d; FontMaxHeight() = %d; FontLineGap() = %d"),
|
sl@0
|
345 |
aFont.FontMaxDescent(), aFont.FontMaxHeight(), aFont.FontLineGap());
|
sl@0
|
346 |
// Old metrics
|
sl@0
|
347 |
TEST(KRequiredHeight == aFont.HeightInPixels());
|
sl@0
|
348 |
TEST(19 == aFont.AscentInPixels());
|
sl@0
|
349 |
TEST(KRequiredHeight - aFont.AscentInPixels() == aFont.DescentInPixels());
|
sl@0
|
350 |
// New metrics
|
sl@0
|
351 |
TEST(18 == aFont.FontCapitalAscent());
|
sl@0
|
352 |
TEST(5 == aFont.FontStandardDescent());
|
sl@0
|
353 |
if (GlyphSample::EScriptNone == aScript ||
|
sl@0
|
354 |
GlyphSample::EScriptLatin == aScript ||
|
sl@0
|
355 |
GlyphSample::EScriptGreek == aScript ||
|
sl@0
|
356 |
GlyphSample::EScriptCyrillic == aScript)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
TEST(28 == aFont.FontMaxAscent());
|
sl@0
|
359 |
TEST(8 == aFont.FontMaxDescent());
|
sl@0
|
360 |
TEST(42 == aFont.FontLineGap());
|
sl@0
|
361 |
}
|
sl@0
|
362 |
else TEST(1 == 0);
|
sl@0
|
363 |
TEST(aFont.FontMaxAscent() + aFont.FontMaxDescent() == aFont.FontMaxHeight());
|
sl@0
|
364 |
INFO_PRINTF2(_L("MaxCharWidthInPixels() returns %d"), aFont.MaxCharWidthInPixels());
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
/**
|
sl@0
|
368 |
@SYMTestCaseID GRAPHICS-FNTSTORE-0004
|
sl@0
|
369 |
|
sl@0
|
370 |
@SYMPREQ PREQ533
|
sl@0
|
371 |
|
sl@0
|
372 |
@SYMREQ REQ3800
|
sl@0
|
373 |
|
sl@0
|
374 |
@SYMTestCaseDesc Verifying font's metrics created by CFontStore::GetNearestFontToMaxHeightInPixels
|
sl@0
|
375 |
with different TLanguage values.
|
sl@0
|
376 |
|
sl@0
|
377 |
@SYMTestPriority Critical
|
sl@0
|
378 |
|
sl@0
|
379 |
@SYMTestStatus Implemented
|
sl@0
|
380 |
|
sl@0
|
381 |
@SYMTestActions (1) Call GetNearestFontToMaxHeightInPixels with ELangNone.
|
sl@0
|
382 |
(2) Call CFont's HeightInPixels, AscentInPixels, DescentInPixels, FontCapitalAscent,
|
sl@0
|
383 |
FontStandardDescent, FontMaxAscent, FontMaxDescent, FontMaxHeight, and FontLineGap
|
sl@0
|
384 |
to verify the font metrics of the returned font object.
|
sl@0
|
385 |
(3) Repeat (1) and (2) with a Latin-based language, a Greek-based language, and a
|
sl@0
|
386 |
Cyrillic-based language for the TLanguage parameter.
|
sl@0
|
387 |
|
sl@0
|
388 |
@SYMTestExpectedResults See returned values in Verify_GetNearestFontToMaxHeightInPixels.
|
sl@0
|
389 |
*/
|
sl@0
|
390 |
void CTFontMetrics::GetNearestFontToMaxHeightInPixels()
|
sl@0
|
391 |
{
|
sl@0
|
392 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
393 |
|
sl@0
|
394 |
INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangNone"));
|
sl@0
|
395 |
CFont* font = NULL;
|
sl@0
|
396 |
openFontSpec.SetScriptTypeForMetrics(ELangNone);
|
sl@0
|
397 |
iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
|
sl@0
|
398 |
Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
399 |
iFontStore->ReleaseFont(font);
|
sl@0
|
400 |
|
sl@0
|
401 |
INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangFinnish"));
|
sl@0
|
402 |
font = NULL;
|
sl@0
|
403 |
openFontSpec.SetScriptTypeForMetrics(ELangFinnish);
|
sl@0
|
404 |
iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
|
sl@0
|
405 |
Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
406 |
iFontStore->ReleaseFont(font);
|
sl@0
|
407 |
|
sl@0
|
408 |
INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangGreek"));
|
sl@0
|
409 |
font = NULL;
|
sl@0
|
410 |
openFontSpec.SetScriptTypeForMetrics(ELangGreek);
|
sl@0
|
411 |
iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
|
sl@0
|
412 |
Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
413 |
iFontStore->ReleaseFont(font);
|
sl@0
|
414 |
|
sl@0
|
415 |
INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangRussian"));
|
sl@0
|
416 |
font = NULL;
|
sl@0
|
417 |
openFontSpec.SetScriptTypeForMetrics(ELangRussian);
|
sl@0
|
418 |
iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
|
sl@0
|
419 |
Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
|
sl@0
|
420 |
iFontStore->ReleaseFont(font);
|
sl@0
|
421 |
}
|
sl@0
|
422 |
|
sl@0
|
423 |
void CTFontMetrics::Verify_GetNearestFontToMaxHeightInPixels(const CFont& aFont, TInt aScript)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
VerifyTypefaceNameAndID(aFont);
|
sl@0
|
426 |
INFO_PRINTF4(_L("HeightInPixels() = %d; AscentInPixels() = %d; DescentInPixels() = %d"),
|
sl@0
|
427 |
aFont.HeightInPixels(), aFont.AscentInPixels(), aFont.DescentInPixels());
|
sl@0
|
428 |
INFO_PRINTF4(_L("FontCapitalAscent() = %d; FontStandardDescent() = %d; FontMaxAscent() = %d"),
|
sl@0
|
429 |
aFont.FontCapitalAscent(), aFont.FontStandardDescent(), aFont.FontMaxAscent());
|
sl@0
|
430 |
INFO_PRINTF4(_L("FontMaxDescent() = %d; FontMaxHeight() = %d; FontLineGap() = %d"),
|
sl@0
|
431 |
aFont.FontMaxDescent(), aFont.FontMaxHeight(), aFont.FontLineGap());
|
sl@0
|
432 |
if (GlyphSample::EScriptNone == aScript)
|
sl@0
|
433 |
{
|
sl@0
|
434 |
// Old metrics
|
sl@0
|
435 |
TEST(16 == aFont.HeightInPixels());
|
sl@0
|
436 |
TEST(13 == aFont.AscentInPixels());
|
sl@0
|
437 |
TEST(16 - 13 == aFont.DescentInPixels());
|
sl@0
|
438 |
// New metrics
|
sl@0
|
439 |
TEST(12 == aFont.FontCapitalAscent());
|
sl@0
|
440 |
TEST(3 == aFont.FontStandardDescent());
|
sl@0
|
441 |
TEST(19 == aFont.FontMaxAscent());
|
sl@0
|
442 |
TEST(6 == aFont.FontMaxDescent());
|
sl@0
|
443 |
TEST(KRequiredHeight + 1 == aFont.FontMaxHeight());
|
sl@0
|
444 |
TEST(31 == aFont.FontLineGap());
|
sl@0
|
445 |
}
|
sl@0
|
446 |
else if (GlyphSample::EScriptLatin == aScript ||
|
sl@0
|
447 |
GlyphSample::EScriptGreek == aScript ||
|
sl@0
|
448 |
GlyphSample::EScriptCyrillic == aScript)
|
sl@0
|
449 |
{
|
sl@0
|
450 |
// Old metrics
|
sl@0
|
451 |
TEST(24 == aFont.HeightInPixels());
|
sl@0
|
452 |
TEST(19 == aFont.AscentInPixels());
|
sl@0
|
453 |
TEST(24 - 19 == aFont.DescentInPixels());
|
sl@0
|
454 |
// New metrics
|
sl@0
|
455 |
TEST(18 == aFont.FontCapitalAscent());
|
sl@0
|
456 |
TEST(5 == aFont.FontStandardDescent());
|
sl@0
|
457 |
TEST(28 == aFont.FontMaxAscent());
|
sl@0
|
458 |
TEST(8 == aFont.FontMaxDescent());
|
sl@0
|
459 |
TEST(KRequiredHeight + 12 == aFont.FontMaxHeight());
|
sl@0
|
460 |
TEST(42 == aFont.FontLineGap());
|
sl@0
|
461 |
}
|
sl@0
|
462 |
else TEST(1 == 0);
|
sl@0
|
463 |
INFO_PRINTF2(_L("MaxCharWidthInPixels() returns %d"), aFont.MaxCharWidthInPixels());
|
sl@0
|
464 |
}
|
sl@0
|
465 |
|
sl@0
|
466 |
void CTFontMetrics::VerifyTypefaceNameAndID(const CFont& aFont)
|
sl@0
|
467 |
{
|
sl@0
|
468 |
const TUid uid = {268435523};
|
sl@0
|
469 |
TEST(uid == aFont.TypeUid());
|
sl@0
|
470 |
TEST(!aFont.FontSpecInTwips().iTypeface.iName.CompareC(KTypefaceName));
|
sl@0
|
471 |
}
|
sl@0
|
472 |
|
sl@0
|
473 |
/**
|
sl@0
|
474 |
@SYMTestCaseID
|
sl@0
|
475 |
GRAPHICS-FNTSTORE-0029
|
sl@0
|
476 |
|
sl@0
|
477 |
@SYMTestCaseDesc
|
sl@0
|
478 |
Tests if CTypefaceStore::iFontAccess generates false positives and
|
sl@0
|
479 |
thus prevents GetNearestFontToDesignHeightInPixels from returning the correct fonts.
|
sl@0
|
480 |
|
sl@0
|
481 |
@SYMTestActions
|
sl@0
|
482 |
1. Creates a TOpenFontSpec object.
|
sl@0
|
483 |
2. Sets name, height, italic and bold
|
sl@0
|
484 |
3. Setting design height to some arbitrary value.
|
sl@0
|
485 |
4. Gets the font which is the nearest to the given font specification.
|
sl@0
|
486 |
5. Checks for errors.
|
sl@0
|
487 |
6. Verifies that existing font object created with the GetNearestFontToDesignHeightInPixels
|
sl@0
|
488 |
(having the wrong font metrics) should not prevent us from getting a new font object
|
sl@0
|
489 |
with the GetNearestFontToMaxHeightInPixels.
|
sl@0
|
490 |
7. Calling the GetNearestFontToMaxHeightInPixels function with
|
sl@0
|
491 |
different languages should still refer to the same font object,
|
sl@0
|
492 |
unless the language has an impact on metrics.
|
sl@0
|
493 |
|
sl@0
|
494 |
@SYMTestExpectedResults
|
sl@0
|
495 |
Test should pass
|
sl@0
|
496 |
*/
|
sl@0
|
497 |
void CTFontMetrics::FontAccessInCTypefaceStore()
|
sl@0
|
498 |
{
|
sl@0
|
499 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
500 |
const TInt KMaxHeight = 24;
|
sl@0
|
501 |
|
sl@0
|
502 |
TInt rc = KErrGeneral;
|
sl@0
|
503 |
|
sl@0
|
504 |
CFont* font01 = NULL;
|
sl@0
|
505 |
rc = iFontStore->GetNearestFontToDesignHeightInPixels(font01, openFontSpec);
|
sl@0
|
506 |
TEST(KErrNone == rc);
|
sl@0
|
507 |
TEST(NULL != font01);
|
sl@0
|
508 |
|
sl@0
|
509 |
CFont* font02 = NULL;
|
sl@0
|
510 |
rc = iFontStore->GetNearestFontToDesignHeightInPixels(font02, openFontSpec);
|
sl@0
|
511 |
TEST(KErrNone == rc);
|
sl@0
|
512 |
TEST(NULL != font02);
|
sl@0
|
513 |
|
sl@0
|
514 |
CFont* font03 = NULL;
|
sl@0
|
515 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font03, openFontSpec, KMaxHeight);
|
sl@0
|
516 |
TEST(KErrNone == rc);
|
sl@0
|
517 |
TEST(NULL != font03);
|
sl@0
|
518 |
|
sl@0
|
519 |
// Setting design height to some arbitrary value
|
sl@0
|
520 |
CFont* font04 = NULL;
|
sl@0
|
521 |
openFontSpec.SetHeight(0);
|
sl@0
|
522 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font04, openFontSpec, KMaxHeight);
|
sl@0
|
523 |
TEST(KErrNone == rc);
|
sl@0
|
524 |
TEST(NULL != font04);
|
sl@0
|
525 |
|
sl@0
|
526 |
// Setting design height to some arbitrary value
|
sl@0
|
527 |
CFont* font05 = NULL;
|
sl@0
|
528 |
openFontSpec.SetHeight(font03->HeightInPixels());
|
sl@0
|
529 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font05, openFontSpec, KMaxHeight);
|
sl@0
|
530 |
TEST(KErrNone == rc);
|
sl@0
|
531 |
TEST(NULL != font05);
|
sl@0
|
532 |
|
sl@0
|
533 |
// Setting design height to that of an old-API generated font object
|
sl@0
|
534 |
CFont* font06 = NULL;
|
sl@0
|
535 |
openFontSpec.SetHeight(font01->HeightInPixels());
|
sl@0
|
536 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font06, openFontSpec, KMaxHeight);
|
sl@0
|
537 |
TEST(KErrNone == rc);
|
sl@0
|
538 |
TEST(NULL != font06);
|
sl@0
|
539 |
|
sl@0
|
540 |
CFont* font07 = NULL;
|
sl@0
|
541 |
openFontSpec.SetScriptTypeForMetrics(ELangEnglish);
|
sl@0
|
542 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font07, openFontSpec, KMaxHeight);
|
sl@0
|
543 |
TEST(KErrNone == rc);
|
sl@0
|
544 |
TEST(NULL != font07);
|
sl@0
|
545 |
|
sl@0
|
546 |
CFont* font08 = NULL;
|
sl@0
|
547 |
openFontSpec.SetScriptTypeForMetrics(ELangSwedish);
|
sl@0
|
548 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(font08, openFontSpec, KMaxHeight);
|
sl@0
|
549 |
TEST(KErrNone == rc);
|
sl@0
|
550 |
TEST(NULL != font08);
|
sl@0
|
551 |
|
sl@0
|
552 |
// Using the same font specifications should return font objects from cache.
|
sl@0
|
553 |
TEST(font01 == font02);
|
sl@0
|
554 |
TEST(font03 == font04);
|
sl@0
|
555 |
TEST(font03 == font05);
|
sl@0
|
556 |
// Design height should be ignored when calling the GetNearestFontToMaxHeight... API.
|
sl@0
|
557 |
TEST(font01 != font03);
|
sl@0
|
558 |
// The existing font object created with the GetNearestFontToDesignHeight... API
|
sl@0
|
559 |
// (thus having the wrong font metrics) should NOT prevent us from getting a new font
|
sl@0
|
560 |
// object with the GetNearestFontToMaxHeight... API (with improved metrics.)
|
sl@0
|
561 |
TEST(font01 != font06);
|
sl@0
|
562 |
// Languages belonging to the same script should return the same font object.
|
sl@0
|
563 |
TEST(font07 == font08);
|
sl@0
|
564 |
// Calling the GetNearestFontToMaxHeight... API with
|
sl@0
|
565 |
// languages belonging to different scripts may refer to different font objects.
|
sl@0
|
566 |
// (Actually different with DejaVu fonts between no script specified and latin script.)
|
sl@0
|
567 |
TEST(font06 != font07);
|
sl@0
|
568 |
|
sl@0
|
569 |
iFontStore->ReleaseFont(font01);
|
sl@0
|
570 |
iFontStore->ReleaseFont(font02);
|
sl@0
|
571 |
iFontStore->ReleaseFont(font03);
|
sl@0
|
572 |
iFontStore->ReleaseFont(font04);
|
sl@0
|
573 |
iFontStore->ReleaseFont(font05);
|
sl@0
|
574 |
iFontStore->ReleaseFont(font06);
|
sl@0
|
575 |
iFontStore->ReleaseFont(font07);
|
sl@0
|
576 |
iFontStore->ReleaseFont(font08);
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
/**
|
sl@0
|
580 |
@SYMTestCaseID
|
sl@0
|
581 |
GRAPHICS-FNTSTORE-0030
|
sl@0
|
582 |
|
sl@0
|
583 |
@SYMTestCaseDesc
|
sl@0
|
584 |
Tests if two loaded fonts are the same if their glyphs are the same.
|
sl@0
|
585 |
Second request for the font with different flags should give reference to the
|
sl@0
|
586 |
same font.
|
sl@0
|
587 |
|
sl@0
|
588 |
@SYMTestActions
|
sl@0
|
589 |
1. Creates a TOpenFontSpec object and sets name, height, italic and bold.
|
sl@0
|
590 |
2. Gets the font which is the nearest to the given font specification.
|
sl@0
|
591 |
3. Checks for errors.
|
sl@0
|
592 |
4. Gets the font specification in twips.
|
sl@0
|
593 |
5. Gets the font which is the nearest to the given font specification.
|
sl@0
|
594 |
6. Checks for errors.
|
sl@0
|
595 |
7. Verifies the fonts are the same.
|
sl@0
|
596 |
8. Releases the fonts.
|
sl@0
|
597 |
|
sl@0
|
598 |
@SYMTestExpectedResults
|
sl@0
|
599 |
The fonts should be the same.
|
sl@0
|
600 |
*/
|
sl@0
|
601 |
void CTFontMetrics::TestINC086513()
|
sl@0
|
602 |
{
|
sl@0
|
603 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
604 |
CFont* theFont = NULL;
|
sl@0
|
605 |
TInt rc = iFontStore->GetNearestFontToDesignHeightInPixels(theFont, openFontSpec);
|
sl@0
|
606 |
TEST(KErrNone == rc);
|
sl@0
|
607 |
TFontSpec fontSpec = theFont->FontSpecInTwips();
|
sl@0
|
608 |
TTypeface typeface;
|
sl@0
|
609 |
typeface.iName=fontSpec.iTypeface.iName;
|
sl@0
|
610 |
typeface.SetIsProportional(!fontSpec.iTypeface.IsProportional());
|
sl@0
|
611 |
CFont* theFont1 = NULL;
|
sl@0
|
612 |
rc = iFontStore->GetNearestFontToDesignHeightInPixels(theFont1, openFontSpec);
|
sl@0
|
613 |
TEST(rc==KErrNone);
|
sl@0
|
614 |
|
sl@0
|
615 |
TEST(theFont1==theFont);//fonts should be the same
|
sl@0
|
616 |
|
sl@0
|
617 |
iFontStore->ReleaseFont(theFont1);
|
sl@0
|
618 |
iFontStore->ReleaseFont(theFont);
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
/*
|
sl@0
|
622 |
This test first marks a font as 'in use' and later tries to
|
sl@0
|
623 |
delete all the fonts in the font store by sending the special
|
sl@0
|
624 |
code KNullUid. Before this would crash the server because
|
sl@0
|
625 |
there are still fonts in use, but now it would just return safely.
|
sl@0
|
626 |
*/
|
sl@0
|
627 |
void CTFontMetrics::TestPDEF099034()
|
sl@0
|
628 |
{
|
sl@0
|
629 |
INFO_PRINTF1(_L("Trying to remove all fonts in the font store\r\n"));
|
sl@0
|
630 |
|
sl@0
|
631 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
632 |
CFont* font = NULL;
|
sl@0
|
633 |
TInt ret = iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
|
sl@0
|
634 |
TEST(ret == KErrNone);
|
sl@0
|
635 |
|
sl@0
|
636 |
TUid uid;
|
sl@0
|
637 |
uid.iUid=0;
|
sl@0
|
638 |
iFontStore->RemoveFile(uid);
|
sl@0
|
639 |
|
sl@0
|
640 |
iFontStore->ReleaseFont(font);
|
sl@0
|
641 |
}
|
sl@0
|
642 |
|
sl@0
|
643 |
/**
|
sl@0
|
644 |
@SYMTestCaseID GRAPHICS-FNTSTORE-0020
|
sl@0
|
645 |
|
sl@0
|
646 |
@SYMDEF DEF101441
|
sl@0
|
647 |
|
sl@0
|
648 |
@SYMTestCaseDesc Tests GetNearestFontToMaxHeightInPixels with boundary max height and above.
|
sl@0
|
649 |
Tests GetNearestFontToMaxHeightInPixels with boundary min height i,e 1.
|
sl@0
|
650 |
|
sl@0
|
651 |
@SYMTestPriority High
|
sl@0
|
652 |
|
sl@0
|
653 |
@SYMTestStatus Implemented
|
sl@0
|
654 |
|
sl@0
|
655 |
@SYMTestActions 1. Call GetNearestFontToMaxHeightInPixels with max height as 1025
|
sl@0
|
656 |
2 Call GetNearestFontToMaxHeightInPixels with max height as 1
|
sl@0
|
657 |
3. Call GetNearestFontToMaxHeightInPixels with max height as 1024
|
sl@0
|
658 |
API Calls:
|
sl@0
|
659 |
CFontStore::GetNearestFontToMaxHeightInPixels()
|
sl@0
|
660 |
|
sl@0
|
661 |
@SYMTestExpectedResults 1. For first call it should return KErrTooBig
|
sl@0
|
662 |
2. For second call it should return KErrArgument
|
sl@0
|
663 |
3. For Third call it should create the font with out any problem
|
sl@0
|
664 |
return KErrNone.
|
sl@0
|
665 |
*/
|
sl@0
|
666 |
void CTFontMetrics::TestGetNearestFontToMaxHeightInPixels()
|
sl@0
|
667 |
{
|
sl@0
|
668 |
TOpenFontSpec openFontSpec = GetTOpenFontSpec();
|
sl@0
|
669 |
CFont* theFont = NULL;
|
sl@0
|
670 |
|
sl@0
|
671 |
TInt rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1025);
|
sl@0
|
672 |
TEST(KErrTooBig == rc);
|
sl@0
|
673 |
TEST(NULL == theFont);
|
sl@0
|
674 |
|
sl@0
|
675 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1);
|
sl@0
|
676 |
TEST(KErrArgument == rc);
|
sl@0
|
677 |
TEST(NULL == theFont);
|
sl@0
|
678 |
|
sl@0
|
679 |
rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1024);
|
sl@0
|
680 |
TEST(NULL != theFont);
|
sl@0
|
681 |
|
sl@0
|
682 |
iFontStore->ReleaseFont(theFont);
|
sl@0
|
683 |
}
|
sl@0
|
684 |
|
sl@0
|
685 |
//--------------
|
sl@0
|
686 |
__CONSTRUCT_STEP__(FontMetrics)
|