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 |
// Coverted from TMan test code (TMMODCHG.CPP) August 2000
|
|
15 |
// Test modifier changed message
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
@test
|
|
22 |
@internalComponent - Internal Symbian test code
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include "TMODCHG.H"
|
|
26 |
|
|
27 |
#define LOGGING on //Uncoment this line to get extra logging
|
|
28 |
|
|
29 |
struct TModifierChangedTestsParams
|
|
30 |
{
|
|
31 |
TText *txt; // Text message telling user what to do
|
|
32 |
TUint changed;
|
|
33 |
TUint state;
|
|
34 |
TUint stateMask;
|
|
35 |
};
|
|
36 |
|
|
37 |
LOCAL_D TModifierChangedTestsParams ModifierChangedTests[]={
|
|
38 |
{(TText *)_S("Press Caps"),EModifierCapsLock,EModifierCapsLock,EModifierCapsLock},
|
|
39 |
{(TText *)_S("Press Caps (again)"),EModifierCapsLock,0,EModifierCapsLock},
|
|
40 |
{(TText *)_S("Press left shift"),EModifierShift|EModifierLeftShift,EModifierShift|EModifierLeftShift,EModifierShift|EModifierLeftShift},
|
|
41 |
{(TText *)_S("Release left shift"),EModifierShift|EModifierLeftShift,0,EModifierShift|EModifierLeftShift},
|
|
42 |
{(TText *)_S("Press right shift"),EModifierShift|EModifierRightShift,EModifierShift|EModifierRightShift,EModifierShift|EModifierRightShift},
|
|
43 |
{(TText *)_S("Release right shift"),EModifierShift|EModifierRightShift,0,EModifierShift|EModifierRightShift},
|
|
44 |
{(TText *)_S("Press (left) func"),EModifierFunc|EModifierLeftFunc,EModifierFunc|EModifierLeftFunc,EModifierFunc|EModifierLeftFunc},
|
|
45 |
{(TText *)_S("Release (left) func"),EModifierFunc|EModifierLeftFunc,0,EModifierFunc|EModifierLeftFunc},
|
|
46 |
{(TText *)_S("Press (left) control"),EModifierCtrl|EModifierLeftCtrl,EModifierCtrl|EModifierLeftCtrl,EModifierCtrl|EModifierLeftCtrl},
|
|
47 |
{(TText *)_S("Release (left) control"),EModifierCtrl|EModifierLeftCtrl,0,EModifierCtrl|EModifierLeftCtrl},
|
|
48 |
};
|
|
49 |
|
|
50 |
// list of ModifierEvents that should be monitored
|
|
51 |
LOCAL_D TInt ModifierChangedEvents=EModifierShift|EModifierLeftShift|EModifierRightShift|
|
|
52 |
EModifierCapsLock|EModifierFunc|EModifierLeftFunc|EModifierCtrl|EModifierLeftCtrl;
|
|
53 |
|
|
54 |
const TInt numTests=sizeof(ModifierChangedTests)/sizeof(ModifierChangedTests[0]);
|
|
55 |
|
|
56 |
|
|
57 |
//
|
|
58 |
// CTEventWindowGroup class //
|
|
59 |
//
|
|
60 |
|
|
61 |
CTEventWindowGroup::CTEventWindowGroup(CTClient *aClient, CTModifiersChanged *aTest) : CTWindowGroup(aClient), iTest(aTest)
|
|
62 |
{}
|
|
63 |
|
|
64 |
void CTEventWindowGroup::ConstructL()
|
|
65 |
{
|
|
66 |
CTWindowGroup::ConstructL();
|
|
67 |
iGroupWin.EnableModifierChangedEvents(ModifierChangedEvents,EEventControlAlways);
|
|
68 |
}
|
|
69 |
|
|
70 |
void CTEventWindowGroup::ModifiersChanged(const TModifiersChangedEvent &aModifiersChanged, const TTime &)
|
|
71 |
{
|
|
72 |
iTest->TestModifiersState(aModifiersChanged); // tests if event is correct
|
|
73 |
}
|
|
74 |
|
|
75 |
void CTEventWindowGroup::KeyL(const TKeyEvent &aKey,const TTime &)
|
|
76 |
{
|
|
77 |
if (aKey.iCode==EKeyEscape || (aKey.iCode==' ' && iTest->iModSetTest))
|
|
78 |
iTest->EndTest(); // not really needed, because timer cancels long running tests
|
|
79 |
}
|
|
80 |
|
|
81 |
//
|
|
82 |
// CMCWindow, class //
|
|
83 |
//
|
|
84 |
|
|
85 |
CMCWindow::CMCWindow(CTModifiersChanged *aTest) : CTWin(), iTest(aTest)
|
|
86 |
{
|
|
87 |
iBack=TRgb::Gray256(230);
|
|
88 |
}
|
|
89 |
|
|
90 |
void CMCWindow::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
|
91 |
{
|
|
92 |
ConstructExtLD(*parent,pos,size);
|
|
93 |
iWin.SetBackgroundColor(iBack);
|
|
94 |
Activate();
|
|
95 |
AssignGC(aGc);
|
|
96 |
iLineHeight=iFont->HeightInPixels()*5/4;
|
|
97 |
iFontAscent=iFont->AscentInPixels();
|
|
98 |
iXpos1=4;
|
|
99 |
iXpos2=iXpos1+12*iFont->TextWidthInPixels(_L("M"));
|
|
100 |
}
|
|
101 |
|
|
102 |
void CMCWindow::DrawModSetLine(const TDesC &aDes,TInt aModifier,TInt iSettableModifiers)
|
|
103 |
{
|
|
104 |
iYpos+=iLineHeight;
|
|
105 |
iGc->DrawText(aDes, TPoint(iXpos1,iYpos));
|
|
106 |
iGc->DrawText(aModifier&iSettableModifiers ? _L("Yes"):_L("No"), TPoint(iXpos2,iYpos));
|
|
107 |
}
|
|
108 |
|
|
109 |
void CMCWindow::Draw()
|
|
110 |
{
|
|
111 |
iGc->Clear();
|
|
112 |
if (iTest->iModSetTest)
|
|
113 |
{
|
|
114 |
iYpos=iFontAscent+3;
|
|
115 |
TBuf<32> buf;
|
|
116 |
buf.Format(TRefByValue<const TDesC>(_L("Settable? [0x%4x]")), iTest->iSettable);
|
|
117 |
iGc->DrawText(_L("Modifier"), TPoint(iXpos1,iYpos));
|
|
118 |
iGc->DrawText(buf, TPoint(iXpos2,iYpos));
|
|
119 |
DrawModSetLine(_L("Shift"),EModifierShift,iTest->iSettable);
|
|
120 |
DrawModSetLine(_L("Left Shift"),EModifierLeftShift,iTest->iSettable);
|
|
121 |
DrawModSetLine(_L("Func"),EModifierFunc,iTest->iSettable);
|
|
122 |
DrawModSetLine(_L("Caps"),EModifierCapsLock,iTest->iSettable);
|
|
123 |
DrawModSetLine(_L("NumLock"),EModifierNumLock,iTest->iSettable);
|
|
124 |
DrawModSetLine(_L("Double Click"),EModifierDoubleClick,iTest->iSettable);
|
|
125 |
}
|
|
126 |
else
|
|
127 |
iGc->DrawText(TPtrC(ModifierChangedTests[iTest->SubState()].txt), TPoint(10,20));
|
|
128 |
}
|
|
129 |
|
|
130 |
//
|
|
131 |
|
|
132 |
CTModifiersChanged::CTModifiersChanged(CTestStep* aStep): CTWsGraphicsBase(aStep),
|
|
133 |
iSkipFirstModifierEvents(EFalse), iSubSchedulerRunning(EFalse)
|
|
134 |
{
|
|
135 |
}
|
|
136 |
|
|
137 |
CTModifiersChanged::~CTModifiersChanged()
|
|
138 |
{
|
|
139 |
delete iTimeOut;
|
|
140 |
delete iWin;
|
|
141 |
delete iEventGroup;
|
|
142 |
}
|
|
143 |
|
|
144 |
void CTModifiersChanged::ConstructL()
|
|
145 |
{
|
|
146 |
iTimeOut=new(ELeave) CTimeOut();
|
|
147 |
iTimeOut->ConstructL();
|
|
148 |
iWin=new(ELeave) CMCWindow(this);
|
|
149 |
iWin->SetUpL(TPoint(10,10),TSize(240,200),Client()->iGroup, *Client()->iGc);
|
|
150 |
}
|
|
151 |
|
|
152 |
TInt CTModifiersChanged::TimeOut(TAny* aTest) // static
|
|
153 |
{
|
|
154 |
static_cast<CTModifiersChanged*>(aTest)->TimeOut();
|
|
155 |
return(KErrNone);
|
|
156 |
}
|
|
157 |
|
|
158 |
void CTModifiersChanged::TimeOut()
|
|
159 |
{
|
|
160 |
#if defined(LOGGING)
|
|
161 |
_LIT(KLogTimeOut,"Test timed out after %d secs.");
|
|
162 |
LOG_MESSAGE2(KLogTimeOut,KTimeOutAfter/1000000);
|
|
163 |
#endif
|
|
164 |
EndTest();
|
|
165 |
}
|
|
166 |
|
|
167 |
void CTModifiersChanged::EndTest()
|
|
168 |
{
|
|
169 |
TEST(EFalse); // test failed (timeout or manually cancelled)
|
|
170 |
if (iModSetTest)
|
|
171 |
{
|
|
172 |
iModSetTest=EFalse;
|
|
173 |
iWin->Invalidate();
|
|
174 |
}
|
|
175 |
_LIT(KLogEndTest,"EndTest - State %d - SubState %d");
|
|
176 |
LOG_MESSAGE3(KLogEndTest,iTest->iState,iSubState);
|
|
177 |
if (iSubSchedulerRunning)
|
|
178 |
{
|
|
179 |
iSubSchedulerRunning = EFalse;
|
|
180 |
CActiveScheduler::Stop(); // stop the sub-scheduler, so test-framework can execute the next test
|
|
181 |
}
|
|
182 |
}
|
|
183 |
|
|
184 |
TInt CTModifiersChanged::SubState() const
|
|
185 |
{
|
|
186 |
return(iSubState);
|
|
187 |
}
|
|
188 |
|
|
189 |
void CTModifiersChanged::IncSubState()
|
|
190 |
{
|
|
191 |
if (iSubState<numTests-1)
|
|
192 |
{
|
|
193 |
iSubState++;
|
|
194 |
iWin->Invalidate();
|
|
195 |
TheClient->WaitForRedrawsToFinish();
|
|
196 |
SendEvents();
|
|
197 |
}
|
|
198 |
else if (iSubState>=numTests-1) // test finished successfully
|
|
199 |
{
|
|
200 |
if (iSubSchedulerRunning)
|
|
201 |
{
|
|
202 |
iSubSchedulerRunning = EFalse;
|
|
203 |
CActiveScheduler::Stop(); // stop the sub-scheduler, so test-framework can execute the next test
|
|
204 |
}
|
|
205 |
}
|
|
206 |
}
|
|
207 |
|
|
208 |
void CTModifiersChanged::TestModifiersState(const TModifiersChangedEvent &aModifiersChanged)
|
|
209 |
{
|
|
210 |
if (iTest->iState==1) // only if currently in test 1 (add another if for further tests)
|
|
211 |
{
|
|
212 |
TInt getMods=Client()->iWs.GetModifierState(); // double check the modifiers
|
|
213 |
#if defined(LOGGING)
|
|
214 |
if (iSkipFirstModifierEvents)
|
|
215 |
{
|
|
216 |
_LIT(KLogIgnored,"### This Event is part of the initial setup and is ignored for the test. ###");
|
|
217 |
LOG_MESSAGE(KLogIgnored);
|
|
218 |
}
|
|
219 |
TLogMessageText buf;
|
|
220 |
_LIT(KLog1,"##MC1 SS=%x Test-Modifiers=0x%x Test-Changed=0x%x Test-Mask=0x%x");
|
|
221 |
buf.Format(KLog1,iSubState,ModifierChangedTests[iSubState].state,ModifierChangedTests[iSubState].changed,ModifierChangedTests[iSubState].stateMask);
|
|
222 |
LOG_MESSAGE(buf);
|
|
223 |
_LIT(KLog2,"##MC2 Event-Modifiers=0x%x Event-Changed=0x%x Get-Modifiers=0x%x");
|
|
224 |
buf.Format(KLog2,aModifiersChanged.iModifiers,aModifiersChanged.iChangedModifiers,getMods);
|
|
225 |
LOG_MESSAGE(buf);
|
|
226 |
_LIT(KLog3,"##MC3 Changed: (Event) 0x%x==0x%x (Test)");
|
|
227 |
buf.Format(KLog3,aModifiersChanged.iChangedModifiers,ModifierChangedTests[iSubState].changed);
|
|
228 |
LOG_MESSAGE(buf);
|
|
229 |
_LIT(KLog4,"##MC4 Modifier (with mask): (Event) 0x%x==0x%x (Test)");
|
|
230 |
buf.Format(KLog4,aModifiersChanged.iModifiers&ModifierChangedTests[iSubState].stateMask,ModifierChangedTests[iSubState].state);
|
|
231 |
LOG_MESSAGE(buf);
|
|
232 |
_LIT(KLog5,"##MC5 Modifier (with mask): (Get) 0x%x==0x%x (Test)");
|
|
233 |
buf.Format(KLog5,getMods&ModifierChangedTests[iSubState].stateMask,ModifierChangedTests[iSubState].state);
|
|
234 |
LOG_MESSAGE(buf);
|
|
235 |
#endif
|
|
236 |
if (iSkipFirstModifierEvents) // skip the events caused by the initialization
|
|
237 |
{
|
|
238 |
if(--iSkipCounter<=0)
|
|
239 |
{
|
|
240 |
iSkipFirstModifierEvents = EFalse;
|
|
241 |
}
|
|
242 |
}
|
|
243 |
else
|
|
244 |
{
|
|
245 |
if (aModifiersChanged.iChangedModifiers==ModifierChangedTests[iSubState].changed &&
|
|
246 |
(aModifiersChanged.iModifiers&ModifierChangedTests[iSubState].stateMask)==ModifierChangedTests[iSubState].state &&
|
|
247 |
(getMods&ModifierChangedTests[iSubState].stateMask)==ModifierChangedTests[iSubState].state)
|
|
248 |
{
|
|
249 |
IncSubState(); // subtest is successfull
|
|
250 |
}
|
|
251 |
else
|
|
252 |
{
|
|
253 |
TEST(EFalse); // subtest failed
|
|
254 |
_LIT(KLogTestFailed,"Modifier Change test failed.");
|
|
255 |
LOG_MESSAGE(KLogTestFailed);
|
|
256 |
}
|
|
257 |
}
|
|
258 |
} // if test 1
|
|
259 |
}
|
|
260 |
|
|
261 |
void CTModifiersChanged::BadParams()
|
|
262 |
{
|
|
263 |
}
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Resets all the modifiers after the test is finished. Make sure that all keys used in the
|
|
267 |
* test are in the up-state.
|
|
268 |
*/
|
|
269 |
void CTModifiersChanged::ResetModifiers()
|
|
270 |
{
|
|
271 |
_LIT(KLogResetModifiersError,"Error %d occured while turning off modifier 0x%x");
|
|
272 |
TInt err;
|
|
273 |
if ((err = Client()->iWs.SetModifierState(EModifierCapsLock,ETurnOffModifier)) != KErrNone)
|
|
274 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierCapsLock);
|
|
275 |
if ((err = Client()->iWs.SetModifierState(EModifierShift,ETurnOffModifier)) != KErrNone)
|
|
276 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierShift);
|
|
277 |
if ((err = Client()->iWs.SetModifierState(EModifierLeftShift,ETurnOffModifier)) != KErrNone)
|
|
278 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierLeftShift);
|
|
279 |
if ((err = Client()->iWs.SetModifierState(EModifierRightShift,ETurnOffModifier)) != KErrNone)
|
|
280 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierRightShift);
|
|
281 |
if ((err = Client()->iWs.SetModifierState(EModifierFunc,ETurnOffModifier)) != KErrNone)
|
|
282 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierFunc);
|
|
283 |
if ((err = Client()->iWs.SetModifierState(EModifierLeftFunc,ETurnOffModifier)) != KErrNone)
|
|
284 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierLeftFunc);
|
|
285 |
if ((err = Client()->iWs.SetModifierState(EModifierCtrl,ETurnOffModifier)) != KErrNone)
|
|
286 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierCtrl);
|
|
287 |
if ((err = Client()->iWs.SetModifierState(EModifierLeftCtrl,ETurnOffModifier)) != KErrNone)
|
|
288 |
LOG_MESSAGE3(KLogResetModifiersError,err, EModifierLeftCtrl);
|
|
289 |
}
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Initialises the Modifier state. All tested modifiers must be in the up-state before the
|
|
293 |
* test starts. The number of sent key simulations needed for initialization is recorded.
|
|
294 |
* Each key simulation during initialization causes a ModifierChanged event which should be
|
|
295 |
* ignored because it's not part of the actual test.
|
|
296 |
*/
|
|
297 |
void CTModifiersChanged::ModifierChangedEventsL()
|
|
298 |
{
|
|
299 |
iEventGroup=new(ELeave) CTEventWindowGroup(Client(), this);
|
|
300 |
iEventGroup->ConstructL();
|
|
301 |
TInt modifiers=Client()->iWs.GetModifierState();
|
|
302 |
|
|
303 |
if ((ModifierChangedEvents&modifiers)>0) // reset modifiers if they are in the down-state
|
|
304 |
{
|
|
305 |
iSkipFirstModifierEvents = ETrue;
|
|
306 |
if ((modifiers&EModifierCapsLock)>0)
|
|
307 |
{
|
|
308 |
iTest->SimulateKeyDownUp(EStdKeyCapsLock);
|
|
309 |
++iSkipCounter;
|
|
310 |
modifiers=Client()->iWs.GetModifierState();
|
|
311 |
}
|
|
312 |
if ((modifiers&EModifierLeftShift)>0)
|
|
313 |
{
|
|
314 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
|
|
315 |
++iSkipCounter;
|
|
316 |
modifiers=Client()->iWs.GetModifierState();
|
|
317 |
}
|
|
318 |
if ((modifiers&EModifierRightShift)>0)
|
|
319 |
{
|
|
320 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift);
|
|
321 |
++iSkipCounter;
|
|
322 |
modifiers=Client()->iWs.GetModifierState();
|
|
323 |
}
|
|
324 |
if ((modifiers&EModifierLeftFunc)>0)
|
|
325 |
{
|
|
326 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
|
|
327 |
++iSkipCounter;
|
|
328 |
modifiers=Client()->iWs.GetModifierState();
|
|
329 |
}
|
|
330 |
if ((modifiers&EModifierLeftCtrl)>0)
|
|
331 |
{
|
|
332 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftCtrl);
|
|
333 |
++iSkipCounter;
|
|
334 |
}
|
|
335 |
}
|
|
336 |
modifiers=Client()->iWs.GetModifierState();
|
|
337 |
_LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)");
|
|
338 |
LOG_MESSAGE2(KLog,modifiers);
|
|
339 |
}
|
|
340 |
|
|
341 |
void CTModifiersChanged::CheckModifier(TEventModifier aModifier)
|
|
342 |
{
|
|
343 |
TBool retVal;
|
|
344 |
TInt oldMods=Client()->iWs.GetModifierState();
|
|
345 |
Client()->iWs.SetModifierState(aModifier,EToggleModifier);
|
|
346 |
TInt getMods=Client()->iWs.GetModifierState();
|
|
347 |
if (oldMods!=getMods)
|
|
348 |
{
|
|
349 |
_LIT(KLogOff,"Attempted to turn off modifiers 0x%x, 0x%x still on");
|
|
350 |
_LIT(KLogOn,"Attempted to turn on modifiers 0x%x, 0x%x still off");
|
|
351 |
iSettable|=aModifier;
|
|
352 |
Client()->iWs.SetModifierState(aModifier,ETurnOffModifier);
|
|
353 |
getMods=Client()->iWs.GetModifierState();
|
|
354 |
retVal=!(getMods&aModifier);
|
|
355 |
TEST(retVal);
|
|
356 |
if (!retVal)
|
|
357 |
LOG_MESSAGE3(KLogOff,aModifier,getMods&aModifier);
|
|
358 |
Client()->iWs.SetModifierState(aModifier,ETurnOnModifier);
|
|
359 |
getMods=Client()->iWs.GetModifierState();
|
|
360 |
retVal=getMods&aModifier;
|
|
361 |
TEST(retVal);
|
|
362 |
if (!retVal)
|
|
363 |
LOG_MESSAGE3(KLogOn,aModifier,getMods&aModifier);
|
|
364 |
Client()->iWs.SetModifierState(aModifier,ETurnOffModifier);
|
|
365 |
getMods=Client()->iWs.GetModifierState();
|
|
366 |
retVal=!(getMods&aModifier);
|
|
367 |
TEST(retVal);
|
|
368 |
if (!retVal)
|
|
369 |
LOG_MESSAGE3(KLogOff,aModifier,getMods&aModifier);
|
|
370 |
if (oldMods&aModifier)
|
|
371 |
Client()->iWs.SetModifierState(aModifier,ETurnOnModifier);
|
|
372 |
}
|
|
373 |
else
|
|
374 |
{
|
|
375 |
Client()->iWs.SetModifierState(aModifier,ETurnOffModifier);
|
|
376 |
retVal=oldMods==Client()->iWs.GetModifierState();
|
|
377 |
TEST(retVal);
|
|
378 |
if (!retVal)
|
|
379 |
{
|
|
380 |
_LIT(KLog,"Attempted to turn off modifiers 0x%x, suceeded when it should have failed");
|
|
381 |
LOG_MESSAGE2(KLog,aModifier);
|
|
382 |
}
|
|
383 |
Client()->iWs.SetModifierState(aModifier,ETurnOnModifier);
|
|
384 |
retVal=oldMods==Client()->iWs.GetModifierState();
|
|
385 |
TEST(retVal);
|
|
386 |
if (!retVal)
|
|
387 |
{
|
|
388 |
_LIT(KLog,"Attempted to turn on modifiers 0x%x, suceeded when it should have failed");
|
|
389 |
LOG_MESSAGE2(KLog,aModifier);
|
|
390 |
}
|
|
391 |
}
|
|
392 |
}
|
|
393 |
|
|
394 |
void CTModifiersChanged::SetModifiers()
|
|
395 |
{
|
|
396 |
iModSetTest=ETrue;
|
|
397 |
for(TInt mod=1;mod!=0;mod<<=1)
|
|
398 |
CheckModifier((TEventModifier)mod);
|
|
399 |
iWin->Invalidate();
|
|
400 |
Client()->iWs.Flush();
|
|
401 |
}
|
|
402 |
|
|
403 |
void CTModifiersChanged::SendEvents()
|
|
404 |
{
|
|
405 |
iTest->LogSubState(iSubState);
|
|
406 |
switch (iSubState)
|
|
407 |
{
|
|
408 |
case 0:
|
|
409 |
iTest->SimulateKeyDownUp(EStdKeyCapsLock);
|
|
410 |
break;
|
|
411 |
case 1:
|
|
412 |
iTest->SimulateKeyDownUp(EStdKeyCapsLock);
|
|
413 |
break;
|
|
414 |
case 2:
|
|
415 |
iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
|
|
416 |
break;
|
|
417 |
case 3:
|
|
418 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
|
|
419 |
break;
|
|
420 |
case 4:
|
|
421 |
iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);
|
|
422 |
break;
|
|
423 |
case 5:
|
|
424 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift);
|
|
425 |
break;
|
|
426 |
case 6:
|
|
427 |
iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
|
|
428 |
break;
|
|
429 |
case 7:
|
|
430 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
|
|
431 |
break;
|
|
432 |
case 8:
|
|
433 |
iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftCtrl);
|
|
434 |
break;
|
|
435 |
case 9:
|
|
436 |
iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftCtrl);
|
|
437 |
break;
|
|
438 |
default:
|
|
439 |
TEST(EFalse);
|
|
440 |
return;
|
|
441 |
}
|
|
442 |
TheClient->iWs.Flush();
|
|
443 |
}
|
|
444 |
|
|
445 |
void CTModifiersChanged::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
446 |
{
|
|
447 |
_LIT(KModChange,"Modifier Change");
|
|
448 |
_LIT(KTestErrors,"Bad Parameter");
|
|
449 |
((CTModifiersChangedStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
|
450 |
switch(++iTest->iState)
|
|
451 |
{
|
|
452 |
/**
|
|
453 |
@SYMTestCaseID GRAPHICS-WSERV-0239
|
|
454 |
|
|
455 |
@SYMDEF DEF081259
|
|
456 |
|
|
457 |
@SYMTestCaseDesc Test modifier changed message
|
|
458 |
|
|
459 |
@SYMTestPriority High
|
|
460 |
|
|
461 |
@SYMTestStatus Implemented
|
|
462 |
|
|
463 |
@SYMTestActions Test that modifier changed message functions correctly
|
|
464 |
|
|
465 |
@SYMTestExpectedResults The message functions correctly
|
|
466 |
*/
|
|
467 |
case 1:
|
|
468 |
((CTModifiersChangedStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0239"));
|
|
469 |
iTest->LogSubTest(KModChange);
|
|
470 |
ModifierChangedEventsL();
|
|
471 |
// start a timer to cancel the sub-scheduler
|
|
472 |
iTimeOut->Start(KTimeOutAfter,TCallBack(CTModifiersChanged::TimeOut,this));
|
|
473 |
SendEvents();
|
|
474 |
iSubSchedulerRunning = ETrue;
|
|
475 |
CActiveScheduler::Start(); // sub-scheduler blocks this AO (test-framework) until completion
|
|
476 |
iTimeOut->Cancel();
|
|
477 |
((CTModifiersChangedStep*)iStep)->RecordTestResultL();
|
|
478 |
((CTModifiersChangedStep*)iStep)->CloseTMSGraphicsStep();
|
|
479 |
break;
|
|
480 |
/**
|
|
481 |
@SYMTestCaseID GRAPHICS-WSERV-0240
|
|
482 |
|
|
483 |
@SYMDEF DEF081259
|
|
484 |
|
|
485 |
@SYMTestCaseDesc Test bad parameters for modifier changed message
|
|
486 |
|
|
487 |
@SYMTestPriority High
|
|
488 |
|
|
489 |
@SYMTestStatus Implemented
|
|
490 |
|
|
491 |
@SYMTestActions Test using bad parameters for a modifier changed message
|
|
492 |
|
|
493 |
@SYMTestExpectedResults Responds correctly when bad parameters are used
|
|
494 |
*/
|
|
495 |
case 2:
|
|
496 |
((CTModifiersChangedStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0240"));
|
|
497 |
iTest->LogSubTest(KTestErrors);
|
|
498 |
BadParams();
|
|
499 |
((CTModifiersChangedStep*)iStep)->RecordTestResultL();
|
|
500 |
break;
|
|
501 |
default:
|
|
502 |
ResetModifiers(); // reset modifiers, so further tests are not influenced
|
|
503 |
((CTModifiersChangedStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
504 |
((CTModifiersChangedStep*)iStep)->CloseTMSGraphicsStep();
|
|
505 |
TestComplete();
|
|
506 |
}
|
|
507 |
|
|
508 |
|
|
509 |
}
|
|
510 |
|
|
511 |
__WS_CONSTRUCT_STEP__(ModifiersChanged)
|