sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\digitiser\t_traweventdigitiser.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
|
sl@0
|
17 |
// API Information:
|
sl@0
|
18 |
// UserSvr
|
sl@0
|
19 |
// Details:
|
sl@0
|
20 |
// - Test the following 6 Events types
|
sl@0
|
21 |
// 1. EPointerMove
|
sl@0
|
22 |
// 2. EPointer3DInRange,
|
sl@0
|
23 |
// 3. EPointer3DOutOfRange,
|
sl@0
|
24 |
// 4. EPointer3DTilt,
|
sl@0
|
25 |
// 5. EPointer3DRotation,
|
sl@0
|
26 |
// 6. EPointer3DTiltAndMove,
|
sl@0
|
27 |
// Platforms/Drives/Compatibility:
|
sl@0
|
28 |
// All.
|
sl@0
|
29 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
30 |
// Failures and causes:
|
sl@0
|
31 |
//
|
sl@0
|
32 |
//
|
sl@0
|
33 |
|
sl@0
|
34 |
#include <e32test.h>
|
sl@0
|
35 |
#include <e32svr.h>
|
sl@0
|
36 |
#include <e32cmn.h>
|
sl@0
|
37 |
#include <e32cmn_private.h>
|
sl@0
|
38 |
|
sl@0
|
39 |
LOCAL_D RTest test(_L("t_TRawEventDigitiser"));
|
sl@0
|
40 |
|
sl@0
|
41 |
class TestTRawDigitiserEvent
|
sl@0
|
42 |
{
|
sl@0
|
43 |
public:
|
sl@0
|
44 |
TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 iTip);
|
sl@0
|
45 |
void TestEvents();
|
sl@0
|
46 |
private:
|
sl@0
|
47 |
TRawEvent::TType iType;
|
sl@0
|
48 |
TInt iX;
|
sl@0
|
49 |
TInt iY;
|
sl@0
|
50 |
TInt iZ;
|
sl@0
|
51 |
TInt iScanCode;
|
sl@0
|
52 |
TInt iPhi;
|
sl@0
|
53 |
TInt iTheta;
|
sl@0
|
54 |
TInt iAlpha;
|
sl@0
|
55 |
TUint8 iPointerNumber;
|
sl@0
|
56 |
TUint8 iTip;
|
sl@0
|
57 |
TRawEvent iDigitiser3DEvent;
|
sl@0
|
58 |
};
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip):iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
|
sl@0
|
62 |
{}
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
void TestTRawDigitiserEvent::TestEvents()
|
sl@0
|
66 |
{
|
sl@0
|
67 |
|
sl@0
|
68 |
test(iDigitiser3DEvent.Type()==0);
|
sl@0
|
69 |
iDigitiser3DEvent.Set(iType);
|
sl@0
|
70 |
test(iDigitiser3DEvent.Type()==iType);
|
sl@0
|
71 |
iDigitiser3DEvent.SetPointerNumber(iPointerNumber);
|
sl@0
|
72 |
test(iPointerNumber == iDigitiser3DEvent.PointerNumber());
|
sl@0
|
73 |
iDigitiser3DEvent.Set(iType,iScanCode);
|
sl@0
|
74 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
75 |
iDigitiser3DEvent.Set(TRawEvent::EKeyDown);
|
sl@0
|
76 |
test(iScanCode==iDigitiser3DEvent.ScanCode());
|
sl@0
|
77 |
iDigitiser3DEvent.Set(iType,iX,iY);
|
sl@0
|
78 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
79 |
iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
|
sl@0
|
80 |
test(TPoint(iX,iY)==iDigitiser3DEvent.Pos());
|
sl@0
|
81 |
iDigitiser3DEvent.Set(iType,iX,iY,iZ);
|
sl@0
|
82 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
83 |
iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
|
sl@0
|
84 |
test(TPoint3D(iX,iY,iZ)==iDigitiser3DEvent.Pos3D());
|
sl@0
|
85 |
iDigitiser3DEvent.SetTip(iTip);
|
sl@0
|
86 |
test(TBool(iTip) == iDigitiser3DEvent.IsTip());
|
sl@0
|
87 |
iDigitiser3DEvent.SetTilt(iType,iPhi,iTheta);
|
sl@0
|
88 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
89 |
iDigitiser3DEvent.Set(TRawEvent::EPointer3DTilt);
|
sl@0
|
90 |
TAngle3D rawEventAnge3D=iDigitiser3DEvent.Tilt();
|
sl@0
|
91 |
test((rawEventAnge3D.iPhi==iPhi) && (rawEventAnge3D.iTheta==iTheta)) ;
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
iDigitiser3DEvent.SetRotation(iType,iAlpha);
|
sl@0
|
95 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
96 |
iDigitiser3DEvent.Set(TRawEvent::EPointer3DRotation);
|
sl@0
|
97 |
test(iAlpha == iDigitiser3DEvent.Rotation());
|
sl@0
|
98 |
iDigitiser3DEvent.Set(iType,iX+1,iY+1,iZ+1,iPhi+1,iTheta+1,iAlpha+1);
|
sl@0
|
99 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
100 |
iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
|
sl@0
|
101 |
test(TPoint3D(iX+1,iY+1,iZ+1)==iDigitiser3DEvent.Pos3D());
|
sl@0
|
102 |
rawEventAnge3D=iDigitiser3DEvent.Tilt();
|
sl@0
|
103 |
test((rawEventAnge3D.iPhi==iPhi+1) &&(rawEventAnge3D.iTheta==iTheta+1));
|
sl@0
|
104 |
test((iAlpha+1) == iDigitiser3DEvent.Rotation());
|
sl@0
|
105 |
iDigitiser3DEvent.Set(iType,iX+2,iY+2,iZ+2,static_cast<TUint8>(iPointerNumber+1));
|
sl@0
|
106 |
//Set the Type temporarily to get through the assertion
|
sl@0
|
107 |
iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
|
sl@0
|
108 |
test(TPoint3D(iX+2,iY+2,iZ+2)==iDigitiser3DEvent.Pos3D());
|
sl@0
|
109 |
test((iPointerNumber+1) == iDigitiser3DEvent.PointerNumber());
|
sl@0
|
110 |
|
sl@0
|
111 |
UserSvr::AddEvent(iDigitiser3DEvent);
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
|
sl@0
|
115 |
GLDEF_C TInt E32Main()
|
sl@0
|
116 |
//
|
sl@0
|
117 |
//
|
sl@0
|
118 |
{
|
sl@0
|
119 |
|
sl@0
|
120 |
test.Title();
|
sl@0
|
121 |
test.Start(_L("Testing Digitiser Events"));
|
sl@0
|
122 |
|
sl@0
|
123 |
TestTRawDigitiserEvent digitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
|
sl@0
|
124 |
TestTRawDigitiserEvent digitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
|
sl@0
|
125 |
TestTRawDigitiserEvent digitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
|
sl@0
|
126 |
TestTRawDigitiserEvent digitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
|
sl@0
|
127 |
TestTRawDigitiserEvent digitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
|
sl@0
|
128 |
TestTRawDigitiserEvent digitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
|
sl@0
|
129 |
|
sl@0
|
130 |
digitiserEvent1.TestEvents();
|
sl@0
|
131 |
digitiserEvent2.TestEvents();
|
sl@0
|
132 |
digitiserEvent3.TestEvents();
|
sl@0
|
133 |
digitiserEvent4.TestEvents();
|
sl@0
|
134 |
digitiserEvent5.TestEvents();
|
sl@0
|
135 |
digitiserEvent6.TestEvents();
|
sl@0
|
136 |
test.Printf(_L("T_TRAWEVENTDIGITISER: TEST Successfully Completed\n"));
|
sl@0
|
137 |
test.End();
|
sl@0
|
138 |
test.Close();
|
sl@0
|
139 |
|
sl@0
|
140 |
return KErrNone;
|
sl@0
|
141 |
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|