Changeset View
Changeset View
Standalone View
Standalone View
autotests/kerfuffle/movetest.cpp
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Line(s) | 204 | { | |||
---|---|---|---|---|---|
226 | QFETCH(QVector<Archive::Entry*>, targetEntries); | 226 | QFETCH(QVector<Archive::Entry*>, targetEntries); | ||
227 | QFETCH(Archive::Entry*, destination); | 227 | QFETCH(Archive::Entry*, destination); | ||
228 | QFETCH(QStringList, expectedNewPaths); | 228 | QFETCH(QStringList, expectedNewPaths); | ||
229 | 229 | | |||
230 | // Retrieve current paths in the archive. | 230 | // Retrieve current paths in the archive. | ||
231 | QStringList oldPaths = getEntryPaths(archive); | 231 | QStringList oldPaths = getEntryPaths(archive); | ||
232 | 232 | | |||
233 | // Check that the entries to be moved are in the archive. | 233 | // Check that the entries to be moved are in the archive. | ||
234 | foreach (const auto entry, targetEntries) { | 234 | for (const auto entry : qAsConst(targetEntries)) { | ||
235 | QVERIFY(oldPaths.contains(entry->fullPath())); | 235 | QVERIFY(oldPaths.contains(entry->fullPath())); | ||
236 | } | 236 | } | ||
237 | 237 | | |||
238 | // Check that the expected paths (after the MoveJob) are not in the archive. | 238 | // Check that the expected paths (after the MoveJob) are not in the archive. | ||
239 | foreach (const auto &expectedPath, expectedNewPaths) { | 239 | for (const auto &expectedPath : qAsConst(expectedNewPaths)) { | ||
240 | QVERIFY(!oldPaths.contains(expectedPath)); | 240 | QVERIFY(!oldPaths.contains(expectedPath)); | ||
241 | } | 241 | } | ||
242 | 242 | | |||
243 | CompressionOptions options; | 243 | CompressionOptions options; | ||
244 | options.setGlobalWorkDir(QFINDTESTDATA("data")); | 244 | options.setGlobalWorkDir(QFINDTESTDATA("data")); | ||
245 | MoveJob *moveJob = archive->moveFiles(targetEntries, destination, options); | 245 | MoveJob *moveJob = archive->moveFiles(targetEntries, destination, options); | ||
246 | TestHelper::startAndWaitForResult(moveJob); | 246 | TestHelper::startAndWaitForResult(moveJob); | ||
247 | 247 | | |||
248 | // Retrieve the resulting paths. | 248 | // Retrieve the resulting paths. | ||
249 | QStringList newPaths = getEntryPaths(archive); | 249 | QStringList newPaths = getEntryPaths(archive); | ||
250 | 250 | | |||
251 | // Check that the expected paths are now in the archive. | 251 | // Check that the expected paths are now in the archive. | ||
252 | foreach (const auto &path, expectedNewPaths) { | 252 | for (const auto &path : qAsConst(expectedNewPaths)) { | ||
253 | QVERIFY(newPaths.contains(path)); | 253 | QVERIFY(newPaths.contains(path)); | ||
254 | } | 254 | } | ||
255 | 255 | | |||
256 | // Check that the target paths are no longer in the archive. | 256 | // Check that the target paths are no longer in the archive. | ||
257 | foreach (const auto entry, targetEntries) { | 257 | for (const auto entry : qAsConst(targetEntries)) { | ||
258 | QVERIFY(!newPaths.contains(entry->fullPath())); | 258 | QVERIFY(!newPaths.contains(entry->fullPath())); | ||
259 | } | 259 | } | ||
260 | 260 | | |||
261 | QFETCH(uint, numberOfEntries); | 261 | QFETCH(uint, numberOfEntries); | ||
262 | QCOMPARE(archive->numberOfEntries(), numberOfEntries); | 262 | QCOMPARE(archive->numberOfEntries(), numberOfEntries); | ||
263 | 263 | | |||
264 | loadJob->deleteLater(); | 264 | loadJob->deleteLater(); | ||
265 | archive->deleteLater(); | 265 | archive->deleteLater(); | ||
266 | } | 266 | } | ||
267 | 267 | | |||
268 | #include "movetest.moc" | 268 | #include "movetest.moc" |