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