author | Maciej Seroka <maciejs@symbian.org> |
Thu, 10 Dec 2009 15:51:05 +0000 | |
changeset 821 | b24df46a3102 |
parent 276 | 140d2eb79802 |
child 872 | 17498133d9ad |
permissions | -rw-r--r-- |
276
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
2 |
// All rights reserved. |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
7 |
// |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
8 |
// Initial Contributors: |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
10 |
// |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
11 |
// Contributors: |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
12 |
// |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
13 |
// Description: |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
14 |
// This contains CTestAppLoaderKeyEvents |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
15 |
// |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
16 |
// |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
17 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
18 |
// USER includes |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
19 |
#include "TestAppLoaderKeyEvents.h" |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
20 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
21 |
// EPOC includes |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
22 |
#include <w32std.h> |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
23 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
24 |
/*@{*/ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
25 |
const TInt KDelayMultiplier = 1000; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
26 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
27 |
/// Parameters |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
28 |
_LIT(KKey, "key%d"); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
29 |
_LIT(KDelay, "delay%d"); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
30 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
31 |
/// Key codes |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
32 |
_LIT(KKeyNull, "EKeyNull"); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
33 |
_LIT(KKeyDevice0, "EKeyDevice0"); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
34 |
_LIT(KKeyDevice1, "EKeyDevice1"); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
35 |
/*@}*/ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
36 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
37 |
// constructor |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
38 |
CTestAppLoaderKeyEvents::CTestAppLoaderKeyEvents() |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
39 |
: CTestAppLoaderBase() |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
40 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
41 |
SetTestStepName(_L("KeyEvents")); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
42 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
43 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
44 |
TBool CTestAppLoaderKeyEvents::GetKeyCodeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TKeyCode& aResult, TStdScanCode& aScanCode) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
45 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
46 |
TPtrC str; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
47 |
TBool ret=GetStringFromConfig(aSectName, aKeyName, str); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
48 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
49 |
if ( ret ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
50 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
51 |
if ( str==KKeyNull ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
52 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
53 |
aResult=EKeyNull; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
54 |
aScanCode=EStdKeyNull; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
55 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
56 |
else if ( str==KKeyDevice0 ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
57 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
58 |
aResult=EKeyDevice0; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
59 |
aScanCode=EStdKeyDevice0; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
60 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
61 |
else if ( str==KKeyDevice1 ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
62 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
63 |
aResult=EKeyDevice1; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
64 |
aScanCode=EStdKeyDevice1; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
65 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
66 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
67 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
68 |
return ret; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
69 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
70 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
71 |
// Each test step must supply a implementation for doTestStepL |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
72 |
enum TVerdict CTestAppLoaderKeyEvents::doTestStepL( void ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
73 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
74 |
// Printing to the console and log file |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
75 |
INFO_PRINTF1(_L("TEST-> KEY EVENTS")); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
76 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
77 |
RWsSession ws; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
78 |
User::LeaveIfError(ws.Connect()); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
79 |
CleanupClosePushL(ws); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
80 |
TBuf<KMaxTestExecuteCommandLength> tempStore; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
81 |
TInt index=0; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
82 |
TBool moreData=ETrue; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
83 |
TKeyCode keyCode; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
84 |
TStdScanCode scanCode; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
85 |
TInt delay; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
86 |
while ( moreData ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
87 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
88 |
tempStore.Format(KKey(), ++index); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
89 |
if ( GetKeyCodeFromConfig(ConfigSection(), tempStore, keyCode, scanCode) ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
90 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
91 |
TKeyEvent event = {keyCode, scanCode, 0, 0}; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
92 |
ws.SimulateKeyEvent(event); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
93 |
ws.Flush(); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
94 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
95 |
tempStore.Format(KDelay(), index); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
96 |
if ( GetIntFromConfig(ConfigSection(), tempStore, delay) ) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
97 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
98 |
User::After(delay*KDelayMultiplier); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
99 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
100 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
101 |
else |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
102 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
103 |
moreData=EFalse; |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
104 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
105 |
} |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
106 |
CleanupStack::PopAndDestroy(&ws); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
107 |
|
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
108 |
// test steps return a result |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
109 |
return TestStepResult(); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
110 |
} |