|
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 // test code for the clock DLL |
|
15 // $Workfile: TCLCK0.CPP $ |
|
16 // $Revision: 1.6 $ |
|
17 // $Author: DougF $ |
|
18 // $Date: 07 Jul 1999 16:16:28 $ |
|
19 // |
|
20 // |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalComponent - Internal Symbian test code |
|
25 */ |
|
26 |
|
27 #include <e32keys.h> |
|
28 #include <coemain.h> |
|
29 #include <coedef.h> |
|
30 #include <coeaui.h> |
|
31 #include <coecntrl.h> |
|
32 #include <clock.h> |
|
33 #include <basched.h> |
|
34 |
|
35 #include <mbs0.mbg> |
|
36 #define TCLCK0_MBM _L("z:\\system\\data\\MBS0.MBM") |
|
37 #define CLOCK EMbmMbs0Clock |
|
38 #define CLOCKMSK EMbmMbs0Clockmsk |
|
39 |
|
40 #include "TCLCK0STEP.h" |
|
41 |
|
42 |
|
43 //_LIT(KTestString1,"Show analog & digital clocks"); |
|
44 _LIT(KTestString2,"Change universal time backward"); |
|
45 _LIT(KTestString3,"Change universal time forward"); |
|
46 _LIT(KTestString4,"Change clock separator"); |
|
47 _LIT(KTestString5,"Moving clock to right"); |
|
48 _LIT(KTestString6,"Set a new background color"); |
|
49 _LIT(KTestString7,"Restore previos background color"); |
|
50 _LIT(KTestString8,"hide clocks"); |
|
51 _LIT(KTestStarted,"Test Started"); |
|
52 _LIT(KTestFinished,"Test Finished"); |
|
53 |
|
54 // enums, structs and classes |
|
55 |
|
56 |
|
57 // local functions |
|
58 |
|
59 LOCAL_C TInt PanickingFunction(TAny* aPtr) |
|
60 { |
|
61 SPanickingFunctionData* data=(SPanickingFunctionData*)aPtr; |
|
62 RWsSession wsSession; |
|
63 wsSession.Connect(); |
|
64 RAnimDll animDll(wsSession); |
|
65 animDll.Load(_L("CLOCKA.DLL")); |
|
66 RWindowGroup windowGroup(wsSession); |
|
67 windowGroup.Construct(NULL); |
|
68 windowGroup.SetOwningWindowGroup(data->iMainWindowGroup); |
|
69 RWindow window(wsSession); |
|
70 window.Construct(windowGroup, NULL); |
|
71 CWsScreenDevice* wsScreenDevice=new CWsScreenDevice(wsSession); |
|
72 wsScreenDevice->Construct(); |
|
73 CDestructableFont* font=new CDestructableFont(wsScreenDevice); |
|
74 font->ConstructL(TFontSpec(_L("arial"), wsScreenDevice->VerticalPixelsToTwips(60))); |
|
75 TInt fontHandle=font->Handle(); |
|
76 STimeDeviceShadow shadow; |
|
77 shadow.iIsOn=EFalse; |
|
78 TRgb color(255, 255, 255); |
|
79 TPoint position(10, 0); |
|
80 TSize size(0, 10); |
|
81 TInt seconds(20*60); |
|
82 TMargins margins; |
|
83 margins.iLeft=0; |
|
84 margins.iRight=0; |
|
85 margins.iTop=0; |
|
86 margins.iBottom=0; |
|
87 TBuf<64> digitalClockFormat=_L("any old thing"); |
|
88 TDigitalDisplayTextSection digitalDisplayTextSection(fontHandle, color, EDigitalDisplayHorizontalTextAlignmentCenter, |
|
89 EDigitalDisplayVerticalTextAlignmentBottomInclDescent, |
|
90 0, 0, digitalClockFormat); |
|
91 RDigitalClock digitalClock(animDll, window); |
|
92 CFbsBitmap* analogClockFace0=new(ELeave) CFbsBitmap; |
|
93 analogClockFace0->Load(TCLCK0_MBM, CLOCK); |
|
94 CFbsBitmap* analogClockFace1=new(ELeave) CFbsBitmap; |
|
95 analogClockFace1->Load(TCLCK0_MBM, CLOCK); |
|
96 TInt analogClockFaceHandle0=analogClockFace0->Handle(); |
|
97 TInt analogClockFaceHandle1=analogClockFace1->Handle(); |
|
98 TAnalogDisplayHand analogClockHandWithNoFeatures(EAnalogDisplayHandOneRevPerMinute); |
|
99 TAnalogDisplayHand analogClockHand(EAnalogDisplayHandOneRevPerMinute); |
|
100 analogClockHand.AddCircle(CGraphicsContext::EDashedPen, color, size, CGraphicsContext::ESolidBrush, color, position, 8); |
|
101 RAnalogClock analogClock(animDll, window); |
|
102 |
|
103 // the last line of each of these cases should panic |
|
104 switch (data->iFunction) |
|
105 { |
|
106 case ECreateDigitalClockWithNoConstructCall: |
|
107 digitalClock.AddTextSectionL(digitalDisplayTextSection); |
|
108 break; |
|
109 case ECreateDigitalClockWithTooManyConstructCalls: |
|
110 digitalClock.ConstructL(seconds, position, size, margins, shadow, color, 1); |
|
111 digitalClock.ConstructL(seconds, position, size, margins, shadow, color, 1); |
|
112 break; |
|
113 case ECreateDigitalClockWithNoTextSections: |
|
114 digitalClock.ConstructL(seconds, position, size, margins, shadow, color, 0); |
|
115 break; |
|
116 case ECreateDigitalClockWithTooManyTextSections: |
|
117 digitalClock.ConstructL(seconds, position, size, margins, shadow, color, 2); |
|
118 digitalClock.AddTextSectionL(digitalDisplayTextSection); |
|
119 digitalClock.AddTextSectionL(digitalDisplayTextSection); |
|
120 digitalClock.AddTextSectionL(digitalDisplayTextSection); |
|
121 break; |
|
122 case ECreateDigitalClockWithNonNormalizedRect: |
|
123 digitalClock.ConstructL(seconds, position, TSize(-1, 0), margins, shadow, color, 1); |
|
124 break; |
|
125 case ECreateAnalogClockWithNoConstructCall: |
|
126 analogClock.AddHandL(analogClockHand); |
|
127 break; |
|
128 case ECreateAnalogClockWithTooManyConstructCalls: |
|
129 analogClock.ConstructL(seconds, position, size, margins, shadow, analogClockFaceHandle0, 0, 2); |
|
130 analogClock.ConstructL(seconds, position, size, margins, shadow, analogClockFaceHandle1, 0, 2); |
|
131 break; |
|
132 case ECreateAnalogClockWithNoHands: |
|
133 analogClock.ConstructL(seconds, position, size, margins, shadow, analogClockFaceHandle0, 0, 0); |
|
134 break; |
|
135 case ECreateAnalogClockWithTooManyHands: |
|
136 analogClock.ConstructL(seconds, position, size, margins, shadow, analogClockFaceHandle0, 0, 2); |
|
137 analogClock.AddHandL(analogClockHand); |
|
138 analogClock.AddHandL(analogClockHand); |
|
139 analogClock.AddHandL(analogClockHand); |
|
140 break; |
|
141 case ECreateAnalogClockWithHandWithNoFeatures: |
|
142 analogClock.ConstructL(seconds, position, size, margins, shadow, analogClockFaceHandle0, 0, 1); |
|
143 analogClock.AddHandL(analogClockHandWithNoFeatures); |
|
144 break; |
|
145 } |
|
146 |
|
147 return 0; |
|
148 } |
|
149 |
|
150 // CDestructableFont |
|
151 |
|
152 CDestructableFont::CDestructableFont(CWsScreenDevice* aScreenDevice) |
|
153 :iScreenDevice(aScreenDevice) |
|
154 { |
|
155 } |
|
156 |
|
157 void CDestructableFont::ConstructL(const TFontSpec& aFontSpec) |
|
158 { |
|
159 User::LeaveIfError(iScreenDevice->GetNearestFontInTwips((CFont*&)iFont, aFontSpec)); |
|
160 } |
|
161 |
|
162 CDestructableFont::~CDestructableFont() |
|
163 { |
|
164 iScreenDevice->ReleaseFont(iFont); // N.B. do not need to do "delete iFont" |
|
165 } |
|
166 |
|
167 TInt CDestructableFont::Handle() const |
|
168 { |
|
169 return iFont->Handle(); |
|
170 } |
|
171 |
|
172 // CClkControl |
|
173 |
|
174 CClkControl::CClkControl() |
|
175 :iBackgroundColor(85, 85, 85), |
|
176 iAnimDll(iCoeEnv->WsSession()), |
|
177 iDigitalClock0Position(250, 125), |
|
178 iDigitalClock0Size(180, 70), |
|
179 iAnalogClock0Position(10, 5), |
|
180 iAnalogClock0Size(200, 200), |
|
181 iUniversalTimeOffset(0) |
|
182 { |
|
183 __DECLARE_NAME(_S("CClkControl")); |
|
184 |
|
185 __ASSERT_DEBUG(iDigitalClock0==NULL, User::Panic(_L("Clock test-code"), 1)); |
|
186 __ASSERT_DEBUG(iAnalogClock0==NULL, User::Panic(_L("Clock test-code"), 2)); |
|
187 } |
|
188 |
|
189 void CClkControl::ConstructL() |
|
190 { |
|
191 // CONE construction stuff |
|
192 CreateWindowL(); |
|
193 Window().SetBackgroundColor(iBackgroundColor); |
|
194 SetExtent(TPoint(10, 10), TSize(620, 220)); |
|
195 ActivateL(); |
|
196 User::LeaveIfError(iAnimDll.Load(_L("CLOCKA.DLL"))); |
|
197 |
|
198 #if (0) |
|
199 TTime time; |
|
200 time.HomeTime(); |
|
201 TDateTime dateTime=time.DateTime(); |
|
202 User::SetHomeTime(TTime(TDateTime(dateTime.Year(), dateTime.Month(), dateTime.Day(), 10, 11, 0, 0))); |
|
203 time=time.DateTime(); |
|
204 #endif |
|
205 |
|
206 // clock construction stuff |
|
207 TestForDegenerateClockCreationL(); |
|
208 CreateDigitalClocksL(); |
|
209 CreateAnalogClocksL(); |
|
210 } |
|
211 |
|
212 CClkControl::~CClkControl() |
|
213 { |
|
214 if (iDigitalClock0!=NULL) |
|
215 iDigitalClock0->Destroy(); |
|
216 if (iAnalogClock0!=NULL) |
|
217 iAnalogClock0->Destroy(); |
|
218 iAnimDll.Close(); |
|
219 |
|
220 } |
|
221 |
|
222 TKeyResponse CClkControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
223 { |
|
224 if (aType==EEventKey) |
|
225 { |
|
226 if (aKeyEvent.iModifiers&EModifierFunc) |
|
227 { |
|
228 TPoint increment(0, 0); |
|
229 TInt incrementMagnitude=(aKeyEvent.iModifiers&EModifierCtrl)? 5: 1; |
|
230 switch(aKeyEvent.iCode) |
|
231 { |
|
232 case EKeyLeftArrow: |
|
233 increment.iX=-incrementMagnitude; |
|
234 goto setDigitalClockSize; |
|
235 case EKeyRightArrow: |
|
236 increment.iX=incrementMagnitude; |
|
237 goto setDigitalClockSize; |
|
238 case EKeyUpArrow: |
|
239 increment.iY=-incrementMagnitude; |
|
240 goto setDigitalClockSize; |
|
241 case EKeyDownArrow: |
|
242 increment.iY=incrementMagnitude; |
|
243 goto setDigitalClockSize; |
|
244 setDigitalClockSize: |
|
245 iDigitalClock0Size+=increment; |
|
246 iAnalogClock0Size+=increment; |
|
247 iDigitalClock0->SetPositionAndSize(iDigitalClock0Position, iDigitalClock0Size); |
|
248 iAnalogClock0->SetPositionAndSize(iAnalogClock0Position, iAnalogClock0Size); |
|
249 break; |
|
250 } |
|
251 } |
|
252 else |
|
253 { |
|
254 TInt adjust=0; |
|
255 switch(aKeyEvent.iCode) |
|
256 { |
|
257 case CTRL('e'): |
|
258 iCoeEnv->Flush(); |
|
259 CBaActiveScheduler::Exit(); |
|
260 break; |
|
261 case EKeySpace: |
|
262 if (aKeyEvent.iModifiers&EModifierShift) |
|
263 iDigitalClock0->SetBackgroundColor(TRgb(85, 85, 85), TRgb(0, 0, 0)); |
|
264 else |
|
265 iDigitalClock0->SetBackgroundColor(TRgb(170, 170, 170), TRgb(85, 85, 85)); |
|
266 break; |
|
267 case EKeyEnter: |
|
268 if (aKeyEvent.iModifiers&EModifierShift) |
|
269 { |
|
270 iDigitalClock0->SetVisible(EFalse); |
|
271 iAnalogClock0->SetVisible(EFalse); |
|
272 } |
|
273 else |
|
274 { |
|
275 iDigitalClock0->SetVisible(ETrue); |
|
276 iAnalogClock0->SetVisible(ETrue); |
|
277 } |
|
278 break; |
|
279 case '$': |
|
280 case '%': |
|
281 case '^': |
|
282 case '&': |
|
283 case '+': |
|
284 case '-': |
|
285 case '*': |
|
286 case '/': |
|
287 case 'S': |
|
288 case 's': |
|
289 case '\\': |
|
290 case ':': |
|
291 { |
|
292 TLocale locale; |
|
293 locale.Refresh(); |
|
294 #pragma warning (disable: 4710) |
|
295 locale.SetTimeSeparator(aKeyEvent.iCode, 1); |
|
296 locale.SetTimeSeparator(aKeyEvent.iCode, 2); |
|
297 #pragma warning (default: 4710) |
|
298 locale.Set(); |
|
299 } |
|
300 break; |
|
301 case EKeyLeftArrow: |
|
302 case EKeyUpArrow: |
|
303 adjust=-3600; |
|
304 goto adjustClock; |
|
305 case EKeyRightArrow: |
|
306 case EKeyDownArrow: |
|
307 adjust=3600; |
|
308 goto adjustClock; |
|
309 adjustClock: |
|
310 iUniversalTimeOffset+=adjust; |
|
311 iDigitalClock0->SetUniversalTimeOffset(iUniversalTimeOffset); |
|
312 iAnalogClock0->SetUniversalTimeOffset(iUniversalTimeOffset); |
|
313 break; |
|
314 case 'U': |
|
315 case 'u': |
|
316 iDigitalClock0->UpdateDisplay(); |
|
317 iAnalogClock0->UpdateDisplay(); |
|
318 break; |
|
319 case 'D': |
|
320 case 'd': |
|
321 iDigitalClock0->Draw(); |
|
322 iAnalogClock0->Draw(); |
|
323 break; |
|
324 } |
|
325 } |
|
326 } |
|
327 |
|
328 return EKeyWasConsumed; |
|
329 } |
|
330 |
|
331 void CClkControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
332 { |
|
333 // CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
334 // CTestClckUi* theApplication = (CTestClckUi*) (coeEnv->AppUi()); |
|
335 |
|
336 switch (aPointerEvent.iType) |
|
337 { |
|
338 case TPointerEvent::EButton1Down: |
|
339 if (aPointerEvent.iModifiers&EModifierShift) |
|
340 { |
|
341 iDigitalClock0Position=aPointerEvent.iPosition; |
|
342 iDigitalClock0->SetPositionAndSize(iDigitalClock0Position, iDigitalClock0Size); |
|
343 } |
|
344 else |
|
345 { |
|
346 iAnalogClock0Position=aPointerEvent.iPosition; |
|
347 iAnalogClock0->SetPositionAndSize(iAnalogClock0Position, iAnalogClock0Size); |
|
348 } |
|
349 break; |
|
350 default: // dummy default to prevent gcc compiler warning |
|
351 break; |
|
352 } |
|
353 } |
|
354 |
|
355 void CClkControl::Draw(const TRect&) const |
|
356 { |
|
357 CGraphicsContext& systemGc=SystemGc(); |
|
358 systemGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
359 systemGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
360 systemGc.SetBrushColor(iBackgroundColor); |
|
361 systemGc.DrawRect(Rect()); |
|
362 } |
|
363 |
|
364 void CClkControl::TestForDegenerateClockCreationL() |
|
365 { |
|
366 // test deleting partially created clocks |
|
367 TestClosingPartiallyCreatedDigitalClocksL(); |
|
368 TestClosingPartiallyCreatedAnalogClocksL(); |
|
369 |
|
370 // test for panics |
|
371 /** |
|
372 TBool oldJustInTimeDebugging=User::JustInTime(); |
|
373 User::SetJustInTime(EFalse); |
|
374 SPanickingFunctionData data; |
|
375 data.iMainWindowGroup=iCoeEnv->RootWin().Identifier(); |
|
376 data.iFunction=ECreateDigitalClockWithNoConstructCall; |
|
377 FireOffNewThreadAndTestForPanicL(&data); |
|
378 data.iFunction=ECreateDigitalClockWithTooManyConstructCalls; |
|
379 FireOffNewThreadAndTestForPanicL(&data); |
|
380 data.iFunction=ECreateDigitalClockWithNoTextSections; |
|
381 FireOffNewThreadAndTestForPanicL(&data); |
|
382 data.iFunction=ECreateDigitalClockWithTooManyTextSections; |
|
383 FireOffNewThreadAndTestForPanicL(&data); |
|
384 data.iFunction=ECreateDigitalClockWithNonNormalizedRect; |
|
385 FireOffNewThreadAndTestForPanicL(&data); |
|
386 data.iFunction=ECreateAnalogClockWithNoConstructCall; |
|
387 FireOffNewThreadAndTestForPanicL(&data); |
|
388 data.iFunction=ECreateAnalogClockWithTooManyConstructCalls; |
|
389 FireOffNewThreadAndTestForPanicL(&data); |
|
390 data.iFunction=ECreateAnalogClockWithNoHands; |
|
391 FireOffNewThreadAndTestForPanicL(&data); |
|
392 data.iFunction=ECreateAnalogClockWithTooManyHands; |
|
393 FireOffNewThreadAndTestForPanicL(&data); |
|
394 data.iFunction=ECreateAnalogClockWithHandWithNoFeatures; |
|
395 FireOffNewThreadAndTestForPanicL(&data); |
|
396 User::SetJustInTime(oldJustInTimeDebugging);*/ |
|
397 } |
|
398 |
|
399 void CClkControl::TestClosingPartiallyCreatedDigitalClocksL() |
|
400 { |
|
401 CWsScreenDevice* screenDevice=iCoeEnv->ScreenDevice(); |
|
402 TRgb color(97, 97, 97); |
|
403 TPoint position(35, -35); |
|
404 TSize size(100, 50); |
|
405 TMargins margins; |
|
406 margins.iLeft=0; |
|
407 margins.iRight=0; |
|
408 margins.iTop=0; |
|
409 margins.iBottom=0; |
|
410 |
|
411 RDigitalClock tempDigitalClock0(iAnimDll, Window()); |
|
412 tempDigitalClock0.Close(); |
|
413 RDigitalClock tempDigitalClock1(iAnimDll, Window()); |
|
414 RDigitalClock tempDigitalClock2(iAnimDll, Window()); |
|
415 STimeDeviceShadow tempDigitalClock2Shadow; |
|
416 tempDigitalClock2Shadow.iIsOn=EFalse; |
|
417 tempDigitalClock2.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempDigitalClock2Shadow, |
|
418 color, 3); |
|
419 RDigitalClock tempDigitalClock3(iAnimDll, Window()); |
|
420 STimeDeviceShadow tempDigitalClock3Shadow; |
|
421 tempDigitalClock3Shadow.iIsOn=EFalse; |
|
422 tempDigitalClock3.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempDigitalClock2Shadow, |
|
423 color, 3); |
|
424 TBuf<64> tempDigitalClock3Format0=_L(""); |
|
425 tempDigitalClock3Format0.Append(_L("%*J")); |
|
426 tempDigitalClock3Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
427 tempDigitalClock3Format0.Append(_L("%:1")); |
|
428 tempDigitalClock3Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
429 tempDigitalClock3Format0.Append(_L("%T")); |
|
430 tempDigitalClock3Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
431 tempDigitalClock3Format0.Append(_L("%:2")); |
|
432 tempDigitalClock3Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
433 tempDigitalClock3Format0.Append(_L("%S %B")); |
|
434 CDestructableFont* tempDigitalClock3Font0=new(ELeave) CDestructableFont(screenDevice); |
|
435 tempDigitalClock3Font0->ConstructL(TFontSpec(_L("arial"), screenDevice->VerticalPixelsToTwips(60))); |
|
436 tempDigitalClock3.AddTextSectionL(TDigitalDisplayTextSection(tempDigitalClock3Font0->Handle(), TRgb(0, 0, 0), |
|
437 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
438 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
439 0, 0, tempDigitalClock3Format0)); |
|
440 RDigitalClock tempDigitalClock4(iAnimDll, Window()); |
|
441 STimeDeviceShadow tempDigitalClock4Shadow; |
|
442 tempDigitalClock4Shadow.iIsOn=EFalse; |
|
443 tempDigitalClock4.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempDigitalClock4Shadow, |
|
444 color, 3); |
|
445 RDigitalClock tempDigitalClock5(iAnimDll, Window()); |
|
446 STimeDeviceShadow tempDigitalClock5Shadow; |
|
447 tempDigitalClock5Shadow.iIsOn=EFalse; |
|
448 tempDigitalClock5.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempDigitalClock2Shadow, |
|
449 color, 3); |
|
450 TBuf<64> tempDigitalClock5Format0=_L(""); |
|
451 tempDigitalClock5Format0.Append(_L("%*J")); |
|
452 tempDigitalClock5Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
453 tempDigitalClock5Format0.Append(_L("%:1")); |
|
454 tempDigitalClock5Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
455 tempDigitalClock5Format0.Append(_L("%T")); |
|
456 tempDigitalClock5Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
457 tempDigitalClock5Format0.Append(_L("%:2")); |
|
458 tempDigitalClock5Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
459 tempDigitalClock5Format0.Append(_L("%S %B")); |
|
460 CDestructableFont* tempDigitalClock5Font0=new(ELeave) CDestructableFont(screenDevice); |
|
461 tempDigitalClock5Font0->ConstructL(TFontSpec(_L("arial"), screenDevice->VerticalPixelsToTwips(60))); |
|
462 tempDigitalClock5.AddTextSectionL(TDigitalDisplayTextSection(tempDigitalClock5Font0->Handle(), TRgb(0, 0, 0), |
|
463 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
464 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
465 0, 0, tempDigitalClock5Format0)); |
|
466 tempDigitalClock2.Close(); |
|
467 tempDigitalClock1.Close(); |
|
468 tempDigitalClock3.Close(); |
|
469 tempDigitalClock4.Close(); |
|
470 tempDigitalClock5.Close(); |
|
471 delete tempDigitalClock3Font0; |
|
472 delete tempDigitalClock5Font0; |
|
473 } |
|
474 |
|
475 void CClkControl::TestClosingPartiallyCreatedAnalogClocksL() |
|
476 { |
|
477 TRgb color(234, 234, 234); |
|
478 TPoint position(0, 0); |
|
479 TSize size(2, 0); |
|
480 RWindow& window=Window(); |
|
481 TMargins margins; |
|
482 margins.iLeft=0; |
|
483 margins.iRight=0; |
|
484 margins.iTop=0; |
|
485 margins.iBottom=0; |
|
486 |
|
487 RAnalogClock tempAnalogClock0(iAnimDll, window); |
|
488 tempAnalogClock0.Close(); |
|
489 RAnalogClock tempAnalogClock1(iAnimDll, window); |
|
490 RAnalogClock tempAnalogClock2(iAnimDll, window); |
|
491 STimeDeviceShadow tempAnalogClock2Shadow; |
|
492 tempAnalogClock2Shadow.iIsOn=EFalse; |
|
493 CFbsBitmap* tempAnalogClock2Face=new(ELeave) CFbsBitmap; |
|
494 User::LeaveIfError(tempAnalogClock2Face->Load(TCLCK0_MBM, CLOCK)); |
|
495 tempAnalogClock2.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempAnalogClock2Shadow, |
|
496 tempAnalogClock2Face->Handle(), 0, 3); |
|
497 RAnalogClock tempAnalogClock3(iAnimDll, window); |
|
498 STimeDeviceShadow tempAnalogClock3Shadow; |
|
499 tempAnalogClock3Shadow.iIsOn=EFalse; |
|
500 CFbsBitmap* tempAnalogClock3Face=new(ELeave) CFbsBitmap; |
|
501 User::LeaveIfError(tempAnalogClock3Face->Load(TCLCK0_MBM, CLOCK)); |
|
502 tempAnalogClock3.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempAnalogClock3Shadow, |
|
503 tempAnalogClock3Face->Handle(), 0, 3); |
|
504 TAnalogDisplayHand tempAnalogClock3Hand(EAnalogDisplayHandOneRevPerMinute); |
|
505 CArrayFix<TPoint>* tempAnalogClock3HandPointList=new(ELeave) CArrayFixFlat<TPoint>(2); |
|
506 tempAnalogClock3HandPointList->AppendL(TPoint(-10000, -10000)); |
|
507 tempAnalogClock3HandPointList->AppendL(TPoint(10000, 10000)); |
|
508 tempAnalogClock3Hand.AddPolyLine(CGraphicsContext::EDottedPen, color, TSize(50, 50), |
|
509 CGraphicsContext::ESolidBrush, TRgb(12, 12, 12), |
|
510 ETrue, tempAnalogClock3HandPointList); |
|
511 tempAnalogClock3Hand.AddCircle(CGraphicsContext::EDashedPen, TRgb(77, 77, 77), TSize(0, 0), CGraphicsContext::ESolidBrush, |
|
512 TRgb(77, 77, 77), TPoint(-20, 20), 9000); |
|
513 tempAnalogClock3.AddHandL(tempAnalogClock3Hand); |
|
514 tempAnalogClock3.AddHandL(tempAnalogClock3Hand); // try adding the same hand more than once |
|
515 RAnalogClock tempAnalogClock4(iAnimDll, window); |
|
516 STimeDeviceShadow tempAnalogClock4Shadow; |
|
517 tempAnalogClock4Shadow.iIsOn=ETrue; |
|
518 tempAnalogClock4Shadow.iColor=TRgb(123, 123, 123); |
|
519 tempAnalogClock4Shadow.iOffset.SetXY(1000, 1000); |
|
520 CFbsBitmap* tempAnalogClock4Face=new(ELeave) CFbsBitmap; |
|
521 User::LeaveIfError(tempAnalogClock4Face->Load(TCLCK0_MBM, CLOCK)); |
|
522 tempAnalogClock4.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempAnalogClock4Shadow, |
|
523 tempAnalogClock4Face->Handle(), 0, /* this parameter is aNumHands: */3); |
|
524 RAnalogClock tempAnalogClock5(iAnimDll, window); |
|
525 STimeDeviceShadow tempAnalogClock5Shadow; |
|
526 tempAnalogClock5Shadow.iIsOn=ETrue; |
|
527 tempAnalogClock5Shadow.iColor=TRgb(123, 123, 123); |
|
528 tempAnalogClock5Shadow.iOffset.SetXY(1000, 1000); |
|
529 CFbsBitmap* tempAnalogClock5Face=new(ELeave) CFbsBitmap; |
|
530 User::LeaveIfError(tempAnalogClock5Face->Load(TCLCK0_MBM, CLOCK)); |
|
531 tempAnalogClock5.ConstructL(TTimeIntervalSeconds(20*60), position, size, margins, tempAnalogClock5Shadow, |
|
532 tempAnalogClock5Face->Handle(), 0, /* this parameter is aNumHands: */3); |
|
533 TAnalogDisplayHand tempAnalogClock5Hand(EAnalogDisplayHandOneRevPerMinute); |
|
534 CArrayFix<TPoint>* tempAnalogClock5HandPointList=new(ELeave) CArrayFixFlat<TPoint>(2); |
|
535 tempAnalogClock5HandPointList->AppendL(TPoint(-10000, -10000)); |
|
536 tempAnalogClock5HandPointList->AppendL(TPoint(10000, 10000)); |
|
537 tempAnalogClock5Hand.AddPolyLine(CGraphicsContext::EDottedPen, color, TSize(50, 0), |
|
538 CGraphicsContext::ESolidBrush, TRgb(12, 12, 12), |
|
539 ETrue, tempAnalogClock5HandPointList); |
|
540 tempAnalogClock5Hand.AddCircle(CGraphicsContext::EDashedPen, TRgb(77, 77, 77), TSize(0, 0), CGraphicsContext::ESolidBrush, |
|
541 TRgb(77, 77, 77), TPoint(-20, 20), 9000); |
|
542 tempAnalogClock5.AddHandL(tempAnalogClock5Hand); |
|
543 tempAnalogClock5.AddHandL(tempAnalogClock5Hand); // try adding the same hand more than once |
|
544 tempAnalogClock2.Close(); |
|
545 tempAnalogClock1.Close(); |
|
546 tempAnalogClock3.Close(); |
|
547 tempAnalogClock4.Close(); |
|
548 tempAnalogClock5.Close(); |
|
549 delete tempAnalogClock2Face; |
|
550 delete tempAnalogClock3Face; |
|
551 delete tempAnalogClock3HandPointList; |
|
552 delete tempAnalogClock4Face; |
|
553 delete tempAnalogClock5Face; |
|
554 delete tempAnalogClock5HandPointList; |
|
555 } |
|
556 |
|
557 void CClkControl::FireOffNewThreadAndTestForPanicL(TAny* aData) |
|
558 { |
|
559 RThread thread; |
|
560 TRequestStatus status; |
|
561 User::LeaveIfError(thread.Create(_L("test-thread"), PanickingFunction, 0x2000, 0x2000, 0x2000, aData)); |
|
562 thread.Logon(status); |
|
563 thread.Resume(); |
|
564 User::WaitForRequest(status); |
|
565 if (thread.ExitType()!=EExitPanic) |
|
566 User::Leave(KErrGeneral); |
|
567 thread.Close(); |
|
568 } |
|
569 |
|
570 void CClkControl::CreateDigitalClocksL() |
|
571 { |
|
572 CWsScreenDevice* screenDevice=iCoeEnv->ScreenDevice(); |
|
573 TMargins margins; |
|
574 margins.iLeft=0; |
|
575 margins.iRight=0; |
|
576 margins.iTop=0; |
|
577 margins.iBottom=0; |
|
578 // construct digital clock |
|
579 STimeDeviceShadow digitalClock0Shadow; |
|
580 digitalClock0Shadow.iIsOn=ETrue; |
|
581 digitalClock0Shadow.iColor=TRgb(85, 85, 85); |
|
582 digitalClock0Shadow.iOffset.SetXY(2, 2); |
|
583 // |
|
584 iDigitalClock0=new(ELeave) RDigitalClock(iAnimDll, Window()); |
|
585 iDigitalClock0->ConstructL(TTimeIntervalSeconds(30*60), iDigitalClock0Position, iDigitalClock0Size, margins, digitalClock0Shadow, TRgb(170, 170, 170), 2); |
|
586 // |
|
587 TBuf<64> digitalClock0Format0=_L(""); // N.B. this string will contain 22 characters i.e. *not* a multiple of 4-bytes |
|
588 digitalClock0Format0.Append(_L("%-B%J")); |
|
589 digitalClock0Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
590 digitalClock0Format0.Append(_L("%:1")); |
|
591 digitalClock0Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
592 digitalClock0Format0.Append(_L("%T")); |
|
593 digitalClock0Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
594 digitalClock0Format0.Append(_L("%:2")); |
|
595 digitalClock0Format0.Append(TChar(EDigitalDisplayLayoutCharFlashingBlockDelimiter)); |
|
596 digitalClock0Format0.Append(_L("%S%+B")); |
|
597 CDestructableFont* digitalClock0Font0=new(ELeave) CDestructableFont(screenDevice); |
|
598 CleanupStack::PushL(digitalClock0Font0); |
|
599 TFontSpec digitalClock0FontSpec0(_L("arial"), screenDevice->VerticalPixelsToTwips(25)); |
|
600 digitalClock0FontSpec0.iFontStyle.SetPosture(EPostureItalic); |
|
601 digitalClock0FontSpec0.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
602 digitalClock0Font0->ConstructL(digitalClock0FontSpec0); |
|
603 iDigitalClock0->AddTextSectionL(TDigitalDisplayTextSection(digitalClock0Font0->Handle(), TRgb(0, 0, 0), |
|
604 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
605 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
606 0, 0, digitalClock0Format0)); |
|
607 // |
|
608 TBuf<64> digitalClock0Format1=_L(""); |
|
609 digitalClock0Format1.Append(_L("date -- %1%/1%2%/2%3")); // N.B. this string contains 20 characters i.e. a multiple of 4-bytes |
|
610 CDestructableFont* digitalClock0Font1=new(ELeave) CDestructableFont(screenDevice); |
|
611 CleanupStack::PushL(digitalClock0Font1); |
|
612 TFontSpec digitalClock0FontSpec1(_L("arial"), screenDevice->VerticalPixelsToTwips(15)); |
|
613 digitalClock0FontSpec1.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
614 digitalClock0Font1->ConstructL(digitalClock0FontSpec1); |
|
615 iDigitalClock0->AddTextSectionL(TDigitalDisplayTextSection(digitalClock0Font1->Handle(), TRgb(255, 255, 255), |
|
616 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
617 EDigitalDisplayVerticalTextAlignmentBottomInclDescent, |
|
618 0, 0, digitalClock0Format1)); |
|
619 // |
|
620 CleanupStack::PopAndDestroy(); // pop and destroy digitalClock0Font1 |
|
621 CleanupStack::PopAndDestroy(); // pop and destroy digitalClock0Font0 |
|
622 // |
|
623 // |
|
624 // |
|
625 STimeDeviceShadow digitalClock1Shadow; |
|
626 digitalClock1Shadow.iIsOn=ETrue; |
|
627 digitalClock1Shadow.iColor=TRgb(85, 85, 85); |
|
628 digitalClock1Shadow.iOffset.SetXY(2, 2); |
|
629 // |
|
630 RDigitalClock digitalClock1(iAnimDll, Window()); |
|
631 digitalClock1.ConstructL(TTimeIntervalSeconds(30*60), TPoint(0, 0), TSize(20, 20), margins, digitalClock1Shadow, TRgb(170, 170, 170), 1); |
|
632 TDigitalDisplayTextSection* textSection=NULL; |
|
633 TInt error=KErrNone; |
|
634 // |
|
635 textSection=new(ELeave) TDigitalDisplayTextSection(0, TRgb(0, 0, 0), |
|
636 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
637 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
638 0, 0, _L("%+")); |
|
639 TRAP(error,digitalClock1.AddTextSectionL(*textSection)); |
|
640 __ASSERT_ALWAYS(error!=KErrNone, User::Panic(_L("Clock test-code"), 3)); |
|
641 delete textSection; |
|
642 // |
|
643 textSection=new(ELeave) TDigitalDisplayTextSection(0, TRgb(0, 0, 0), |
|
644 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
645 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
646 0, 0, _L("%-")); |
|
647 TRAP(error,digitalClock1.AddTextSectionL(*textSection)); |
|
648 __ASSERT_ALWAYS(error!=KErrNone, User::Panic(_L("Clock test-code"), 4)); |
|
649 delete textSection; |
|
650 // |
|
651 textSection=new(ELeave) TDigitalDisplayTextSection(0, TRgb(0, 0, 0), |
|
652 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
653 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
654 0, 0, _L("%:_")); |
|
655 TRAP(error,digitalClock1.AddTextSectionL(*textSection)); |
|
656 __ASSERT_ALWAYS(error!=KErrNone, User::Panic(_L("Clock test-code"), 6)); |
|
657 delete textSection; |
|
658 // |
|
659 textSection=new(ELeave) TDigitalDisplayTextSection(0, TRgb(0, 0, 0), |
|
660 EDigitalDisplayHorizontalTextAlignmentCenter, |
|
661 EDigitalDisplayVerticalTextAlignmentCenterExclDescent, |
|
662 0, 0, _L("%/5")); |
|
663 TRAP(error,digitalClock1.AddTextSectionL(*textSection)); |
|
664 __ASSERT_ALWAYS(error!=KErrNone, User::Panic(_L("Clock test-code"), 7)); |
|
665 delete textSection; |
|
666 digitalClock1.Close(); |
|
667 } |
|
668 |
|
669 void CClkControl::CreateAnalogClocksL() |
|
670 { |
|
671 CWsScreenDevice* screenDevice=iCoeEnv->ScreenDevice(); |
|
672 TMargins margins; |
|
673 margins.iLeft=0; |
|
674 margins.iRight=0; |
|
675 margins.iTop=0; |
|
676 margins.iBottom=0; |
|
677 // construct analog clock |
|
678 // |
|
679 STimeDeviceShadow analogClock0Shadow; |
|
680 analogClock0Shadow.iIsOn=ETrue; |
|
681 analogClock0Shadow.iColor=TRgb(85, 85, 85); |
|
682 analogClock0Shadow.iOffset.SetXY(4, 4); |
|
683 // |
|
684 CDestructableFont* analogClock0AmPmFont=new(ELeave) CDestructableFont(screenDevice); |
|
685 CleanupStack::PushL(analogClock0AmPmFont); |
|
686 TFontSpec analogClock0AmPmFontSpec(_L("arial"), screenDevice->VerticalPixelsToTwips(12)); |
|
687 analogClock0AmPmFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
688 analogClock0AmPmFont->ConstructL(analogClock0AmPmFontSpec); |
|
689 // |
|
690 SAnalogDisplayAmPm analogClock0AmPm; |
|
691 analogClock0AmPm.iPositionRelativeToFace=TPoint(174, 103); |
|
692 analogClock0AmPm.iShadow.iIsOn=EFalse; |
|
693 analogClock0AmPm.iShadow.iColor=TRgb(85, 85, 85); |
|
694 analogClock0AmPm.iShadow.iOffset.SetXY(2, 2); |
|
695 analogClock0AmPm.iSize.SetSize(18, 13); |
|
696 analogClock0AmPm.iBackgroundColor=TRgb(255, 255, 255); |
|
697 analogClock0AmPm.iFontHandle=analogClock0AmPmFont->Handle(); |
|
698 analogClock0AmPm.iTextColor=TRgb(0, 0, 0); |
|
699 // |
|
700 CFbsBitmap* analogClock0Face=new(ELeave) CFbsBitmap; |
|
701 CleanupStack::PushL(analogClock0Face); |
|
702 User::LeaveIfError(analogClock0Face->Load(TCLCK0_MBM, CLOCK)); |
|
703 analogClock0Face->SetSizeInTwips(screenDevice); |
|
704 CFbsBitmap* analogClock0FaceMask=new(ELeave) CFbsBitmap; |
|
705 CleanupStack::PushL(analogClock0FaceMask); |
|
706 User::LeaveIfError(analogClock0FaceMask->Load(TCLCK0_MBM, CLOCKMSK)); |
|
707 analogClock0FaceMask->SetSizeInTwips(screenDevice); |
|
708 // |
|
709 iAnalogClock0=new(ELeave) RAnalogClock(iAnimDll, Window()); |
|
710 iAnalogClock0->ConstructL(TTimeIntervalSeconds(30*60), iAnalogClock0Position, iAnalogClock0Size, margins, analogClock0Shadow, |
|
711 analogClock0Face->Handle(), analogClock0FaceMask->Handle(), 3, &analogClock0AmPm); |
|
712 // |
|
713 TRgb black(0, 0, 0); |
|
714 CArrayFix<TPoint>* pointList=new(ELeave) CArrayFixFlat<TPoint>(4); |
|
715 CleanupStack::PushL(pointList); |
|
716 // |
|
717 // N.B. the dimensions/positions of the hand features (i.e. lines and circles) are specified with the hand assumed to be in the |
|
718 // 12 o'clock position, with TPoint(0, 0) being the center of the clock |
|
719 TAnalogDisplayHand analogClock0HourHand(EAnalogDisplayHandOneRevPer12Hours); |
|
720 analogClock0HourHand.AddLine(CGraphicsContext::ESolidPen, black, TSize(4, 4), TPoint(0, 10), TPoint(0, -55)); |
|
721 iAnalogClock0->AddHandL(analogClock0HourHand); |
|
722 // |
|
723 TAnalogDisplayHand analogClock0MinuteHand(EAnalogDisplayHandOneRevPerHour); |
|
724 analogClock0MinuteHand.AddLine(CGraphicsContext::ESolidPen, black, TSize(4, 4), TPoint(0, 10), TPoint(0, -70)); |
|
725 iAnalogClock0->AddHandL(analogClock0MinuteHand); |
|
726 // |
|
727 TAnalogDisplayHand analogClock0SecondHand(EAnalogDisplayHandOneRevPerMinute); |
|
728 analogClock0SecondHand.AddLine(CGraphicsContext::ESolidPen, black, TSize(1, 1), TPoint(0, 40), TPoint(0, -60)); |
|
729 analogClock0SecondHand.AddCircle(CGraphicsContext::ESolidPen, black, TSize(2, 2), CGraphicsContext::ENullBrush, black, TPoint(0, -65), 5); |
|
730 analogClock0SecondHand.AddLine(CGraphicsContext::ESolidPen, black, TSize(1, 1), TPoint(0, -70), TPoint(0, -80)); |
|
731 pointList->AppendL(TPoint(-16, 33)); |
|
732 pointList->AppendL(TPoint(0, 7)); |
|
733 pointList->AppendL(TPoint(16, 33)); |
|
734 pointList->AppendL(TPoint(0, 14)); |
|
735 analogClock0SecondHand.AddPolyLine(CGraphicsContext::ESolidPen, black, TSize(1, 1), CGraphicsContext::ESolidBrush, TRgb(170, 170, 170), ETrue, pointList); |
|
736 pointList->Reset(); |
|
737 pointList->AppendL(TPoint(-16, 39)); |
|
738 pointList->AppendL(TPoint(0, 21)); |
|
739 pointList->AppendL(TPoint(16, 39)); |
|
740 pointList->AppendL(TPoint(0, 28)); |
|
741 analogClock0SecondHand.AddPolyLine(CGraphicsContext::ESolidPen, black, TSize(1, 1), CGraphicsContext::ENullBrush, black, ETrue, pointList); |
|
742 pointList->Reset(); |
|
743 pointList->AppendL(TPoint(-16, 45)); |
|
744 pointList->AppendL(TPoint(0, 35)); |
|
745 pointList->AppendL(TPoint(16, 45)); |
|
746 analogClock0SecondHand.AddPolyLine(CGraphicsContext::ESolidPen, black, TSize(1, 1), CGraphicsContext::ENullBrush, black, EFalse, pointList); |
|
747 pointList->Reset(); |
|
748 iAnalogClock0->AddHandL(analogClock0SecondHand); |
|
749 // |
|
750 CleanupStack::PopAndDestroy(); // pop and destroy pointList |
|
751 CleanupStack::PopAndDestroy(); // pop and destroy analogClock0FaceMask |
|
752 CleanupStack::PopAndDestroy(); // pop and destroy analogClock0Face |
|
753 CleanupStack::PopAndDestroy(); // pop and destroy analogClock0AmPmFont |
|
754 } |
|
755 |
|
756 |
|
757 CTestClckUi::CTestClckUi(CTmsTestStep* aStep) : |
|
758 CTestCoeAppUi(aStep) |
|
759 {} |
|
760 |
|
761 |
|
762 void CTestClckUi::ConstructL() |
|
763 { |
|
764 CTestCoeAppUi::ConstructL(); |
|
765 iControl=new(ELeave) CClkControl; |
|
766 AddToStackL(iControl,ECoeStackPriorityDefault,ECoeStackFlagOwnershipTransfered); |
|
767 iControl->ConstructL(); |
|
768 AutoTestManager().StartAutoTest(); |
|
769 } |
|
770 |
|
771 /** |
|
772 @SYMTestCaseID UIF-Clock-TClock0 |
|
773 */ |
|
774 |
|
775 void CTestClckUi::RunTestStepL(TInt aNumStep) |
|
776 { |
|
777 TKeyEvent theKeyEvent; |
|
778 TEventCode theType = EEventKey; |
|
779 |
|
780 //only for debug |
|
781 User::After(TTimeIntervalMicroSeconds32(1000000)); |
|
782 _LIT(KTestString1,"Show analog & digital clocks"); |
|
783 |
|
784 switch(aNumStep) |
|
785 { |
|
786 case 1: |
|
787 SetTestStepID(_L("UIF-Clock-TClock0")); // for TMS |
|
788 theKeyEvent.iCode = EKeyEnter; |
|
789 theKeyEvent.iModifiers = 0; |
|
790 |
|
791 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
792 |
|
793 INFO_PRINTF1(KTestString1); |
|
794 break; |
|
795 |
|
796 case 2: case 3: case 4: case 5: |
|
797 theKeyEvent.iCode = EKeyLeftArrow; |
|
798 theKeyEvent.iModifiers = 0; |
|
799 |
|
800 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
801 INFO_PRINTF1(KTestString2); |
|
802 break; |
|
803 |
|
804 case 6: case 7: case 8: case 9: |
|
805 theKeyEvent.iCode = EKeyRightArrow; |
|
806 theKeyEvent.iModifiers = 0; |
|
807 |
|
808 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
809 INFO_PRINTF1(KTestString3); |
|
810 break; |
|
811 |
|
812 case 10: |
|
813 theKeyEvent.iCode = '*'; |
|
814 theKeyEvent.iModifiers = 0; |
|
815 |
|
816 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
817 INFO_PRINTF1(KTestString4); |
|
818 break; |
|
819 |
|
820 case 11: case 12: case 13: case 14: |
|
821 theKeyEvent.iCode = EKeyRightArrow; |
|
822 theKeyEvent.iModifiers = EModifierFunc | EModifierCtrl; |
|
823 |
|
824 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
825 INFO_PRINTF1(KTestString5); |
|
826 break; |
|
827 case 15: |
|
828 theKeyEvent.iCode = EKeySpace; |
|
829 theKeyEvent.iModifiers = EModifierShift; |
|
830 |
|
831 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
832 INFO_PRINTF1(KTestString6); |
|
833 break; |
|
834 |
|
835 case 16: |
|
836 theKeyEvent.iCode = EKeySpace; |
|
837 theKeyEvent.iModifiers = 0; |
|
838 |
|
839 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
840 INFO_PRINTF1(KTestString7); |
|
841 break; |
|
842 |
|
843 case 17: |
|
844 theKeyEvent.iCode = EKeyEnter; |
|
845 theKeyEvent.iModifiers = EModifierShift; |
|
846 |
|
847 iControl->OfferKeyEventL(theKeyEvent, theType); |
|
848 INFO_PRINTF1(KTestString8); |
|
849 RecordTestResultL(); // for TMS |
|
850 CloseTMSGraphicsStep(); |
|
851 break; |
|
852 |
|
853 case 18: |
|
854 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
855 } |
|
856 } |
|
857 // main functions |
|
858 |
|
859 void CTClck0Step::ConstructAppL(CCoeEnv* aCoeEnv) |
|
860 { |
|
861 aCoeEnv->ConstructL(); |
|
862 CTestClckUi* appUi=new(ELeave) CTestClckUi(this); |
|
863 appUi->ConstructL(); |
|
864 aCoeEnv->SetAppUi(appUi); |
|
865 } |
|
866 |
|
867 |
|
868 CTClck0Step::~CTClck0Step() |
|
869 /** |
|
870 Destructor |
|
871 */ |
|
872 { |
|
873 } |
|
874 |
|
875 CTClck0Step::CTClck0Step() |
|
876 /** |
|
877 Constructor |
|
878 */ |
|
879 { |
|
880 // Call base class method to set up the human readable name for logging |
|
881 SetTestStepName(KTClck0Step); |
|
882 } |
|
883 |
|
884 TVerdict CTClck0Step::doTestStepL() |
|
885 { |
|
886 INFO_PRINTF1(KTestStarted); |
|
887 |
|
888 PreallocateHALBuffer(); |
|
889 |
|
890 CCoeEnv* coeEnv=new CCoeEnv; |
|
891 if (coeEnv==NULL) |
|
892 { |
|
893 SetTestStepResult(EFail); |
|
894 return TestStepResult(); |
|
895 } |
|
896 TRAPD(error, ConstructAppL(coeEnv)); |
|
897 if (error!=KErrNone) |
|
898 { |
|
899 delete coeEnv; |
|
900 SetTestStepResult(EFail); |
|
901 return TestStepResult(); |
|
902 } |
|
903 |
|
904 coeEnv->ExecuteD(); |
|
905 |
|
906 INFO_PRINTF1(KTestFinished); |
|
907 return TestStepResult(); |
|
908 } |
|
909 |
|
910 |
|
911 |