0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "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 |
// e32test\device\t_keyboardrotate.cpp
|
|
15 |
// Keyboard Rotation test file
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include <e32test.h>
|
|
20 |
#include <e32svr.h>
|
|
21 |
#include <e32event.h>
|
|
22 |
#include <e32event_private.h>
|
|
23 |
#include <hal.h>
|
|
24 |
|
|
25 |
//---------------------------------------------
|
|
26 |
//! @SYMTestCaseID PBASE_KEYBOARDROTATE
|
|
27 |
//! @SYMTestType UT
|
|
28 |
//! @SYMTestCaseDesc Manual test of keyboard rotation modifiers.
|
|
29 |
//! @SYMREQ CR - APOS-666C3S
|
|
30 |
//! @SYMTestActions Select each of 4 possible keyboard rotations and verify correct behaviour.
|
|
31 |
//! @SYMTestExpectedResults The described section of the keyboard is rotated as displayed by the test.
|
|
32 |
//! @SYMTestPriority High
|
|
33 |
//---------------------------------------------
|
|
34 |
|
|
35 |
LOCAL_D RTest test(_L("T_KEYBOARDROTATE"));
|
|
36 |
|
|
37 |
GLDEF_C TInt E32Main()
|
|
38 |
{
|
|
39 |
|
|
40 |
test.Title();
|
|
41 |
test.Start(_L("Test Keyboard Rotation Modifiers\n"));
|
|
42 |
test.Printf(_L("The following 3x3 grid of keys can be rotated: \n\n"));
|
|
43 |
test.Printf(_L("Q W E\n\n"));
|
|
44 |
test.Printf(_L("A S D\n\n"));
|
|
45 |
test.Printf(_L("Z X C\n\n"));
|
|
46 |
|
|
47 |
TKeyCode response;
|
|
48 |
TRawEvent event;
|
|
49 |
|
|
50 |
TInt machineuid;
|
|
51 |
HAL::Get(HAL::EMachineUid, machineuid);
|
|
52 |
if(machineuid != HAL::EMachineUid_Lubbock && machineuid != HAL::EMachineUid_Win32Emulator)
|
|
53 |
{
|
|
54 |
test.Printf(_L("Test only supports Lubbock platform and emulator\n"));
|
|
55 |
test.End();
|
|
56 |
return(0);
|
|
57 |
}
|
|
58 |
|
|
59 |
for(;;)
|
|
60 |
{
|
|
61 |
test.Printf(_L("Select desired option: \n\n"));
|
|
62 |
test.Printf(_L("(1) Rotate 90 deg clockwise\n"));
|
|
63 |
test.Printf(_L("(2) Rotate 180 deg clockwise\n"));
|
|
64 |
test.Printf(_L("(3) Rotate 270 deg clockwise\n"));
|
|
65 |
test.Printf(_L("(4) Return to default layout\n\n"));
|
|
66 |
test.Printf(_L("Press any other key to exit\n\n"));
|
|
67 |
|
|
68 |
response=test.Getch();
|
|
69 |
|
|
70 |
switch((TInt)response)
|
|
71 |
{
|
|
72 |
case '1':
|
|
73 |
event.Set(TRawEvent::EUpdateModifiers, EModifierRotateBy90);
|
|
74 |
UserSvr::AddEvent(event);
|
|
75 |
test.Printf(_L("The keyboard layout is now as follows: \n\n"));
|
|
76 |
test.Printf(_L("Z A Q\n\n"));
|
|
77 |
test.Printf(_L("X S W\n\n"));
|
|
78 |
test.Printf(_L("C D E\n\n"));
|
|
79 |
break;
|
|
80 |
|
|
81 |
case '2':
|
|
82 |
event.Set(TRawEvent::EUpdateModifiers, EModifierRotateBy180);
|
|
83 |
UserSvr::AddEvent(event);
|
|
84 |
test.Printf(_L("The keyboard layout is now as follows: \n\n"));
|
|
85 |
test.Printf(_L("C X Z\n\n"));
|
|
86 |
test.Printf(_L("D S A\n\n"));
|
|
87 |
test.Printf(_L("E W Q\n\n"));
|
|
88 |
break;
|
|
89 |
|
|
90 |
case '3':
|
|
91 |
event.Set(TRawEvent::EUpdateModifiers, EModifierRotateBy270);
|
|
92 |
UserSvr::AddEvent(event);
|
|
93 |
test.Printf(_L("The keyboard layout is now as follows: \n\n"));
|
|
94 |
test.Printf(_L("E D C\n\n"));
|
|
95 |
test.Printf(_L("W S X\n\n"));
|
|
96 |
test.Printf(_L("Q A Z\n\n"));
|
|
97 |
break;
|
|
98 |
|
|
99 |
case '4':
|
|
100 |
event.Set(TRawEvent::EUpdateModifiers, EModifierCancelRotation);
|
|
101 |
UserSvr::AddEvent(event);
|
|
102 |
test.Printf(_L("The keyboard layout is now as follows: \n\n"));
|
|
103 |
test.Printf(_L("Q W E\n\n"));
|
|
104 |
test.Printf(_L("A S D\n\n"));
|
|
105 |
test.Printf(_L("Z X C\n\n"));
|
|
106 |
break;
|
|
107 |
|
|
108 |
default:
|
|
109 |
event.Set(TRawEvent::EUpdateModifiers, EModifierCancelRotation);
|
|
110 |
UserSvr::AddEvent(event);
|
|
111 |
test.End();
|
|
112 |
return(0);
|
|
113 |
}
|
|
114 |
|
|
115 |
test.Printf(_L("Test the new keyboard layout below and press enter when finished:\n"));
|
|
116 |
|
|
117 |
while(response!=EKeyEnter)
|
|
118 |
{
|
|
119 |
response=test.Getch();
|
|
120 |
test.Printf(TPtrC((TUint16 *)&response, 1));
|
|
121 |
}
|
|
122 |
|
|
123 |
test.Printf(_L("\n\n"));
|
|
124 |
}
|
|
125 |
}
|
|
126 |
|