|
1 // Copyright (c) 2005-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 // Contains implementation of CTestVersionStep class |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 // System Include |
|
24 #include <bookmarkdatabase.h> |
|
25 |
|
26 // User Include |
|
27 #include "TestVersionStep.h" |
|
28 |
|
29 /** |
|
30 Constructor. Sets the test step name |
|
31 @internalTechnology |
|
32 @test |
|
33 */ |
|
34 CTestVersionStep::CTestVersionStep(CTestBookmarksServer& aTestServer) : CTestBookmarksBaseStep(aTestServer) |
|
35 { |
|
36 //Call base class method to set human readable name for test step |
|
37 SetTestStepName(KTestVersionStep); |
|
38 } |
|
39 |
|
40 |
|
41 /** |
|
42 Base class pure virtual. |
|
43 @internalTechnology |
|
44 @test |
|
45 @param None |
|
46 @return EPass or EFail indicating the result of the test step. |
|
47 */ |
|
48 TVerdict CTestVersionStep::doTestStepL() |
|
49 { |
|
50 TInt major; |
|
51 TInt minor; |
|
52 TInt build; |
|
53 |
|
54 if(!GetIntFromConfig(ConfigSection(), KIniMajor, major ) || |
|
55 !GetIntFromConfig(ConfigSection(), KIniMinor, minor ) || |
|
56 !GetIntFromConfig(ConfigSection(), KIniBuild, build ) |
|
57 ) |
|
58 { |
|
59 ERR_PRINTF4(_L("Problem in reading values from ini. \ |
|
60 \nExpected fields are : \n%S\n%S\n%S\n" |
|
61 ),&KIniMajor, &KIniMinor, &KIniBuild |
|
62 ); |
|
63 SetTestStepResult(EFail); |
|
64 } |
|
65 else |
|
66 { |
|
67 DoTest(major, minor, build); |
|
68 } |
|
69 return TestStepResult(); |
|
70 } // doTestStepL |
|
71 |
|
72 /** |
|
73 Gets the version and compares with values specified in ini |
|
74 @internalTechnology |
|
75 @test |
|
76 @param Major version |
|
77 @param Minor version |
|
78 @param Build version |
|
79 @return None |
|
80 */ |
|
81 void CTestVersionStep::DoTest(const TInt& aMajor, const TInt& aMinor, const TInt& aBuild) |
|
82 { |
|
83 TVersion version = iBkDb.Version(); |
|
84 |
|
85 INFO_PRINTF4(_L("Version expected = %D.%D.%D"), aMajor, aMinor, aBuild); |
|
86 INFO_PRINTF4(_L("Version returned = %D.%D.%D"), version.iMajor, version.iMinor, version.iBuild); |
|
87 |
|
88 // Examine major, minor and build versions |
|
89 if(version.iMajor != aMajor) |
|
90 { |
|
91 ERR_PRINTF1(_L("Major version did not match")); |
|
92 SetTestStepResult(EFail); |
|
93 } |
|
94 if(version.iMinor != aMinor) |
|
95 { |
|
96 ERR_PRINTF1(_L("Minor version did not match")); |
|
97 SetTestStepResult(EFail); |
|
98 } |
|
99 if(version.iBuild != aBuild) |
|
100 { |
|
101 ERR_PRINTF1(_L("Build version did not match")); |
|
102 SetTestStepResult(EFail); |
|
103 } |
|
104 } // DoTest |
|
105 |
|
106 |