|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // @file |
|
15 // @internalComponent - Internal Symbian test code |
|
16 // This is a support app used by Apparc\tef\TApparcTestServer (TApparc4Step in particular) |
|
17 // This application covers the following tests for the static objects |
|
18 // Test 1 : Existing CCoeStatic derived objects using the 2 parameter |
|
19 // constructor must be destroyed before the app ui. |
|
20 // Way to test this, |
|
21 // Case 1: Get hold of a particular static using CCoeEnv::Static(TUid aUid) |
|
22 // in an application's override of CEikAppUi::PrepareToExit() and confirm the |
|
23 // returned pointer is not null. |
|
24 // Case 2: Then, the same thing is done in the app ui's destructor to check that |
|
25 // the pointer is now null. |
|
26 // Test 2: A static constructed with a negative priority should be accessible from the |
|
27 // app ui's destructor, but then destroyed before another static that has a lower priority value. |
|
28 // Way to test this, |
|
29 // Case 1: Construct a static (A) using the 3 parameter constructor, specifying a negative priority. |
|
30 // Then construct another static (B) specifying a priority (A's priority - 1). |
|
31 // Check that static A is still non-null when accessed from the app ui's destructor. |
|
32 // Case 2: Then check that static A is null when accessed from B's destructor. |
|
33 // Test 3: Given two statics with different positive priorities, |
|
34 // the higher priority one should be destroyed first. |
|
35 // Way to test this, |
|
36 // Case 1: If (for example) static A has priority EDefaultDestructionPriority, |
|
37 // and static B has EDefaultDestructionPriority-1, A's destructor should be able to access B, |
|
38 // Case 2: But B's destructor shouldn't be able to access A. |
|
39 // Test 4: Statics with priorities immediately either side of the pre/post-destroy app ui should be destroyed before/after the app ui. Should also test that |
|
40 // the first negative priority static is destroyed and not "skipped over" when the code calculates |
|
41 // which static should be destroyed next after the app ui has been destroyed. |
|
42 // Way to test this, |
|
43 // Case 1: We could create statics A, B and C with priority zero, -1 and -2 respectively. |
|
44 // Then check in the app ui destructor that A is null, and B and C are both non-null. |
|
45 // Case 2: Then in B's destructor check that C is still non-null. |
|
46 // Case 3: And in C's destructor check that B is now null. |
|
47 // |
|
48 // tapparctestapp.cpp |
|
49 // |
|
50 |
|
51 #include <coeccntx.h> |
|
52 #include <apgtask.h> |
|
53 #include <eikenv.h> |
|
54 #include <eikappui.h> |
|
55 #include <eikapp.h> |
|
56 #include <eikdoc.h> |
|
57 #include <techview/eikmenup.h> |
|
58 #include <f32file.h> |
|
59 #include <techview/eikon.hrh> |
|
60 #include <eikstart.h> //TKAS added for exe-app |
|
61 |
|
62 #include <tapparctestapp.rsg> |
|
63 |
|
64 // File which stores the test results |
|
65 _LIT(KApparcTestResultsFileName, "c:\\system\\Apparctest\\ApparcTestResultsFile.txt"); |
|
66 _LIT(KApparcTestDir, "c:\\system\\Apparctest\\"); |
|
67 |
|
68 _LIT8(KTestPass ,"PASS\r\n"); |
|
69 _LIT8(KTestFail,"FAIL\r\n"); |
|
70 |
|
71 _LIT8(KApparcTest1,"Test1:"); |
|
72 _LIT8(KApparcTest2,"Test2:"); |
|
73 _LIT8(KApparcTest3,"Test3:"); |
|
74 _LIT8(KApparcTest4,"Test4:"); |
|
75 _LIT8(KApparcTestCase1,"Case1:"); |
|
76 _LIT8(KApparcTestCase2,"Case2:"); |
|
77 _LIT8(KApparcTestCase3,"Case3:"); |
|
78 |
|
79 const TUid KUidApparcTestApp = {0x100048F3}; |
|
80 |
|
81 // Uids for diffent classes for static |
|
82 const TUid KUidTestStatic = {0x13003ACE}; |
|
83 const TUid KUidTestStaticNegativePrioA = {0x13004ACE}; |
|
84 const TUid KUidTestStaticNegativePrioB = {0x13005ACE}; |
|
85 const TUid KUidTestStaticPosPriA = {0x13006ACE}; |
|
86 const TUid KUidTestStaticPosPriB = {0x13007ACE}; |
|
87 const TUid KUidTestStaticPriZeroA= {0x13009ACE}; |
|
88 const TUid KUidTestStaticPriOneB = {0x1300AACE}; |
|
89 const TUid KUidTestStaticPriTwoC = {0x1300BACE}; |
|
90 |
|
91 // Priorities for static objects |
|
92 enum {ENegativePriortyStaticA = -3}; |
|
93 enum {EPriorityTwoStaticC= -2,EPriorityOneStaticB = -1,EPriorityZeroStaticA= 0}; |
|
94 |
|
95 // static class for Test case 1 |
|
96 class CTApparcTestStatic : public CCoeStatic |
|
97 { |
|
98 public: |
|
99 inline CTApparcTestStatic(RFile& aFile); |
|
100 inline static CTApparcTestStatic* Self(); |
|
101 ~CTApparcTestStatic(); |
|
102 RFile iFile; |
|
103 }; |
|
104 |
|
105 CTApparcTestStatic::~CTApparcTestStatic() |
|
106 { |
|
107 } |
|
108 |
|
109 // Static class with negative priority for Test case 2. |
|
110 class CTApparcTestNegativePrioStaticA : public CCoeStatic |
|
111 { |
|
112 public: |
|
113 inline CTApparcTestNegativePrioStaticA(RFile& aFile); |
|
114 inline static CTApparcTestNegativePrioStaticA* Self(); |
|
115 ~CTApparcTestNegativePrioStaticA(); |
|
116 |
|
117 RFile& iFile; |
|
118 }; |
|
119 |
|
120 // Static class with negative priority for Test case 2. (priority less than CTApparcTestNegativePrioStaticA) |
|
121 class CTApparcTestNegativePrioStaticB : public CCoeStatic |
|
122 { |
|
123 public: |
|
124 inline CTApparcTestNegativePrioStaticB(); |
|
125 inline static CTApparcTestNegativePrioStaticB* Self(); |
|
126 static CTApparcTestNegativePrioStaticB* NewL(); |
|
127 void ConstructL(); |
|
128 ~CTApparcTestNegativePrioStaticB(); |
|
129 |
|
130 RFile iFile; |
|
131 RFs iFs; |
|
132 }; |
|
133 |
|
134 CTApparcTestNegativePrioStaticA::~CTApparcTestNegativePrioStaticA() |
|
135 { |
|
136 } |
|
137 |
|
138 CTApparcTestNegativePrioStaticB::~CTApparcTestNegativePrioStaticB() |
|
139 { |
|
140 // Test 2, Case 2 |
|
141 CTApparcTestNegativePrioStaticA* testCoeStaticA = CTApparcTestNegativePrioStaticA::Self(); |
|
142 iFile.Write(KApparcTest2); |
|
143 iFile.Write(KApparcTestCase2); |
|
144 |
|
145 if(testCoeStaticA == NULL) |
|
146 iFile.Write(KTestPass); |
|
147 else |
|
148 iFile.Write(KTestFail); |
|
149 |
|
150 // CTApparcTestNegativePrioStaticB class object is the most negative prioritised |
|
151 // static objects .Hence the file and session handles are closed here as no |
|
152 // more logging is required hereafter. |
|
153 iFile.Close(); |
|
154 iFs.Close(); |
|
155 } |
|
156 |
|
157 // Static class with positive priority for Test case 3: |
|
158 class CTApparcTestPosPrioStaticA : public CCoeStatic |
|
159 { |
|
160 public: |
|
161 inline CTApparcTestPosPrioStaticA(RFile& aFile); |
|
162 inline static CTApparcTestPosPrioStaticA* Self(); |
|
163 ~CTApparcTestPosPrioStaticA(); |
|
164 |
|
165 RFile& iFile; |
|
166 }; |
|
167 |
|
168 // static class with positive priority less than CTApparcTestPosPrioStaticA for Test case 3. |
|
169 class CTApparcTestPosPrioStaticB : public CCoeStatic |
|
170 { |
|
171 public: |
|
172 inline CTApparcTestPosPrioStaticB(RFile& aFile); |
|
173 inline static CTApparcTestPosPrioStaticB* Self(); |
|
174 ~CTApparcTestPosPrioStaticB(); |
|
175 |
|
176 RFile& iFile; |
|
177 }; |
|
178 |
|
179 CTApparcTestPosPrioStaticA::~CTApparcTestPosPrioStaticA() |
|
180 { |
|
181 // Test 3 , Case 1 |
|
182 CTApparcTestPosPrioStaticB* testPosPrioStaticB = CTApparcTestPosPrioStaticB::Self(); |
|
183 iFile.Write(KApparcTest3); |
|
184 iFile.Write(KApparcTestCase1); |
|
185 |
|
186 if(testPosPrioStaticB != NULL) |
|
187 iFile.Write(KTestPass); |
|
188 else |
|
189 iFile.Write(KTestFail); |
|
190 } |
|
191 |
|
192 CTApparcTestPosPrioStaticB::~CTApparcTestPosPrioStaticB() |
|
193 { |
|
194 // Test 3 , Case 2 |
|
195 CTApparcTestPosPrioStaticA* testPosPrioStaticA = CTApparcTestPosPrioStaticA::Self(); |
|
196 iFile.Write(KApparcTest3); |
|
197 iFile.Write(KApparcTestCase2); |
|
198 |
|
199 if(testPosPrioStaticA == NULL) |
|
200 iFile.Write(KTestPass); |
|
201 else |
|
202 iFile.Write(KTestFail); |
|
203 } |
|
204 |
|
205 // static class with priority 0 for test case 4 |
|
206 class CTApparcTestPrioZeroStaticA : public CCoeStatic |
|
207 { |
|
208 public: |
|
209 inline CTApparcTestPrioZeroStaticA(RFile& aFile); |
|
210 inline static CTApparcTestPrioZeroStaticA* Self(); |
|
211 ~CTApparcTestPrioZeroStaticA(); |
|
212 |
|
213 RFile& iFile; |
|
214 }; |
|
215 |
|
216 // static class with priority -1 for test case 4 |
|
217 class CTApparcTestPrioOneStaticB : public CCoeStatic |
|
218 { |
|
219 public: |
|
220 inline CTApparcTestPrioOneStaticB(RFile& aFile); |
|
221 inline static CTApparcTestPrioOneStaticB* Self(); |
|
222 ~CTApparcTestPrioOneStaticB(); |
|
223 |
|
224 RFile& iFile; |
|
225 }; |
|
226 |
|
227 // static class with priority -2 for test case 4 |
|
228 class CTApparcTestPrioTwoStaticC : public CCoeStatic |
|
229 { |
|
230 public: |
|
231 inline CTApparcTestPrioTwoStaticC(RFile& aFile); |
|
232 inline static CTApparcTestPrioTwoStaticC* Self(); |
|
233 ~CTApparcTestPrioTwoStaticC(); |
|
234 |
|
235 RFile& iFile; |
|
236 }; |
|
237 |
|
238 |
|
239 CTApparcTestPrioZeroStaticA::~CTApparcTestPrioZeroStaticA() |
|
240 { |
|
241 } |
|
242 |
|
243 CTApparcTestPrioOneStaticB::~CTApparcTestPrioOneStaticB() |
|
244 { |
|
245 // Test 4 , Case 2 |
|
246 CTApparcTestPrioTwoStaticC* testPrioTwoCoeStaticC = CTApparcTestPrioTwoStaticC::Self(); |
|
247 iFile.Write(KApparcTest4); |
|
248 iFile.Write(KApparcTestCase2); |
|
249 |
|
250 if(testPrioTwoCoeStaticC != NULL) |
|
251 iFile.Write(KTestPass); |
|
252 else |
|
253 iFile.Write(KTestFail); |
|
254 } |
|
255 |
|
256 CTApparcTestPrioTwoStaticC::~CTApparcTestPrioTwoStaticC() |
|
257 { |
|
258 // Test 4 , Case 3 |
|
259 CTApparcTestPrioOneStaticB* testPrioOneCoeStaticB = CTApparcTestPrioOneStaticB::Self(); |
|
260 iFile.Write(KApparcTest4); |
|
261 iFile.Write(KApparcTestCase3); |
|
262 |
|
263 if(testPrioOneCoeStaticB == NULL) |
|
264 iFile.Write(KTestPass); |
|
265 else |
|
266 iFile.Write(KTestFail); |
|
267 } |
|
268 |
|
269 // |
|
270 // |
|
271 // CTApparcTestAppView |
|
272 // |
|
273 // |
|
274 class CTApparcTestAppView : public CCoeControl |
|
275 { |
|
276 public: |
|
277 static CTApparcTestAppView* NewL(const TRect& aRect); |
|
278 CTApparcTestAppView(); |
|
279 ~CTApparcTestAppView(); |
|
280 void ConstructL(const TRect& aRect); |
|
281 private: |
|
282 // Inherited from CCoeControl |
|
283 void Draw(const TRect& /*aRect*/) const; |
|
284 private: |
|
285 HBufC* iApparcTestText; |
|
286 }; |
|
287 |
|
288 CTApparcTestAppView::CTApparcTestAppView() |
|
289 { |
|
290 } |
|
291 |
|
292 CTApparcTestAppView* CTApparcTestAppView::NewL(const TRect& aRect) |
|
293 { |
|
294 CTApparcTestAppView* self = new(ELeave) CTApparcTestAppView(); |
|
295 CleanupStack::PushL(self); |
|
296 self->ConstructL(aRect); |
|
297 CleanupStack::Pop(); |
|
298 return self; |
|
299 } |
|
300 |
|
301 CTApparcTestAppView::~CTApparcTestAppView() |
|
302 { |
|
303 delete iApparcTestText; |
|
304 } |
|
305 |
|
306 void CTApparcTestAppView::ConstructL(const TRect& aRect) |
|
307 { |
|
308 iApparcTestText = iEikonEnv->AllocReadResourceL(R_TAPPARCTEST_TEXT_TITLE); |
|
309 CreateWindowL(); |
|
310 SetRect(aRect); |
|
311 ActivateL(); |
|
312 } |
|
313 |
|
314 void CTApparcTestAppView::Draw(const TRect& /*aRect*/) const |
|
315 { |
|
316 CWindowGc& gc = SystemGc(); |
|
317 TRect drawRect = Rect(); |
|
318 const CFont* fontUsed = iEikonEnv->TitleFont(); |
|
319 |
|
320 gc.Clear(); |
|
321 gc.UseFont(fontUsed); |
|
322 TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; |
|
323 gc.DrawText(*iApparcTestText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0); |
|
324 gc.DiscardFont(); |
|
325 } |
|
326 |
|
327 // |
|
328 // |
|
329 // CTApparcTestAppUi |
|
330 // |
|
331 // |
|
332 |
|
333 class CTApparcTestAppUi : public CEikAppUi |
|
334 { |
|
335 public: |
|
336 void ConstructL(); |
|
337 ~CTApparcTestAppUi(); |
|
338 private: |
|
339 // Inherirted from class CEikAppUi |
|
340 void PrepareToExit(); |
|
341 void HandleCommandL(TInt aCommand); |
|
342 |
|
343 private: |
|
344 CCoeControl* iAppView; |
|
345 }; |
|
346 |
|
347 |
|
348 void CTApparcTestAppUi::ConstructL() |
|
349 { |
|
350 BaseConstructL(); |
|
351 iAppView = CTApparcTestAppView::NewL(ClientRect()); |
|
352 |
|
353 // Constructs the static object for tests |
|
354 CTApparcTestNegativePrioStaticB* testCoeStaticB = CTApparcTestNegativePrioStaticB::NewL(); |
|
355 |
|
356 CTApparcTestStatic* testCoeStatic = new (ELeave)CTApparcTestStatic(testCoeStaticB->iFile); |
|
357 CTApparcTestNegativePrioStaticA* testCoeStaticA = new(ELeave)CTApparcTestNegativePrioStaticA(testCoeStaticB->iFile); |
|
358 CTApparcTestPrioTwoStaticC* testPrioTwoStaticC = new(ELeave) CTApparcTestPrioTwoStaticC(testCoeStaticB->iFile); |
|
359 CTApparcTestPosPrioStaticA* testPosPriStaticA = new(ELeave) CTApparcTestPosPrioStaticA(testCoeStaticB->iFile); |
|
360 CTApparcTestPosPrioStaticB* testPosPriStaticB = new(ELeave) CTApparcTestPosPrioStaticB(testCoeStaticB->iFile); |
|
361 CTApparcTestPrioZeroStaticA* testPrioZeroStaticA = new(ELeave) CTApparcTestPrioZeroStaticA(testCoeStaticB->iFile); |
|
362 CTApparcTestPrioOneStaticB* testPrioOneStaticB = new(ELeave) CTApparcTestPrioOneStaticB(testCoeStaticB->iFile); |
|
363 |
|
364 // to get rid of compiler warnings |
|
365 if(testCoeStatic==NULL || testCoeStaticA == NULL || testCoeStaticB == NULL|| testPosPriStaticA ==NULL || |
|
366 testPosPriStaticB == NULL || testPrioZeroStaticA == NULL || testPrioOneStaticB == NULL|| testPrioTwoStaticC == NULL) |
|
367 return; |
|
368 } |
|
369 |
|
370 CTApparcTestAppUi::~CTApparcTestAppUi() |
|
371 { |
|
372 CTApparcTestNegativePrioStaticB* testNegStaticB = CTApparcTestNegativePrioStaticB::Self(); |
|
373 // Test 1, Case 2 |
|
374 CTApparcTestStatic* testCoeStatic = CTApparcTestStatic::Self(); |
|
375 testNegStaticB->iFile.Write(KApparcTest1); |
|
376 testNegStaticB->iFile.Write(KApparcTestCase2); |
|
377 |
|
378 if(testCoeStatic == NULL) |
|
379 testNegStaticB->iFile.Write(KTestPass); |
|
380 else |
|
381 testNegStaticB->iFile.Write(KTestFail); |
|
382 |
|
383 // Test 2, Case 1 |
|
384 CTApparcTestNegativePrioStaticA* testCoeStaticA = CTApparcTestNegativePrioStaticA::Self(); |
|
385 testNegStaticB->iFile.Write(KApparcTest2); |
|
386 testNegStaticB->iFile.Write(KApparcTestCase1); |
|
387 |
|
388 if(testCoeStaticA != NULL) |
|
389 testNegStaticB->iFile.Write(KTestPass); |
|
390 else |
|
391 testNegStaticB->iFile.Write(KTestFail); |
|
392 |
|
393 // Test 4, Case 1 |
|
394 CTApparcTestPrioZeroStaticA* testPrioZeroCoeStaticA = CTApparcTestPrioZeroStaticA::Self(); |
|
395 CTApparcTestPrioOneStaticB* testPrioOneCoeStaticB = CTApparcTestPrioOneStaticB::Self(); |
|
396 CTApparcTestPrioTwoStaticC* testPrioTwoCoeStaticC = CTApparcTestPrioTwoStaticC::Self(); |
|
397 testNegStaticB->iFile.Write(KApparcTest4); |
|
398 testNegStaticB->iFile.Write(KApparcTestCase1); |
|
399 |
|
400 if(testPrioZeroCoeStaticA == NULL && testPrioOneCoeStaticB != NULL && testPrioTwoCoeStaticC != NULL) |
|
401 testNegStaticB->iFile.Write(KTestPass); |
|
402 else |
|
403 testNegStaticB->iFile.Write(KTestFail); |
|
404 |
|
405 delete iAppView; |
|
406 } |
|
407 |
|
408 void CTApparcTestAppUi::HandleCommandL(TInt aCommand) |
|
409 { |
|
410 switch (aCommand) |
|
411 { |
|
412 case EEikCmdExit: |
|
413 Exit(); |
|
414 break; |
|
415 } |
|
416 } |
|
417 |
|
418 void CTApparcTestAppUi::PrepareToExit() |
|
419 { |
|
420 CEikAppUi::PrepareToExit(); |
|
421 // Test 1, Case 1 |
|
422 CTApparcTestStatic* testCoeStatic = CTApparcTestStatic::Self(); |
|
423 |
|
424 testCoeStatic->iFile.Write(KApparcTest1); |
|
425 testCoeStatic->iFile.Write(KApparcTestCase1); |
|
426 |
|
427 if(testCoeStatic != NULL) |
|
428 testCoeStatic->iFile.Write(KTestPass); |
|
429 else |
|
430 testCoeStatic->iFile.Write(KTestFail); |
|
431 } |
|
432 |
|
433 // |
|
434 // |
|
435 // CTApparcTestDocument |
|
436 // |
|
437 // |
|
438 |
|
439 class CTApparcTestDocument : public CEikDocument |
|
440 { |
|
441 public: |
|
442 static CTApparcTestDocument* NewL(CEikApplication& aApp); |
|
443 CTApparcTestDocument(CEikApplication& aApp); |
|
444 void ConstructL(); |
|
445 private: |
|
446 // Inherited from CEikDocument |
|
447 CEikAppUi* CreateAppUiL(); |
|
448 }; |
|
449 |
|
450 CTApparcTestDocument::CTApparcTestDocument(CEikApplication& aApp) |
|
451 : CEikDocument(aApp) |
|
452 { |
|
453 } |
|
454 |
|
455 CEikAppUi* CTApparcTestDocument::CreateAppUiL() |
|
456 { |
|
457 return new(ELeave) CTApparcTestAppUi; |
|
458 } |
|
459 |
|
460 // |
|
461 // |
|
462 // CTApparcTestApplication |
|
463 // |
|
464 // |
|
465 |
|
466 class CTApparcTestApplication : public CEikApplication |
|
467 { |
|
468 private: |
|
469 // Inherited from class CApaApplication |
|
470 CApaDocument* CreateDocumentL(); |
|
471 TUid AppDllUid() const; |
|
472 private: |
|
473 CApaDocument* CreateDocumentL(CApaProcess* a) { return CEikApplication::CreateDocumentL(a); } |
|
474 }; |
|
475 |
|
476 TUid CTApparcTestApplication::AppDllUid() const |
|
477 { |
|
478 return KUidApparcTestApp; |
|
479 } |
|
480 |
|
481 CApaDocument* CTApparcTestApplication::CreateDocumentL() |
|
482 { |
|
483 return new (ELeave) CTApparcTestDocument(*this); |
|
484 } |
|
485 |
|
486 EXPORT_C CApaApplication* NewApplication() |
|
487 { |
|
488 return new CTApparcTestApplication; |
|
489 } |
|
490 |
|
491 GLDEF_C TInt E32Main() |
|
492 { |
|
493 return EikStart::RunApplication(NewApplication); |
|
494 } |
|
495 |
|
496 |
|
497 // inline function for CTApparcTestStatic |
|
498 inline CTApparcTestStatic::CTApparcTestStatic(RFile& aFile) |
|
499 : CCoeStatic(KUidTestStatic),iFile(aFile) |
|
500 { |
|
501 } |
|
502 |
|
503 inline CTApparcTestStatic* CTApparcTestStatic::Self() |
|
504 { |
|
505 return STATIC_CAST(CTApparcTestStatic*,CCoeEnv::Static(KUidTestStatic)); |
|
506 } |
|
507 |
|
508 // inline functions for CTApparcTestNegativePrioStaticA |
|
509 inline CTApparcTestNegativePrioStaticA::CTApparcTestNegativePrioStaticA(RFile& aFile) |
|
510 : CCoeStatic(KUidTestStaticNegativePrioA,ENegativePriortyStaticA),iFile(aFile) |
|
511 { |
|
512 } |
|
513 |
|
514 inline CTApparcTestNegativePrioStaticA* CTApparcTestNegativePrioStaticA::Self() |
|
515 { |
|
516 return STATIC_CAST(CTApparcTestNegativePrioStaticA*,CCoeEnv::Static(KUidTestStaticNegativePrioA)); |
|
517 } |
|
518 |
|
519 // inline functions for CTApparcTestNegativePrioStaticB |
|
520 inline CTApparcTestNegativePrioStaticB::CTApparcTestNegativePrioStaticB() |
|
521 : CCoeStatic(KUidTestStaticNegativePrioB,ENegativePriortyStaticA - 1) |
|
522 { |
|
523 } |
|
524 |
|
525 inline CTApparcTestNegativePrioStaticB* CTApparcTestNegativePrioStaticB::Self() |
|
526 { |
|
527 return STATIC_CAST(CTApparcTestNegativePrioStaticB*,CCoeEnv::Static(KUidTestStaticNegativePrioB)); |
|
528 } |
|
529 |
|
530 CTApparcTestNegativePrioStaticB* CTApparcTestNegativePrioStaticB::NewL() |
|
531 { |
|
532 CTApparcTestNegativePrioStaticB* self = new(ELeave)CTApparcTestNegativePrioStaticB(); |
|
533 CleanupStack::PushL(self); |
|
534 self->ConstructL(); |
|
535 CleanupStack::Pop(); |
|
536 return self; |
|
537 } |
|
538 |
|
539 void CTApparcTestNegativePrioStaticB::ConstructL() |
|
540 { |
|
541 User::LeaveIfError(iFs.Connect()); |
|
542 TInt err = iFs.MkDirAll(KApparcTestDir); |
|
543 |
|
544 err = iFile.Create(iFs,KApparcTestResultsFileName,EFileWrite | EFileShareAny); |
|
545 if(err == KErrAlreadyExists) |
|
546 iFile.Open(iFs,KApparcTestResultsFileName,EFileWrite | EFileShareAny); |
|
547 } |
|
548 |
|
549 // inline functions for CTApparcTestPosPrioStaticA |
|
550 inline CTApparcTestPosPrioStaticA::CTApparcTestPosPrioStaticA(RFile& aFile) |
|
551 : CCoeStatic(KUidTestStaticPosPriA,EDefaultDestructionPriority),iFile(aFile) |
|
552 { |
|
553 } |
|
554 |
|
555 inline CTApparcTestPosPrioStaticA* CTApparcTestPosPrioStaticA::Self() |
|
556 { |
|
557 return STATIC_CAST(CTApparcTestPosPrioStaticA*,CCoeEnv::Static(KUidTestStaticPosPriA)); |
|
558 } |
|
559 |
|
560 // inline functions for CTApparcTestPosPrioStaticB |
|
561 inline CTApparcTestPosPrioStaticB::CTApparcTestPosPrioStaticB(RFile& aFile) |
|
562 : CCoeStatic(KUidTestStaticPosPriB,EDefaultDestructionPriority-1),iFile(aFile) |
|
563 { |
|
564 } |
|
565 |
|
566 inline CTApparcTestPosPrioStaticB* CTApparcTestPosPrioStaticB::Self() |
|
567 { |
|
568 return STATIC_CAST(CTApparcTestPosPrioStaticB*,CCoeEnv::Static(KUidTestStaticPosPriB)); |
|
569 } |
|
570 |
|
571 // inline functions for CTApparcTestPrioZeroStaticA |
|
572 inline CTApparcTestPrioZeroStaticA::CTApparcTestPrioZeroStaticA(RFile& aFile) |
|
573 : CCoeStatic(KUidTestStaticPriZeroA,EPriorityZeroStaticA),iFile(aFile) |
|
574 { |
|
575 } |
|
576 |
|
577 inline CTApparcTestPrioZeroStaticA* CTApparcTestPrioZeroStaticA::Self() |
|
578 { |
|
579 return STATIC_CAST(CTApparcTestPrioZeroStaticA*,CCoeEnv::Static(KUidTestStaticPriZeroA)); |
|
580 } |
|
581 |
|
582 // inline functions for CTApparcTestPrioOneStaticB |
|
583 inline CTApparcTestPrioOneStaticB::CTApparcTestPrioOneStaticB(RFile& aFile) |
|
584 : CCoeStatic(KUidTestStaticPriOneB,EPriorityOneStaticB),iFile(aFile) |
|
585 { |
|
586 } |
|
587 |
|
588 inline CTApparcTestPrioOneStaticB* CTApparcTestPrioOneStaticB::Self() |
|
589 { |
|
590 return STATIC_CAST(CTApparcTestPrioOneStaticB*,CCoeEnv::Static(KUidTestStaticPriOneB)); |
|
591 } |
|
592 |
|
593 // inline functions for CTApparcTestPrioTwoStaticC |
|
594 inline CTApparcTestPrioTwoStaticC::CTApparcTestPrioTwoStaticC(RFile& aFile) |
|
595 : CCoeStatic(KUidTestStaticPriTwoC,EPriorityTwoStaticC),iFile(aFile) |
|
596 { |
|
597 } |
|
598 |
|
599 inline CTApparcTestPrioTwoStaticC* CTApparcTestPrioTwoStaticC::Self() |
|
600 { |
|
601 return STATIC_CAST(CTApparcTestPrioTwoStaticC*,CCoeEnv::Static(KUidTestStaticPriTwoC)); |
|
602 } |
|
603 |
|
604 |
|
605 |