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