File indexing completed on 2024-12-22 05:05:23
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "importakregatorjobinterfacetest.h" 0008 #include "archivestorage.h" 0009 #include "importakregatorjobinterfacetestimpl.h" 0010 #include "testimportfile.h" 0011 #include <QTest> 0012 QTEST_MAIN(ImportAkregatorJobInterfaceTest) 0013 0014 ImportAkregatorJobInterfaceTest::ImportAkregatorJobInterfaceTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 void ImportAkregatorJobInterfaceTest::importAkegator_data() 0020 { 0021 QTest::addColumn<QString>("zipFilePath"); 0022 QTest::addColumn<QString>("testPath"); 0023 QTest::addColumn<Utils::StoredTypes>("options"); 0024 const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/"); 0025 Utils::StoredTypes options = {Utils::StoredType::Config}; 0026 QTest::newRow("test1") << QString::fromLatin1(pathConfig) << QStringLiteral("/akregatorconfig/") << options; 0027 options = {Utils::StoredType::Config | Utils::StoredType::Resources}; 0028 QTest::newRow("test1resource") << QString::fromLatin1(pathConfig) << QStringLiteral("/akregatorresource/") << options; 0029 } 0030 0031 void ImportAkregatorJobInterfaceTest::importAkegator() 0032 { 0033 QFETCH(QString, zipFilePath); 0034 QFETCH(QString, testPath); 0035 QFETCH(Utils::StoredTypes, options); 0036 auto file = new TestImportFile(zipFilePath + testPath, this); 0037 file->setPathConfig(zipFilePath + testPath); 0038 file->setExtractPath(QDir::tempPath() + testPath); 0039 auto impl = new ImportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1); 0040 file->setAbstractImportExportJob(impl); 0041 file->start(); 0042 delete impl; 0043 delete file; 0044 } 0045 0046 #include "moc_importakregatorjobinterfacetest.cpp"