|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "TGraphicsContext.h" |
|
20 #include <e32std.h> |
|
21 #include <e32test.h> |
|
22 #include <frmtlay.h> |
|
23 #include <frmtview.h> |
|
24 #include <frmconst.h> |
|
25 #include <txtlaydc.h> |
|
26 #include <txtetext.h> |
|
27 #include <w32std.h> |
|
28 |
|
29 namespace LocalToFile |
|
30 { |
|
31 |
|
32 _LIT(KTCustomCharMapping, "TCustomCharMapping"); |
|
33 const TInt KDisplayWidth = 202; |
|
34 const TInt KDisplayHeight = 100; |
|
35 const TInt KPictureCharacter = 0xFFFC; |
|
36 RTest test(KTCustomCharMapping); |
|
37 |
|
38 enum TTestNum |
|
39 { |
|
40 EDefaultBehaviourInvisible = 0, |
|
41 EDefaultBehaviourVisible = 1, |
|
42 ECustomRemappingInvisible = 2, |
|
43 ECustomRemappingVisible = 3, |
|
44 ENewTest = 4 //Test remapping with no custom remapper and some flags explicitly set to invisible |
|
45 }; |
|
46 |
|
47 |
|
48 class CPinkSquare : public CPicture |
|
49 { |
|
50 public: |
|
51 // Size of square in twips. |
|
52 // 600 is 15 pixels using the standard test graphics device at |
|
53 // its default resolution. |
|
54 enum { KWidth = 600, KHeight = 600 }; |
|
55 CPinkSquare() |
|
56 {} |
|
57 void Draw(CGraphicsContext& aGc, const TPoint& aTopLeft, const TRect& aClipRect, MGraphicsDeviceMap* aMap) const |
|
58 { |
|
59 // This picture is a magenta square |
|
60 TPoint size(KWidth, KHeight); |
|
61 if (aMap) |
|
62 size = aMap->TwipsToPixels(size); |
|
63 TRect rect(aTopLeft, aTopLeft + size); |
|
64 aGc.SetClippingRect(aClipRect); |
|
65 aGc.SetDrawMode(CGraphicsContext::EDrawModePEN); |
|
66 aGc.SetPenColor(KRgbMagenta); |
|
67 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
68 aGc.SetBrushColor(KRgbMagenta); |
|
69 aGc.DrawRect(rect); |
|
70 } |
|
71 void ExternalizeL(RWriteStream&) const |
|
72 {} |
|
73 void GetOriginalSizeInTwips(TSize& a) const |
|
74 { |
|
75 a.iWidth = CPinkSquare::KWidth; |
|
76 a.iHeight = CPinkSquare::KHeight; |
|
77 } |
|
78 }; |
|
79 |
|
80 _LIT(KEnd, "\x2029"); |
|
81 class TDocModel : public MLayDoc |
|
82 { |
|
83 public: |
|
84 TDocModel(const TDesC& aDes) |
|
85 : iDes(&aDes), iParagraphFormat(0) |
|
86 {} |
|
87 void SetParagraphFormat(CParaFormat* a) |
|
88 { |
|
89 iParagraphFormat = a; |
|
90 } |
|
91 // From MLayDoc |
|
92 TInt LdDocumentLength() const |
|
93 { return iDes->Length(); } |
|
94 TInt LdToParagraphStart(TInt& a) const |
|
95 { |
|
96 TInt curr = a; |
|
97 if (a < LdDocumentLength()) |
|
98 { |
|
99 a = iDes->Left(a).LocateReverse(0x2029); |
|
100 a = a < 0? 0 : a + 1; |
|
101 } |
|
102 return curr - a; |
|
103 } |
|
104 void GetParagraphFormatL(CParaFormat* aFormat, TInt) const |
|
105 { |
|
106 if (iParagraphFormat) |
|
107 { |
|
108 aFormat->CopyL(*iParagraphFormat); |
|
109 return; |
|
110 } |
|
111 aFormat->Reset(); |
|
112 TTabStop tabStop; |
|
113 tabStop.iTwipsPosition = 1000; |
|
114 tabStop.iType = TTabStop::ELeftTab; |
|
115 aFormat->StoreTabL(tabStop); |
|
116 } |
|
117 void GetChars(TPtrC& aView,TCharFormat& aFormat, TInt aStartPos)const |
|
118 { |
|
119 TCharFormat cf; |
|
120 aFormat = cf; |
|
121 if (aStartPos == LdDocumentLength()) |
|
122 aView.Set(KEnd); |
|
123 else |
|
124 aView.Set(iDes->Mid(aStartPos)); |
|
125 } |
|
126 TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos) const |
|
127 { |
|
128 if ((*iDes)[aPos] != KPictureCharacter) |
|
129 return KErrNotFound; |
|
130 aSize.iWidth = CPinkSquare::KWidth; |
|
131 aSize.iHeight = CPinkSquare::KHeight; |
|
132 return KErrNone; |
|
133 } |
|
134 CPicture* PictureHandleL(TInt aPos, TForcePictureLoad) const |
|
135 { |
|
136 if ((*iDes)[aPos] != KPictureCharacter) |
|
137 return 0; |
|
138 return new(ELeave) CPinkSquare; |
|
139 } |
|
140 TBool EnquirePageBreak(TInt aPos, TInt aLength)const |
|
141 { |
|
142 return iDes->Mid(aPos, aLength).Locate(0x000C) < 0? |
|
143 EFalse : ETrue; |
|
144 } |
|
145 TBool SelectParagraphLabel(TInt) |
|
146 { return EFalse; } |
|
147 void CancelSelectLabel() |
|
148 {} |
|
149 private: |
|
150 const TDesC* iDes; |
|
151 CParaFormat* iParagraphFormat; |
|
152 }; |
|
153 } |
|
154 using namespace LocalToFile; |
|
155 |
|
156 class CTestTextView // slightly naughty |
|
157 { |
|
158 public: |
|
159 static void SetContextForFlickerFreeRedraw(CTextView* aView, CBitmapContext* aContext) |
|
160 { |
|
161 aView->iOffScreenContext = aContext; |
|
162 } |
|
163 }; |
|
164 |
|
165 |
|
166 static const TInt KTestCases = 5; |
|
167 static const TInt KVariants = 2; |
|
168 |
|
169 // For tests 0 to 3 the source string consists of: |
|
170 // 'Y' <hard space> 'Z' <normal space> <non-breaking hyphen> <zero width space> |
|
171 static const TPtrC KTestStrings[KTestCases][KVariants] = |
|
172 { |
|
173 { // Test remapping with no custom remapper and flags set to invisible |
|
174 // The non-breaking hyphen is turned into a normal hyphen |
|
175 // The zero width space disappears (0xFFFF) and the hard space becomes a normal space |
|
176 // All done by MTmCustom::Map() |
|
177 _S("\x0059\x00A0\x005A\x0020\x2011\x200B"), |
|
178 _S("\xFFFF\x0059\x0020\x005A\x0020\x002D\xFFFF\xFFFF"), |
|
179 }, |
|
180 { // Test remapping with no custom remapper and flags set to visible |
|
181 // The non-breaking hyphen becomes a tilde |
|
182 // The normal space and the zero width space become visible middle dots |
|
183 // The hard (non-breaking) space becomes a degree sign |
|
184 // The paragraph sign becomes a pilcrow |
|
185 // All done by MTmCustom::Map() |
|
186 _S("\x0059\x00A0\x005A\x0020\x2011\x200B"), |
|
187 _S("\xFFFF\x0059\x00B0\x005A\x00B7\x007E\x00B7\x00B6\xFFFF"), |
|
188 }, |
|
189 { // Test remapping with custom remapper and flags set to invisible |
|
190 // The non-breaking hyphen is turned into a normal hyphen |
|
191 // The zero width space disappears (0xFFFF) and the hard space becomes a normal space |
|
192 // All done by MTmCustom::Map() |
|
193 // The hard (non-breaking) space becomes a caret |
|
194 // This is done by the custom remapper |
|
195 _S("\x0059\x00A0\x005A\x0020\x2011\x200B"), |
|
196 _S("\xFFFF\x0059\x005E\x005A\x0020\x002D\xFFFF\xFFFF"), |
|
197 }, |
|
198 { // Test remapping with custom remapper and flags set to visible |
|
199 // The non-breaking hyphen becomes a tilde |
|
200 // The zero width space become visible middle dots |
|
201 // All done by MTmCustom::Map() |
|
202 // The normal space remains a normal (invisible) space because default behaviour is overidden |
|
203 // The hard (non-breaking) space becomes a caret |
|
204 // The paragraph sign becomes a capital P |
|
205 // All done by the custom remapper |
|
206 _S("\x0059\x00A0\x005A\x0020\x2011\x200B"), |
|
207 _S("\xFFFF\x0059\x005E\x005A\x0020\x007E\x00B7\x0050\xFFFF"), |
|
208 }, |
|
209 { |
|
210 // Test remapping with no custom remapper and some flags explicitly set to invisible |
|
211 // The non-breaking hyphen is turned into a normal hyphen |
|
212 // The zero width space disappears (0xFFFF) and the hard space becomes a normal space |
|
213 // All done by MTmCustom::Map() |
|
214 _S("\x0059\x00A0\x005A\x0020\x2011\x200B"), |
|
215 _S("\xFFFF\x0059\x0020\x005A\x0020\x002D\xFFFF\xFFFF"), |
|
216 } |
|
217 }; |
|
218 |
|
219 |
|
220 class CCustomRemapper : public MFormCustomInvisibleCharacterRemapper |
|
221 { |
|
222 public: |
|
223 static CCustomRemapper* NewL(); |
|
224 ~CCustomRemapper(); |
|
225 TUint Remap(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc); |
|
226 private: |
|
227 CCustomRemapper(); |
|
228 }; |
|
229 |
|
230 CCustomRemapper* CCustomRemapper::NewL() |
|
231 { |
|
232 CCustomRemapper* me = new(ELeave) CCustomRemapper; |
|
233 return me; |
|
234 } |
|
235 |
|
236 CCustomRemapper::~CCustomRemapper() |
|
237 { |
|
238 } |
|
239 |
|
240 TUint CCustomRemapper::Remap(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc) |
|
241 { |
|
242 switch (aChar) |
|
243 { |
|
244 case CEditableText::EParagraphDelimiter: |
|
245 if (aNonPrintingCharVisibility.ParagraphDelimitersVisible()) |
|
246 return 0x0050; // capital P - override when visible |
|
247 break; |
|
248 |
|
249 case CEditableText::ESpace: |
|
250 return aChar; // don't remap but don't pass it on - override default |
|
251 // break statement was removed. |
|
252 |
|
253 case CEditableText::ENonBreakingSpace: |
|
254 return 0x005E; // Caret - override always - visible or not |
|
255 // break statement was removed. |
|
256 default: |
|
257 break; // do nothing |
|
258 } |
|
259 |
|
260 // If not mapping special characters, or not mapping this particular character, use the default mapping. |
|
261 return DefaultMapping(aChar, aNonPrintingCharVisibility, aLayDoc); |
|
262 } |
|
263 |
|
264 CCustomRemapper::CCustomRemapper() |
|
265 { |
|
266 } |
|
267 |
|
268 void DoTestL(TDes& aText, CTextLayout* /*aLayout*/, CTestGraphicsDevice* aDevice, CTextView* aView, TTestNum aTestNum) |
|
269 { |
|
270 aText = KTestStrings[aTestNum][0]; |
|
271 aDevice->LineArray().ResetLineArray(); |
|
272 aView->HandleGlobalChangeL(); |
|
273 const TTestGCDisplayLine* line1 = &(aDevice->LineArray().Line(0)); |
|
274 const TTestGCDisplayLine* line2 = aDevice->LineArray().Find(KTestStrings[aTestNum][1]); |
|
275 test(0 != line1); |
|
276 test(0 != line2); |
|
277 // Can't always do a direct comparison of lines because same string |
|
278 // may appear in more than one line, so compare contents |
|
279 test(line1->iLineData.Compare(line2->iLineData) == 0); |
|
280 } |
|
281 |
|
282 |
|
283 /** |
|
284 @SYMTestCaseID SYSLIB-FORM-CT-0147 |
|
285 @SYMTestCaseDesc Test installation and deinstallation of custom remapper |
|
286 @SYMTestPriority High |
|
287 @SYMTestActions Test installation and deinstallation of custom remapper |
|
288 @SYMTestExpectedResults The test must not fail. |
|
289 @SYMPREQ 1128 Placeholders for invisible characers in rich text shall be customizable |
|
290 */ |
|
291 void RunInstallationTestsL() |
|
292 { |
|
293 // Note: If you need to move these heap checks any further "in" to focus |
|
294 // on a specific test then you will have to move all the setup code in as |
|
295 // well - and still preserve the two different display widths in use |
|
296 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-CT-0147 ")); |
|
297 __UHEAP_MARK; |
|
298 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
299 CleanupStack::PushL(scheduler); |
|
300 CActiveScheduler::Install(scheduler); |
|
301 TBuf<100> text; |
|
302 TDocModel docModel(text); |
|
303 TRect displayRect(0, 0, KDisplayWidth, KDisplayHeight); |
|
304 CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width()); |
|
305 CleanupStack::PushL(layout); |
|
306 CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0); |
|
307 CleanupStack::PushL(device); |
|
308 CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0); |
|
309 CleanupStack::PushL(view); |
|
310 // This is used to force the use of CTestGraphicsContext instead of a normal one |
|
311 CWindowGc* offScreenContext; |
|
312 User::LeaveIfError(device->CreateContext(offScreenContext)); |
|
313 CleanupStack::PushL(offScreenContext); |
|
314 CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext); |
|
315 |
|
316 // OK, let's get down to testing |
|
317 MFormCustomInvisibleCharacterRemapper* remapper; |
|
318 // read what the ptr is set to - check it is null |
|
319 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
320 test.Next(_L("Test uninstalled")); |
|
321 test(remapper == NULL); |
|
322 |
|
323 // install a custom remapper - get the ptr - check it is set |
|
324 MFormCustomInvisibleCharacterRemapper* customRemapper = CCustomRemapper::NewL(); |
|
325 layout->SetCustomInvisibleCharacterRemapper(customRemapper); |
|
326 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
327 test.Next(_L("Test installed")); |
|
328 test(remapper == customRemapper); |
|
329 |
|
330 // set the ptr back to null (deinstall) - get the ptr - check it is null |
|
331 layout->SetCustomInvisibleCharacterRemapper(NULL); |
|
332 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
333 test.Next(_L("Test uninstalled again")); |
|
334 test(remapper == NULL); |
|
335 |
|
336 delete customRemapper; |
|
337 |
|
338 CleanupStack::PopAndDestroy(offScreenContext); |
|
339 CleanupStack::PopAndDestroy(view); |
|
340 CleanupStack::PopAndDestroy(device); |
|
341 CleanupStack::PopAndDestroy(layout); |
|
342 CleanupStack::PopAndDestroy(scheduler); |
|
343 __UHEAP_MARKEND; |
|
344 } |
|
345 |
|
346 |
|
347 /** |
|
348 @SYMTestCaseID SYSLIB-FORM-CT-0148 |
|
349 @SYMTestCaseDesc Test behaviour without custom remapper installed |
|
350 @SYMTestPriority High |
|
351 @SYMTestActions Test behaviour without custom remapper installed |
|
352 @SYMTestExpectedResults The test must not fail. |
|
353 @SYMPREQ 1128 Placeholders for invisible characers in rich text shall be customizable |
|
354 */ |
|
355 void RunDefaultBehaviourTestsL() |
|
356 { |
|
357 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-CT-0148 ")); |
|
358 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
359 CleanupStack::PushL(scheduler); |
|
360 CActiveScheduler::Install(scheduler); |
|
361 TBuf<100> text; |
|
362 TDocModel docModel(text); |
|
363 TRect displayRect(0, 0, KDisplayWidth, KDisplayHeight); |
|
364 CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width()); |
|
365 CleanupStack::PushL(layout); |
|
366 CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0); |
|
367 CleanupStack::PushL(device); |
|
368 CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0); |
|
369 CleanupStack::PushL(view); |
|
370 // This is used to force the use of CTestGraphicsContext instead of a normal one |
|
371 CWindowGc* offScreenContext; |
|
372 User::LeaveIfError(device->CreateContext(offScreenContext)); |
|
373 CleanupStack::PushL(offScreenContext); |
|
374 CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext); |
|
375 |
|
376 // Start by making sure no custom remapper is installed |
|
377 MFormCustomInvisibleCharacterRemapper* remapper; |
|
378 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
379 test(remapper == NULL); |
|
380 |
|
381 // Set all invisible characters to be invisible |
|
382 TNonPrintingCharVisibility visibility; |
|
383 visibility.SetNoneVisible(); |
|
384 layout->SetNonPrintingCharsVisibility(visibility); |
|
385 |
|
386 // Test remapping with no custom remapper and flags set to invisible |
|
387 test.Next(_L("Test uninstalled behaviour - flags invisible")); |
|
388 DoTestL(text, layout, device, view, EDefaultBehaviourInvisible); |
|
389 |
|
390 // Now set all invisible characters to be visible |
|
391 visibility.SetAllVisible(); |
|
392 layout->SetNonPrintingCharsVisibility(visibility); |
|
393 |
|
394 // Test remapping with no custom remapper and flags set to visible |
|
395 test.Next(_L("Test uninstalled behaviour - flags visible")); |
|
396 DoTestL(text, layout, device, view, EDefaultBehaviourVisible); |
|
397 |
|
398 // Test remapping with no custom remapper and some flags explicitly set to invisible |
|
399 test.Next(_L("Test uninstalled behaviour - some flags invisible")); |
|
400 //Set all invisible characters to be visible |
|
401 visibility.SetAllVisible(); |
|
402 //Set some attributes explicitly to be invisible |
|
403 visibility.SetSpacesVisible(EFalse); |
|
404 visibility.SetTabsVisible(EFalse); |
|
405 visibility.SetPotentialHyphensVisible(EFalse); |
|
406 visibility.SetParagraphDelimitersVisible(EFalse); |
|
407 visibility.SetPageBreaksVisible(EFalse); |
|
408 visibility.SetNonBreakingSpacesVisible(EFalse); |
|
409 visibility.SetNonBreakingHyphensVisible(EFalse); |
|
410 visibility.SetLineBreaksVisible(EFalse); |
|
411 layout->SetNonPrintingCharsVisibility(visibility); |
|
412 //Test if the visibility is set accordingly |
|
413 DoTestL(text, layout, device, view, ENewTest); |
|
414 |
|
415 CleanupStack::PopAndDestroy(offScreenContext); |
|
416 CleanupStack::PopAndDestroy(view); |
|
417 CleanupStack::PopAndDestroy(device); |
|
418 CleanupStack::PopAndDestroy(layout); |
|
419 CleanupStack::PopAndDestroy(scheduler); |
|
420 } |
|
421 |
|
422 |
|
423 /** |
|
424 @SYMTestCaseID SYSLIB-FORM-CT-0149 |
|
425 @SYMTestCaseDesc Test behaviour with custom remapper installed |
|
426 @SYMTestPriority High |
|
427 @SYMTestActions Test behaviour with custom remapper installed |
|
428 @SYMTestExpectedResults The test must not fail. |
|
429 @SYMPREQ 1128 Placeholders for invisible characers in rich text shall be customizable |
|
430 */ |
|
431 void RunCustomBehaviourTestsL() |
|
432 { |
|
433 // Note: If you need to move these heap checks any further "in" to focus |
|
434 // on a specific test then you will have to move all the setup code in as |
|
435 // well - and still preserve the two different display widths in use |
|
436 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-CT-0149 ")); |
|
437 __UHEAP_MARK; |
|
438 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
439 CleanupStack::PushL(scheduler); |
|
440 CActiveScheduler::Install(scheduler); |
|
441 TBuf<100> text; |
|
442 TDocModel docModel(text); |
|
443 TRect displayRect(0, 0, KDisplayWidth, KDisplayHeight); |
|
444 CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width()); |
|
445 CleanupStack::PushL(layout); |
|
446 CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0); |
|
447 CleanupStack::PushL(device); |
|
448 CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0); |
|
449 CleanupStack::PushL(view); |
|
450 // This is used to force the use of CTestGraphicsContext instead of a normal one |
|
451 CWindowGc* offScreenContext; |
|
452 User::LeaveIfError(device->CreateContext(offScreenContext)); |
|
453 CleanupStack::PushL(offScreenContext); |
|
454 CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext); |
|
455 |
|
456 // We need to install a custom remapper |
|
457 MFormCustomInvisibleCharacterRemapper* remapper; |
|
458 MFormCustomInvisibleCharacterRemapper* customRemapper = CCustomRemapper::NewL(); |
|
459 layout->SetCustomInvisibleCharacterRemapper(customRemapper); |
|
460 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
461 test(remapper == customRemapper); |
|
462 |
|
463 // Set all invisible characters to be invisible |
|
464 TNonPrintingCharVisibility visibility; |
|
465 visibility.SetNoneVisible(); |
|
466 layout->SetNonPrintingCharsVisibility(visibility); |
|
467 |
|
468 // Test remapping with custom remapper and flags set to invisible |
|
469 test.Next(_L("Test installed behaviour - flags invisible")); |
|
470 DoTestL(text, layout, device, view, ECustomRemappingInvisible); |
|
471 |
|
472 // Now set all invisible characters to be visible |
|
473 visibility.SetAllVisible(); |
|
474 layout->SetNonPrintingCharsVisibility(visibility); |
|
475 |
|
476 // Test remapping with custom remapper and flags set to visible |
|
477 test.Next(_L("Test installed behaviour - flags visible")); |
|
478 DoTestL(text, layout, device, view, ECustomRemappingVisible); |
|
479 |
|
480 // Now we are finished deinstall and delete it |
|
481 layout->SetCustomInvisibleCharacterRemapper(NULL); |
|
482 remapper = layout->GetCustomInvisibleCharacterRemapper(); |
|
483 test(remapper == NULL); |
|
484 delete customRemapper; |
|
485 |
|
486 CleanupStack::PopAndDestroy(offScreenContext); |
|
487 CleanupStack::PopAndDestroy(view); |
|
488 CleanupStack::PopAndDestroy(device); |
|
489 CleanupStack::PopAndDestroy(layout); |
|
490 CleanupStack::PopAndDestroy(scheduler); |
|
491 __UHEAP_MARKEND; |
|
492 } |
|
493 |
|
494 |
|
495 TInt E32Main() |
|
496 { |
|
497 __UHEAP_MARK; |
|
498 test.Title(); |
|
499 static CTrapCleanup* TrapCleanup = CTrapCleanup::New(); |
|
500 test.Start(_L("Test installation/deinstallatiion")); |
|
501 TInt error = RFbsSession::Connect(); |
|
502 if (error == KErrNotFound) |
|
503 { |
|
504 FbsStartup(); |
|
505 error = RFbsSession::Connect(); |
|
506 } |
|
507 test(error == KErrNone); |
|
508 TRAP(error, RunInstallationTestsL()); |
|
509 test(error == KErrNone); |
|
510 test.Next(_L("Test uninstalled behaviour")); |
|
511 TRAP(error, RunDefaultBehaviourTestsL()); |
|
512 test(error == KErrNone); |
|
513 test.Next(_L("Test behaviour with custom remapper installed")); |
|
514 TRAP(error, RunCustomBehaviourTestsL()); |
|
515 test(error == KErrNone); |
|
516 RFbsSession::Disconnect(); |
|
517 test.End(); |
|
518 delete TrapCleanup; |
|
519 test.Close(); |
|
520 __UHEAP_MARKEND; |
|
521 User::Heap().Check(); |
|
522 return error; |
|
523 } |
|
524 |
|
525 |
|
526 #if defined(__WINS__) |
|
527 EXPORT_C TInt EntryPoint(TAny*) {return E32Main();} |
|
528 #endif |
|
529 |