|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * tpropertystep.cpp |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <e32property.h> |
|
21 #include "numberconversion.h" |
|
22 #include "tupspropertystep.h" |
|
23 |
|
24 CPropertyStep::CPropertyStep() |
|
25 /** |
|
26 * Constructor |
|
27 */ |
|
28 { |
|
29 SetTestStepName(KPropertyStep); |
|
30 } |
|
31 |
|
32 CPropertyStep::~CPropertyStep() |
|
33 /** |
|
34 * Destructor |
|
35 */ |
|
36 { |
|
37 __UHEAP_MARKEND; |
|
38 } |
|
39 |
|
40 TVerdict CPropertyStep::doTestStepPreambleL() |
|
41 /** |
|
42 * @return - TVerdict code |
|
43 * Override of base class virtual |
|
44 */ |
|
45 { |
|
46 __UHEAP_MARK; |
|
47 SetTestStepResult(EPass); |
|
48 return TestStepResult(); |
|
49 } |
|
50 |
|
51 TVerdict CPropertyStep::doTestStepPostambleL() |
|
52 /** |
|
53 * @return - TVerdict code |
|
54 * Override of base class virtual |
|
55 */ |
|
56 { |
|
57 return TestStepResult(); |
|
58 } |
|
59 |
|
60 TVerdict CPropertyStep::doTestStepL() |
|
61 { |
|
62 |
|
63 INFO_PRINTF1(_L(">> CPropertyStep::doTestStepL()")); |
|
64 |
|
65 TInt index = 1; |
|
66 |
|
67 TName fPropertyName; |
|
68 fPropertyName.Format(_L("PropertyName_%d"),index); |
|
69 TName fPropertyCreate; |
|
70 fPropertyCreate.Format(_L("PropertyCreate_%d"),index); |
|
71 TName fPropertyKey; |
|
72 fPropertyKey.Format(_L("PropertyKey_%d"),index); |
|
73 TName fPropertyType; |
|
74 fPropertyType.Format(_L("PropertyType_%d"),index); |
|
75 |
|
76 TPtrC propertyName; |
|
77 TBool propertyCreate; |
|
78 TInt propertyKey; |
|
79 TInt propertyType; |
|
80 |
|
81 GetStringFromConfig(ConfigSection(), fPropertyName, propertyName); |
|
82 GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate); |
|
83 GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey); |
|
84 GetIntFromConfig(ConfigSection(),fPropertyType, propertyType); |
|
85 |
|
86 // read all the property details in from the ini file |
|
87 while (GetStringFromConfig(ConfigSection(), fPropertyName, propertyName) |
|
88 && GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate) |
|
89 && GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey) |
|
90 && GetIntFromConfig(ConfigSection(),fPropertyType, propertyType)) |
|
91 { |
|
92 // INFO_PRINTF2(_L("Read test action %d"),index); // debug |
|
93 |
|
94 if (propertyCreate) |
|
95 { |
|
96 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); |
|
97 if (propertyType == static_cast<TInt>(RProperty::EInt)) |
|
98 { |
|
99 RProperty::Define(propertyKey, RProperty::EInt, KAllowAllPolicy, KAllowAllPolicy); |
|
100 } |
|
101 else |
|
102 { |
|
103 RProperty::Define(propertyKey, RProperty::EByteArray, KAllowAllPolicy, KAllowAllPolicy); |
|
104 } |
|
105 } |
|
106 else |
|
107 { |
|
108 RProperty::Delete(propertyKey); |
|
109 } |
|
110 ++index; |
|
111 fPropertyName.Format(_L("PropertyName_%d"), index); |
|
112 fPropertyCreate.Format(_L("PropertyCreate_%d"), index); |
|
113 fPropertyKey.Format(_L("PropertyKey_%d"), index); |
|
114 fPropertyType.Format(_L("PropertyType_%d"), index); |
|
115 |
|
116 GetStringFromConfig(ConfigSection(), fPropertyName, propertyName); |
|
117 GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate); |
|
118 GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey); |
|
119 GetIntFromConfig(ConfigSection(),fPropertyType, propertyType); |
|
120 |
|
121 } |
|
122 SetTestStepResult(EPass); |
|
123 return TestStepResult(); |
|
124 } |