|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 #ifndef CASTORAGETEST_H |
|
18 #define CASTORAGETEST_H |
|
19 |
|
20 // INCLUDES |
|
21 #include <e32svr.h> |
|
22 #include <e32math.h> |
|
23 #include <f32file.h> |
|
24 #include <QtTest/QtTest> |
|
25 #include <QString> |
|
26 |
|
27 #include "cainnerquery.h" |
|
28 |
|
29 class CCaStorage; |
|
30 class CCaInnerEntry; |
|
31 |
|
32 class CCAStorageTest : public QObject |
|
33 { |
|
34 Q_OBJECT |
|
35 |
|
36 private slots: |
|
37 |
|
38 /** |
|
39 * Test methods are listed below. |
|
40 */ |
|
41 |
|
42 |
|
43 |
|
44 //tests for add command |
|
45 void testAdd(); |
|
46 //tests for add command without icon |
|
47 void testAddEmptyIcon(); |
|
48 //tests for add command with icon |
|
49 void testAddWithIcon(); |
|
50 //tests for add command with existing icon |
|
51 void testAddWithExistingIcon(); |
|
52 //tests for add command with existing icon where only filename specified |
|
53 void testAddWithExistingIconOnlyFileName(); |
|
54 //tests for add command with partly matching icon |
|
55 void testAddWithPartlyMatchingIcon(); |
|
56 //tests for add command with partly matching icon when not all icon params where set |
|
57 void testAddWithPartlyMatchingIconNotAllParams(); |
|
58 //tests for add command with not complete icon |
|
59 void testAddWithNotCompleteIcon(); |
|
60 //tests for add command to update icon |
|
61 void testAddUpdateIcon(); |
|
62 //tests for add command to update icon with the same one |
|
63 void testAddUpdateIconOnlyFewParams(); |
|
64 //tests for add command to update icon |
|
65 void testAddUpdateWithEmptyIcon(); |
|
66 //tests for add command to update icon |
|
67 void testAddUpdateWithEmptyIconAdvanced(); |
|
68 //tests for add command to update icon, to an already existing icon |
|
69 void testAddUpdateWithExistingIcon(); |
|
70 //tests for add command - add attributes |
|
71 void testAddAttributes(); |
|
72 //tests for add command - update attributes |
|
73 void testUpdateAttributes(); |
|
74 //tests for add command - remove attributes |
|
75 void testDeleteAttributes(); |
|
76 //tests for remove command |
|
77 void testRemoveOneEntryWithIcon(); |
|
78 |
|
79 void testRemoveOneEntryWhenIconIsUseByOtherEntry(); |
|
80 |
|
81 void testRemoveTwoEntriesWithSameIcon(); |
|
82 |
|
83 void testRemoveOneEntryWithoutIcon(); |
|
84 |
|
85 void testRemove5Entries(); |
|
86 |
|
87 void testRemoveEntriesWithIdOutOFBound(); |
|
88 |
|
89 void testTouch(); |
|
90 |
|
91 void testTouch2Times(); |
|
92 |
|
93 void testTouch5Entries(); |
|
94 |
|
95 void testRemoveOldFromLaunch(); |
|
96 |
|
97 void testRemoveOldWhen2DifferentLaunchTimes(); |
|
98 |
|
99 //tests getentries by id. |
|
100 void testGetEntriesById(); |
|
101 |
|
102 //tests getentries by group id. |
|
103 void testGetEntriesByGroupId(); |
|
104 |
|
105 //tests getentries by group id. |
|
106 void testGetEntriesByTypeName(); |
|
107 |
|
108 //tests getentries sorted by name. |
|
109 void testGetEntriesSortByName(); |
|
110 |
|
111 //tests getentries sorted by created timestamp. |
|
112 void testGetEntriesSortByCreatedTimestamp(); |
|
113 |
|
114 //tests getentries sorted by most used timestamp. |
|
115 void testGetEntriesSortByMostUsedTimestamp(); |
|
116 |
|
117 //tests getentries sorted by last used timestamp. |
|
118 void testGetEntriesSortByLastUsedTimestamp(); |
|
119 |
|
120 //tests getentries sorted by default. |
|
121 void testGetEntriesSortByDefault(); |
|
122 |
|
123 //tests getentries by flags. |
|
124 void testGetEntriesByFlags(); |
|
125 |
|
126 //tests getentries by flags off. |
|
127 void testGetEntriesByFlagsOff(); |
|
128 |
|
129 //tests getentries by flags on. |
|
130 void testGetEntriesByFlagsOn(); |
|
131 |
|
132 //tests getentries by flags on. |
|
133 void testGetEntriesByRole(); |
|
134 |
|
135 //tests getentries by flags. |
|
136 void testGetEntriesByUid(); |
|
137 |
|
138 //tests getentries by attributes. |
|
139 void testGetEntriesByAttributes(); |
|
140 |
|
141 //tests getentries by attributes. |
|
142 void testGetEntriesByAttributes2(); |
|
143 |
|
144 //tests getentries by child Id. |
|
145 void testGetEntriesByChildId(); |
|
146 |
|
147 //tests organize remove. |
|
148 void testOrganizeRemove(); |
|
149 |
|
150 //tests organize append. |
|
151 void testOrganizeAppend(); |
|
152 |
|
153 //tests organize prepend. |
|
154 void testOrganizePrepend(); |
|
155 |
|
156 //tests organize insert new entry into group. |
|
157 void testOrganizeInsertNewIntoGroup(); |
|
158 |
|
159 //tests organize get entries' ids. |
|
160 void testGetEntriesIds(); |
|
161 |
|
162 //tests organize bad parameters case. |
|
163 void testOrganizeBadParams(); |
|
164 |
|
165 void testGetNewEntryWithAttributes(); |
|
166 |
|
167 void testGetNewEntryWithAttributesByUid(); |
|
168 |
|
169 void testGetEntriesWhenLimitSetTo(); |
|
170 |
|
171 //tests custom sort |
|
172 void testCustomSort(); |
|
173 |
|
174 //tests get parent ids |
|
175 void testGetParentIds(); |
|
176 |
|
177 void testGetParentIdsInLoop(); |
|
178 |
|
179 //tests properties |
|
180 void testPropertyGetDbVersion(); |
|
181 |
|
182 void testPropertyGetLanguage(); |
|
183 |
|
184 void testLoadDBFromROM(); |
|
185 |
|
186 //tests localization |
|
187 void testRemoveFromLocalizationAfterNameChange(); |
|
188 |
|
189 void testGetLocalizations(); |
|
190 |
|
191 void testLocalizeEntry(); |
|
192 |
|
193 void testAddLocalizationEntry(); |
|
194 |
|
195 void testUpdateLocalizationEntry(); |
|
196 |
|
197 void testSaveRestoreDatabase(); |
|
198 |
|
199 |
|
200 //unused |
|
201 //void testBadDBVersion(); |
|
202 |
|
203 void init(); // called before each test method |
|
204 void cleanup(); // called after each test method |
|
205 void initTestCase(); // called once before all test methods |
|
206 void cleanupTestCase(); // caled once after all test methods |
|
207 /** |
|
208 * Utility methods are listed below. |
|
209 */ |
|
210 |
|
211 // Test that two data arrays have opposite order. |
|
212 |
|
213 |
|
214 private: |
|
215 TInt locEntriesCount(); |
|
216 |
|
217 |
|
218 protected: |
|
219 |
|
220 |
|
221 /** |
|
222 * Utils methods are listed below. |
|
223 */ |
|
224 TInt verifyOppositeOrder(RPointerArray<CCaInnerEntry>& aArray1, |
|
225 RPointerArray<CCaInnerEntry>& aArray2); |
|
226 |
|
227 TInt testSortingBySortOrder(CCaInnerQuery::TSortAttribute sortAttr1, |
|
228 CCaInnerQuery::TSortAttribute sortAttr2); |
|
229 |
|
230 TInt testSortingBySortOrder(CCaInnerQuery *aInnerQuery1, |
|
231 CCaInnerQuery *aInnerQuery2); |
|
232 void RestoreDatabase(); |
|
233 void CopyFile(const TDesC &aSorcePath, const TDesC &aDestinationPath); |
|
234 QString descToQString(const TDesC &descriptor); |
|
235 private: |
|
236 |
|
237 CCaStorage *mStorage; |
|
238 |
|
239 }; |
|
240 |
|
241 #endif |