Changeset View
Changeset View
Standalone View
Standalone View
autotests/packagestructuretest.cpp
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | |||||
170 | void PackageStructureTest::multiplePaths() | 170 | void PackageStructureTest::multiplePaths() | ||
171 | { | 171 | { | ||
172 | NoPrefixes package; | 172 | NoPrefixes package; | ||
173 | QCOMPARE(package.name("MultiplePaths"), QStringLiteral("Description proper")); | 173 | QCOMPARE(package.name("MultiplePaths"), QStringLiteral("Description proper")); | ||
174 | } | 174 | } | ||
175 | 175 | | |||
176 | void PackageStructureTest::directories() | 176 | void PackageStructureTest::directories() | ||
177 | { | 177 | { | ||
178 | QList<const char *> dirs; | 178 | const QList<const char *> dirs{"config", "data", "images", "theme", "scripts", "translations", "ui"}; | ||
179 | dirs << "config" << "data" << "images" << "theme" << "scripts" << "translations" << "ui"; | | |||
180 | 179 | | |||
181 | QList<const char *> psDirs = ps.directories(); | 180 | const QList<const char *> psDirs = ps.directories(); | ||
182 | 181 | | |||
183 | QCOMPARE(dirs.count(), psDirs.count()); | 182 | QCOMPARE(dirs.count(), psDirs.count()); | ||
184 | 183 | | |||
185 | foreach (const char *dir, psDirs) { | 184 | for (const char *dir : psDirs) { | ||
186 | bool found = false; | 185 | bool found = false; | ||
187 | foreach (const char *check, dirs) { | 186 | for (const char *check : dirs) { | ||
188 | if (qstrcmp(dir, check)) { | 187 | if (qstrcmp(dir, check)) { | ||
189 | found = true; | 188 | found = true; | ||
190 | break; | 189 | break; | ||
191 | } | 190 | } | ||
192 | } | 191 | } | ||
193 | QVERIFY(found); | 192 | QVERIFY(found); | ||
194 | } | 193 | } | ||
195 | 194 | | |||
196 | foreach (const char *dir, dirs) { | 195 | for (const char *dir : dirs) { | ||
197 | bool found = false; | 196 | bool found = false; | ||
198 | foreach (const char *check, psDirs) { | 197 | for (const char *check : psDirs) { | ||
199 | if (qstrcmp(dir, check)) { | 198 | if (qstrcmp(dir, check)) { | ||
200 | found = true; | 199 | found = true; | ||
201 | break; | 200 | break; | ||
202 | } | 201 | } | ||
203 | } | 202 | } | ||
204 | QVERIFY(found); | 203 | QVERIFY(found); | ||
205 | } | 204 | } | ||
206 | } | 205 | } | ||
207 | 206 | | |||
208 | void PackageStructureTest::requiredDirectories() | 207 | void PackageStructureTest::requiredDirectories() | ||
209 | { | 208 | { | ||
210 | QList<const char *> dirs; | 209 | QList<const char *> dirs; | ||
211 | QCOMPARE(ps.requiredDirectories(), dirs); | 210 | QCOMPARE(ps.requiredDirectories(), dirs); | ||
212 | } | 211 | } | ||
213 | 212 | | |||
214 | void PackageStructureTest::files() | 213 | void PackageStructureTest::files() | ||
215 | { | 214 | { | ||
216 | QList<const char *> files; | 215 | const QList<const char *> files{"mainconfigui", "mainconfigxml", "mainscript"}; | ||
217 | files << "mainconfigui" << "mainconfigxml" << "mainscript"; | | |||
218 | 216 | | |||
219 | QList<const char *> psFiles = ps.files(); | 217 | const QList<const char *> psFiles = ps.files(); | ||
220 | 218 | | |||
221 | //for (int i = 0; i < psFiles.count(); ++i) { | 219 | //for (int i = 0; i < psFiles.count(); ++i) { | ||
222 | // qDebug() << psFiles[i]; | 220 | // qDebug() << psFiles[i]; | ||
223 | //} | 221 | //} | ||
224 | foreach (const char *file, psFiles) { | 222 | for (const char *file : psFiles) { | ||
225 | bool found = false; | 223 | bool found = false; | ||
226 | foreach (const char *check, files) { | 224 | for (const char *check : files) { | ||
227 | if (qstrcmp(file, check)) { | 225 | if (qstrcmp(file, check)) { | ||
228 | found = true; | 226 | found = true; | ||
229 | break; | 227 | break; | ||
230 | } | 228 | } | ||
231 | } | 229 | } | ||
232 | QVERIFY(found); | 230 | QVERIFY(found); | ||
233 | } | 231 | } | ||
234 | } | 232 | } | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |