103
|
1 |
// Copyright (c) 1996-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 |
// Auto test Animated DLL functions
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <e32std.h>
|
|
19 |
#include <w32std.h>
|
|
20 |
#include <w32adll.h>
|
|
21 |
#include <bitstd.h>
|
|
22 |
#include "AUTODLL.H"
|
|
23 |
#include "TAnimDraw.h"
|
|
24 |
#include "eventdd.h"
|
|
25 |
#include <gdi.h>
|
|
26 |
#include <fbs.h>
|
|
27 |
|
|
28 |
union TAnimArgUnion
|
|
29 |
{
|
|
30 |
const TAny* any;
|
|
31 |
const TBool* Bool;
|
|
32 |
const TInt* Int;
|
|
33 |
const TPoint* Point;
|
|
34 |
const TSize* Size;
|
|
35 |
const TRect* Rect;
|
|
36 |
const TSpriteMemberInfo* SpriteMemberInfo;
|
|
37 |
const TShadowDrawTest* ShadowDrawTest;
|
|
38 |
const TDrawTestScreen* DrawTestScreen;
|
|
39 |
const TSyncTests* SyncTests;
|
|
40 |
const TTimeChangeTest* TimeChangeTest;
|
|
41 |
const TAnimRawEvent* AnimRawEvent;
|
|
42 |
const TWindowGroupInfoParms* WindowGroupInfoParms;
|
|
43 |
const TSetOrdinalParms* SetOrdinalParms;
|
|
44 |
const TFrameData* FrameData;
|
|
45 |
const TRawEvent* RawEvent;
|
|
46 |
};
|
|
47 |
|
|
48 |
class CPanicAnim : public CWindowAnim
|
|
49 |
{
|
|
50 |
enum TSyncState
|
|
51 |
{
|
|
52 |
ESyncStateNull,
|
|
53 |
ESyncStateStarting,
|
|
54 |
ESyncStateCounting,
|
|
55 |
ESyncLeave,
|
|
56 |
ESyncStateTimeChange1,
|
|
57 |
ESyncStateTimeChange2,
|
|
58 |
ESyncStateTimeChange3
|
|
59 |
};
|
|
60 |
enum {ESyncCount=8};
|
|
61 |
public:
|
|
62 |
~CPanicAnim();
|
|
63 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
64 |
virtual void Animate(TDateTime *aDateTime);
|
|
65 |
virtual void Redraw();
|
|
66 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
67 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
68 |
virtual void FocusChanged(TBool aState);
|
|
69 |
//Pure virtual function from MEventHandler
|
|
70 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
71 |
private:
|
|
72 |
void StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync);
|
|
73 |
void StartTimeChangeTest();
|
|
74 |
void DoLeaveInActiveCallback();
|
|
75 |
static TInt LeaveInActiveCallback(TAny *aThis);
|
|
76 |
private:
|
|
77 |
TRequestStatus *iStatusPtr;
|
|
78 |
TRequestStatus *iStatusPtr2;
|
|
79 |
TTime iTime;
|
|
80 |
TInt iSyncCount;
|
|
81 |
TSyncState iSyncState;
|
|
82 |
MAnimGeneralFunctions::TAnimSync iSyncMode;
|
|
83 |
TBool iLeaveInRedraw;
|
|
84 |
CIdle* iActivePanicIdle;
|
|
85 |
};
|
|
86 |
|
|
87 |
class CPanicAnim2 : public CWindowAnim
|
|
88 |
//
|
|
89 |
// Simply panics in the ConstructL()
|
|
90 |
//
|
|
91 |
{
|
|
92 |
public:
|
|
93 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
94 |
virtual void Animate(TDateTime *aDateTime);
|
|
95 |
virtual void Redraw();
|
|
96 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
97 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
98 |
virtual void FocusChanged(TBool aState);
|
|
99 |
//Pure virtual function from MEventHandler
|
|
100 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
101 |
};
|
|
102 |
|
|
103 |
class CAutoAnim3 : public CWindowAnim
|
|
104 |
//
|
|
105 |
// test drawing/redrawing
|
|
106 |
//
|
|
107 |
{
|
|
108 |
public:
|
|
109 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
110 |
virtual void Animate(TDateTime *aDateTime);
|
|
111 |
virtual void Redraw();
|
|
112 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
113 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
114 |
virtual void FocusChanged(TBool aState);
|
|
115 |
void Draw(const TRect &aRect);
|
|
116 |
void DrawTestScreenL(const TDrawTestScreen* aParams);
|
|
117 |
//Pure virtual function from MEventHandler
|
|
118 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
119 |
private:
|
|
120 |
TRequestStatus *iStatusPtr;
|
|
121 |
CFbsFont *iFont;
|
|
122 |
TRect iRect;
|
|
123 |
TRect iBaseRect;
|
|
124 |
TInt iMode;
|
|
125 |
};
|
|
126 |
|
|
127 |
class CAutoAnimScrBack : public CWindowAnim
|
|
128 |
//
|
|
129 |
// test anim drawing behind a backed up window
|
|
130 |
//
|
|
131 |
{
|
|
132 |
public:
|
|
133 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
134 |
virtual void Animate(TDateTime *aDateTime);
|
|
135 |
virtual void Redraw();
|
|
136 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
137 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
138 |
virtual void FocusChanged(TBool aState);
|
|
139 |
void Draw();
|
|
140 |
//Pure virtual function from MEventHandler
|
|
141 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
142 |
private:
|
|
143 |
TRect iRect;
|
|
144 |
TInt iMode;
|
|
145 |
};
|
|
146 |
|
|
147 |
class CTestSpriteAnim : public CSpriteAnim
|
|
148 |
{
|
|
149 |
public:
|
|
150 |
virtual void ConstructL(TAny *aArgs);
|
|
151 |
virtual void Animate(TDateTime *aDateTime);
|
|
152 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
153 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
154 |
//Pure virtual function from MEventHandler
|
|
155 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
156 |
private:
|
|
157 |
TBool CheckMember(const TSpriteMemberInfo& aMemInfo);
|
|
158 |
void DrawMemberL(TInt aMember);
|
|
159 |
void DrawMemberL();
|
|
160 |
};
|
|
161 |
|
|
162 |
/**
|
|
163 |
Used by CAnimTimer below
|
|
164 |
*/
|
|
165 |
class MAnimTimerObserver
|
|
166 |
{
|
|
167 |
public:
|
|
168 |
virtual void DisplayNextFrameL()=0;
|
|
169 |
};
|
|
170 |
|
|
171 |
/**
|
|
172 |
This class is used by CTestFreeTimerAnim to determine when to swap the current frame with the next one.
|
|
173 |
*/
|
|
174 |
class CAnimTimer : public CTimer
|
|
175 |
{
|
|
176 |
public:
|
|
177 |
~CAnimTimer();
|
|
178 |
static CAnimTimer* NewL(MAnimTimerObserver& aObserver);
|
|
179 |
void RunL();
|
|
180 |
private:
|
|
181 |
CAnimTimer(MAnimTimerObserver& aObserver);
|
|
182 |
void ConstructL();
|
|
183 |
private:
|
|
184 |
MAnimTimerObserver& iAnim;
|
|
185 |
};
|
|
186 |
|
|
187 |
class CTestFreeTimerAnim : public CFreeTimerWindowAnim, public MAnimTimerObserver
|
|
188 |
{
|
|
189 |
public:
|
|
190 |
//from CBase
|
|
191 |
~CTestFreeTimerAnim();
|
|
192 |
//from CAnim
|
|
193 |
void Animate(TDateTime *aDateTime);
|
|
194 |
void Command(TInt aOpcode, TAny *aArgs);
|
|
195 |
TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
196 |
//from CWindowAnim
|
|
197 |
void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
198 |
void Redraw();
|
|
199 |
void FocusChanged(TBool aState);
|
|
200 |
//from MEventHandler
|
|
201 |
TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
202 |
private:
|
|
203 |
void DisplayNextFrameL();
|
|
204 |
private:
|
|
205 |
CAnimTimer* iTimer;
|
|
206 |
TInt iFrameTime;
|
|
207 |
TRgb iColour;
|
|
208 |
TRect iRect;
|
|
209 |
};
|
|
210 |
|
|
211 |
class CEventTestAnimBase : public CWindowAnim
|
|
212 |
{
|
|
213 |
enum {EEventBufferSize=40};
|
|
214 |
public:
|
|
215 |
virtual ~CEventTestAnimBase();
|
|
216 |
//Pure virtual functions from CAnim
|
|
217 |
virtual void Animate(TDateTime *aDateTime);
|
|
218 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
219 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
220 |
//Pure virtual functions from CWindowAnim
|
|
221 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
222 |
virtual void Redraw();
|
|
223 |
virtual void FocusChanged(TBool aState);
|
|
224 |
//Pure virtual function from MEventHandler
|
|
225 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
226 |
protected:
|
|
227 |
void Fail();
|
|
228 |
TBool IsIgnorableEvent(const TRawEvent& aRawEvent) const;
|
|
229 |
TBool GetNextExpectedEvent(TAnimRawEvent& aRawEvent);
|
|
230 |
TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const;
|
|
231 |
TBool HandleRecursiveEvent(const TRawEvent& aRawEvent);
|
|
232 |
|
|
233 |
TInt Error() const;
|
|
234 |
TInt EventCount() const;
|
|
235 |
void ResetEventCount();
|
|
236 |
TInt TotalExpectedEvents() const;
|
|
237 |
TInt AddEvent(const TAnimRawEvent* event);
|
|
238 |
private:
|
|
239 |
virtual TInt AddExpectedEvent(const TAnimRawEvent* event)=0;
|
|
240 |
private:
|
|
241 |
CCirBuf<TAnimRawEvent> iExpectedEvents;
|
|
242 |
TInt iError;
|
|
243 |
TInt iEventCount;
|
|
244 |
};
|
|
245 |
|
|
246 |
class CEventTestAnim : public CEventTestAnimBase
|
|
247 |
{
|
|
248 |
public:
|
|
249 |
~CEventTestAnim();
|
|
250 |
//Pure virtual functions from CWindowAnim overridden in CEventTestAnimBase
|
|
251 |
void ConstructL(TAny* aArgs,TBool aHasFocus);
|
|
252 |
//Pure virtual functions from CAnim overridden in CEventTestAnimBase
|
|
253 |
TInt CommandReplyL(TInt aOpcode,TAny* aArgs);
|
|
254 |
void Command(TInt aOpcode,TAny* aArgs);
|
|
255 |
private:
|
|
256 |
TInt UnloadDeviceDriver();
|
|
257 |
//Pure virtual function from CEventTestAnimBase
|
|
258 |
TInt AddExpectedEvent(const TAnimRawEvent* event);
|
|
259 |
private:
|
|
260 |
TBool iDevDriverLoaded;
|
|
261 |
REventDD iLdd;
|
|
262 |
};
|
|
263 |
|
|
264 |
class CEventPostingAnim : public CEventTestAnimBase
|
|
265 |
{
|
|
266 |
public:
|
|
267 |
~CEventPostingAnim();
|
|
268 |
//Virtual functions from CEventTestAnimBase
|
|
269 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
270 |
//Virtual function from MEventHandler
|
|
271 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
272 |
private:
|
|
273 |
//Pure virtual function from CEventTestAnimBase
|
|
274 |
virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
|
|
275 |
};
|
|
276 |
|
|
277 |
class CRemovableAnim : public CEventTestAnimBase
|
|
278 |
{
|
|
279 |
public:
|
|
280 |
~CRemovableAnim();
|
|
281 |
//Virtual functions from CEventTestAnimBase
|
|
282 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
283 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
284 |
private:
|
|
285 |
//Pure virtual function from CEventTestAnimBase
|
|
286 |
virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
|
|
287 |
private:
|
|
288 |
TInt iLifetime;
|
|
289 |
};
|
|
290 |
|
|
291 |
class CTimerTestAnim : public CWindowAnim
|
|
292 |
{
|
|
293 |
public:
|
|
294 |
~CTimerTestAnim();
|
|
295 |
//Pure virtual functions from CAnim
|
|
296 |
virtual void Animate(TDateTime *aDateTime);
|
|
297 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
298 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
299 |
//Pure virtual functions from CWindowAnim
|
|
300 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
301 |
virtual void Redraw();
|
|
302 |
virtual void FocusChanged(TBool aState);
|
|
303 |
//Pure virtual function from MEventHandler
|
|
304 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
305 |
private:
|
|
306 |
TInt iTimerCount;
|
|
307 |
TBool iExpectingTicks;
|
|
308 |
TBool iFail;
|
|
309 |
};
|
|
310 |
|
|
311 |
class CWinFunctionTestAnim : public CWindowAnim
|
|
312 |
{
|
|
313 |
//enum {EEventBufferSize=40};
|
|
314 |
public:
|
|
315 |
~CWinFunctionTestAnim();
|
|
316 |
//Pure virtual functions from CAnim
|
|
317 |
virtual void Animate(TDateTime *aDateTime);
|
|
318 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
319 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
320 |
//Pure virtual functions from CWindowAnim
|
|
321 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
322 |
virtual void Redraw();
|
|
323 |
virtual void FocusChanged(TBool aState);
|
|
324 |
//Pure virtual function from MEventHandler
|
|
325 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
326 |
private:
|
|
327 |
MAnimGeneralFunctionsWindowExtension* iWinFunctions;
|
|
328 |
};
|
|
329 |
|
|
330 |
class CNotificationTestAnim : public CWindowAnim
|
|
331 |
{
|
|
332 |
public:
|
|
333 |
CNotificationTestAnim();
|
|
334 |
~CNotificationTestAnim();
|
|
335 |
//Pure virtual functions from CAnim
|
|
336 |
virtual void HandleNotification(const TWsEvent& aEvent);
|
|
337 |
virtual void Animate(TDateTime *aDateTime);
|
|
338 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
339 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
340 |
//Pure virtual functions from CWindowAnim
|
|
341 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
342 |
virtual void Redraw();
|
|
343 |
virtual void FocusChanged(TBool aState);
|
|
344 |
//Pure virtual function from MEventHandler
|
|
345 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
346 |
private:
|
|
347 |
TFixedArray<TBool,2> iDSA;
|
|
348 |
TBool iHeartbeatState;
|
|
349 |
TBool iScreenDeviceChanged;
|
|
350 |
TTime iLastAnimTime;
|
|
351 |
};
|
|
352 |
|
|
353 |
class CTransAnim : public CWindowAnim
|
|
354 |
//
|
|
355 |
// Test drawing/redrawing in Transparent window.
|
|
356 |
//
|
|
357 |
{
|
|
358 |
public:
|
|
359 |
//Implementaion for pure virtual functions from CAnim
|
|
360 |
void ConstructL(TAny* aArgs, TBool aHasFocus);
|
|
361 |
void Animate(TDateTime* aDateTime);
|
|
362 |
void Redraw();
|
|
363 |
void Command(TInt aOpcode, TAny* aArgs);
|
|
364 |
TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
|
|
365 |
void FocusChanged(TBool aState);
|
|
366 |
TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
367 |
private:
|
|
368 |
CFbsFont* iFont;
|
|
369 |
TRect iRect;
|
|
370 |
TInt iMode;
|
|
371 |
TInt iDraw;
|
|
372 |
TRgb iColor;
|
|
373 |
TInt iCount;
|
|
374 |
};
|
|
375 |
|
|
376 |
class CTestHandlerAnim : public CWindowAnim
|
|
377 |
{
|
|
378 |
public:
|
|
379 |
~CTestHandlerAnim();
|
|
380 |
void ConstructL(TAny* aArgs, TBool aHasFocus);
|
|
381 |
void Redraw();
|
|
382 |
void FocusChanged(TBool aState);
|
|
383 |
TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
|
|
384 |
void Command(TInt aOpcode, TAny* aArgs);
|
|
385 |
void Animate(TDateTime* aDateTime);
|
|
386 |
TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
387 |
private:
|
|
388 |
};
|
|
389 |
|
|
390 |
class CCoverageAnim : public CWindowAnim
|
|
391 |
/**
|
|
392 |
This class adds functional coverage to CWsAnimGc.
|
|
393 |
The actual work is handled by the 'Draw' method which calls
|
|
394 |
each method in turn.
|
|
395 |
Mostly copied from CAutoAnimScrBack and CAutoAnim3.
|
|
396 |
@SYMTestCaseID
|
|
397 |
@SYMPREQ 1841 Add Coverage tests.
|
|
398 |
@SYMTestCaseDesc Functional coverage.
|
|
399 |
@SYMTestActions Run functional coverage test on CWsAnimGc.
|
|
400 |
*/
|
|
401 |
{
|
|
402 |
public:
|
|
403 |
~CCoverageAnim();
|
|
404 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
405 |
virtual void Animate(TDateTime *aDateTime);
|
|
406 |
virtual void Redraw();
|
|
407 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
408 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
409 |
virtual void FocusChanged(TBool aState);
|
|
410 |
void Draw();
|
|
411 |
//Pure virtual function from MEventHandler
|
|
412 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
413 |
private:
|
|
414 |
TRect iRect; /** rectangle used for all draw ops that require one */
|
|
415 |
CFbsFont* iFont;
|
|
416 |
};
|
|
417 |
|
|
418 |
class CMultiPointerAnim : public CWindowAnim
|
|
419 |
{
|
|
420 |
enum {EEventBufferSize=40};
|
|
421 |
public:
|
|
422 |
virtual ~CMultiPointerAnim();
|
|
423 |
//Pure virtual functions from CAnim
|
|
424 |
virtual void Animate(TDateTime *aDateTime);
|
|
425 |
virtual void Command(TInt aOpcode, TAny *aArgs);
|
|
426 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
|
|
427 |
//Pure virtual functions from CWindowAnim
|
|
428 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
|
|
429 |
virtual void Redraw();
|
|
430 |
virtual void FocusChanged(TBool aState);
|
|
431 |
//Pure virtual function from MEventHandler
|
|
432 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
|
|
433 |
protected:
|
|
434 |
TInt AddEvent(const TAnimRawEvent* aEvent);
|
|
435 |
TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent);
|
|
436 |
private:
|
|
437 |
CCirBuf<TAnimRawEvent> iExpectedEvents;
|
|
438 |
TBuf<255> iErrorDes;
|
|
439 |
TInt iEventCount;
|
|
440 |
TInt iError;
|
|
441 |
};
|
|
442 |
|
|
443 |
class CTestAnimDll : public CAnimDll
|
|
444 |
{
|
|
445 |
public:
|
|
446 |
CAnim *CreateInstanceL(TInt aType);
|
|
447 |
private:
|
|
448 |
};
|
|
449 |
|
|
450 |
/*#if defined(__WINS__)
|
|
451 |
#pragma data_seg(".E32_UID")
|
|
452 |
__WINS_UID(0, KWservAnimDllUidValue, 0)
|
|
453 |
#pragma data_seg()
|
|
454 |
#endif*/
|
|
455 |
|
|
456 |
EXPORT_C CAnimDll *CreateCAnimDllL()
|
|
457 |
{
|
|
458 |
return(new(ELeave) CTestAnimDll());
|
|
459 |
}
|
|
460 |
|
|
461 |
|
|
462 |
// Panic Tests //
|
|
463 |
void CPanicAnim::ConstructL(TAny *, TBool )
|
|
464 |
{
|
|
465 |
iWindowFunctions->SetRect(TRect(0,0,1,1));
|
|
466 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
467 |
if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncSecond)
|
|
468 |
User::Leave(KErrGeneral);
|
|
469 |
// Check the anim time is not ahead of and not more than 2 secs behind the system time
|
|
470 |
TTime now;
|
|
471 |
now.UniversalTime();
|
|
472 |
TDateTime dt=now.DateTime();
|
|
473 |
TDateTime adt=iFunctions->SystemTime();
|
|
474 |
if (adt.Day()!=dt.Day())
|
|
475 |
User::Leave(KErrGeneral);
|
|
476 |
|
|
477 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
478 |
if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncNone)
|
|
479 |
User::Leave(KErrGeneral);
|
|
480 |
}
|
|
481 |
|
|
482 |
CPanicAnim::~CPanicAnim()
|
|
483 |
{
|
|
484 |
delete iActivePanicIdle;
|
|
485 |
}
|
|
486 |
|
|
487 |
void CPanicAnim::Animate(TDateTime *aDateTime)
|
|
488 |
{
|
|
489 |
switch(iSyncState)
|
|
490 |
{
|
|
491 |
case ESyncStateNull:
|
|
492 |
break;
|
|
493 |
case ESyncStateStarting:
|
|
494 |
iTime=iFunctions->SystemTime();
|
|
495 |
iSyncState=ESyncStateCounting;
|
|
496 |
iSyncCount=0;
|
|
497 |
break;
|
|
498 |
case ESyncStateCounting:
|
|
499 |
if (aDateTime)
|
|
500 |
{
|
|
501 |
TTimeIntervalSeconds interval;
|
|
502 |
TTime(*aDateTime).SecondsFrom(iTime, interval);
|
|
503 |
iSyncCount=interval.Int();
|
|
504 |
}
|
|
505 |
else
|
|
506 |
iSyncCount++;
|
|
507 |
if (iSyncCount==ESyncCount)
|
|
508 |
{
|
|
509 |
TTimeIntervalMicroSeconds minInterval(0);
|
|
510 |
TTimeIntervalMicroSeconds maxInterval(0);
|
|
511 |
iSyncState=ESyncStateNull;
|
|
512 |
switch(iSyncMode)
|
|
513 |
{
|
|
514 |
case MAnimGeneralFunctions::ESyncSecond:
|
|
515 |
minInterval=iSyncCount*1000000-100000;
|
|
516 |
maxInterval=iSyncCount*1000000+100000;
|
|
517 |
break;
|
|
518 |
default:;
|
|
519 |
}
|
|
520 |
TTime time(iFunctions->SystemTime());
|
|
521 |
TTimeIntervalMicroSeconds interval=time.MicroSecondsFrom(iTime);
|
|
522 |
TInt ret=KErrNone;
|
|
523 |
if (interval<minInterval || interval>maxInterval)
|
|
524 |
ret=KErrGeneral;
|
|
525 |
iFunctions->Client().RequestComplete(iStatusPtr,ret);
|
|
526 |
}
|
|
527 |
break;
|
|
528 |
case ESyncLeave:
|
|
529 |
User::Leave(KErrGeneral); // Test: Not allowed to leave, will cause a panic
|
|
530 |
break;
|
|
531 |
case ESyncStateTimeChange1:
|
|
532 |
if (!aDateTime)
|
|
533 |
{
|
|
534 |
iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
|
|
535 |
iSyncState=ESyncStateTimeChange2;
|
|
536 |
}
|
|
537 |
break;
|
|
538 |
case ESyncStateTimeChange2:
|
|
539 |
if (!aDateTime)
|
|
540 |
{
|
|
541 |
iSyncState=ESyncStateTimeChange3;
|
|
542 |
break;
|
|
543 |
}
|
|
544 |
case ESyncStateTimeChange3:
|
|
545 |
iFunctions->Client().RequestComplete(iStatusPtr2,aDateTime ? KErrNone : KErrGeneral);
|
|
546 |
iSyncState=ESyncStateNull;
|
|
547 |
break;
|
|
548 |
}
|
|
549 |
}
|
|
550 |
|
|
551 |
void CPanicAnim::Redraw()
|
|
552 |
{
|
|
553 |
if (iLeaveInRedraw)
|
|
554 |
User::Leave(KErrGeneral); //Test: Not allowed to leave, will cause a panic
|
|
555 |
}
|
|
556 |
|
|
557 |
void CPanicAnim::Command(TInt aOpcode, TAny *)
|
|
558 |
{
|
|
559 |
switch(aOpcode)
|
|
560 |
{
|
|
561 |
case EADllPanicCallPanic:
|
|
562 |
iFunctions->Panic();
|
|
563 |
break;
|
|
564 |
case EADllPanicSetInterval:
|
|
565 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
566 |
iFunctions->SetInterval(1);
|
|
567 |
break;
|
|
568 |
case EADllPanicSetNextInterval:
|
|
569 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
|
|
570 |
iFunctions->SetNextInterval(1);
|
|
571 |
break;
|
|
572 |
case EADllPanicDoubleActivateGC:
|
|
573 |
iWindowFunctions->ActivateGc();
|
|
574 |
iWindowFunctions->ActivateGc();
|
|
575 |
break;
|
|
576 |
case EADllPanicDrawRectWithNoGc:
|
|
577 |
iGc->DrawRect(TRect(0,0,10,10));
|
|
578 |
break;
|
|
579 |
case EADllPanicDrawTextWithNoFont:
|
|
580 |
iWindowFunctions->ActivateGc();
|
|
581 |
iGc->DrawText(_L("Panic"),TPoint(20,20));
|
|
582 |
break;
|
|
583 |
case EADllPanicLeaveInAnimate:
|
|
584 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
585 |
iSyncState=ESyncLeave;
|
|
586 |
break;
|
|
587 |
case EADllPanicLeaveInRedraw:
|
|
588 |
iLeaveInRedraw=ETrue;
|
|
589 |
iWindowFunctions->Invalidate(TRect(0,0,10,10));
|
|
590 |
break;
|
|
591 |
case EADllPanicLeave:
|
|
592 |
//tests a leaving function in a non-leaving function and should not be moved to CommandReplyL as it leaves
|
|
593 |
User::Leave(KErrGeneral); //LeaveScan: intentional test
|
|
594 |
break;
|
|
595 |
case EADllPanicSetVisWithGcActive:
|
|
596 |
iWindowFunctions->ActivateGc();
|
|
597 |
iWindowFunctions->SetVisible(EFalse);
|
|
598 |
iWindowFunctions->SetVisible(ETrue);
|
|
599 |
break;
|
|
600 |
case EADllPanicLeaveInActiveCallback:
|
|
601 |
iActivePanicIdle=CIdle::NewL(EPriorityHigh);
|
|
602 |
iActivePanicIdle->Start(TCallBack(CPanicAnim::LeaveInActiveCallback,this));
|
|
603 |
break;
|
|
604 |
case EADllPanicSetClippingRectWithNoGc:
|
|
605 |
{
|
|
606 |
// currently this test fails because when deactivated iWin is also NULL and is deferenced in function
|
|
607 |
TRect rect(20,20,20,20);
|
|
608 |
iGc->SetClippingRect(rect);
|
|
609 |
}
|
|
610 |
break;
|
|
611 |
case EADllPanicCancelClippingRegionWithNoGc:
|
|
612 |
// currently this test fails because when deactivated iWin is NULL and function leaves
|
|
613 |
iGc->CancelClippingRegion();
|
|
614 |
break;
|
|
615 |
case EADllPanicCancelClippingRectWithNoGc:
|
|
616 |
// currently this test fails because when deactivated iWin is also NULL and is deferenced in function
|
|
617 |
iGc->CancelClippingRect();
|
|
618 |
break;
|
|
619 |
case EADllPanicSetDrawModeWithNoGc:
|
|
620 |
iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
|
|
621 |
break;
|
|
622 |
case EADllPanicUseFontWithNoGc:
|
|
623 |
{
|
|
624 |
// currently this test fails because does not check for NULL font
|
|
625 |
CFbsFont* font = NULL;
|
|
626 |
iGc->UseFont(font);
|
|
627 |
}
|
|
628 |
break;
|
|
629 |
case EADllPanicDiscardFontWithNoGc:
|
|
630 |
iGc->DiscardFont();
|
|
631 |
break;
|
|
632 |
case EADllPanicSetUnderlineStyleWithNoGc:
|
|
633 |
iGc->SetUnderlineStyle(EUnderlineOff);
|
|
634 |
break;
|
|
635 |
case EADllPanicSetStrikeThoughStyleWithNoGc:
|
|
636 |
iGc->SetStrikethroughStyle(EStrikethroughOff);
|
|
637 |
break;
|
|
638 |
case EADllPanicSetWordJustificationWithNoGc:
|
|
639 |
iGc->SetWordJustification(0,0);
|
|
640 |
break;
|
|
641 |
case EADllPanicSetCharJustificationWithNoGc:
|
|
642 |
iGc->SetCharJustification(0,0);
|
|
643 |
break;
|
|
644 |
case EADllPanicSetPenColorWithNoGc:
|
|
645 |
{
|
|
646 |
TRgb rgbs;
|
|
647 |
iGc->SetPenColor(rgbs);
|
|
648 |
}
|
|
649 |
break;
|
|
650 |
case EADllPanicSetPenStyleWithNoGc:
|
|
651 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
652 |
break;
|
|
653 |
case EADllPanicSetPenSizeWithNoGc:
|
|
654 |
{
|
|
655 |
const TSize size;
|
|
656 |
iGc->SetPenSize(size);
|
|
657 |
}
|
|
658 |
break;
|
|
659 |
case EADllPanicSetBrushColorWithNoGc:
|
|
660 |
{
|
|
661 |
TRgb rgbs;
|
|
662 |
iGc->SetBrushColor(rgbs);
|
|
663 |
}
|
|
664 |
break;
|
|
665 |
case EADllPanicSetBrushStyleWithNoGc:
|
|
666 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
667 |
break;
|
|
668 |
case EADllPanicSetBrushOriginWithNoGc:
|
|
669 |
{
|
|
670 |
TPoint point;
|
|
671 |
iGc->SetBrushOrigin(point);
|
|
672 |
}
|
|
673 |
break;
|
|
674 |
case EADllPanicUseBrushPatterWithNoGc:
|
|
675 |
{
|
|
676 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
677 |
CleanupStack::PushL(bitmap);
|
|
678 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
679 |
iGc->UseBrushPattern(bitmap);
|
|
680 |
CleanupStack::PopAndDestroy(bitmap);
|
|
681 |
}
|
|
682 |
break;
|
|
683 |
case EADllPanicDiscardBrushPatternWithNoGc:
|
|
684 |
iGc->DiscardBrushPattern();
|
|
685 |
break;
|
|
686 |
case EADllPanicSetFadedWithNoGc:
|
|
687 |
iGc->SetFaded(EFalse);
|
|
688 |
break;
|
|
689 |
case EADllPanicSetFadingParametersWithNoGc:
|
|
690 |
iGc->SetFadingParameters(1,1);
|
|
691 |
break;
|
|
692 |
case EADllPanicDrawArcWithNoGc:
|
|
693 |
{
|
|
694 |
TRect rect;
|
|
695 |
iGc->DrawArc(rect,
|
|
696 |
TPoint(rect.Center().iX, rect.iTl.iY),
|
|
697 |
TPoint(rect.iBr.iX, rect.Center().iY));
|
|
698 |
}
|
|
699 |
break;
|
|
700 |
case EADllPanicDrawPieWithNoGc:
|
|
701 |
{
|
|
702 |
TRect rect;
|
|
703 |
iGc->DrawPie(rect, TPoint(rect.Center().iX, rect.iTl.iY), TPoint(rect.iBr.iX, rect.Center().iY));
|
|
704 |
}
|
|
705 |
break;
|
|
706 |
case EADllPanicDrawLineWithNoGc:
|
|
707 |
{
|
|
708 |
const TPoint point1;
|
|
709 |
const TPoint point2;
|
|
710 |
iGc->DrawLine(point1, point2);
|
|
711 |
}
|
|
712 |
break;
|
|
713 |
case EADllPanicDrawLineToWithNoGc:
|
|
714 |
{
|
|
715 |
const TPoint point;
|
|
716 |
iGc->DrawLineTo(point);
|
|
717 |
}
|
|
718 |
break;
|
|
719 |
case EADllPanicDrawLineByWithNoGc:
|
|
720 |
{
|
|
721 |
const TPoint point;
|
|
722 |
iGc->DrawLineBy(point);
|
|
723 |
}
|
|
724 |
break;
|
|
725 |
case EADllPanicDrawEllipseWithNoGc:
|
|
726 |
{
|
|
727 |
TRect rect(20,20,20,20);
|
|
728 |
iGc->DrawEllipse(rect);
|
|
729 |
}
|
|
730 |
break;
|
|
731 |
case EADllPanicDrawRoundedRecWithNoGc:
|
|
732 |
{
|
|
733 |
TRect rect;
|
|
734 |
iGc->DrawRoundRect(rect, TSize(rect.Width()/8, rect.Height()/8));
|
|
735 |
}
|
|
736 |
break;
|
|
737 |
case EADllPanicClearWithRectWithNoGc:
|
|
738 |
{
|
|
739 |
TRect rect(20,20,20,20);
|
|
740 |
iGc->Clear(rect);
|
|
741 |
}
|
|
742 |
break;
|
|
743 |
case EADllPanicClearWithNoGc:
|
|
744 |
iGc->Clear();
|
|
745 |
break;
|
|
746 |
case EADllPanicBitBltWithNoGc:
|
|
747 |
{
|
|
748 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
749 |
CleanupStack::PushL(bitmap);
|
|
750 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
751 |
iGc->BitBlt(TPoint(0, 0), bitmap);
|
|
752 |
CleanupStack::PopAndDestroy(bitmap);
|
|
753 |
}
|
|
754 |
break;
|
|
755 |
case EADllPanicBitBltWithRectWithNoGc:
|
|
756 |
{
|
|
757 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
758 |
TRect rect;
|
|
759 |
CleanupStack::PushL(bitmap);
|
|
760 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
761 |
iGc->BitBlt(TPoint(0, 0), bitmap, rect);
|
|
762 |
CleanupStack::PopAndDestroy(bitmap);
|
|
763 |
}
|
|
764 |
break;
|
|
765 |
case EADllPanicBitBltMaskedWithNoGc:
|
|
766 |
{
|
|
767 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
768 |
TRect rect;
|
|
769 |
CleanupStack::PushL(bitmap);
|
|
770 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
771 |
iGc->BitBltMasked(TPoint(0, 0), bitmap, rect, bitmap, EFalse);
|
|
772 |
CleanupStack::PopAndDestroy(bitmap);
|
|
773 |
}
|
|
774 |
break;
|
|
775 |
case EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc:
|
|
776 |
{
|
|
777 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
778 |
TRect rect;
|
|
779 |
CleanupStack::PushL(bitmap);
|
|
780 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
781 |
iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
|
|
782 |
CleanupStack::PopAndDestroy(bitmap);
|
|
783 |
}
|
|
784 |
break;
|
|
785 |
case EADllPanicDrawBitmapMaskedWsBitmapWithNoGc:
|
|
786 |
{
|
|
787 |
CWsBitmap* bitmap = NULL;
|
|
788 |
TRect rect;
|
|
789 |
iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
|
|
790 |
}
|
|
791 |
break;
|
|
792 |
case EADllPanicDrawBitmapPointWithNoGc:
|
|
793 |
{
|
|
794 |
CWsBitmap* bitmap = NULL;
|
|
795 |
TRect rect;
|
|
796 |
iGc->DrawBitmap(rect.iTl, bitmap);
|
|
797 |
}
|
|
798 |
break;
|
|
799 |
case EADllPanicDrawBitmapWithNoGc:
|
|
800 |
{
|
|
801 |
CWsBitmap* bitmap = NULL;
|
|
802 |
TRect rect;
|
|
803 |
iGc->DrawBitmap(rect, bitmap);
|
|
804 |
}
|
|
805 |
break;
|
|
806 |
case EADllPanicDrawBitmapRectWithNoGc:
|
|
807 |
{
|
|
808 |
CWsBitmap* bitmap = NULL;
|
|
809 |
TRect rect;
|
|
810 |
iGc->DrawBitmap(rect, bitmap, TRect(0, 0, 16, 16));
|
|
811 |
}
|
|
812 |
break;
|
|
813 |
case EADllPanicDrawPolyLinePointsWithNoGc:
|
|
814 |
{
|
|
815 |
TRect rect;
|
|
816 |
CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
|
|
817 |
CleanupStack::PushL(polyPoints);
|
|
818 |
polyPoints->AppendL(rect.iTl);
|
|
819 |
polyPoints->AppendL(rect.Center());
|
|
820 |
polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
|
|
821 |
iGc->DrawPolyLine(&polyPoints->At(0), 3);
|
|
822 |
CleanupStack::PopAndDestroy(polyPoints);
|
|
823 |
}
|
|
824 |
break;
|
|
825 |
case EADllPanicDrawPolyLineArrayWithNoGc:
|
|
826 |
{
|
|
827 |
TRect rect;
|
|
828 |
CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
|
|
829 |
CleanupStack::PushL(polyPoints);
|
|
830 |
polyPoints->AppendL(rect.iTl);
|
|
831 |
polyPoints->AppendL(rect.Center());
|
|
832 |
polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
|
|
833 |
iGc->DrawPolyLine(polyPoints);
|
|
834 |
CleanupStack::PopAndDestroy(polyPoints);
|
|
835 |
}
|
|
836 |
break;
|
|
837 |
case EADllPanicMoveToWithNoGc:
|
|
838 |
{
|
|
839 |
TPoint point;
|
|
840 |
iGc->MoveTo(point);
|
|
841 |
}
|
|
842 |
break;
|
|
843 |
case EADllPanicMoveByWithNoGc:
|
|
844 |
{
|
|
845 |
TPoint point;
|
|
846 |
iGc->MoveBy(point);
|
|
847 |
}
|
|
848 |
break;
|
|
849 |
case EADllPanicPlotWithNoGc:
|
|
850 |
{
|
|
851 |
TPoint point;
|
|
852 |
iGc->Plot(point);
|
|
853 |
}
|
|
854 |
break;
|
|
855 |
case EADllPanicSetOriginWithNoGc:
|
|
856 |
{
|
|
857 |
TPoint point;
|
|
858 |
iGc->SetOrigin(point);
|
|
859 |
}
|
|
860 |
break;
|
|
861 |
case EADllPanicCopyRectWithNoGc:
|
|
862 |
{
|
|
863 |
TPoint point;
|
|
864 |
TRect rect;
|
|
865 |
iGc->CopyRect(point, rect);
|
|
866 |
}
|
|
867 |
break;
|
|
868 |
case EADllPanicResetWithNoGc:
|
|
869 |
iGc->Reset();
|
|
870 |
break;
|
|
871 |
case EADllPanicMapColorsWithNoGc:
|
|
872 |
{
|
|
873 |
TRgb rgbs[2];
|
|
874 |
TRect rect;
|
|
875 |
iGc->MapColors(rect, rgbs, 1, ETrue);
|
|
876 |
}
|
|
877 |
break;
|
|
878 |
case EADllPanicDrawTextWithRectWithNoFont:
|
|
879 |
iWindowFunctions->ActivateGc();
|
|
880 |
iGc->DrawText(_L("Panic"),TRect(20,20,20,20),0);
|
|
881 |
break;
|
|
882 |
case EADllPanicDrawTextVerticalWithNoFont:
|
|
883 |
iWindowFunctions->ActivateGc();
|
|
884 |
iGc->DrawTextVertical(_L("Panic"),TPoint(20,20), EFalse);
|
|
885 |
break;
|
|
886 |
case EADllPanicDrawTextVerticalWithRectWithNoFont:
|
|
887 |
iWindowFunctions->ActivateGc();
|
|
888 |
iGc->DrawTextVertical(_L("Panic"),TRect(20,20,20,20), 0, EFalse);
|
|
889 |
break;
|
|
890 |
case EADllPanicInvalidFocusScreenTooBig:
|
|
891 |
(static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(3000);
|
|
892 |
break;
|
|
893 |
case EADllPanicInvalidFocusScreenNegative:
|
|
894 |
(static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(-1);
|
|
895 |
break;
|
|
896 |
default:
|
|
897 |
iFunctions->Panic();
|
|
898 |
}
|
|
899 |
}
|
|
900 |
|
|
901 |
void CPanicAnim::DoLeaveInActiveCallback()
|
|
902 |
{
|
|
903 |
iWindowFunctions->ActivateGc();
|
|
904 |
User::Leave(KErrUnknown);
|
|
905 |
}
|
|
906 |
|
|
907 |
TInt CPanicAnim::LeaveInActiveCallback(TAny *aThis)
|
|
908 |
{
|
|
909 |
CPanicAnim* panicAnim=(CPanicAnim*)aThis;
|
|
910 |
panicAnim->DoLeaveInActiveCallback();
|
|
911 |
return(KErrNone);
|
|
912 |
}
|
|
913 |
|
|
914 |
void CPanicAnim::StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync)
|
|
915 |
{
|
|
916 |
iFunctions->SetSync(aSync);
|
|
917 |
iSyncMode=aSync;
|
|
918 |
iSyncState=ESyncStateStarting;
|
|
919 |
}
|
|
920 |
|
|
921 |
void CPanicAnim::StartTimeChangeTest()
|
|
922 |
{
|
|
923 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
924 |
iSyncMode=MAnimGeneralFunctions::ESyncSecond;
|
|
925 |
iSyncState=ESyncStateTimeChange1;
|
|
926 |
}
|
|
927 |
|
|
928 |
TInt CPanicAnim::CommandReplyL(TInt aOpcode,TAny* aParams)
|
|
929 |
{
|
|
930 |
TAnimArgUnion pData;
|
|
931 |
pData.any=aParams;
|
|
932 |
switch(aOpcode)
|
|
933 |
{
|
|
934 |
case EADllPanicBadFont:
|
|
935 |
iFunctions->DuplicateFontL(123);
|
|
936 |
break;
|
|
937 |
case EADllPanicBadBitmap:
|
|
938 |
iFunctions->DuplicateBitmapL(123);
|
|
939 |
break;
|
|
940 |
case EADllPanicCallPanic:
|
|
941 |
iFunctions->Panic();
|
|
942 |
break;
|
|
943 |
case EADllReadRemoteDescriptor:
|
|
944 |
{
|
|
945 |
TInt ret=0;
|
|
946 |
const RMessagePtr2& message=*iFunctions->Message();
|
|
947 |
TInt bufLength = message.GetDesLength(KIpcSlot);
|
|
948 |
TUint16* heapCell=static_cast<TUint16*>(User::AllocL(bufLength*2));
|
|
949 |
TPtr buf(heapCell,bufLength*2,bufLength*2);
|
|
950 |
const TInt theError=message.Read(KIpcSlot,buf);
|
|
951 |
if(theError == KErrNone)
|
|
952 |
{
|
|
953 |
for (TInt index=0;index<bufLength;index++)
|
|
954 |
{
|
|
955 |
ret+=buf[index];
|
|
956 |
}
|
|
957 |
}
|
|
958 |
User::Free(heapCell);
|
|
959 |
return(ret);
|
|
960 |
}
|
|
961 |
case EADllTestWindowSize:
|
|
962 |
return(*pData.Size==iWindowFunctions->WindowSize());
|
|
963 |
case EADllSyncTests:
|
|
964 |
iStatusPtr=pData.SyncTests->status;
|
|
965 |
StartSyncTest(pData.SyncTests->syncMode);
|
|
966 |
break;
|
|
967 |
case EADllTimeChangedTest:
|
|
968 |
iStatusPtr=pData.TimeChangeTest->status;
|
|
969 |
iStatusPtr2=pData.TimeChangeTest->status2;
|
|
970 |
StartTimeChangeTest();
|
|
971 |
break;
|
|
972 |
case EADllTestSetVisible:
|
|
973 |
if (iWindowFunctions->IsHidden())
|
|
974 |
goto setVisFailed;
|
|
975 |
iWindowFunctions->SetVisible(EFalse);
|
|
976 |
if (!iWindowFunctions->IsHidden())
|
|
977 |
goto setVisFailed;
|
|
978 |
iWindowFunctions->SetVisible(ETrue);
|
|
979 |
if (iWindowFunctions->IsHidden())
|
|
980 |
setVisFailed: return(EFalse);
|
|
981 |
return(ETrue);
|
|
982 |
case EADllPanicSetVisWithGcActiveReply:
|
|
983 |
iWindowFunctions->ActivateGc();
|
|
984 |
iWindowFunctions->SetVisible(EFalse);
|
|
985 |
iWindowFunctions->SetVisible(ETrue);
|
|
986 |
break;
|
|
987 |
case EADllPanicSetClippingRegionWithNoGc:
|
|
988 |
{
|
|
989 |
// currently this test fails because when deactivated iWin is also NULL and is deferenced in function
|
|
990 |
RRegion region;
|
|
991 |
TBool err = iGc->SetClippingRegion(region);
|
|
992 |
}
|
|
993 |
break;
|
|
994 |
case EADllPanicDrawPolygonPointsWithNoGc:
|
|
995 |
{
|
|
996 |
TRect rect(20,20,20,20);
|
|
997 |
CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
|
|
998 |
CleanupStack::PushL(polyPoints);
|
|
999 |
polyPoints->AppendL(rect.iTl);
|
|
1000 |
polyPoints->AppendL(rect.Center());
|
|
1001 |
polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
|
|
1002 |
iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
|
|
1003 |
CleanupStack::PopAndDestroy(polyPoints);
|
|
1004 |
}
|
|
1005 |
break;
|
|
1006 |
case EADllPanicDrawPolygonArrayWithNoGc:
|
|
1007 |
{
|
|
1008 |
TRect rect(20,20,20,20);
|
|
1009 |
CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
|
|
1010 |
CleanupStack::PushL(polyPoints);
|
|
1011 |
polyPoints->AppendL(rect.iTl);
|
|
1012 |
polyPoints->AppendL(rect.Center());
|
|
1013 |
polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
|
|
1014 |
iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
|
|
1015 |
CleanupStack::PopAndDestroy(polyPoints);
|
|
1016 |
}
|
|
1017 |
break;
|
|
1018 |
case EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc:
|
|
1019 |
{
|
|
1020 |
TRect rect(20,20,20,20);
|
|
1021 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
1022 |
CleanupStack::PushL(bitmap);
|
|
1023 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
1024 |
iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, rect, bitmap, TPoint(0,0));
|
|
1025 |
CleanupStack::PopAndDestroy(bitmap);
|
|
1026 |
}
|
|
1027 |
break;
|
|
1028 |
case EADllPanicDevice:
|
|
1029 |
{
|
|
1030 |
CGraphicsDevice *device = iGc->Device();
|
|
1031 |
}
|
|
1032 |
break;
|
|
1033 |
default:
|
|
1034 |
iFunctions->Panic();
|
|
1035 |
}
|
|
1036 |
return(KErrNone);
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
void CPanicAnim::FocusChanged(TBool )
|
|
1040 |
{
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
TBool CPanicAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
1044 |
{
|
|
1045 |
return EFalse;
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
|
|
1049 |
// CPanicAnim2 simply panics in the construct //
|
|
1050 |
void CPanicAnim2::ConstructL(TAny *, TBool )
|
|
1051 |
{
|
|
1052 |
iFunctions->Panic();
|
|
1053 |
}
|
|
1054 |
|
|
1055 |
void CPanicAnim2::Animate(TDateTime *)
|
|
1056 |
{}
|
|
1057 |
|
|
1058 |
void CPanicAnim2::Redraw()
|
|
1059 |
{}
|
|
1060 |
|
|
1061 |
void CPanicAnim2::Command(TInt , TAny *)
|
|
1062 |
{}
|
|
1063 |
|
|
1064 |
TInt CPanicAnim2::CommandReplyL(TInt , TAny *)
|
|
1065 |
{return(0);}
|
|
1066 |
|
|
1067 |
void CPanicAnim2::FocusChanged(TBool )
|
|
1068 |
{}
|
|
1069 |
|
|
1070 |
TBool CPanicAnim2::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
1071 |
{
|
|
1072 |
return EFalse;
|
|
1073 |
}
|
|
1074 |
|
|
1075 |
|
|
1076 |
// CAutoAnim3 test drawing/redrawing //
|
|
1077 |
void CAutoAnim3::ConstructL(TAny *aParam, TBool )
|
|
1078 |
{
|
|
1079 |
iRect=*((TRect *)aParam);
|
|
1080 |
iWindowFunctions->SetRect(iRect);
|
|
1081 |
iMode=0;
|
|
1082 |
iWindowFunctions->Invalidate(iRect);
|
|
1083 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
void CAutoAnim3::Animate(TDateTime *)
|
|
1087 |
{
|
|
1088 |
iWindowFunctions->ActivateGc();
|
|
1089 |
if (iMode==1)
|
|
1090 |
{
|
|
1091 |
Draw(iRect);
|
|
1092 |
if (iRect.Width()>20 && iRect.Height()>20)
|
|
1093 |
iRect.Shrink(TSize(20,20));
|
|
1094 |
else
|
|
1095 |
iRect=iBaseRect;
|
|
1096 |
Draw(iRect);
|
|
1097 |
}
|
|
1098 |
else if (iMode==2)
|
|
1099 |
{
|
|
1100 |
Draw(iRect);
|
|
1101 |
iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
|
|
1102 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
1103 |
}
|
|
1104 |
else if (iMode==3)
|
|
1105 |
{
|
|
1106 |
// flip between two sizes
|
|
1107 |
if (iRect.iTl.iX == 10)
|
|
1108 |
iRect.SetRect(40,40,80,80);
|
|
1109 |
else
|
|
1110 |
iRect.SetRect(10,10,110,110);
|
|
1111 |
Draw(iRect);
|
|
1112 |
}
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
void CAutoAnim3::Draw(const TRect &aRect)
|
|
1116 |
{
|
|
1117 |
switch(iMode)
|
|
1118 |
{
|
|
1119 |
case 0:
|
|
1120 |
iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
|
|
1121 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1122 |
iGc->SetBrushColor(TRgb::Gray256(85));
|
|
1123 |
iGc->SetPenColor(TRgb::Gray256(170));
|
|
1124 |
iGc->DrawEllipse(aRect);
|
|
1125 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
1126 |
break;
|
|
1127 |
case 1: // Shrinking box
|
|
1128 |
iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
|
|
1129 |
iGc->SetPenColor(TRgb::Gray256(255));
|
|
1130 |
iGc->DrawRect(aRect);
|
|
1131 |
break;
|
|
1132 |
case 2:
|
|
1133 |
case 3:
|
|
1134 |
iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
|
|
1135 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1136 |
iGc->SetBrushColor(TRgb::Gray256(85));
|
|
1137 |
iGc->SetPenColor(TRgb::Gray256(170));
|
|
1138 |
iGc->DrawEllipse(aRect);
|
|
1139 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
1140 |
break;
|
|
1141 |
default:
|
|
1142 |
break;
|
|
1143 |
}
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
void CAutoAnim3::Redraw()
|
|
1147 |
{
|
|
1148 |
Draw(iRect);
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
void CAutoAnim3::Command(TInt aOpcode,TAny* aParam)
|
|
1152 |
{
|
|
1153 |
TAnimArgUnion pData;
|
|
1154 |
pData.any=aParam;
|
|
1155 |
switch(aOpcode)
|
|
1156 |
{
|
|
1157 |
case EADllSetRect:
|
|
1158 |
iWindowFunctions->ActivateGc();
|
|
1159 |
Draw(iRect);
|
|
1160 |
iRect=*pData.Rect;
|
|
1161 |
iWindowFunctions->SetRect(iRect);
|
|
1162 |
Draw(iRect);
|
|
1163 |
{ //Do more extensive testing
|
|
1164 |
TWindowInfo data;
|
|
1165 |
iWindowFunctions->Parameters(data);
|
|
1166 |
}
|
|
1167 |
break;
|
|
1168 |
case EADllStartAnimate:
|
|
1169 |
iWindowFunctions->ActivateGc();
|
|
1170 |
Draw(iRect);
|
|
1171 |
iMode=1;
|
|
1172 |
iBaseRect=*pData.Rect;
|
|
1173 |
iRect=iBaseRect;
|
|
1174 |
iWindowFunctions->SetRect(iRect);
|
|
1175 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
1176 |
Draw(iRect);
|
|
1177 |
break;
|
|
1178 |
case EADllCancelAnimate:
|
|
1179 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
1180 |
iWindowFunctions->ActivateGc();
|
|
1181 |
Draw(iRect);
|
|
1182 |
iMode=-1;
|
|
1183 |
break;
|
|
1184 |
case EADllSetVisible:
|
|
1185 |
iWindowFunctions->SetVisible(*pData.Bool);
|
|
1186 |
break;
|
|
1187 |
case EADllSetShadowDrawMode:
|
|
1188 |
iMode=2;
|
|
1189 |
break;
|
|
1190 |
case EADllDrawTestScreen:
|
|
1191 |
DrawTestScreenL(pData.DrawTestScreen); //Should move to CommandReplyL as it leaves
|
|
1192 |
break;
|
|
1193 |
case EADllSetMode:
|
|
1194 |
iMode = *pData.Int;
|
|
1195 |
break;
|
|
1196 |
}
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
TInt CAutoAnim3::CommandReplyL(TInt aOpcode, TAny *aParam)
|
|
1200 |
{
|
|
1201 |
TAnimArgUnion pData;
|
|
1202 |
pData.any = aParam;
|
|
1203 |
TInt ret=0;
|
|
1204 |
switch(aOpcode)
|
|
1205 |
{
|
|
1206 |
case EADllShadowAnimTest:
|
|
1207 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
1208 |
iStatusPtr=((TShadowDrawTest *)aParam)->status;
|
|
1209 |
break;
|
|
1210 |
case EADllParameterRectValueTest:
|
|
1211 |
{
|
|
1212 |
TWindowInfo wininf;
|
|
1213 |
iWindowFunctions->Parameters(wininf);
|
|
1214 |
TRect comp = *(pData.Rect);
|
|
1215 |
ret=(comp==wininf.iScreenPos);
|
|
1216 |
}
|
|
1217 |
break;
|
|
1218 |
case EADllDoSetSync:
|
|
1219 |
iFunctions->SetSync(static_cast<MAnimGeneralFunctions::TAnimSync>(*pData.Int));
|
|
1220 |
break;
|
|
1221 |
case EADllSetInterval:
|
|
1222 |
iFunctions->SetInterval(*pData.Int);
|
|
1223 |
break;
|
|
1224 |
}
|
|
1225 |
return(ret);
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
void CAutoAnim3::FocusChanged(TBool )
|
|
1229 |
{}
|
|
1230 |
|
|
1231 |
//void CAutoAnim3::DrawTestScreen(TDrawTestScreen *aParams)
|
|
1232 |
//Function now at bottom of file
|
|
1233 |
|
|
1234 |
TBool CAutoAnim3::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
1235 |
{
|
|
1236 |
return EFalse;
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
|
|
1240 |
// CAutoAnimScrBack test drawing/redrawing //
|
|
1241 |
void CAutoAnimScrBack::ConstructL(TAny *aParam, TBool )
|
|
1242 |
{
|
|
1243 |
iRect=*((TRect *)aParam);
|
|
1244 |
iWindowFunctions->SetRect(iRect);
|
|
1245 |
iMode=1;
|
|
1246 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
void CAutoAnimScrBack::Animate(TDateTime *)
|
|
1250 |
{
|
|
1251 |
iWindowFunctions->ActivateGc();
|
|
1252 |
Draw();
|
|
1253 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
1254 |
}
|
|
1255 |
|
|
1256 |
void CAutoAnimScrBack::Draw()
|
|
1257 |
{
|
|
1258 |
iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
|
|
1259 |
if (iMode==2)
|
|
1260 |
iGc->SetPenSize(TSize(3,3));
|
|
1261 |
iGc->SetPenColor(TRgb::Gray4(iMode==1 ? 2 : 3));
|
|
1262 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1263 |
iGc->SetBrushColor(TRgb::Gray4(iMode==1 ? 1 : 0));
|
|
1264 |
iGc->DrawRect(iRect);
|
|
1265 |
}
|
|
1266 |
|
|
1267 |
void CAutoAnimScrBack::Redraw()
|
|
1268 |
{
|
|
1269 |
Draw();
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
void CAutoAnimScrBack::Command(TInt aOpcode,TAny* aParam)
|
|
1273 |
{
|
|
1274 |
TAnimArgUnion pData;
|
|
1275 |
pData.any=aParam;
|
|
1276 |
switch(aOpcode)
|
|
1277 |
{
|
|
1278 |
case EADllDrawOtherRect:
|
|
1279 |
{
|
|
1280 |
TRect oldRect(iRect);
|
|
1281 |
if (iMode==2)
|
|
1282 |
oldRect.Grow(1,1); // To allow for 3x3 pen size
|
|
1283 |
iMode=2;
|
|
1284 |
iRect=*pData.Rect;
|
|
1285 |
TRect fullRect(iRect);
|
|
1286 |
fullRect.Grow(1,1); // To allow for 3x3 pen size
|
|
1287 |
iWindowFunctions->Invalidate(oldRect);
|
|
1288 |
iWindowFunctions->SetRect(fullRect);
|
|
1289 |
iWindowFunctions->Invalidate(fullRect);
|
|
1290 |
}
|
|
1291 |
// iFunctions->ActivateGc();
|
|
1292 |
// Draw();
|
|
1293 |
break;
|
|
1294 |
}
|
|
1295 |
}
|
|
1296 |
|
|
1297 |
TInt CAutoAnimScrBack::CommandReplyL(TInt aOpcode, TAny *)
|
|
1298 |
{
|
|
1299 |
switch(aOpcode)
|
|
1300 |
{
|
|
1301 |
case EADllIsHidden:
|
|
1302 |
return iWindowFunctions->IsHidden();
|
|
1303 |
}
|
|
1304 |
return(0);
|
|
1305 |
}
|
|
1306 |
|
|
1307 |
void CAutoAnimScrBack::FocusChanged(TBool )
|
|
1308 |
{}
|
|
1309 |
|
|
1310 |
TBool CAutoAnimScrBack::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
1311 |
{
|
|
1312 |
return EFalse;
|
|
1313 |
}
|
|
1314 |
|
|
1315 |
|
|
1316 |
// CTestSpriteAnim test sprite access //
|
|
1317 |
void CTestSpriteAnim::ConstructL(TAny* /*aParam*/)
|
|
1318 |
{
|
|
1319 |
iSpriteFunctions->SizeChangedL();
|
|
1320 |
iSpriteFunctions->Activate(ETrue);
|
|
1321 |
}
|
|
1322 |
|
|
1323 |
void CTestSpriteAnim::Animate(TDateTime*)
|
|
1324 |
{
|
|
1325 |
}
|
|
1326 |
|
|
1327 |
void CTestSpriteAnim::Command(TInt aOpcode,TAny* aParam)
|
|
1328 |
{
|
|
1329 |
TAnimArgUnion pData;
|
|
1330 |
pData.any=aParam;
|
|
1331 |
switch (aOpcode)
|
|
1332 |
{
|
|
1333 |
case EADllSizeChanged:
|
|
1334 |
iSpriteFunctions->Activate(EFalse);
|
|
1335 |
iSpriteFunctions->SizeChangedL(); //Should move to CommandReplyL as it leaves
|
|
1336 |
case EADllActivate:
|
|
1337 |
iSpriteFunctions->Activate(ETrue);
|
|
1338 |
break;
|
|
1339 |
case EADllDeactivate:
|
|
1340 |
iSpriteFunctions->Activate(EFalse);
|
|
1341 |
break;
|
|
1342 |
case EADllSetPos:
|
|
1343 |
iSpriteFunctions->SetPosition(*pData.Point);
|
|
1344 |
break;
|
|
1345 |
case EADllDraw1:
|
|
1346 |
case EADllDraw2:
|
|
1347 |
case EADllDraw3:
|
|
1348 |
DrawMemberL(aOpcode-EADllDraw1); //Should move to CommandReplyL as it leaves
|
|
1349 |
break;
|
|
1350 |
case EADllIncDraw:
|
|
1351 |
DrawMemberL(); //Should move to CommandReplyL as it leaves
|
|
1352 |
break;
|
|
1353 |
default:;
|
|
1354 |
}
|
|
1355 |
}
|
|
1356 |
|
|
1357 |
TInt CTestSpriteAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
1358 |
{
|
|
1359 |
TAnimArgUnion pData;
|
|
1360 |
pData.any=aParam;
|
|
1361 |
switch (aOpcode)
|
|
1362 |
{
|
|
1363 |
case EADllCheckMember:
|
|
1364 |
return CheckMember(*pData.SpriteMemberInfo);
|
|
1365 |
default:;
|
|
1366 |
}
|
|
1367 |
return(KErrNone);
|
|
1368 |
}
|
|
1369 |
|
|
1370 |
TBool CTestSpriteAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
1371 |
{
|
|
1372 |
return EFalse;
|
|
1373 |
}
|
|
1374 |
|
|
1375 |
TBool CTestSpriteAnim::CheckMember(const TSpriteMemberInfo& aMemInfo)
|
|
1376 |
{
|
|
1377 |
TSpriteMember spriteMember=*iSpriteFunctions->GetSpriteMember(aMemInfo.iMember);
|
|
1378 |
if (spriteMember.iBitmap->Handle()!=aMemInfo.iBitmapHandle)
|
|
1379 |
return EFalse;
|
|
1380 |
if (aMemInfo.iMaskBitmapHandle==0)
|
|
1381 |
{
|
|
1382 |
if (spriteMember.iMaskBitmap!=NULL)
|
|
1383 |
return EFalse;
|
|
1384 |
}
|
|
1385 |
else
|
|
1386 |
{
|
|
1387 |
if (spriteMember.iMaskBitmap->Handle()!=aMemInfo.iMaskBitmapHandle)
|
|
1388 |
return EFalse;
|
|
1389 |
}
|
|
1390 |
if (spriteMember.iInvertMask!=aMemInfo.iInvertMask)
|
|
1391 |
return EFalse;
|
|
1392 |
if (spriteMember.iDrawMode!=aMemInfo.iDrawMode)
|
|
1393 |
return EFalse;
|
|
1394 |
if (spriteMember.iOffset!=aMemInfo.iOffset)
|
|
1395 |
return EFalse;
|
|
1396 |
if (spriteMember.iInterval!=aMemInfo.iInterval)
|
|
1397 |
return EFalse;
|
|
1398 |
return ETrue;
|
|
1399 |
}
|
|
1400 |
|
|
1401 |
void CTestSpriteAnim::DrawMemberL(TInt aMember)
|
|
1402 |
{
|
|
1403 |
CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(aMember)->iBitmap;
|
|
1404 |
CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
|
|
1405 |
CleanupStack::PushL(device);
|
|
1406 |
CFbsBitGc *gc;
|
|
1407 |
User::LeaveIfError(device->CreateContext(gc));
|
|
1408 |
CleanupStack::PushL(gc);
|
|
1409 |
//gc->SetBrushColor(TRgb::Gray4((aMember+1)%3));
|
|
1410 |
gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1411 |
gc->SetPenSize(TSize());
|
|
1412 |
TSize size=bitmap->SizeInPixels();
|
|
1413 |
size.SetSize(size.iWidth/2,size.iHeight/2);
|
|
1414 |
TPoint point=size.AsPoint();
|
|
1415 |
gc->SetBrushColor(TRgb::Gray4(0));
|
|
1416 |
//TRect rect=bitmap->SizeInPixels();
|
|
1417 |
gc->DrawRect(TRect(TPoint(),size));
|
|
1418 |
gc->SetBrushColor(TRgb::Gray4(1));
|
|
1419 |
gc->DrawRect(TRect(TPoint(point.iX,0),size));
|
|
1420 |
gc->SetBrushColor(TRgb::Gray4(2));
|
|
1421 |
gc->DrawRect(TRect(TPoint(0,point.iY),size));
|
|
1422 |
gc->SetBrushColor(TRgb::Gray4(3));
|
|
1423 |
gc->DrawRect(TRect(point,size));
|
|
1424 |
iSpriteFunctions->UpdateMember(aMember,TRect(bitmap->SizeInPixels()),ETrue);
|
|
1425 |
CleanupStack::PopAndDestroy(2);
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
void CTestSpriteAnim::DrawMemberL()
|
|
1429 |
{
|
|
1430 |
CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(0)->iBitmap;
|
|
1431 |
CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
|
|
1432 |
CleanupStack::PushL(device);
|
|
1433 |
CFbsBitGc *gc;
|
|
1434 |
User::LeaveIfError(device->CreateContext(gc));
|
|
1435 |
CleanupStack::PushL(gc);
|
|
1436 |
gc->SetPenSize(TSize(3,3));
|
|
1437 |
gc->SetPenColor(TRgb::Gray4(1));
|
|
1438 |
TPoint corner=bitmap->SizeInPixels().AsPoint();
|
|
1439 |
gc->DrawLine(TPoint(),corner);
|
|
1440 |
gc->DrawLine(TPoint(0,corner.iY),TPoint(corner.iX,0));
|
|
1441 |
iSpriteFunctions->UpdateMember(0,TRect(bitmap->SizeInPixels()),EFalse);
|
|
1442 |
CleanupStack::PopAndDestroy(2);
|
|
1443 |
}
|
|
1444 |
|
|
1445 |
|
|
1446 |
// CTestFreeTimerAnim test drawing off own timer //
|
|
1447 |
CTestFreeTimerAnim::~CTestFreeTimerAnim()
|
|
1448 |
{
|
|
1449 |
iTimer->Cancel();
|
|
1450 |
delete iTimer;
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
void CTestFreeTimerAnim::ConstructL(TAny* /*aParam*/, TBool )
|
|
1454 |
{
|
|
1455 |
User::LeaveIfNull(iFunctions);
|
|
1456 |
User::LeaveIfNull(iWindowFunctions);
|
|
1457 |
|
|
1458 |
//Configure free-timer anim (these values should be the default ones)
|
|
1459 |
iFunctions->SetSync( MAnimGeneralFunctions::ESyncNone );
|
|
1460 |
iFunctions->SetInterval(0);
|
|
1461 |
|
|
1462 |
iFrameTime = 100000; //default frametime 0.1s
|
|
1463 |
iTimer = CAnimTimer::NewL(*this);
|
|
1464 |
iRect = iWindowFunctions->WindowSize();
|
|
1465 |
}
|
|
1466 |
|
|
1467 |
#define MAX(a,b) (((a)>(b))?(a):(b))
|
|
1468 |
|
|
1469 |
void CTestFreeTimerAnim::Animate(TDateTime*)
|
|
1470 |
{
|
|
1471 |
TInt max = MAX(iRect.Width(), iRect.Height());
|
|
1472 |
if(max <= 0)
|
|
1473 |
{
|
|
1474 |
iRect = iWindowFunctions->WindowSize();
|
|
1475 |
}
|
|
1476 |
else
|
|
1477 |
{
|
|
1478 |
iRect.Shrink(1,1);
|
|
1479 |
}
|
|
1480 |
|
|
1481 |
//change colour
|
|
1482 |
switch(iColour.Value())
|
|
1483 |
{
|
|
1484 |
case 0x000000: //black
|
|
1485 |
case 0xffffff: //white
|
|
1486 |
iColour = KRgbRed;
|
|
1487 |
break;
|
|
1488 |
case 0x0000ff: //red
|
|
1489 |
iColour = KRgbGreen;
|
|
1490 |
break;
|
|
1491 |
case 0x00ff00: //green
|
|
1492 |
iColour = KRgbBlue;
|
|
1493 |
break;
|
|
1494 |
case 0xff0000: //blue
|
|
1495 |
iColour = KRgbBlack;
|
|
1496 |
break;
|
|
1497 |
}
|
|
1498 |
}
|
|
1499 |
|
|
1500 |
void CTestFreeTimerAnim::Redraw()
|
|
1501 |
{
|
|
1502 |
//draw something in the animated colour
|
|
1503 |
iGc->SetBrushColor(iColour);
|
|
1504 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1505 |
iGc->SetPenColor(KRgbBlack);
|
|
1506 |
iGc->DrawRect(iRect);
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
void CTestFreeTimerAnim::Command(TInt aOpcode, TAny* aArgs)
|
|
1510 |
{
|
|
1511 |
switch(aOpcode)
|
|
1512 |
{
|
|
1513 |
case EStartAnimation:
|
|
1514 |
DisplayNextFrameL();
|
|
1515 |
break;
|
|
1516 |
case EStopAnimation:
|
|
1517 |
iTimer->Cancel();
|
|
1518 |
break;
|
|
1519 |
case ESetFrameTime:
|
|
1520 |
ASSERT(aArgs);
|
|
1521 |
iFrameTime = *reinterpret_cast<TInt*>(aArgs);
|
|
1522 |
break;
|
|
1523 |
default:
|
|
1524 |
ASSERT(0);
|
|
1525 |
}
|
|
1526 |
}
|
|
1527 |
|
|
1528 |
TInt CTestFreeTimerAnim::CommandReplyL(TInt aOpcode, TAny* aArgs)
|
|
1529 |
{
|
|
1530 |
switch(aOpcode)
|
|
1531 |
{
|
|
1532 |
case EStartAnimation:
|
|
1533 |
DisplayNextFrameL();
|
|
1534 |
break;
|
|
1535 |
case EStopAnimation:
|
|
1536 |
iTimer->Cancel();
|
|
1537 |
break;
|
|
1538 |
case ESetFrameTime:
|
|
1539 |
ASSERT(aArgs);
|
|
1540 |
iFrameTime = *reinterpret_cast<TInt*>(aArgs);
|
|
1541 |
break;
|
|
1542 |
default:
|
|
1543 |
ASSERT(0);
|
|
1544 |
}
|
|
1545 |
return(KErrNone);
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
void CTestFreeTimerAnim::FocusChanged(TBool /*aState*/)
|
|
1549 |
{
|
|
1550 |
}
|
|
1551 |
|
|
1552 |
TBool CTestFreeTimerAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
1553 |
{
|
|
1554 |
return EFalse;
|
|
1555 |
}
|
|
1556 |
|
|
1557 |
|
|
1558 |
void CTestFreeTimerAnim::DisplayNextFrameL()
|
|
1559 |
{
|
|
1560 |
//Reschedule timer callback
|
|
1561 |
iTimer->Cancel();
|
|
1562 |
iTimer->After(iFrameTime);
|
|
1563 |
|
|
1564 |
Animate(NULL); //wserv don't animate free-timer animations
|
|
1565 |
|
|
1566 |
//Schedule wserv redraw
|
|
1567 |
MAnimFreeTimerWindowFunctions* windowFunctions = WindowFunctions();
|
|
1568 |
ASSERT(windowFunctions);
|
|
1569 |
windowFunctions->ActivateGc();
|
|
1570 |
windowFunctions->DeactivateGc();
|
|
1571 |
windowFunctions->Update();
|
|
1572 |
}
|
|
1573 |
|
|
1574 |
//
|
|
1575 |
// CAnimTimer class
|
|
1576 |
//
|
|
1577 |
|
|
1578 |
/**
|
|
1579 |
Constructs a new bitmap animation timer object,and adds the specified active object to the current active scheduler.
|
|
1580 |
|
|
1581 |
@param aObserver a pointer to MAnimTimerObserver
|
|
1582 |
*/
|
|
1583 |
CAnimTimer::CAnimTimer(MAnimTimerObserver& aObserver)
|
|
1584 |
:CTimer(EPriorityStandard),
|
|
1585 |
iAnim(aObserver)
|
|
1586 |
{
|
|
1587 |
CActiveScheduler::Add(this);
|
|
1588 |
}
|
|
1589 |
|
|
1590 |
/**
|
|
1591 |
Frees resources owned by the object prior to deletion.
|
|
1592 |
*/
|
|
1593 |
CAnimTimer::~CAnimTimer()
|
|
1594 |
{
|
|
1595 |
}
|
|
1596 |
|
|
1597 |
/**
|
|
1598 |
Creates a new bitmap animation timer object.
|
|
1599 |
|
|
1600 |
@param aObserver A pointer to the MAnimTimerObserver
|
|
1601 |
@return A pointer to the new bitmap animation timer object.
|
|
1602 |
*/
|
|
1603 |
CAnimTimer* CAnimTimer::NewL(MAnimTimerObserver& aObserver)
|
|
1604 |
{
|
|
1605 |
CAnimTimer* timer=new(ELeave) CAnimTimer(aObserver);
|
|
1606 |
CleanupStack::PushL(timer);
|
|
1607 |
timer->ConstructL();
|
|
1608 |
CleanupStack::Pop();
|
|
1609 |
return timer;
|
|
1610 |
}
|
|
1611 |
|
|
1612 |
/**
|
|
1613 |
Completes construction of the bitmap animation timer object and
|
|
1614 |
constructs a new asynchronous timer.
|
|
1615 |
*/
|
|
1616 |
void CAnimTimer::ConstructL()
|
|
1617 |
{
|
|
1618 |
CTimer::ConstructL();
|
|
1619 |
}
|
|
1620 |
|
|
1621 |
/**
|
|
1622 |
Handles an active object's request completion event.
|
|
1623 |
Invokes the function to draw the next frame
|
|
1624 |
*/
|
|
1625 |
void CAnimTimer::RunL()
|
|
1626 |
{
|
|
1627 |
iAnim.DisplayNextFrameL();
|
|
1628 |
}
|
|
1629 |
|
|
1630 |
// CEventTestAnimBase base class for event test anims //
|
|
1631 |
CEventTestAnimBase::~CEventTestAnimBase()
|
|
1632 |
{
|
|
1633 |
iFunctions->GetRawEvents(EFalse);
|
|
1634 |
}
|
|
1635 |
|
|
1636 |
void CEventTestAnimBase::ConstructL(TAny* /*aParam*/, TBool )
|
|
1637 |
{
|
|
1638 |
iExpectedEvents.SetLengthL(EEventBufferSize);
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
void CEventTestAnimBase::Animate(TDateTime*)
|
|
1642 |
{
|
|
1643 |
}
|
|
1644 |
|
|
1645 |
void CEventTestAnimBase::Redraw()
|
|
1646 |
{
|
|
1647 |
}
|
|
1648 |
|
|
1649 |
void CEventTestAnimBase::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
|
|
1650 |
{
|
|
1651 |
/*switch (aOpcode)
|
|
1652 |
{
|
|
1653 |
default:;
|
|
1654 |
}*/
|
|
1655 |
}
|
|
1656 |
|
|
1657 |
void CEventTestAnimBase::FocusChanged(TBool /*aState*/)
|
|
1658 |
{
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
// Base class common client server interface
|
|
1662 |
TInt CEventTestAnimBase::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
1663 |
{
|
|
1664 |
TAnimArgUnion pData;
|
|
1665 |
pData.any=aParam;
|
|
1666 |
switch (aOpcode)
|
|
1667 |
{
|
|
1668 |
case EADllAddExpectedEvent:
|
|
1669 |
return AddExpectedEvent(pData.AnimRawEvent);
|
|
1670 |
case EADllNumberOfEventsReceived:
|
|
1671 |
return iEventCount;
|
|
1672 |
case EADllErrorCode:
|
|
1673 |
return iError;
|
|
1674 |
case EADllReset:
|
|
1675 |
iExpectedEvents.Reset();
|
|
1676 |
iError = 0;
|
|
1677 |
iEventCount = 0;
|
|
1678 |
return KErrNone;
|
|
1679 |
default:;
|
|
1680 |
}
|
|
1681 |
return(KErrNone);
|
|
1682 |
}
|
|
1683 |
|
|
1684 |
TBool CEventTestAnimBase::HandleRecursiveEvent(const TRawEvent& aRawEvent)
|
|
1685 |
{
|
|
1686 |
if (aRawEvent.ScanCode() == 60)
|
|
1687 |
{
|
|
1688 |
TRawEvent rawEvent;
|
|
1689 |
rawEvent.Set(TRawEvent::EKeyUp, 34);
|
|
1690 |
iFunctions->PostRawEvent(rawEvent);
|
|
1691 |
rawEvent.Set(TRawEvent::EKeyUp, 35);
|
|
1692 |
iFunctions->PostRawEvent(rawEvent);
|
|
1693 |
return ETrue;
|
|
1694 |
}
|
|
1695 |
return EFalse;
|
|
1696 |
}
|
|
1697 |
|
|
1698 |
TBool CEventTestAnimBase::OfferRawEvent(const TRawEvent& aRawEvent)
|
|
1699 |
{
|
|
1700 |
// Do not consume the following types of events
|
|
1701 |
if (IsIgnorableEvent(aRawEvent))
|
|
1702 |
{
|
|
1703 |
return EFalse;
|
|
1704 |
}
|
|
1705 |
|
|
1706 |
// Increment event count if not in an error state
|
|
1707 |
if (!Error())
|
|
1708 |
{
|
|
1709 |
iEventCount++;
|
|
1710 |
}
|
|
1711 |
|
|
1712 |
// For anim which generates recursive events
|
|
1713 |
if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 60)
|
|
1714 |
{
|
|
1715 |
return HandleRecursiveEvent(aRawEvent);
|
|
1716 |
}
|
|
1717 |
|
|
1718 |
TAnimRawEvent event;
|
|
1719 |
|
|
1720 |
if (!GetNextExpectedEvent(event))
|
|
1721 |
{
|
|
1722 |
Fail();
|
|
1723 |
return EFalse;
|
|
1724 |
}
|
|
1725 |
|
|
1726 |
// Fail if wrong event type
|
|
1727 |
if (!CompareEvents(event.iRawEvent, aRawEvent))
|
|
1728 |
{
|
|
1729 |
Fail();
|
|
1730 |
}
|
|
1731 |
|
|
1732 |
return event.iEat;
|
|
1733 |
}
|
|
1734 |
|
|
1735 |
TBool CEventTestAnimBase::GetNextExpectedEvent(TAnimRawEvent& aRawEvent)
|
|
1736 |
{
|
|
1737 |
// Get next expected event
|
|
1738 |
if (iExpectedEvents.Remove(&aRawEvent)<1)
|
|
1739 |
{
|
|
1740 |
Fail();
|
|
1741 |
return EFalse;
|
|
1742 |
}
|
|
1743 |
else
|
|
1744 |
{
|
|
1745 |
return ETrue;
|
|
1746 |
}
|
|
1747 |
}
|
|
1748 |
|
|
1749 |
TBool CEventTestAnimBase::IsIgnorableEvent(const TRawEvent& aRawEvent) const
|
|
1750 |
{
|
|
1751 |
TRawEvent::TType aType=aRawEvent.Type();
|
|
1752 |
TBool result = (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
|
|
1753 |
|| (iExpectedEvents.Count()==0 && aType==TRawEvent::EPointerMove));
|
|
1754 |
|
|
1755 |
return result;
|
|
1756 |
}
|
|
1757 |
|
|
1758 |
TBool CEventTestAnimBase::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const
|
|
1759 |
{
|
|
1760 |
TRawEvent::TType eType=aExpectedEvent.Type();
|
|
1761 |
TRawEvent::TType aType=aActualEvent.Type();
|
|
1762 |
if (eType!=aType)
|
|
1763 |
{
|
|
1764 |
return EFalse;
|
|
1765 |
}
|
|
1766 |
else
|
|
1767 |
{
|
|
1768 |
switch (aType)
|
|
1769 |
{
|
|
1770 |
case TRawEvent::EUpdateModifiers:
|
|
1771 |
{
|
|
1772 |
TInt eMod=aExpectedEvent.Modifiers(),aMod=aActualEvent.Modifiers();
|
|
1773 |
if (eMod!=aMod)
|
|
1774 |
{
|
|
1775 |
return EFalse;
|
|
1776 |
}
|
|
1777 |
break;
|
|
1778 |
}
|
|
1779 |
case TRawEvent::EKeyDown:
|
|
1780 |
case TRawEvent::EKeyUp:
|
|
1781 |
{
|
|
1782 |
TInt eScan=aExpectedEvent.ScanCode(),aScan=aActualEvent.ScanCode();
|
|
1783 |
if (eScan!=aScan)
|
|
1784 |
{
|
|
1785 |
return EFalse;
|
|
1786 |
}
|
|
1787 |
break;
|
|
1788 |
}
|
|
1789 |
case TRawEvent::EPointerMove:
|
|
1790 |
case TRawEvent::EPointerSwitchOn:
|
|
1791 |
case TRawEvent::EButton1Down:
|
|
1792 |
case TRawEvent::EButton1Up:
|
|
1793 |
case TRawEvent::EButton2Down:
|
|
1794 |
case TRawEvent::EButton2Up:
|
|
1795 |
case TRawEvent::EButton3Down:
|
|
1796 |
case TRawEvent::EButton3Up:
|
|
1797 |
{
|
|
1798 |
TPoint ePoint=aExpectedEvent.Pos(),aPoint=aActualEvent.Pos();
|
|
1799 |
if (ePoint!=aPoint)
|
|
1800 |
{
|
|
1801 |
return EFalse;
|
|
1802 |
}
|
|
1803 |
break;
|
|
1804 |
}
|
|
1805 |
default:;
|
|
1806 |
}
|
|
1807 |
}
|
|
1808 |
return ETrue;
|
|
1809 |
}
|
|
1810 |
|
|
1811 |
void CEventTestAnimBase::Fail()
|
|
1812 |
{
|
|
1813 |
if (iError==0)
|
|
1814 |
{
|
|
1815 |
iError=iEventCount;
|
|
1816 |
}
|
|
1817 |
}
|
|
1818 |
|
|
1819 |
inline TInt CEventTestAnimBase::Error() const
|
|
1820 |
{
|
|
1821 |
return iError;
|
|
1822 |
}
|
|
1823 |
|
|
1824 |
inline TInt CEventTestAnimBase::EventCount() const
|
|
1825 |
{
|
|
1826 |
return iEventCount;
|
|
1827 |
}
|
|
1828 |
|
|
1829 |
inline void CEventTestAnimBase::ResetEventCount()
|
|
1830 |
{
|
|
1831 |
iEventCount = 0;
|
|
1832 |
}
|
|
1833 |
|
|
1834 |
inline TInt CEventTestAnimBase::TotalExpectedEvents() const
|
|
1835 |
{
|
|
1836 |
return iExpectedEvents.Count();
|
|
1837 |
}
|
|
1838 |
|
|
1839 |
inline TInt CEventTestAnimBase::AddEvent(const TAnimRawEvent* aEvent)
|
|
1840 |
{
|
|
1841 |
return iExpectedEvents.Add(aEvent);
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
// CEventTestAnim test drawing off own timer //
|
|
1845 |
CEventTestAnim::~CEventTestAnim()
|
|
1846 |
{
|
|
1847 |
UnloadDeviceDriver();
|
|
1848 |
}
|
|
1849 |
|
|
1850 |
void CEventTestAnim::ConstructL(TAny* aParam, TBool aBool)
|
|
1851 |
{
|
|
1852 |
CEventTestAnimBase::ConstructL(aParam, aBool);
|
|
1853 |
iFunctions->GetRawEvents(ETrue);
|
|
1854 |
iDevDriverLoaded=EFalse;
|
|
1855 |
}
|
|
1856 |
|
|
1857 |
TInt CEventTestAnim::UnloadDeviceDriver()
|
|
1858 |
{
|
|
1859 |
TInt err=KErrNone;
|
|
1860 |
iLdd.Close();
|
|
1861 |
if (iDevDriverLoaded)
|
|
1862 |
{
|
|
1863 |
err=User::FreeLogicalDevice(REventDD::BinaryName());
|
|
1864 |
if (err==KErrNone)
|
|
1865 |
iDevDriverLoaded=EFalse;
|
|
1866 |
}
|
|
1867 |
return err;
|
|
1868 |
}
|
|
1869 |
|
|
1870 |
TInt CEventTestAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
|
|
1871 |
{
|
|
1872 |
return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
|
|
1873 |
}
|
|
1874 |
|
|
1875 |
TInt CEventTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
1876 |
{
|
|
1877 |
switch (aOpcode)
|
|
1878 |
{
|
|
1879 |
case EADllNoEventsAndReset:
|
|
1880 |
{
|
|
1881 |
TInt events=EventCount();
|
|
1882 |
ResetEventCount();
|
|
1883 |
return events;
|
|
1884 |
}
|
|
1885 |
case EADllLoadDeviceDriver:
|
|
1886 |
{
|
|
1887 |
TInt err=User::LoadLogicalDevice(REventDD::BinaryName());
|
|
1888 |
if (err==KErrNone || err==KErrAlreadyExists)
|
|
1889 |
{
|
|
1890 |
TInt err2=iLdd.Open();
|
|
1891 |
if (err==KErrNone)
|
|
1892 |
{
|
|
1893 |
if (err2==KErrNone)
|
|
1894 |
iDevDriverLoaded=ETrue;
|
|
1895 |
else //Only unload if we loaded it
|
|
1896 |
User::FreeLogicalDevice(REventDD::BinaryName());
|
|
1897 |
}
|
|
1898 |
err=err2;
|
|
1899 |
}
|
|
1900 |
return err;
|
|
1901 |
}
|
|
1902 |
case EADllUnloadDeviceDriver:
|
|
1903 |
return UnloadDeviceDriver();
|
|
1904 |
case EADllSendEvent:
|
|
1905 |
{
|
|
1906 |
TAnimRawEvent event;
|
|
1907 |
TInt events=*static_cast<TInt*>(aParam);
|
|
1908 |
TInt err=KErrNone;
|
|
1909 |
TInt ii;
|
|
1910 |
for (ii=events;ii>0;--ii)
|
|
1911 |
{
|
|
1912 |
event.iRawEvent.Set(ii/2==0 ? TRawEvent::ECaseOpen : TRawEvent::ECaseClose);
|
|
1913 |
//TInt err=UserSvr::AddEvent(event.iRawEvent);
|
|
1914 |
//Need to do the above line here, but don't have enough capability
|
|
1915 |
//so call a device driver to do it instead
|
|
1916 |
err=iLdd.SendEvent(event.iRawEvent);
|
|
1917 |
if (err!=KErrNone)
|
|
1918 |
return err;
|
|
1919 |
event.iEat=ETrue;
|
|
1920 |
AddExpectedEvent(&event);
|
|
1921 |
}
|
|
1922 |
return KErrNone;
|
|
1923 |
}
|
|
1924 |
default:;
|
|
1925 |
return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
|
|
1926 |
}
|
|
1927 |
}
|
|
1928 |
|
|
1929 |
void CEventTestAnim::Command(TInt aOpcode,TAny* /*aParam*/)
|
|
1930 |
{
|
|
1931 |
switch (aOpcode)
|
|
1932 |
{
|
|
1933 |
case EADllAfterEvent:
|
|
1934 |
if (TotalExpectedEvents()>0)
|
|
1935 |
Fail();
|
|
1936 |
break;
|
|
1937 |
default:;
|
|
1938 |
}
|
|
1939 |
}
|
|
1940 |
|
|
1941 |
// CEventPostingAnim test posting of anim events //
|
|
1942 |
CEventPostingAnim::~CEventPostingAnim()
|
|
1943 |
{
|
|
1944 |
}
|
|
1945 |
|
|
1946 |
void CEventPostingAnim::ConstructL(TAny* aParam, TBool aBool)
|
|
1947 |
{
|
|
1948 |
CEventTestAnimBase::ConstructL(aParam, aBool);
|
|
1949 |
iFunctions->GetRawEvents(ETrue);
|
|
1950 |
}
|
|
1951 |
|
|
1952 |
TInt CEventPostingAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
|
|
1953 |
{
|
|
1954 |
return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
|
|
1955 |
}
|
|
1956 |
|
|
1957 |
TBool CEventPostingAnim::OfferRawEvent(const TRawEvent &aRawEvent)
|
|
1958 |
{
|
|
1959 |
// Call PostRawEvent or PostKeyEvent according to type of the event
|
|
1960 |
TBool ret = CEventTestAnimBase::OfferRawEvent(aRawEvent);
|
|
1961 |
if (ret)
|
|
1962 |
{
|
|
1963 |
if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 45)
|
|
1964 |
{
|
|
1965 |
TKeyEvent event;
|
|
1966 |
event.iCode='J';
|
|
1967 |
event.iScanCode=0;
|
|
1968 |
event.iModifiers=0;
|
|
1969 |
|
|
1970 |
// This is to check the normal PostKeyEvent API
|
|
1971 |
iFunctions->PostKeyEvent(event);
|
|
1972 |
|
|
1973 |
// This is to check the newly added API
|
|
1974 |
iFunctions->EventExtension()->PostKeyEvent(event, 2);
|
|
1975 |
}
|
|
1976 |
else
|
|
1977 |
{
|
|
1978 |
iFunctions->PostRawEvent(aRawEvent);
|
|
1979 |
}
|
|
1980 |
}
|
|
1981 |
return ret;
|
|
1982 |
}
|
|
1983 |
|
|
1984 |
// CTimerTestAnim check that timer events stop //
|
|
1985 |
CTimerTestAnim::~CTimerTestAnim()
|
|
1986 |
{
|
|
1987 |
}
|
|
1988 |
|
|
1989 |
void CTimerTestAnim::ConstructL(TAny* /*aParam*/, TBool )
|
|
1990 |
{
|
|
1991 |
iWindowFunctions->SetRect(TRect(0,0,1,1));
|
|
1992 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
1993 |
iExpectingTicks=ETrue;
|
|
1994 |
iFail=EFalse;
|
|
1995 |
}
|
|
1996 |
|
|
1997 |
void CTimerTestAnim::Animate(TDateTime*)
|
|
1998 |
{
|
|
1999 |
++iTimerCount;
|
|
2000 |
if (!iExpectingTicks)
|
|
2001 |
iFail=iTimerCount;
|
|
2002 |
}
|
|
2003 |
|
|
2004 |
void CTimerTestAnim::Redraw()
|
|
2005 |
{
|
|
2006 |
}
|
|
2007 |
|
|
2008 |
void CTimerTestAnim::Command(TInt aOpcode, TAny* /*aParam*/)
|
|
2009 |
{
|
|
2010 |
switch (aOpcode)
|
|
2011 |
{
|
|
2012 |
case EADllResetCount:
|
|
2013 |
iTimerCount=0;
|
|
2014 |
break;
|
|
2015 |
case EADllNoTimer:
|
|
2016 |
iExpectingTicks=EFalse;
|
|
2017 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
2018 |
break;
|
|
2019 |
case EADllTimerStarted:
|
|
2020 |
iExpectingTicks=ETrue;
|
|
2021 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
2022 |
break;
|
|
2023 |
default:;
|
|
2024 |
}
|
|
2025 |
}
|
|
2026 |
|
|
2027 |
TInt CTimerTestAnim::CommandReplyL(TInt aOpcode, TAny* /*aParam*/)
|
|
2028 |
{
|
|
2029 |
switch (aOpcode)
|
|
2030 |
{
|
|
2031 |
case EADllCurrentCount:
|
|
2032 |
return iTimerCount;
|
|
2033 |
case EADllFailed:
|
|
2034 |
return iFail;
|
|
2035 |
default:;
|
|
2036 |
}
|
|
2037 |
return(KErrNone);
|
|
2038 |
}
|
|
2039 |
|
|
2040 |
void CTimerTestAnim::FocusChanged(TBool /*aState*/)
|
|
2041 |
{
|
|
2042 |
}
|
|
2043 |
|
|
2044 |
TBool CTimerTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
2045 |
{
|
|
2046 |
return EFalse;
|
|
2047 |
}
|
|
2048 |
|
|
2049 |
|
|
2050 |
// CWinFunctionTestAnim test drawing off own timer //
|
|
2051 |
CWinFunctionTestAnim::~CWinFunctionTestAnim()
|
|
2052 |
{}
|
|
2053 |
|
|
2054 |
void CWinFunctionTestAnim::ConstructL(TAny* /*aParam*/,TBool)
|
|
2055 |
{
|
|
2056 |
iWinFunctions=static_cast<MAnimGeneralFunctionsWindowExtension*>
|
|
2057 |
(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
|
|
2058 |
}
|
|
2059 |
|
|
2060 |
void CWinFunctionTestAnim::Animate(TDateTime*)
|
|
2061 |
{}
|
|
2062 |
|
|
2063 |
void CWinFunctionTestAnim::Redraw()
|
|
2064 |
{}
|
|
2065 |
|
|
2066 |
void CWinFunctionTestAnim::Command(TInt /*aOpcode*/,TAny* /*aParam*/)
|
|
2067 |
{
|
|
2068 |
/*switch (aOpcode)
|
|
2069 |
{
|
|
2070 |
default:;
|
|
2071 |
}*/
|
|
2072 |
}
|
|
2073 |
|
|
2074 |
TInt CWinFunctionTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
2075 |
{
|
|
2076 |
TAnimArgUnion pData;
|
|
2077 |
pData.any=aParam;
|
|
2078 |
switch (aOpcode)
|
|
2079 |
{
|
|
2080 |
case EADllScreen:
|
|
2081 |
return iWinFunctions->Screens();
|
|
2082 |
case EADllFocusScreen:
|
|
2083 |
return iWinFunctions->FocusScreens();
|
|
2084 |
case EADllWindowGroups:
|
|
2085 |
return iWinFunctions->WindowGroups(*pData.Int);
|
|
2086 |
case EADllWindowGroupInfo:
|
|
2087 |
{
|
|
2088 |
const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
|
|
2089 |
TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> info;
|
|
2090 |
TBool ret=iWinFunctions->WindowGroupInfo(info(),params.iScreen,params.iOrdinalPosition);
|
|
2091 |
/*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,info);
|
|
2092 |
return ret;
|
|
2093 |
}
|
|
2094 |
case EADllWindowGroupName:
|
|
2095 |
{
|
|
2096 |
const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
|
|
2097 |
TPtrC name;
|
|
2098 |
TBool ret=iWinFunctions->WindowGroupName(name,params.iScreen,params.iOrdinalPosition);
|
|
2099 |
/*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,name);
|
|
2100 |
return ret;
|
|
2101 |
}
|
|
2102 |
case EADllSetOrdinalPosition:
|
|
2103 |
{
|
|
2104 |
const TSetOrdinalParms& params=*pData.SetOrdinalParms;
|
|
2105 |
return iWinFunctions->SetOrdinalPosition(params.iIdentifier,params.iOrdinalPosition,params.iOrdinalPriority);
|
|
2106 |
}
|
|
2107 |
case EADllSetFocusScreen:
|
|
2108 |
{
|
|
2109 |
const TInt& params=*pData.Int;
|
|
2110 |
iWinFunctions->SetFocusScreen(params);
|
|
2111 |
break;
|
|
2112 |
}
|
|
2113 |
default:;
|
|
2114 |
}
|
|
2115 |
return(KErrNone);
|
|
2116 |
}
|
|
2117 |
|
|
2118 |
void CWinFunctionTestAnim::FocusChanged(TBool /*aState*/)
|
|
2119 |
{}
|
|
2120 |
|
|
2121 |
TBool CWinFunctionTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
2122 |
{
|
|
2123 |
return EFalse;
|
|
2124 |
}
|
|
2125 |
|
|
2126 |
|
|
2127 |
// CNotificationTestAnim
|
|
2128 |
CNotificationTestAnim::CNotificationTestAnim() : iHeartbeatState(EFalse) , iScreenDeviceChanged(ETrue)
|
|
2129 |
{
|
|
2130 |
}
|
|
2131 |
|
|
2132 |
CNotificationTestAnim::~CNotificationTestAnim()
|
|
2133 |
{
|
|
2134 |
// Removed for test case GRAPHICS-WSERV-0139 for DEF12220
|
|
2135 |
// iFunctions->RegisterForNotifications(EFalse);
|
|
2136 |
}
|
|
2137 |
|
|
2138 |
void CNotificationTestAnim::ConstructL(TAny* /*aParam*/, TBool )
|
|
2139 |
{
|
|
2140 |
iWindowFunctions->SetRect(TRect(0,0,1,1));
|
|
2141 |
iFunctions->RegisterForNotifications(EDirectScreenAccess|EHeartbeatTimer|EScreenDeviceChange);
|
|
2142 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
2143 |
iLastAnimTime.UniversalTime();
|
|
2144 |
}
|
|
2145 |
|
|
2146 |
void CNotificationTestAnim::HandleNotification(const TWsEvent& aEvent)
|
|
2147 |
{
|
|
2148 |
switch (aEvent.Type())
|
|
2149 |
{
|
|
2150 |
case EEventDirectScreenAccessBegin:
|
|
2151 |
{
|
|
2152 |
TInt screenNum = *(aEvent.Int());
|
|
2153 |
iDSA[screenNum] = ETrue;
|
|
2154 |
}
|
|
2155 |
break;
|
|
2156 |
case EEventDirectScreenAccessEnd:
|
|
2157 |
{
|
|
2158 |
TInt screenNum = *(aEvent.Int());
|
|
2159 |
iDSA[screenNum] = EFalse;
|
|
2160 |
}
|
|
2161 |
break;
|
|
2162 |
case EEventHeartbeatTimerStateChange:
|
|
2163 |
{
|
|
2164 |
iHeartbeatState=*aEvent.Int();
|
|
2165 |
}
|
|
2166 |
break;
|
|
2167 |
case EEventScreenDeviceChanged:
|
|
2168 |
{
|
|
2169 |
iScreenDeviceChanged=!iScreenDeviceChanged;
|
|
2170 |
}
|
|
2171 |
break;
|
|
2172 |
default:
|
|
2173 |
break;
|
|
2174 |
}
|
|
2175 |
}
|
|
2176 |
|
|
2177 |
void CNotificationTestAnim::Animate(TDateTime*)
|
|
2178 |
{
|
|
2179 |
iLastAnimTime.UniversalTime();
|
|
2180 |
}
|
|
2181 |
|
|
2182 |
void CNotificationTestAnim::Redraw()
|
|
2183 |
{
|
|
2184 |
}
|
|
2185 |
|
|
2186 |
void CNotificationTestAnim::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
|
|
2187 |
{
|
|
2188 |
}
|
|
2189 |
|
|
2190 |
TInt CNotificationTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
2191 |
{
|
|
2192 |
TAnimArgUnion pData;
|
|
2193 |
pData.any=aParam;
|
|
2194 |
switch (aOpcode)
|
|
2195 |
{
|
|
2196 |
case EADllQueryDSA:
|
|
2197 |
{
|
|
2198 |
TInt screenNum = *pData.Int;
|
|
2199 |
return iDSA[screenNum];
|
|
2200 |
}
|
|
2201 |
case EADllQueryHeartbeatState:
|
|
2202 |
{
|
|
2203 |
return iHeartbeatState;
|
|
2204 |
}
|
|
2205 |
case EADllIsAnimating:
|
|
2206 |
{
|
|
2207 |
// Check if the anim DLL is currently animating by comparing
|
|
2208 |
// the current time with the last anim time - if this is greater than a second
|
|
2209 |
// then we are not animating
|
|
2210 |
TTime timeNow;
|
|
2211 |
timeNow.UniversalTime();
|
|
2212 |
TTimeIntervalMicroSeconds microSecs = timeNow.MicroSecondsFrom(iLastAnimTime);
|
|
2213 |
if(microSecs > TTimeIntervalMicroSeconds(1200000)) // 1 sec plus 0.2 secs to cope with any latency
|
|
2214 |
{
|
|
2215 |
return EFalse;
|
|
2216 |
}
|
|
2217 |
else
|
|
2218 |
{
|
|
2219 |
return ETrue;
|
|
2220 |
}
|
|
2221 |
}
|
|
2222 |
default:;
|
|
2223 |
}
|
|
2224 |
return(KErrNone);
|
|
2225 |
}
|
|
2226 |
|
|
2227 |
void CNotificationTestAnim::FocusChanged(TBool /*aState*/)
|
|
2228 |
{
|
|
2229 |
}
|
|
2230 |
|
|
2231 |
TBool CNotificationTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
2232 |
{
|
|
2233 |
return EFalse;
|
|
2234 |
}
|
|
2235 |
|
|
2236 |
// CTransAnim test drawing//
|
|
2237 |
void CTransAnim::ConstructL(TAny* aParam, TBool)
|
|
2238 |
{
|
|
2239 |
iRect=*static_cast<TRect*>(aParam);//Assigns the animation area
|
|
2240 |
iWindowFunctions->SetRect(iRect);
|
|
2241 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
2242 |
iFont=NULL;
|
|
2243 |
iColor=TRgb(0,0,0);
|
|
2244 |
}
|
|
2245 |
|
|
2246 |
void CTransAnim::Animate(TDateTime*)
|
|
2247 |
{
|
|
2248 |
iWindowFunctions->ActivateGc();
|
|
2249 |
if(iMode==1) //Draw line mode
|
|
2250 |
{
|
|
2251 |
DoDraw(iDraw,*iGc,iColor,iRect);
|
|
2252 |
}
|
|
2253 |
else if(iMode==2) //Draw text mode
|
|
2254 |
{
|
|
2255 |
DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
|
|
2256 |
}
|
|
2257 |
}
|
|
2258 |
|
|
2259 |
void CTransAnim::Redraw()
|
|
2260 |
{
|
|
2261 |
DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
|
|
2262 |
}
|
|
2263 |
|
|
2264 |
void CTransAnim::Command(TInt aOpcode,TAny* aParam)
|
|
2265 |
{
|
|
2266 |
TAnimArgUnion pData;
|
|
2267 |
pData.any=aParam;
|
|
2268 |
switch(aOpcode)
|
|
2269 |
{
|
|
2270 |
case EADllDrawNow: //Used to draw a single frame
|
|
2271 |
iWindowFunctions->ActivateGc();
|
|
2272 |
iMode=1;
|
|
2273 |
iDraw=36;
|
|
2274 |
iColor=TRgb(0,0,0);
|
|
2275 |
DoDraw(iDraw,*iGc,iColor,iRect);
|
|
2276 |
break;
|
|
2277 |
case EADllNextFrame: //Used to draw a continous frame
|
|
2278 |
iMode=2;
|
|
2279 |
iColor=pData.FrameData->color;
|
|
2280 |
iDraw=pData.FrameData->draw;
|
|
2281 |
iCount=pData.FrameData->text;
|
|
2282 |
break;
|
|
2283 |
case EADllStartAnimText: //Used to start text animate
|
|
2284 |
iWindowFunctions->ActivateGc();
|
|
2285 |
iMode=2;
|
|
2286 |
iDraw=37;
|
|
2287 |
iFont=iFunctions->DuplicateFontL(pData.FrameData->font);
|
|
2288 |
iColor=pData.FrameData->color;
|
|
2289 |
iCount=pData.FrameData->text;
|
|
2290 |
if(pData.FrameData->sync==EStateFlash)
|
|
2291 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
2292 |
else if(pData.FrameData->sync==EStateSecond)
|
|
2293 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
2294 |
DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
|
|
2295 |
break;
|
|
2296 |
case EADllEndAnimText: //Used to end text animate
|
|
2297 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
2298 |
iWindowFunctions->ActivateGc();
|
|
2299 |
iCount=0;
|
|
2300 |
iMode=0;
|
|
2301 |
iFunctions->CloseFont(iFont);
|
|
2302 |
iFont=NULL;
|
|
2303 |
break;
|
|
2304 |
}
|
|
2305 |
}
|
|
2306 |
|
|
2307 |
TInt CTransAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aParam*/)
|
|
2308 |
{
|
|
2309 |
return(0);
|
|
2310 |
}
|
|
2311 |
|
|
2312 |
void CTransAnim::FocusChanged(TBool /*aState*/)
|
|
2313 |
{}
|
|
2314 |
|
|
2315 |
TBool CTransAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
|
|
2316 |
{
|
|
2317 |
return EFalse;
|
|
2318 |
}
|
|
2319 |
|
|
2320 |
// an anim dll that doesn't remove itself from the event handler list
|
|
2321 |
CTestHandlerAnim::~CTestHandlerAnim()
|
|
2322 |
{
|
|
2323 |
}
|
|
2324 |
|
|
2325 |
void CTestHandlerAnim::ConstructL(TAny* /*aArgs*/, TBool /*aHasFocus*/)
|
|
2326 |
{
|
|
2327 |
iFunctions->GetRawEvents(ETrue);
|
|
2328 |
}
|
|
2329 |
|
|
2330 |
void CTestHandlerAnim::Redraw()
|
|
2331 |
{
|
|
2332 |
}
|
|
2333 |
|
|
2334 |
void CTestHandlerAnim::FocusChanged(TBool /*aState*/)
|
|
2335 |
{
|
|
2336 |
}
|
|
2337 |
|
|
2338 |
TInt CTestHandlerAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aArgs*/)
|
|
2339 |
{
|
|
2340 |
return KErrNone;
|
|
2341 |
}
|
|
2342 |
|
|
2343 |
void CTestHandlerAnim::Command(TInt /*aOpcode*/, TAny* /*aArgs*/)
|
|
2344 |
{
|
|
2345 |
}
|
|
2346 |
|
|
2347 |
void CTestHandlerAnim::Animate(TDateTime* /*aDateTime*/)
|
|
2348 |
{
|
|
2349 |
}
|
|
2350 |
|
|
2351 |
TBool CTestHandlerAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
2352 |
{
|
|
2353 |
return EFalse;
|
|
2354 |
}
|
|
2355 |
|
|
2356 |
// CRemovableAnim Test removal of anim during event handling //
|
|
2357 |
CRemovableAnim::~CRemovableAnim()
|
|
2358 |
{
|
|
2359 |
}
|
|
2360 |
|
|
2361 |
TInt CRemovableAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
|
|
2362 |
{
|
|
2363 |
if (TotalExpectedEvents() + EventCount() < iLifetime)
|
|
2364 |
{
|
|
2365 |
return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
|
|
2366 |
}
|
|
2367 |
else
|
|
2368 |
{
|
|
2369 |
return KErrNone;
|
|
2370 |
}
|
|
2371 |
}
|
|
2372 |
|
|
2373 |
TInt CRemovableAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
|
|
2374 |
{
|
|
2375 |
TAnimArgUnion pData;
|
|
2376 |
pData.any=aParam;
|
|
2377 |
switch (aOpcode)
|
|
2378 |
{
|
|
2379 |
case EADllSetEventHandlerLifetime:
|
|
2380 |
iLifetime = *pData.Int;
|
|
2381 |
return iLifetime;
|
|
2382 |
case EADllEventHandlerLifetime:
|
|
2383 |
return iLifetime;
|
|
2384 |
case EADllAddToEventHandlers:
|
|
2385 |
iFunctions->GetRawEvents(ETrue);
|
|
2386 |
return KErrNone;
|
|
2387 |
case EADllRemoveFromEventHandlers:
|
|
2388 |
iFunctions->GetRawEvents(EFalse);
|
|
2389 |
return KErrNone;
|
|
2390 |
case EADllTestPassed:
|
|
2391 |
{
|
|
2392 |
// If any unexpected events are received, then Error() > 0
|
|
2393 |
// If fewer than the number of expected events are received, then TotalExpectedEvents() > 0
|
|
2394 |
TBool passed = (Error() == 0) && (TotalExpectedEvents() == 0);
|
|
2395 |
return passed;
|
|
2396 |
}
|
|
2397 |
default:
|
|
2398 |
return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
|
|
2399 |
}
|
|
2400 |
}
|
|
2401 |
|
|
2402 |
|
|
2403 |
TBool CRemovableAnim::OfferRawEvent(const TRawEvent& aRawEvent)
|
|
2404 |
{
|
|
2405 |
TBool eat = CEventTestAnimBase::OfferRawEvent(aRawEvent);
|
|
2406 |
|
|
2407 |
// Remove anim from event handlers if lifetime has been exceeded
|
|
2408 |
if (EventCount() >= iLifetime)
|
|
2409 |
{
|
|
2410 |
iFunctions->GetRawEvents(EFalse);
|
|
2411 |
}
|
|
2412 |
return eat;
|
|
2413 |
}
|
|
2414 |
|
|
2415 |
// CMultiPointerAnim for Testing multipointerevents for anims //
|
|
2416 |
CMultiPointerAnim::~CMultiPointerAnim()
|
|
2417 |
{
|
|
2418 |
iFunctions->GetRawEvents(EFalse);
|
|
2419 |
}
|
|
2420 |
|
|
2421 |
// Important thing here is to call GetRawEvents() which Switches animation raw event handling on
|
|
2422 |
void CMultiPointerAnim::ConstructL(TAny */*aArgs*/, TBool /*aHasFocus*/)
|
|
2423 |
{
|
|
2424 |
iExpectedEvents.SetLengthL(EEventBufferSize);
|
|
2425 |
iFunctions->GetRawEvents(ETrue);
|
|
2426 |
}
|
|
2427 |
|
|
2428 |
void CMultiPointerAnim::Animate(TDateTime */*aDateTime*/)
|
|
2429 |
{
|
|
2430 |
}
|
|
2431 |
|
|
2432 |
void CMultiPointerAnim::Command(TInt /*aOpcode*/, TAny */*aArgs*/)
|
|
2433 |
{
|
|
2434 |
}
|
|
2435 |
|
|
2436 |
TInt CMultiPointerAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
|
|
2437 |
{
|
|
2438 |
TAnimArgUnion pData;
|
|
2439 |
pData.any=aArgs;
|
|
2440 |
switch (aOpcode)
|
|
2441 |
{
|
|
2442 |
case EADllAddExpectedMultiPtrEvent:
|
|
2443 |
return AddEvent(pData.AnimRawEvent);
|
|
2444 |
case EADllMultiPtrEventError:
|
|
2445 |
return iError;
|
|
2446 |
case EADllMultiPtrEventErrorDesc:
|
|
2447 |
if (iError != KErrNone)
|
|
2448 |
{
|
|
2449 |
// returns the error description which gets displayed in logs if test failed
|
|
2450 |
const RMessagePtr2& message=*iFunctions->Message();
|
|
2451 |
const TInt error=message.Write(KIpcSlot, iErrorDes);
|
|
2452 |
if (error != KErrNone)
|
|
2453 |
{
|
|
2454 |
return error;
|
|
2455 |
}
|
|
2456 |
}
|
|
2457 |
break;
|
|
2458 |
case EADllMultiPtrEventReset:
|
|
2459 |
iExpectedEvents.Reset();
|
|
2460 |
iError = 0;
|
|
2461 |
iEventCount = 0;
|
|
2462 |
break;
|
|
2463 |
default:;
|
|
2464 |
}
|
|
2465 |
return(KErrNone);
|
|
2466 |
}
|
|
2467 |
|
|
2468 |
void CMultiPointerAnim::Redraw()
|
|
2469 |
{
|
|
2470 |
}
|
|
2471 |
|
|
2472 |
void CMultiPointerAnim::FocusChanged(TBool /*aState*/)
|
|
2473 |
{
|
|
2474 |
}
|
|
2475 |
|
|
2476 |
TBool CMultiPointerAnim::OfferRawEvent(const TRawEvent &aRawEvent)
|
|
2477 |
{
|
|
2478 |
// Ignore following raw events
|
|
2479 |
TRawEvent::TType aType=aRawEvent.Type();
|
|
2480 |
if (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
|
|
2481 |
|| aType==TRawEvent::EPointerSwitchOn || aType==TRawEvent::EUpdateModifiers)
|
|
2482 |
{
|
|
2483 |
return EFalse;
|
|
2484 |
}
|
|
2485 |
|
|
2486 |
// If it has already failed then do not test other events becasue the error value
|
|
2487 |
// and its descriptor will be over written
|
|
2488 |
if (iError)
|
|
2489 |
{
|
|
2490 |
return EFalse;;
|
|
2491 |
}
|
|
2492 |
|
|
2493 |
TAnimRawEvent expectedEvent;
|
|
2494 |
if (iExpectedEvents.Remove(&expectedEvent)<1)
|
|
2495 |
{
|
|
2496 |
return EFalse;
|
|
2497 |
}
|
|
2498 |
|
|
2499 |
// Increment event count
|
|
2500 |
iEventCount++;
|
|
2501 |
|
|
2502 |
// Call compare events function passing in both the events
|
|
2503 |
if (!CompareEvents(expectedEvent.iRawEvent, aRawEvent))
|
|
2504 |
{
|
|
2505 |
iError = iEventCount;
|
|
2506 |
}
|
|
2507 |
|
|
2508 |
return expectedEvent.iEat;
|
|
2509 |
}
|
|
2510 |
|
|
2511 |
TInt CMultiPointerAnim::AddEvent(const TAnimRawEvent* aEvent)
|
|
2512 |
{
|
|
2513 |
return iExpectedEvents.Add(aEvent);
|
|
2514 |
}
|
|
2515 |
|
|
2516 |
TBool CMultiPointerAnim::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent)
|
|
2517 |
{
|
|
2518 |
// Check pointer type
|
|
2519 |
if (aExpectedEvent.Type() != aActualEvent.Type())
|
|
2520 |
{
|
|
2521 |
_LIT(KEventType, "Actual Event type = %d Expected Event Type = %d ");
|
|
2522 |
iErrorDes.Format(KEventType, aActualEvent.Type(), aExpectedEvent.Type());
|
|
2523 |
return EFalse;
|
|
2524 |
}
|
|
2525 |
|
|
2526 |
// Here for EOutOfRange we cannot query Pos or Pos3D...
|
|
2527 |
if (aExpectedEvent.Type() != TRawEvent::EPointer3DOutOfRange)
|
|
2528 |
{
|
|
2529 |
// Check 3d position
|
|
2530 |
TPoint3D expected3DPos = aExpectedEvent.Pos3D();
|
|
2531 |
TPoint3D actual3DPos = aActualEvent.Pos3D();
|
|
2532 |
if (expected3DPos.iX != actual3DPos.iX)
|
|
2533 |
{
|
|
2534 |
_LIT(KXPosition, "Actual X coordinate = %d Expected X coordinate = %d ");
|
|
2535 |
iErrorDes.Format(KXPosition, actual3DPos.iX, expected3DPos.iX);
|
|
2536 |
return EFalse;
|
|
2537 |
}
|
|
2538 |
if (expected3DPos.iY != actual3DPos.iY)
|
|
2539 |
{
|
|
2540 |
_LIT(KYPosition, "Actual Y coordinate = %d Expected Y coordinate = %d ");
|
|
2541 |
iErrorDes.Format(KYPosition, actual3DPos.iY, expected3DPos.iY);
|
|
2542 |
return EFalse;
|
|
2543 |
}
|
|
2544 |
if (expected3DPos.iZ != actual3DPos.iZ)
|
|
2545 |
{
|
|
2546 |
_LIT(KZPosition, "Actual Z coordinate = %d Expected Z coordinate = %d ");
|
|
2547 |
iErrorDes.Format(KZPosition, actual3DPos.iZ, expected3DPos.iZ);
|
|
2548 |
return EFalse;
|
|
2549 |
}
|
|
2550 |
}
|
|
2551 |
|
|
2552 |
// Check pointer number
|
|
2553 |
if (aExpectedEvent.PointerNumber() != aActualEvent.PointerNumber())
|
|
2554 |
{
|
|
2555 |
_LIT(KPointerNumber, "Actual Pointer number = %d Expected Pointer number = %d ");
|
|
2556 |
iErrorDes.Copy(KPointerNumber);
|
|
2557 |
iErrorDes.Format(KPointerNumber, aActualEvent.PointerNumber(), aExpectedEvent.PointerNumber());
|
|
2558 |
return EFalse;
|
|
2559 |
}
|
|
2560 |
return ETrue;
|
|
2561 |
}
|
|
2562 |
|
|
2563 |
// CCoverageAnim test drawing/redrawing //
|
|
2564 |
CCoverageAnim::~CCoverageAnim()
|
|
2565 |
{
|
|
2566 |
if(iFont && iFunctions)
|
|
2567 |
iFunctions->CloseFont(iFont);
|
|
2568 |
}
|
|
2569 |
|
|
2570 |
/**
|
|
2571 |
Initializes members.
|
|
2572 |
*/
|
|
2573 |
void CCoverageAnim::ConstructL(TAny *aParam, TBool )
|
|
2574 |
{
|
|
2575 |
iRect=*static_cast<TRect*>(aParam);
|
|
2576 |
iWindowFunctions->SetRect(iRect);
|
|
2577 |
iWindowFunctions->Invalidate(iRect);
|
|
2578 |
|
|
2579 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncDay);
|
|
2580 |
if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncDay)
|
|
2581 |
User::Leave(KErrGeneral);
|
|
2582 |
|
|
2583 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
|
|
2584 |
if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncMinute)
|
|
2585 |
User::Leave(KErrGeneral);
|
|
2586 |
|
|
2587 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
|
|
2588 |
if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncSecond)
|
|
2589 |
User::Leave(KErrGeneral);
|
|
2590 |
|
|
2591 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
2592 |
if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncFlash)
|
|
2593 |
User::Leave(KErrGeneral);
|
|
2594 |
|
|
2595 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
|
|
2596 |
if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncNone)
|
|
2597 |
User::Leave(KErrGeneral);
|
|
2598 |
|
|
2599 |
iFunctions->SetInterval(1);
|
|
2600 |
iFunctions->SetInterval(0);
|
|
2601 |
iFunctions->SetNextInterval(0);
|
|
2602 |
|
|
2603 |
User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::ENumberOfExtendedInterfaces));
|
|
2604 |
User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
|
|
2605 |
User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EEventExtentionInterface));
|
|
2606 |
User::LeaveIfError(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EInterfaceCount) != NULL);
|
|
2607 |
|
|
2608 |
#if !defined(SYMBIAN_GRAPHICS_GCE)
|
|
2609 |
// Deprecated in NGA but needs to be tested in NONNGA
|
|
2610 |
User::LeaveIfNull((TAny*)iFunctions->ScreenDevice());
|
|
2611 |
#endif
|
|
2612 |
|
|
2613 |
iFunctions->Client();
|
|
2614 |
}
|
|
2615 |
|
|
2616 |
/**
|
|
2617 |
Copied from CAutoAnimScrBack.
|
|
2618 |
*/
|
|
2619 |
void CCoverageAnim::Animate(TDateTime *)
|
|
2620 |
{
|
|
2621 |
iWindowFunctions->ActivateGc();
|
|
2622 |
Draw();
|
|
2623 |
}
|
|
2624 |
|
|
2625 |
/**
|
|
2626 |
All methods of the graphic-context are executed one by one.
|
|
2627 |
*/
|
|
2628 |
void CCoverageAnim::Draw()
|
|
2629 |
{
|
|
2630 |
iGc->SetClippingRect(iRect);
|
|
2631 |
iGc->Clear();
|
|
2632 |
iGc->Clear(iRect);
|
|
2633 |
|
|
2634 |
iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
|
|
2635 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
2636 |
iGc->SetBrushColor(TRgb::Gray256(85));
|
|
2637 |
iGc->SetBrushOrigin(TPoint(0,0));
|
|
2638 |
iGc->SetPenColor(TRgb::Gray256(170));
|
|
2639 |
|
|
2640 |
//primitive method calls
|
|
2641 |
iGc->SetFaded(ETrue);
|
|
2642 |
iGc->SetFadingParameters(1, 1);
|
|
2643 |
|
|
2644 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
2645 |
iGc->SetStrikethroughStyle(EStrikethroughOff);
|
|
2646 |
iGc->SetUnderlineStyle(EUnderlineOff);
|
|
2647 |
iGc->SetWordJustification(2, 1);
|
|
2648 |
|
|
2649 |
if(iFont)
|
|
2650 |
iGc->UseFont(iFont);
|
|
2651 |
|
|
2652 |
iGc->DrawArc(iRect,
|
|
2653 |
TPoint(iRect.Center().iX, iRect.iTl.iY),
|
|
2654 |
TPoint(iRect.iBr.iX, iRect.Center().iY));
|
|
2655 |
iGc->DrawLine(iRect.iTl,iRect.Center());
|
|
2656 |
iGc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
|
|
2657 |
|
|
2658 |
iGc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
|
|
2659 |
iGc->MoveBy(iRect.iTl + TPoint(1,1));
|
|
2660 |
iGc->MoveTo(iRect.iTl + TPoint(0,0));
|
|
2661 |
iGc->SetPenSize(TSize(10,10));
|
|
2662 |
iGc->Plot(iRect.iTl + TPoint(2,2));
|
|
2663 |
iGc->SetPenSize(TSize(1,1));
|
|
2664 |
|
|
2665 |
CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
|
|
2666 |
CleanupStack::PushL(polyPoints);
|
|
2667 |
polyPoints->AppendL(iRect.iTl);
|
|
2668 |
polyPoints->AppendL(iRect.Center());
|
|
2669 |
polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
|
|
2670 |
|
|
2671 |
iGc->DrawPolyLine(polyPoints);
|
|
2672 |
iGc->DrawPolyLine(&polyPoints->At(0), 3);
|
|
2673 |
iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
|
|
2674 |
iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
|
|
2675 |
|
|
2676 |
iGc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
|
|
2677 |
iGc->DrawEllipse(iRect);
|
|
2678 |
iGc->DrawRect(iRect);
|
|
2679 |
iGc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
|
|
2680 |
|
|
2681 |
CleanupStack::PopAndDestroy(polyPoints);
|
|
2682 |
|
|
2683 |
iGc->CopyRect(TPoint(10, 10), iRect);
|
|
2684 |
|
|
2685 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
|
|
2686 |
CleanupStack::PushL(bitmap);
|
|
2687 |
User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
|
|
2688 |
|
|
2689 |
iGc->UseBrushPattern(bitmap);
|
|
2690 |
iGc->DrawBitmap(iRect.iTl, bitmap);
|
|
2691 |
iGc->DrawBitmap(iRect, bitmap);
|
|
2692 |
iGc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
|
|
2693 |
iGc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
|
|
2694 |
|
|
2695 |
iGc->BitBlt(TPoint(0, 0), bitmap);
|
|
2696 |
iGc->BitBlt(TPoint(0, 0), bitmap, iRect);
|
|
2697 |
iGc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
|
|
2698 |
iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
|
|
2699 |
|
|
2700 |
CleanupStack::PopAndDestroy(bitmap);
|
|
2701 |
|
|
2702 |
iGc->SetCharJustification(1,1);
|
|
2703 |
iGc->SetClippingRect(iRect);
|
|
2704 |
if(iFont)
|
|
2705 |
{
|
|
2706 |
_LIT(KHelloWorld,"Hello World");
|
|
2707 |
iGc->DrawText(*&KHelloWorld, iRect.iTl);
|
|
2708 |
iGc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
|
|
2709 |
iGc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
|
|
2710 |
iGc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
|
|
2711 |
}
|
|
2712 |
|
|
2713 |
TRgb rgbs[2];
|
|
2714 |
iGc->MapColors(iRect, rgbs, 1, ETrue);
|
|
2715 |
iGc->DiscardBrushPattern();
|
|
2716 |
|
|
2717 |
if(iFont)
|
|
2718 |
iGc->DiscardFont();
|
|
2719 |
|
|
2720 |
iFunctions->CloseFont(0);
|
|
2721 |
|
|
2722 |
TDateTime dt = iFunctions->SystemTime();
|
|
2723 |
}
|
|
2724 |
|
|
2725 |
/**
|
|
2726 |
Copied from CAutoAnim3.
|
|
2727 |
*/
|
|
2728 |
void CCoverageAnim::Redraw()
|
|
2729 |
{
|
|
2730 |
Draw();
|
|
2731 |
}
|
|
2732 |
|
|
2733 |
/**
|
|
2734 |
Copied from CAutoAnim3.
|
|
2735 |
*/
|
|
2736 |
void CCoverageAnim::Command(TInt ,TAny*)
|
|
2737 |
{
|
|
2738 |
}
|
|
2739 |
|
|
2740 |
/**
|
|
2741 |
Copied from CAutoAnim3.
|
|
2742 |
*/
|
|
2743 |
TInt CCoverageAnim::CommandReplyL(TInt aOpcode , TAny* aParam)
|
|
2744 |
{
|
|
2745 |
TAnimArgUnion pData;
|
|
2746 |
pData.any=aParam;
|
|
2747 |
switch(aOpcode)
|
|
2748 |
{
|
|
2749 |
case EADllDrawNow:
|
|
2750 |
iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
|
|
2751 |
break;
|
|
2752 |
case EADllSetFont:
|
|
2753 |
if(iFont)
|
|
2754 |
{
|
|
2755 |
iFunctions->CloseFont(iFont);
|
|
2756 |
iFont = NULL;
|
|
2757 |
}
|
|
2758 |
iFont = iFunctions->DuplicateFontL(*pData.Int);
|
|
2759 |
break;
|
|
2760 |
}
|
|
2761 |
return(KErrNone);
|
|
2762 |
}
|
|
2763 |
|
|
2764 |
/**
|
|
2765 |
Copied from CAutoAnim3.
|
|
2766 |
*/
|
|
2767 |
void CCoverageAnim::FocusChanged(TBool )
|
|
2768 |
{}
|
|
2769 |
|
|
2770 |
/**
|
|
2771 |
Copied from CAutoAnim3.
|
|
2772 |
*/
|
|
2773 |
TBool CCoverageAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
|
|
2774 |
{
|
|
2775 |
return EFalse;
|
|
2776 |
}
|
|
2777 |
|
|
2778 |
|
|
2779 |
// DLL code //
|
|
2780 |
|
|
2781 |
CAnim *CTestAnimDll::CreateInstanceL(TInt aType)
|
|
2782 |
{
|
|
2783 |
CAnim *anim=NULL;
|
|
2784 |
switch(aType)
|
|
2785 |
{
|
|
2786 |
case EAnimTypeTest1:
|
|
2787 |
anim=new(ELeave) CPanicAnim();
|
|
2788 |
break;
|
|
2789 |
case EAnimTypeTest2:
|
|
2790 |
anim=new(ELeave) CPanicAnim2();
|
|
2791 |
break;
|
|
2792 |
case EAnimTypeTest3:
|
|
2793 |
anim=new(ELeave) CAutoAnim3();
|
|
2794 |
break;
|
|
2795 |
case EAnimTypeScrBackTest:
|
|
2796 |
anim=new(ELeave) CAutoAnimScrBack();
|
|
2797 |
break;
|
|
2798 |
case EAnimTypeSprite:
|
|
2799 |
anim=new(ELeave) CTestSpriteAnim();
|
|
2800 |
break;
|
|
2801 |
case EAnimTypeFreeTimer:
|
|
2802 |
anim=new(ELeave) CTestFreeTimerAnim();
|
|
2803 |
break;
|
|
2804 |
case EAnimTypeEventTest:
|
|
2805 |
anim=new(ELeave) CEventTestAnim();
|
|
2806 |
break;
|
|
2807 |
case EAnimTypeNotificationTest:
|
|
2808 |
anim=new(ELeave) CNotificationTestAnim();
|
|
2809 |
break;
|
|
2810 |
case EAnimTypeTimer:
|
|
2811 |
anim=new(ELeave) CTimerTestAnim();
|
|
2812 |
break;
|
|
2813 |
case EAnimTypeWindowFunctions:
|
|
2814 |
anim=new(ELeave) CWinFunctionTestAnim();
|
|
2815 |
break;
|
|
2816 |
case EAnimTypeTrans:
|
|
2817 |
anim=new(ELeave) CTransAnim();
|
|
2818 |
break;
|
|
2819 |
case EAnimTypeEventHandler:
|
|
2820 |
anim = new (ELeave) CTestHandlerAnim();
|
|
2821 |
break;
|
|
2822 |
case EAnimTypeRemovableAnim:
|
|
2823 |
anim=new(ELeave) CRemovableAnim();
|
|
2824 |
break;
|
|
2825 |
case EAnimTypeEventPostingTest:
|
|
2826 |
anim=new(ELeave) CEventPostingAnim();
|
|
2827 |
break;
|
|
2828 |
case EAnimTypeCoverage:
|
|
2829 |
anim=new(ELeave) CCoverageAnim();
|
|
2830 |
break;
|
|
2831 |
case EAnimTypeMultiPointer:
|
|
2832 |
anim=new(ELeave) CMultiPointerAnim();
|
|
2833 |
break;
|
|
2834 |
}
|
|
2835 |
return(anim);
|
|
2836 |
}
|
|
2837 |
|
|
2838 |
// Dummy E32Dll needed by E32 to build //
|
|
2839 |
|
|
2840 |
void CAutoAnim3::DrawTestScreenL(const TDrawTestScreen* aParams)
|
|
2841 |
//Moved here as the include messes up the debugging of the rest of the file.
|
|
2842 |
{
|
|
2843 |
CFbsBitmap *aBitmap=iFunctions->DuplicateBitmapL(aParams->bitmap);
|
|
2844 |
CleanupStack::PushL(aBitmap);
|
|
2845 |
CFbsBitmap *aMaskBitmap=iFunctions->DuplicateBitmapL(aParams->maskBitmap);
|
|
2846 |
CleanupStack::PushL(aMaskBitmap);
|
|
2847 |
CFbsFont *aFont=iFont=iFunctions->DuplicateFontL(aParams->font);
|
|
2848 |
TSize size(iWindowFunctions->WindowSize());
|
|
2849 |
iWindowFunctions->ActivateGc();
|
|
2850 |
CBitmapContext *gc=iGc;
|
|
2851 |
TBool aExtraDrawBitMap=ETrue;
|
|
2852 |
//
|
|
2853 |
#include "DLLDRAW.H"
|
|
2854 |
//
|
|
2855 |
iFunctions->CloseFont(iFont);
|
|
2856 |
iFont=NULL;
|
|
2857 |
CleanupStack::PopAndDestroy(2);
|
|
2858 |
}
|