Changeset View
Changeset View
Standalone View
Standalone View
autotests/kerfuffle/addtest.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 131 | { | |||
---|---|---|---|---|---|
153 | QFETCH(QVector<Archive::Entry*>, targetEntries); | 153 | QFETCH(QVector<Archive::Entry*>, targetEntries); | ||
154 | QFETCH(Archive::Entry*, destination); | 154 | QFETCH(Archive::Entry*, destination); | ||
155 | QFETCH(QStringList, expectedNewPaths); | 155 | QFETCH(QStringList, expectedNewPaths); | ||
156 | 156 | | |||
157 | // Retrieve current paths in the archive. | 157 | // Retrieve current paths in the archive. | ||
158 | QStringList oldPaths = getEntryPaths(archive); | 158 | QStringList oldPaths = getEntryPaths(archive); | ||
159 | 159 | | |||
160 | // Check that the expected paths (after the AddJob) are not in the archive. | 160 | // Check that the expected paths (after the AddJob) are not in the archive. | ||
161 | foreach (const auto &expectedPath, expectedNewPaths) { | 161 | for (const auto &expectedPath : qAsConst(expectedNewPaths)) { | ||
162 | QVERIFY(!oldPaths.contains(expectedPath)); | 162 | QVERIFY(!oldPaths.contains(expectedPath)); | ||
163 | } | 163 | } | ||
164 | 164 | | |||
165 | CompressionOptions options; | 165 | CompressionOptions options; | ||
166 | options.setGlobalWorkDir(QFINDTESTDATA("data")); | 166 | options.setGlobalWorkDir(QFINDTESTDATA("data")); | ||
167 | AddJob *addJob = archive->addFiles(targetEntries, destination, options); | 167 | AddJob *addJob = archive->addFiles(targetEntries, destination, options); | ||
168 | TestHelper::startAndWaitForResult(addJob); | 168 | TestHelper::startAndWaitForResult(addJob); | ||
169 | 169 | | |||
170 | // Retrieve the resulting paths. | 170 | // Retrieve the resulting paths. | ||
171 | QStringList newPaths = getEntryPaths(archive); | 171 | QStringList newPaths = getEntryPaths(archive); | ||
172 | 172 | | |||
173 | // Check that the expected paths are now in the archive. | 173 | // Check that the expected paths are now in the archive. | ||
174 | foreach (const auto &path, expectedNewPaths) { | 174 | for (const auto &path : qAsConst(expectedNewPaths)) { | ||
175 | QVERIFY(newPaths.contains(path)); | 175 | QVERIFY(newPaths.contains(path)); | ||
176 | } | 176 | } | ||
177 | 177 | | |||
178 | QFETCH(uint, numberOfEntries); | 178 | QFETCH(uint, numberOfEntries); | ||
179 | QCOMPARE(archive->numberOfEntries(), numberOfEntries); | 179 | QCOMPARE(archive->numberOfEntries(), numberOfEntries); | ||
180 | 180 | | |||
181 | loadJob->deleteLater(); | 181 | loadJob->deleteLater(); | ||
182 | archive->deleteLater(); | 182 | archive->deleteLater(); | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | #include "addtest.moc" | 185 | #include "addtest.moc" |