|
1 /* |
|
2 * Copyright (c) 2005 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 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPOSTP122_H |
|
21 #define CPOSTP122_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "FT_CLandmarkTestProcedureBase.h" |
|
25 #include <EPos_CPosLmNearestCriteria.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPosLmMultiDbSearch; |
|
29 class CNearestSearchResult; |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Test procedure 122 |
|
34 */ |
|
35 class CPosTp122 : public CLandmarkTestProcedureBase |
|
36 { |
|
37 public: // Constructors and destructor |
|
38 |
|
39 /** |
|
40 * C++ default constructor. |
|
41 */ |
|
42 |
|
43 CPosTp122(TInt tpno, CStifLogger* aLog) : CLandmarkTestProcedureBase(tpno, aLog) {iErrorsFound = KErrNone;}; |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 ~CPosTp122() {}; |
|
48 |
|
49 public: // Functions from base classes |
|
50 |
|
51 |
|
52 |
|
53 void CloseTest(); |
|
54 |
|
55 |
|
56 void InitTestL(); |
|
57 |
|
58 /** |
|
59 * From CLandmarkTestProcedureBase |
|
60 * Runs the test in the module |
|
61 */ |
|
62 void StartL(); |
|
63 |
|
64 private: |
|
65 |
|
66 enum TTp122SortOrder |
|
67 { |
|
68 ESortNone, |
|
69 ESortAscending, |
|
70 ESortDescending |
|
71 }; |
|
72 |
|
73 void AppendNearestSearchResultsL(); |
|
74 |
|
75 void TestLeaveCodesL(); |
|
76 |
|
77 void CancelTestL(const RPointerArray<CNearestSearchResult>& aSearchResults, |
|
78 TBool aCancelInCallback); |
|
79 |
|
80 void StartSearchOperationL( |
|
81 const RPointerArray<CNearestSearchResult>& aSearchResults, |
|
82 TExecutionMode aExecutionMode = ESynchronous, |
|
83 TTp122SortOrder aSortOrder = ESortNone, |
|
84 TInt aNrOfSearches = 0); |
|
85 |
|
86 void SearchL( |
|
87 CPosLmNearestCriteria* aNearestSearchCriteria, |
|
88 TExecutionMode aExecutionMode, |
|
89 TBool aRefinedSearch = EFalse, |
|
90 TTp122SortOrder aSortOrder = ESortNone); |
|
91 |
|
92 void TestMaximumNrOfMatchesL( |
|
93 const RPointerArray<CNearestSearchResult>& aSearchResults, |
|
94 TExecutionMode aExecutionMode, TTp122SortOrder aSortOrder); |
|
95 |
|
96 void ValidateTotalNrOfMatchesL( |
|
97 TUint aRetrievedNrOfMatches, |
|
98 TUint aExpectedNrOfMatches); |
|
99 |
|
100 TInt NrOfSearchErrors(CPosLmMultiDbSearch* aMultiDbSearcher); |
|
101 |
|
102 void TestOnTheFlySearchL(const RPointerArray<CNearestSearchResult>& aSearchResults); |
|
103 |
|
104 void ValidateIdL(TPosLmItemId aId, TInt aDbIndex); |
|
105 |
|
106 void PrepareDatabasesL(); |
|
107 |
|
108 void CheckSearchResultL(CNearestSearchResult& aSearchResult, TTp122SortOrder aSortOrder); |
|
109 |
|
110 void PrintLm(CPosLandmarkDatabase* db); |
|
111 |
|
112 void DoLastTestPartL(const RPointerArray<CNearestSearchResult>& aSearchResults); |
|
113 |
|
114 void CheckDbL(); |
|
115 |
|
116 void SetupLimits(); |
|
117 |
|
118 private: |
|
119 |
|
120 CDesCArray* iDatabases; |
|
121 CPosLmMultiDbSearch* iMultiDbSearch; |
|
122 TInt iNrOfDatabases; |
|
123 |
|
124 RPointerArray<CNearestSearchResult> iNearestSearchResults; |
|
125 TInt iErrorsFound; |
|
126 |
|
127 CPosLmDisplayData* iDisplayData; |
|
128 TBool iPartial; |
|
129 |
|
130 TUint iIdDb1Min; |
|
131 TUint iIdDb1Max; |
|
132 TUint iIdDb2Min; |
|
133 TUint iIdDb2Max; |
|
134 TUint iIdDb3Min; |
|
135 TUint iIdDb3Max; |
|
136 TUint iIdDb4Min; |
|
137 TUint iIdDb4Max; |
|
138 TUint iIdDb5Min; |
|
139 TUint iIdDb5Max; |
|
140 |
|
141 }; |
|
142 |
|
143 // Commented for testing -- Moved these class defines to FT_CPosTp35.h |
|
144 |
|
145 class TSearchResult |
|
146 { |
|
147 public: |
|
148 |
|
149 TSearchResult(); |
|
150 |
|
151 TSearchResult(const TPosLmItemId& aId, const TReal32& aDistance); |
|
152 |
|
153 TReal64 Distance() const; |
|
154 |
|
155 TPosLmItemId Id() const; |
|
156 |
|
157 private: |
|
158 friend class CPosTp122; |
|
159 |
|
160 TReal32 iDistance; |
|
161 TPosLmItemId iId; |
|
162 |
|
163 }; |
|
164 |
|
165 |
|
166 |
|
167 class CNearestSearchResult : public CSearchResultBase |
|
168 { |
|
169 |
|
170 public: // Constructors and destructor |
|
171 |
|
172 /** |
|
173 * Two-phased constructor. |
|
174 */ |
|
175 static CNearestSearchResult* NewL( |
|
176 const TDesC& aDes, |
|
177 const TInt& aIndex, |
|
178 RFs& aFileSession); |
|
179 |
|
180 /** |
|
181 * Destructor. |
|
182 */ |
|
183 ~CNearestSearchResult(); |
|
184 |
|
185 public: |
|
186 |
|
187 TReal64 Latitude() const; |
|
188 |
|
189 TReal64 Longitude() const; |
|
190 |
|
191 TBool UseCoverageRadius() const; |
|
192 |
|
193 TReal32 MaxDistance() const; |
|
194 |
|
195 TInt ErrorCode() const; |
|
196 |
|
197 void Print(TDes& aDes); |
|
198 |
|
199 void PrintDistances(TDes& aPrint); |
|
200 |
|
201 private: |
|
202 |
|
203 /** |
|
204 * Constructor. |
|
205 */ |
|
206 CNearestSearchResult(RFs& aFileSession); |
|
207 |
|
208 void ConstructL(const TDesC& aDes, const TInt& aIndex); |
|
209 |
|
210 void AppendDistancesL(const TInt& aIndex); |
|
211 |
|
212 void ParseDistanceL(const TDesC& aDes, const TInt& aIndex, const TPosLmItemId& aId); |
|
213 |
|
214 void SortDistances(); |
|
215 |
|
216 private: |
|
217 |
|
218 // By default, prohibit copy constructor |
|
219 CNearestSearchResult(const CNearestSearchResult&); |
|
220 // Prohibit assigment operator |
|
221 CNearestSearchResult& operator=(const CNearestSearchResult&); |
|
222 |
|
223 private: // Data |
|
224 |
|
225 friend class CPosTp122; |
|
226 |
|
227 enum TValueIndex |
|
228 { |
|
229 ELatitude =1, |
|
230 ELongitude =2, |
|
231 EUseCoverageRadius =3, |
|
232 EMaxDistance =4, |
|
233 EErrorCode =5, |
|
234 ERedefined =6, |
|
235 EMaxSearchResult =7, |
|
236 ESearchResult =8 |
|
237 }; |
|
238 |
|
239 TInt iErrorCode; |
|
240 TReal64 iLatitude; |
|
241 TReal64 iLongitude; |
|
242 TBool iUseCoverageRadius; |
|
243 TReal32 iMaxDistance; |
|
244 TInt iMaxSearchResult; |
|
245 |
|
246 RArray<TSearchResult> iDistances; |
|
247 |
|
248 CPosLandmarkDatabase* iDatabase; |
|
249 RFs& iFileSession; |
|
250 }; |
|
251 |
|
252 |
|
253 #endif // CPOSTP122_H |
|
254 |
|
255 // End of File |