sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1995-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 |
#include "T_LinkedFontUpdateTests.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
CTLinkedFontsUpdateStage1::CTLinkedFontsUpdateStage1(CTestStep* aStep)
|
sl@0
|
21 |
: CTGraphicsBase(aStep)
|
sl@0
|
22 |
{
|
sl@0
|
23 |
iFontLinkingSupported = EFalse;
|
sl@0
|
24 |
}
|
sl@0
|
25 |
|
sl@0
|
26 |
CTLinkedFontsUpdateStage1::~CTLinkedFontsUpdateStage1()
|
sl@0
|
27 |
{
|
sl@0
|
28 |
}
|
sl@0
|
29 |
|
sl@0
|
30 |
void CTLinkedFontsUpdateStage1::TestPanic(TInt aPanic)
|
sl@0
|
31 |
{
|
sl@0
|
32 |
_LIT(KFntTestStorePanicCategory,"TestFntStore");
|
sl@0
|
33 |
User::Panic(KFntTestStorePanicCategory,aPanic);
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
void CTLinkedFontsUpdateStage1::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
39 |
switch (aCurTestCase)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
case 1:
|
sl@0
|
42 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
43 |
SetupTestsL();
|
sl@0
|
44 |
break;
|
sl@0
|
45 |
case 2:
|
sl@0
|
46 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-LINKEDFONTS-0200"));
|
sl@0
|
47 |
RegisterThenUpdateTestL();
|
sl@0
|
48 |
break;
|
sl@0
|
49 |
case 3:
|
sl@0
|
50 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-LINKEDFONTS-0201"));
|
sl@0
|
51 |
NegativeUpdateTestsL();
|
sl@0
|
52 |
break;
|
sl@0
|
53 |
case 4:
|
sl@0
|
54 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
55 |
CloseTestsL();
|
sl@0
|
56 |
break;
|
sl@0
|
57 |
default:
|
sl@0
|
58 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
59 |
((CTLinkedFontsUpdateStage1Step*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
60 |
TestComplete();
|
sl@0
|
61 |
break;
|
sl@0
|
62 |
}
|
sl@0
|
63 |
((CTLinkedFontsUpdateStage1Step*)iStep)->RecordTestResultL();
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
/**
|
sl@0
|
67 |
Connect to the Font Bitmap Server and construct a CFbsTypeface store to access the fontstore.
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
void CTLinkedFontsUpdateStage1::SetupTestsL()
|
sl@0
|
70 |
{
|
sl@0
|
71 |
TInt ret = RFbsSession::Connect();
|
sl@0
|
72 |
TEST2(ret, KErrNone);
|
sl@0
|
73 |
|
sl@0
|
74 |
iFbs = RFbsSession::GetSession();
|
sl@0
|
75 |
|
sl@0
|
76 |
iTfStore = CFbsTypefaceStore::NewL(NULL);
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
void CTLinkedFontsUpdateStage1::CloseTestsL()
|
sl@0
|
80 |
{
|
sl@0
|
81 |
delete iTfStore;
|
sl@0
|
82 |
RFbsSession::Disconnect();
|
sl@0
|
83 |
}
|
sl@0
|
84 |
/**
|
sl@0
|
85 |
@SYMTestCaseID
|
sl@0
|
86 |
GRAPHICS-FNTSTORE-LINKEDFONTS-0200
|
sl@0
|
87 |
|
sl@0
|
88 |
@SYMPREQ
|
sl@0
|
89 |
PREQ2147
|
sl@0
|
90 |
|
sl@0
|
91 |
@SYMREQ
|
sl@0
|
92 |
REQ11859
|
sl@0
|
93 |
|
sl@0
|
94 |
@SYMTestCaseDesc
|
sl@0
|
95 |
Creates three brand new linked typefaces, then updates each. The first typeface has an
|
sl@0
|
96 |
element added to it, the second has one removed and the third is replaced with a different
|
sl@0
|
97 |
specification.
|
sl@0
|
98 |
|
sl@0
|
99 |
The outcome of the update process is checked after a reboot by test case 202.
|
sl@0
|
100 |
|
sl@0
|
101 |
@SYMTestPriority
|
sl@0
|
102 |
Critical
|
sl@0
|
103 |
|
sl@0
|
104 |
@SYMTestStatus
|
sl@0
|
105 |
Implemented
|
sl@0
|
106 |
|
sl@0
|
107 |
@SYMTestActions
|
sl@0
|
108 |
Checks the update process has completed succesfully.
|
sl@0
|
109 |
|
sl@0
|
110 |
@SYMTestExpectedResults
|
sl@0
|
111 |
Linked fonts are created and updated successfully. Validation of the new file is performed after a reboot.
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
|
sl@0
|
114 |
void CTLinkedFontsUpdateStage1::RegisterThenUpdateTestL()
|
sl@0
|
115 |
{
|
sl@0
|
116 |
CLinkedTypefaceSpecification* addSpec = CreateAddTypefaceLC(EFalse);
|
sl@0
|
117 |
CLinkedTypefaceSpecification* removeSpec = CreateRemoveTypefaceLC(EFalse);
|
sl@0
|
118 |
CLinkedTypefaceSpecification* updateSpec = CreateUpdateTypefaceLC(EFalse);
|
sl@0
|
119 |
|
sl@0
|
120 |
//Create three new linked fonts
|
sl@0
|
121 |
TRAPD(ret, addSpec->RegisterLinkedTypefaceL(*iTfStore));
|
sl@0
|
122 |
|
sl@0
|
123 |
//Ensure that a supporting rasterizer is present.
|
sl@0
|
124 |
if (ret == KErrNotSupported)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
WARN_PRINTF1(_L("There is not a font rasterizer present supporting font linking installed, skipping test."));
|
sl@0
|
127 |
CleanupStack::PopAndDestroy(3, addSpec);
|
sl@0
|
128 |
return;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
else
|
sl@0
|
131 |
{
|
sl@0
|
132 |
iFontLinkingSupported = ETrue;
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
TEST(ret == KErrNone);
|
sl@0
|
136 |
TRAP(ret, removeSpec->RegisterLinkedTypefaceL(*iTfStore));
|
sl@0
|
137 |
TEST(ret == KErrNone);
|
sl@0
|
138 |
TRAP(ret, updateSpec->RegisterLinkedTypefaceL(*iTfStore));
|
sl@0
|
139 |
TEST(ret == KErrNone);
|
sl@0
|
140 |
|
sl@0
|
141 |
CleanupStack::PopAndDestroy(3);
|
sl@0
|
142 |
|
sl@0
|
143 |
//Update the three linked fonts with their new specifications
|
sl@0
|
144 |
addSpec = CreateAddTypefaceLC(ETrue);
|
sl@0
|
145 |
TRAP(ret, addSpec->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
146 |
TEST(ret == KErrNone);
|
sl@0
|
147 |
|
sl@0
|
148 |
removeSpec = CreateRemoveTypefaceLC(ETrue);
|
sl@0
|
149 |
TRAP(ret, removeSpec->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
150 |
TEST(ret == KErrNone);
|
sl@0
|
151 |
|
sl@0
|
152 |
updateSpec = CreateUpdateTypefaceLC(ETrue);
|
sl@0
|
153 |
TRAP(ret, updateSpec->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
154 |
TEST(ret == KErrNone);
|
sl@0
|
155 |
|
sl@0
|
156 |
CleanupStack::PopAndDestroy(3, addSpec);
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
/**
|
sl@0
|
160 |
@SYMTestCaseID
|
sl@0
|
161 |
GRAPHICS-FNTSTORE-LINKEDFONTS-0201
|
sl@0
|
162 |
|
sl@0
|
163 |
@SYMPREQ
|
sl@0
|
164 |
PREQ2147
|
sl@0
|
165 |
|
sl@0
|
166 |
@SYMREQ
|
sl@0
|
167 |
REQ11859
|
sl@0
|
168 |
|
sl@0
|
169 |
@SYMTestCaseDesc
|
sl@0
|
170 |
Attempt to update a linked font with Invalid or Non-Existent Elements.
|
sl@0
|
171 |
Attempt to update a non-linked font.
|
sl@0
|
172 |
|
sl@0
|
173 |
@SYMTestPriority
|
sl@0
|
174 |
Critical
|
sl@0
|
175 |
|
sl@0
|
176 |
@SYMTestStatus
|
sl@0
|
177 |
Implemented
|
sl@0
|
178 |
|
sl@0
|
179 |
@SYMTestActions
|
sl@0
|
180 |
Ensures the correct error codes are returned showing that no updates were made to the relevant typefaces.
|
sl@0
|
181 |
|
sl@0
|
182 |
@SYMTestExpectedResults
|
sl@0
|
183 |
All invalid updates will return KErrNotFound or KErrAccessDenied
|
sl@0
|
184 |
*/
|
sl@0
|
185 |
void CTLinkedFontsUpdateStage1::NegativeUpdateTestsL()
|
sl@0
|
186 |
{
|
sl@0
|
187 |
if (!iFontLinkingSupported)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
WARN_PRINTF1(_L("There is not a font rasterizer present supporting font linking installed, skipping test."));
|
sl@0
|
190 |
return;
|
sl@0
|
191 |
}
|
sl@0
|
192 |
//Update with invalid element
|
sl@0
|
193 |
CLinkedTypefaceSpecification* invalidSpec = CreateUpdateTypefaceLC(EFalse);
|
sl@0
|
194 |
|
sl@0
|
195 |
CLinkedTypefaceElementSpec* invalidElement = CLinkedTypefaceElementSpec::NewLC(_L("SomeThingInValid"), 1);
|
sl@0
|
196 |
invalidSpec->AddTypefaceAtBackL(*invalidElement);
|
sl@0
|
197 |
CleanupStack::Pop(invalidElement);
|
sl@0
|
198 |
|
sl@0
|
199 |
TRAPD(ret, invalidSpec->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
200 |
TEST(ret == KErrNotFound);
|
sl@0
|
201 |
|
sl@0
|
202 |
CleanupStack::PopAndDestroy(invalidSpec);
|
sl@0
|
203 |
|
sl@0
|
204 |
//Update a typeface that doesn't exist.
|
sl@0
|
205 |
_LIT(KNonExistantTypeface, "DoesNotExist");
|
sl@0
|
206 |
CLinkedTypefaceSpecification* nonExistentTypeface = CreateNegativeTestTypefaceLC(KNonExistantTypeface);
|
sl@0
|
207 |
TRAP(ret, nonExistentTypeface->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
208 |
TEST(ret == KErrNotFound);
|
sl@0
|
209 |
|
sl@0
|
210 |
CleanupStack::PopAndDestroy(nonExistentTypeface);
|
sl@0
|
211 |
|
sl@0
|
212 |
//Update the default techview font (that is not a linked font).
|
sl@0
|
213 |
_LIT(KNonLinkedFontName, "DejaVu Sans Condensed");
|
sl@0
|
214 |
CLinkedTypefaceSpecification* nonLinkedTypeface = CreateNegativeTestTypefaceLC(KNonLinkedFontName);
|
sl@0
|
215 |
TRAP(ret, nonLinkedTypeface->UpdateLinkedTypefaceL(*iTfStore));
|
sl@0
|
216 |
TEST(ret == KErrAccessDenied);
|
sl@0
|
217 |
|
sl@0
|
218 |
CleanupStack::PopAndDestroy(nonLinkedTypeface);
|
sl@0
|
219 |
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
/**
|
sl@0
|
223 |
Create a typeface to test adding a new element to a linked font.
|
sl@0
|
224 |
@param TBool EFalse for Original, ETrue for Update version
|
sl@0
|
225 |
*/
|
sl@0
|
226 |
CLinkedTypefaceSpecification* CTLinkedFontsUpdateStage1::CreateAddTypefaceLC(TBool aUpdate)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KAddElementFontName);
|
sl@0
|
229 |
|
sl@0
|
230 |
AddGroups(spec);
|
sl@0
|
231 |
|
sl@0
|
232 |
CLinkedTypefaceElementSpec* element = CLinkedTypefaceElementSpec::NewLC(KElement1Name, 1);
|
sl@0
|
233 |
element->SetCanonical(ETrue);
|
sl@0
|
234 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
235 |
CleanupStack::Pop(element);
|
sl@0
|
236 |
|
sl@0
|
237 |
element = CLinkedTypefaceElementSpec::NewLC(KElement2Name, 2);
|
sl@0
|
238 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
239 |
CleanupStack::Pop(element);
|
sl@0
|
240 |
|
sl@0
|
241 |
if (aUpdate)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
element = CLinkedTypefaceElementSpec::NewLC(KElement3Name, 2);
|
sl@0
|
244 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
245 |
CleanupStack::Pop(element);
|
sl@0
|
246 |
}
|
sl@0
|
247 |
|
sl@0
|
248 |
return spec;
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
/**
|
sl@0
|
252 |
Create a typeface to test removing an element from a linked font.
|
sl@0
|
253 |
@param TBool EFalse for Original, ETrue for Update version
|
sl@0
|
254 |
*/
|
sl@0
|
255 |
CLinkedTypefaceSpecification* CTLinkedFontsUpdateStage1::CreateRemoveTypefaceLC(TBool aUpdate)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KRemoveElementFontName);
|
sl@0
|
258 |
AddGroups(spec);
|
sl@0
|
259 |
|
sl@0
|
260 |
CLinkedTypefaceElementSpec* element = CLinkedTypefaceElementSpec::NewLC(KElement1Name, 1);
|
sl@0
|
261 |
element->SetCanonical(ETrue);
|
sl@0
|
262 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
263 |
CleanupStack::Pop(element);
|
sl@0
|
264 |
|
sl@0
|
265 |
element = CLinkedTypefaceElementSpec::NewLC(KElement2Name, 2);
|
sl@0
|
266 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
267 |
CleanupStack::Pop(element);
|
sl@0
|
268 |
|
sl@0
|
269 |
if (!aUpdate)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
element = CLinkedTypefaceElementSpec::NewLC(KElement3Name, 2);
|
sl@0
|
272 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
273 |
CleanupStack::Pop(element);
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
return spec;
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
/**
|
sl@0
|
280 |
Create a typeface to test completely changing a linked font.
|
sl@0
|
281 |
@param TBool EFalse for Original, ETrue for Update version
|
sl@0
|
282 |
*/
|
sl@0
|
283 |
CLinkedTypefaceSpecification* CTLinkedFontsUpdateStage1::CreateUpdateTypefaceLC(TBool aUpdate)
|
sl@0
|
284 |
{
|
sl@0
|
285 |
CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KUpdateFontName);
|
sl@0
|
286 |
AddGroups(spec);
|
sl@0
|
287 |
|
sl@0
|
288 |
CLinkedTypefaceElementSpec* element;
|
sl@0
|
289 |
|
sl@0
|
290 |
if (!aUpdate)
|
sl@0
|
291 |
{
|
sl@0
|
292 |
element = CLinkedTypefaceElementSpec::NewLC(KElement1Name, 1);
|
sl@0
|
293 |
element->SetCanonical(ETrue);
|
sl@0
|
294 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
295 |
CleanupStack::Pop(element);
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
element = CLinkedTypefaceElementSpec::NewLC(KElement2Name, 2);
|
sl@0
|
299 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
300 |
CleanupStack::Pop(element);
|
sl@0
|
301 |
|
sl@0
|
302 |
if (aUpdate)
|
sl@0
|
303 |
{
|
sl@0
|
304 |
CLinkedTypefaceElementSpec* element = CLinkedTypefaceElementSpec::NewLC(KElement3Name, 1);
|
sl@0
|
305 |
element->SetCanonical(ETrue);
|
sl@0
|
306 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
307 |
CleanupStack::Pop(element);
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
return spec;
|
sl@0
|
311 |
}
|
sl@0
|
312 |
|
sl@0
|
313 |
/**
|
sl@0
|
314 |
Create a typeface for use in the negative test cases.
|
sl@0
|
315 |
|
sl@0
|
316 |
This has a number of typeface groups already added to it.
|
sl@0
|
317 |
|
sl@0
|
318 |
@see CTLinkedFontsUpdate1::AddGroups()
|
sl@0
|
319 |
@param aName The name of the typeface.
|
sl@0
|
320 |
*/
|
sl@0
|
321 |
CLinkedTypefaceSpecification* CTLinkedFontsUpdateStage1::CreateNegativeTestTypefaceLC(const TDesC& aName)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(aName);
|
sl@0
|
324 |
|
sl@0
|
325 |
AddGroups(spec);
|
sl@0
|
326 |
|
sl@0
|
327 |
CLinkedTypefaceElementSpec* element = CLinkedTypefaceElementSpec::NewLC(_L("DejaVu Sans Condensed"), 1);
|
sl@0
|
328 |
element->SetCanonical(ETrue);
|
sl@0
|
329 |
spec->AddTypefaceAtBackL(*element);
|
sl@0
|
330 |
CleanupStack::Pop(element);
|
sl@0
|
331 |
|
sl@0
|
332 |
return spec;
|
sl@0
|
333 |
}
|
sl@0
|
334 |
|
sl@0
|
335 |
/**
|
sl@0
|
336 |
Adds two simple linked typeface groups to the linked typeface group.
|
sl@0
|
337 |
|
sl@0
|
338 |
@param aSpec The specification to have groups added to
|
sl@0
|
339 |
*/
|
sl@0
|
340 |
void CTLinkedFontsUpdateStage1::AddGroups(CLinkedTypefaceSpecification* aSpec)
|
sl@0
|
341 |
{
|
sl@0
|
342 |
CLinkedTypefaceGroup* grp = CLinkedTypefaceGroup::NewLC(1);
|
sl@0
|
343 |
grp->SetBaselineShift(CLinkedTypefaceGroup::EBaselineShift);
|
sl@0
|
344 |
aSpec->AddLinkedTypefaceGroupL(*grp);
|
sl@0
|
345 |
CleanupStack::Pop(grp);
|
sl@0
|
346 |
|
sl@0
|
347 |
grp = CLinkedTypefaceGroup::NewLC(2);
|
sl@0
|
348 |
grp->SetBaselineShift(CLinkedTypefaceGroup::ENoBaselineShift);
|
sl@0
|
349 |
aSpec->AddLinkedTypefaceGroupL(*grp);
|
sl@0
|
350 |
CleanupStack::Pop(grp);
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
__CONSTRUCT_STEP__(LinkedFontsUpdateStage1)
|
sl@0
|
354 |
|
sl@0
|
355 |
|
sl@0
|
356 |
//CTLinkedFontsUpdate2
|
sl@0
|
357 |
CTLinkedFontsUpdateStage2::CTLinkedFontsUpdateStage2(CTestStep* aStep)
|
sl@0
|
358 |
: CTGraphicsBase(aStep)
|
sl@0
|
359 |
{
|
sl@0
|
360 |
}
|
sl@0
|
361 |
|
sl@0
|
362 |
CTLinkedFontsUpdateStage2::~CTLinkedFontsUpdateStage2()
|
sl@0
|
363 |
{
|
sl@0
|
364 |
}
|
sl@0
|
365 |
|
sl@0
|
366 |
void CTLinkedFontsUpdateStage2::TestPanic(TInt aPanic)
|
sl@0
|
367 |
{
|
sl@0
|
368 |
_LIT(KFntTestStorePanicCategory,"TestFntStore");
|
sl@0
|
369 |
User::Panic(KFntTestStorePanicCategory,aPanic);
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
void CTLinkedFontsUpdateStage2::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
((CTLinkedFontsUpdateStage2Step*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
375 |
switch (aCurTestCase)
|
sl@0
|
376 |
{
|
sl@0
|
377 |
case 1:
|
sl@0
|
378 |
((CTLinkedFontsUpdateStage2Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
379 |
SetupTestsL();
|
sl@0
|
380 |
break;
|
sl@0
|
381 |
case 2:
|
sl@0
|
382 |
((CTLinkedFontsUpdateStage1Step*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-LINKEDFONTS-0202"));
|
sl@0
|
383 |
ValidateLinkedFontsL();
|
sl@0
|
384 |
break;
|
sl@0
|
385 |
case 3:
|
sl@0
|
386 |
((CTLinkedFontsUpdateStage2Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
387 |
CloseTestsL();
|
sl@0
|
388 |
default:
|
sl@0
|
389 |
((CTLinkedFontsUpdateStage2Step*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
390 |
((CTLinkedFontsUpdateStage2Step*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
391 |
TestComplete();
|
sl@0
|
392 |
break;
|
sl@0
|
393 |
}
|
sl@0
|
394 |
((CTLinkedFontsUpdateStage2Step*)iStep)->RecordTestResultL();
|
sl@0
|
395 |
}
|
sl@0
|
396 |
|
sl@0
|
397 |
/**
|
sl@0
|
398 |
Connect to the Font Bitmap Server and construct a CFbsTypeface store to access the fontstore.
|
sl@0
|
399 |
*/
|
sl@0
|
400 |
void CTLinkedFontsUpdateStage2::SetupTestsL()
|
sl@0
|
401 |
{
|
sl@0
|
402 |
TInt ret = RFbsSession::Connect();
|
sl@0
|
403 |
TEST2(ret, KErrNone);
|
sl@0
|
404 |
|
sl@0
|
405 |
iFbs = RFbsSession::GetSession();
|
sl@0
|
406 |
|
sl@0
|
407 |
iTfStore = CFbsTypefaceStore::NewL(NULL);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
void CTLinkedFontsUpdateStage2::CloseTestsL()
|
sl@0
|
411 |
{
|
sl@0
|
412 |
delete iTfStore;
|
sl@0
|
413 |
RFbsSession::Disconnect();
|
sl@0
|
414 |
}
|
sl@0
|
415 |
/**
|
sl@0
|
416 |
@SYMTestCaseID
|
sl@0
|
417 |
GRAPHICS-FNTSTORE-LINKEDFONTS-0202
|
sl@0
|
418 |
|
sl@0
|
419 |
@SYMPREQ
|
sl@0
|
420 |
PREQ2147
|
sl@0
|
421 |
|
sl@0
|
422 |
@SYMREQ
|
sl@0
|
423 |
REQ11859
|
sl@0
|
424 |
|
sl@0
|
425 |
@SYMTestCaseDesc
|
sl@0
|
426 |
Tests the updates made to three linked typefaces created by test case 200; this checks the linked fonts
|
sl@0
|
427 |
have been correctly updated to the latest specification.
|
sl@0
|
428 |
|
sl@0
|
429 |
@SYMTestPriority
|
sl@0
|
430 |
Critical
|
sl@0
|
431 |
|
sl@0
|
432 |
@SYMTestStatus
|
sl@0
|
433 |
Implemented
|
sl@0
|
434 |
|
sl@0
|
435 |
@SYMTestActions
|
sl@0
|
436 |
Checks the update process has completed succesfully.
|
sl@0
|
437 |
|
sl@0
|
438 |
@SYMTestExpectedResults
|
sl@0
|
439 |
The linked fonts match the specification they were updated to.
|
sl@0
|
440 |
Failures may be due to other failures in test case xxx as this is the second stage of these tests.
|
sl@0
|
441 |
*/
|
sl@0
|
442 |
void CTLinkedFontsUpdateStage2::ValidateLinkedFontsL()
|
sl@0
|
443 |
{
|
sl@0
|
444 |
CLinkedTypefaceSpecification* addSpec = CLinkedTypefaceSpecification::NewLC(KAddElementFontName);
|
sl@0
|
445 |
TRAPD(ret, addSpec->FetchLinkedTypefaceSpecificationL(*iTfStore));
|
sl@0
|
446 |
TEST(ret == KErrNone);
|
sl@0
|
447 |
|
sl@0
|
448 |
CLinkedTypefaceSpecification* removeSpec = CLinkedTypefaceSpecification::NewLC(KRemoveElementFontName);
|
sl@0
|
449 |
TRAP(ret, removeSpec->FetchLinkedTypefaceSpecificationL(*iTfStore));
|
sl@0
|
450 |
TEST(ret == KErrNone);
|
sl@0
|
451 |
|
sl@0
|
452 |
CLinkedTypefaceSpecification* updateSpec = CLinkedTypefaceSpecification::NewLC(KUpdateFontName);
|
sl@0
|
453 |
TRAP(ret, updateSpec->FetchLinkedTypefaceSpecificationL(*iTfStore));
|
sl@0
|
454 |
TEST(ret == KErrNone);
|
sl@0
|
455 |
|
sl@0
|
456 |
//Test Elements are in correct order
|
sl@0
|
457 |
TEST(addSpec->TypefaceCount() == 3);
|
sl@0
|
458 |
|
sl@0
|
459 |
if (addSpec->Typeface(0))
|
sl@0
|
460 |
TEST(addSpec->Typeface(0)->ElementName() == KElement1Name);
|
sl@0
|
461 |
else
|
sl@0
|
462 |
TEST(EFalse);
|
sl@0
|
463 |
|
sl@0
|
464 |
if (addSpec->Typeface(1))
|
sl@0
|
465 |
TEST(addSpec->Typeface(1)->ElementName() == KElement2Name);
|
sl@0
|
466 |
else
|
sl@0
|
467 |
TEST(EFalse);
|
sl@0
|
468 |
|
sl@0
|
469 |
if (addSpec->Typeface(2))
|
sl@0
|
470 |
TEST(addSpec->Typeface(2)->ElementName() == KElement3Name);
|
sl@0
|
471 |
else
|
sl@0
|
472 |
TEST(EFalse);
|
sl@0
|
473 |
|
sl@0
|
474 |
TEST(removeSpec->TypefaceCount() == 2);
|
sl@0
|
475 |
if (addSpec->Typeface(0))
|
sl@0
|
476 |
TEST(removeSpec->Typeface(0)->ElementName() == KElement1Name);
|
sl@0
|
477 |
else
|
sl@0
|
478 |
TEST(EFalse);
|
sl@0
|
479 |
|
sl@0
|
480 |
if (addSpec->Typeface(1))
|
sl@0
|
481 |
TEST(removeSpec->Typeface(1)->ElementName() == KElement2Name);
|
sl@0
|
482 |
else
|
sl@0
|
483 |
TEST(EFalse);
|
sl@0
|
484 |
|
sl@0
|
485 |
TEST(updateSpec->TypefaceCount() == 2);
|
sl@0
|
486 |
if (addSpec->Typeface(1))
|
sl@0
|
487 |
TEST(updateSpec->Typeface(0)->ElementName() == KElement2Name);
|
sl@0
|
488 |
else
|
sl@0
|
489 |
TEST(EFalse);
|
sl@0
|
490 |
|
sl@0
|
491 |
if (addSpec->Typeface(1))
|
sl@0
|
492 |
TEST(updateSpec->Typeface(1)->ElementName() == KElement3Name);
|
sl@0
|
493 |
else
|
sl@0
|
494 |
TEST(EFalse);
|
sl@0
|
495 |
|
sl@0
|
496 |
CleanupStack::PopAndDestroy(3, addSpec);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
|
sl@0
|
499 |
__CONSTRUCT_STEP__(LinkedFontsUpdateStage2)
|