|
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 // INCLUDES |
|
21 #include "FT_CPosTp40.h" |
|
22 #include <EPos_CPosLandmarkDatabase.h> |
|
23 #include <EPos_CPosLmTextCriteria.h> |
|
24 |
|
25 // ================= MEMBER FUNCTIONS ======================= |
|
26 |
|
27 // --------------------------------------------------------- |
|
28 // CPosTp40::GetName |
|
29 // |
|
30 // (other items were commented in a header). |
|
31 // --------------------------------------------------------- |
|
32 // |
|
33 void CPosTp40::GetName(TDes& aName) const |
|
34 { |
|
35 _LIT(KTestName, "Tp40 - Verify KErrLocked not returned, etc"); |
|
36 aName = KTestName; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------- |
|
40 // CPosTp40::CloseTest |
|
41 // |
|
42 // (other items were commented in a header). |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 void CPosTp40::CloseTest() |
|
46 { |
|
47 delete iDatabase; |
|
48 iDatabase = NULL; |
|
49 } |
|
50 // --------------------------------------------------------- |
|
51 // CPosTp40::StartL |
|
52 // |
|
53 // (other items were commented in a header). |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 void CPosTp40::StartL() |
|
57 { |
|
58 RemoveDefaultDbL(); |
|
59 |
|
60 iDatabase = CPosLandmarkDatabase::OpenL(); |
|
61 if (iDatabase->IsInitializingNeeded()) |
|
62 { |
|
63 ExecuteAndDeleteLD(iDatabase->InitializeL()); // Synchronous since no argument |
|
64 } |
|
65 |
|
66 ExecuteAndDeleteLD(iDatabase->CompactL()); |
|
67 |
|
68 // Test error report ESLI-5ZYMPM |
|
69 TestPart1L(); |
|
70 ExecuteAndDeleteLD(iDatabase->CompactL()); |
|
71 // Test error report ESLI-62FGEV, (debug panic, only raised on WINS (not on target)) |
|
72 TestPart2L(); |
|
73 |
|
74 delete iDatabase; |
|
75 iDatabase = NULL; |
|
76 } |
|
77 // --------------------------------------------------------- |
|
78 // CPosTp40::TestPart1L |
|
79 // |
|
80 // (other items were commented in a header). |
|
81 // --------------------------------------------------------- |
|
82 // |
|
83 void CPosTp40::TestPart1L() |
|
84 { |
|
85 // |
|
86 // Testing error report ESLI-5ZYMPM |
|
87 // Landmarks - KErrLocked returned on write operations even if no operations are outstanding. |
|
88 // |
|
89 iLog->Put(_L("TestPart1L")); |
|
90 |
|
91 CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*iDatabase); |
|
92 CleanupStack::PushL(landmarkSearch); |
|
93 |
|
94 CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC(); |
|
95 textCriteria->SetTextL(_L("Library*")); |
|
96 |
|
97 CPosLmOperation* operation = landmarkSearch->StartLandmarkSearchL(*textCriteria); |
|
98 RArray<TPosLmItemId> arr1; |
|
99 CleanupClosePushL(arr1); |
|
100 TPosLmItemId id1(1); |
|
101 TPosLmItemId id2(2); |
|
102 arr1.Append(id1); |
|
103 arr1.Append(id2); |
|
104 operation -> ExecuteL(); |
|
105 |
|
106 CPosLmOperation* operationPartial = iDatabase -> PreparePartialLandmarksL(arr1); |
|
107 CleanupStack::PushL(operationPartial); |
|
108 delete operation; //if this is moved to before PreparePartial... everything works |
|
109 operation = NULL; |
|
110 operationPartial->ExecuteL(); |
|
111 |
|
112 iDatabase -> RemoveLandmarkL(1); //Before leaved with -22 here -> ERROR |
|
113 CleanupStack::PopAndDestroy(operationPartial); |
|
114 CleanupStack::PopAndDestroy(&arr1); |
|
115 CleanupStack::PopAndDestroy(textCriteria); |
|
116 CleanupStack::PopAndDestroy(landmarkSearch); |
|
117 iLog->Put(_L("TestPart1L completed successfully")); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CPosTp40::TestPart2L |
|
122 // |
|
123 // (other items were commented in a header). |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 void CPosTp40::TestPart2L() |
|
127 { |
|
128 // |
|
129 // Testing error report ESLI-62FGEV |
|
130 // Landmarks - TPosLmItemId array with 0 value and PreparePartialLandmarksL |
|
131 // |
|
132 iLog->Put(_L("TestPart2L")); |
|
133 |
|
134 CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*iDatabase); |
|
135 CleanupStack::PushL(landmarkSearch); |
|
136 CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC(); |
|
137 textCriteria->SetTextL(_L("Library*")); |
|
138 |
|
139 CPosLmOperation* operation = landmarkSearch->StartLandmarkSearchL(*textCriteria); |
|
140 RArray<TPosLmItemId> arr1; |
|
141 CleanupClosePushL(arr1); |
|
142 TPosLmItemId id1(0); // Is actually not allowed to have a 0 value |
|
143 TPosLmItemId id2(1); |
|
144 arr1.Append(id1); |
|
145 arr1.Append(id2); |
|
146 operation -> ExecuteL(); |
|
147 |
|
148 // When passing an array with 0 value method should leave with error, |
|
149 // instead the operationPartial->ExecuteL() method panics with -2 |
|
150 CPosLmOperation* operationPartial = iDatabase -> PreparePartialLandmarksL(arr1); |
|
151 CleanupStack::PushL(operationPartial); |
|
152 delete operation; |
|
153 operation = NULL; |
|
154 // This method Panics (debug panic only on WINS) with -2 |
|
155 operationPartial->ExecuteL(); |
|
156 |
|
157 CleanupStack::PopAndDestroy(operationPartial); |
|
158 CleanupStack::PopAndDestroy(&arr1); |
|
159 CleanupStack::PopAndDestroy(textCriteria); |
|
160 CleanupStack::PopAndDestroy(landmarkSearch); |
|
161 iLog->Put(_L("TestPart2L completed successfully")); |
|
162 } |
|
163 |
|
164 // End of File |