|
1 /* |
|
2 * Copyright (c) 2005-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 "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 * Example CTestStep derived implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file WriteHexStep.cpp |
|
23 */ |
|
24 #include "WriteHexStep.h" |
|
25 #include "Te_RegStepTestSuiteDefs.h" |
|
26 |
|
27 CWriteHexStep::~CWriteHexStep() |
|
28 /** |
|
29 * Destructor |
|
30 */ |
|
31 { |
|
32 } |
|
33 |
|
34 CWriteHexStep::CWriteHexStep() |
|
35 /** |
|
36 * Constructor |
|
37 */ |
|
38 { |
|
39 // **MUST** call SetTestStepName in the constructor as the controlling |
|
40 // framework uses the test step name immediately following construction to set |
|
41 // up the step's unique logging ID. |
|
42 SetTestStepName(KWriteHexStep); |
|
43 } |
|
44 |
|
45 TVerdict CWriteHexStep::doTestStepPreambleL() |
|
46 /** |
|
47 * @return - TVerdict code |
|
48 * Override of base class virtual |
|
49 */ |
|
50 { |
|
51 // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. |
|
52 SetTestStepResult(EPass); |
|
53 return TestStepResult(); |
|
54 } |
|
55 |
|
56 |
|
57 TVerdict CWriteHexStep::doTestStepL() |
|
58 /** |
|
59 * @return - TVerdict code |
|
60 * Override of base class pure virtual |
|
61 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
62 * not leave. That being the case, the current test result value will be EPass. |
|
63 */ |
|
64 { |
|
65 INFO_PRINTF1(_L("This step tests WriteHexToConfig function.")); |
|
66 SetTestStepResult(EFail); |
|
67 |
|
68 TInt TheHex; |
|
69 TInt originalValue; |
|
70 |
|
71 if(!GetHexFromConfig(ConfigSection(),KTe_RegStepTestSuiteHex, originalValue)) |
|
72 { |
|
73 // Leave if there's any error. |
|
74 User::Leave(KErrNotFound); |
|
75 } |
|
76 |
|
77 INFO_PRINTF2(_L("The ORIGINAL Hex-value is %d"),originalValue); // Block end |
|
78 TheHex=1234; |
|
79 if (WriteHexToConfig(ConfigSection(),KTe_RegStepTestSuiteHex,TheHex)) |
|
80 { |
|
81 if (GetHexFromConfig(ConfigSection(),KTe_RegStepTestSuiteHex, TheHex) && TheHex==1234) |
|
82 { |
|
83 INFO_PRINTF2(_L("The CHANGED Hex-value is %d"),TheHex); |
|
84 SetTestStepResult(EPass); |
|
85 } |
|
86 } |
|
87 |
|
88 if (!WriteHexToConfig(ConfigSection(),KTe_RegStepTestSuiteHex,originalValue)) |
|
89 { |
|
90 SetTestStepResult(EFail); |
|
91 } |
|
92 |
|
93 return TestStepResult(); |
|
94 } |
|
95 |
|
96 |
|
97 |
|
98 TVerdict CWriteHexStep::doTestStepPostambleL() |
|
99 /** |
|
100 * @return - TVerdict code |
|
101 * Override of base class virtual |
|
102 */ |
|
103 { |
|
104 return TestStepResult(); |
|
105 } |