|
1 /* |
|
2 * Copyright (c) 2007 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: Provides testing of TPosLmSortPref class methods |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <EPos_CPosLandmark.h> |
|
22 #include <EPos_CPosLandmarkDatabase.h> |
|
23 #include <EPos_CPosLmCategoryManager.h> |
|
24 #include <EPos_CPosLandmarkCategory.h> |
|
25 #include <LbsPosition.h> |
|
26 #include "testtposlmsortpref.h" |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // TTestPosLmSortPref::TTestPosLmSortPref |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 TTestPosLmSortPref::TTestPosLmSortPref( CStifLogger* aLog ) |
|
37 { |
|
38 iLog = aLog; |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // TTestPosLmSortPref::CreateSortPref |
|
43 // |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 TInt TTestPosLmSortPref::CreateSortPref( CStifItemParser& /*aItem*/ ) |
|
48 { |
|
49 // Create , sorting by position in ascending order |
|
50 TPosLmSortPref sortPref( CPosLandmark::EPosition ); |
|
51 // |
|
52 iLog->Log(_L("CreateSortPref succeeds")); |
|
53 return KErrNone; |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // TTestPosLmSortPref::GetSortOrder |
|
58 // |
|
59 // |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 TInt TTestPosLmSortPref::GetSortOrder( CStifItemParser& /*aItem*/ ) |
|
63 { |
|
64 // Create , sorting by position in ascending order |
|
65 TPosLmSortPref sortPref( CPosLandmark::EPosition ); |
|
66 // Get |
|
67 TPosLmSortPref::TSortOrder sortOrder = sortPref.SortOrder(); |
|
68 // Check |
|
69 if( sortOrder != TPosLmSortPref::EAscending ) |
|
70 { |
|
71 iLog->Log(_L("Error in GetSortOrder")); |
|
72 return KErrGeneral; |
|
73 } |
|
74 iLog->Log(_L("GetSortOrder succeeds")); |
|
75 return KErrNone; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // TTestPosLmSortPref::SetAndGetSortAttr |
|
80 // |
|
81 // |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 TInt TTestPosLmSortPref::SetAndGetSortAttr( CStifItemParser& /*aItem*/ ) |
|
85 { |
|
86 TPosLmSortPref sortPref( CPosLandmark::EPosition ); |
|
87 // Set, sort by name |
|
88 sortPref.SetSortByLandmarkAttribute( CPosLandmark::ELandmarkName ); |
|
89 // Get |
|
90 CPosLandmark::TAttributes attr = sortPref.LandmarkAttributeToSortBy(); |
|
91 // Compare |
|
92 if( attr != CPosLandmark::ELandmarkName ) |
|
93 { |
|
94 iLog->Log(_L("Error in SetAndGetSortAttr")); |
|
95 return KErrGeneral; |
|
96 } |
|
97 iLog->Log(_L("SetAndGetSortAttr succeeds")); |
|
98 return KErrNone; |
|
99 } |