|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #ifndef __TKREPEAT_H__ |
|
23 #define __TKREPEAT_H__ |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <e32svr.h> |
|
27 #include <w32std.h> |
|
28 #include "../tlib/testbase.h" |
|
29 #include "AUTO.H" |
|
30 #include "TGraphicsHarness.h" |
|
31 |
|
32 class CRKWindow; |
|
33 |
|
34 class CTKRepeat : public CTWsGraphicsBase |
|
35 { |
|
36 friend class CRKWindow; |
|
37 public: |
|
38 CTKRepeat(CTestStep* aStep); |
|
39 ~CTKRepeat(); |
|
40 void ConstructL(); |
|
41 void TestKeyboardRepeatRateL(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); |
|
42 TBool CheckReportL(); |
|
43 public: |
|
44 TBool iAbort; |
|
45 protected: |
|
46 //from CTGraphicsStep |
|
47 virtual void RunTestCaseL(TInt aCurTestCase); |
|
48 private: |
|
49 inline TestClient *Client() {return TheClient;} |
|
50 private: |
|
51 TTimeIntervalMicroSeconds32 iOldInitialTime; |
|
52 TTimeIntervalMicroSeconds32 iOldTime; |
|
53 CRKWindow *iWin; |
|
54 TSize iWinSize; |
|
55 TInt iState; |
|
56 }; |
|
57 |
|
58 class CRKWindow : public CTWin |
|
59 { |
|
60 enum TRKStates { |
|
61 EStateWaitingForKeyDown, |
|
62 EStateWaitingForKeyCode, |
|
63 EStateWaitingForFirstRepeat, |
|
64 EStateWaitingForNthRepeat, |
|
65 EStateWaitingForKeyUp, |
|
66 EStateInactive, |
|
67 EStateError, |
|
68 }; |
|
69 public: |
|
70 CRKWindow(CTKRepeat *aTest); |
|
71 void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc); |
|
72 void SetState(TRKStates aState); |
|
73 void SetKeyboardRepeatRate(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); |
|
74 void WinKeyL(const TKeyEvent &,const TTime &); |
|
75 void KeyUpL(const TKeyEvent &aKey,const TTime &aTime); |
|
76 void KeyDownL(const TKeyEvent &aKey,const TTime &aTime); |
|
77 void Draw(); |
|
78 TDesC& Report(); |
|
79 TBool CheckResults(); |
|
80 void SendEvent(); |
|
81 protected: |
|
82 TInt iConnIndex; |
|
83 CTKRepeat *iTest; |
|
84 TRgb iBack; |
|
85 TRKStates iState; |
|
86 TInt iDownCode; |
|
87 TInt iRepCount; |
|
88 TTimeIntervalMicroSeconds32 iInitialRepeatSet; |
|
89 TTimeIntervalMicroSeconds32 iRepeatSet; |
|
90 TTime iPrevTime; |
|
91 TTimeIntervalMicroSeconds32 iInitialGap; |
|
92 TTimeIntervalMicroSeconds32 iTotalGap; |
|
93 TTimeIntervalMicroSeconds32 iMinGap; |
|
94 TTimeIntervalMicroSeconds32 iMaxGap; |
|
95 TBuf<0x40> iReport; |
|
96 }; |
|
97 |
|
98 class CTKRepeatStep : public CTGraphicsStep |
|
99 { |
|
100 public: |
|
101 CTKRepeatStep(); |
|
102 protected: |
|
103 //from CTGraphicsStep |
|
104 virtual CTGraphicsBase* CreateTestL(); |
|
105 }; |
|
106 |
|
107 _LIT(KTKRepeatStep,"TKRepeat"); |
|
108 |
|
109 |
|
110 #endif |