Changeset View
Changeset View
Standalone View
Standalone View
autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp
Show All 30 Lines | |||||
31 | 31 | | |||
32 | QTEST_GUILESS_MAIN(CliUnarchiverTest) | 32 | QTEST_GUILESS_MAIN(CliUnarchiverTest) | ||
33 | 33 | | |||
34 | using namespace Kerfuffle; | 34 | using namespace Kerfuffle; | ||
35 | 35 | | |||
36 | void CliUnarchiverTest::initTestCase() | 36 | void CliUnarchiverTest::initTestCase() | ||
37 | { | 37 | { | ||
38 | m_plugin = new Plugin(this); | 38 | m_plugin = new Plugin(this); | ||
39 | foreach (Plugin *plugin, m_pluginManger.availablePlugins()) { | 39 | const auto plugins = m_pluginManger.availablePlugins(); | ||
40 | for (Plugin *plugin : plugins) { | ||||
40 | if (plugin->metaData().pluginId() == QStringLiteral("kerfuffle_cliunarchiver")) { | 41 | if (plugin->metaData().pluginId() == QStringLiteral("kerfuffle_cliunarchiver")) { | ||
41 | m_plugin = plugin; | 42 | m_plugin = plugin; | ||
42 | return; | 43 | return; | ||
43 | } | 44 | } | ||
44 | } | 45 | } | ||
45 | } | 46 | } | ||
46 | 47 | | |||
47 | void CliUnarchiverTest::testArchive_data() | 48 | void CliUnarchiverTest::testArchive_data() | ||
▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Line(s) | 384 | { | |||
387 | 388 | | |||
388 | QFETCH(QString, archiveName); | 389 | QFETCH(QString, archiveName); | ||
389 | CliPlugin *plugin = new CliPlugin(this, {QVariant(archiveName), | 390 | CliPlugin *plugin = new CliPlugin(this, {QVariant(archiveName), | ||
390 | QVariant::fromValue(m_plugin->metaData())}); | 391 | QVariant::fromValue(m_plugin->metaData())}); | ||
391 | QVERIFY(plugin); | 392 | QVERIFY(plugin); | ||
392 | 393 | | |||
393 | QFETCH(QVector<Archive::Entry*>, files); | 394 | QFETCH(QVector<Archive::Entry*>, files); | ||
394 | QStringList filesList; | 395 | QStringList filesList; | ||
395 | foreach (const Archive::Entry *e, files) { | 396 | for (const Archive::Entry *e : qAsConst(files)) { | ||
396 | filesList << e->fullPath(NoTrailingSlash); | 397 | filesList << e->fullPath(NoTrailingSlash); | ||
397 | } | 398 | } | ||
398 | 399 | | |||
399 | QFETCH(QString, password); | 400 | QFETCH(QString, password); | ||
400 | 401 | | |||
401 | const auto replacedArgs = plugin->cliProperties()->extractArgs(archiveName, filesList, false, password); | 402 | const auto replacedArgs = plugin->cliProperties()->extractArgs(archiveName, filesList, false, password); | ||
402 | 403 | | |||
403 | QFETCH(QStringList, expectedArgs); | 404 | QFETCH(QStringList, expectedArgs); | ||
404 | QCOMPARE(replacedArgs, expectedArgs); | 405 | QCOMPARE(replacedArgs, expectedArgs); | ||
405 | 406 | | |||
406 | plugin->deleteLater(); | 407 | plugin->deleteLater(); | ||
407 | } | 408 | } |