diff --git a/core/autotests/akregator/data/import/akregatorconfig/list.txt b/core/autotests/akregator/data/import/akregatorconfig/list.txt new file mode 100644 index 0000000..e69de29 diff --git a/core/autotests/akregator/data/import/akregatorresource/list.txt b/core/autotests/akregator/data/import/akregatorresource/list.txt new file mode 100644 index 0000000..e69de29 diff --git a/core/autotests/akregator/importakregatorjobinterfacetest.cpp b/core/autotests/akregator/importakregatorjobinterfacetest.cpp index 2e0af7e..da63c4a 100644 --- a/core/autotests/akregator/importakregatorjobinterfacetest.cpp +++ b/core/autotests/akregator/importakregatorjobinterfacetest.cpp @@ -1,74 +1,80 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "importakregatorjobinterfacetest.h" #include "archivestorage.h" #include "resourceconvertertest.h" #include "testimportfile.h" #include #include QTEST_MAIN(ImportAkregatorJobInterfaceTest) ImportAkregatorJobInterfaceTestImpl::ImportAkregatorJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep) : ImportAkregatorJobInterface(parent, typeSelected, archiveStorage, numberOfStep) { } ImportAkregatorJobInterfaceTestImpl::~ImportAkregatorJobInterfaceTestImpl() { } Akonadi::Collection::Id ImportAkregatorJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path) { Q_UNREACHABLE(); return -1; } QString ImportAkregatorJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) { Q_UNREACHABLE(); return {}; } ImportAkregatorJobInterfaceTest::ImportAkregatorJobInterfaceTest(QObject *parent) : QObject(parent) { } -void ImportAkregatorJobInterfaceTest::importCalendarConfig_data() + +void ImportAkregatorJobInterfaceTest::importAkegator_data() { QTest::addColumn("zipFilePath"); QTest::addColumn("testPath"); + QTest::addColumn("options"); const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/"); - QTest::newRow("test1") << QString::fromLatin1(pathConfig) << QStringLiteral("/test1/"); + Utils::StoredTypes options = {Utils::StoredType::Config}; + QTest::newRow("test1") << QString::fromLatin1(pathConfig) << QStringLiteral("/test1/") << options; + options = {Utils::StoredType::Config|Utils::StoredType::Resources}; + QTest::newRow("test1resource") << QString::fromLatin1(pathConfig) << QStringLiteral("/test1resource/") << options; } -void ImportAkregatorJobInterfaceTest::importCalendarConfig() +void ImportAkregatorJobInterfaceTest::importAkegator() { QFETCH(QString, zipFilePath); QFETCH(QString, testPath); + QFETCH(Utils::StoredTypes, options); TestImportFile *file = new TestImportFile(zipFilePath + testPath, this); file->setPathConfig(zipFilePath + testPath); file->setExtractPath(QDir::tempPath() + testPath); - ImportAkregatorJobInterfaceTestImpl *impl = new ImportAkregatorJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1); + ImportAkregatorJobInterfaceTestImpl *impl = new ImportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1); file->setAbstractImportExportJob(impl); file->start(); delete impl; delete file; } diff --git a/core/autotests/akregator/importakregatorjobinterfacetest.h b/core/autotests/akregator/importakregatorjobinterfacetest.h index 3c12513..3584714 100644 --- a/core/autotests/akregator/importakregatorjobinterfacetest.h +++ b/core/autotests/akregator/importakregatorjobinterfacetest.h @@ -1,50 +1,50 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef IMPORTAKREGATORJOBINTERFACETEST_H #define IMPORTAKREGATORJOBINTERFACETEST_H #include #include "akregator/importakregatorjobinterface.h" class ImportAkregatorJobInterfaceTestImpl : public ImportAkregatorJobInterface { Q_OBJECT public: explicit ImportAkregatorJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep); ~ImportAkregatorJobInterfaceTestImpl(); protected: Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override; Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override; }; class ImportAkregatorJobInterfaceTest : public QObject { Q_OBJECT public: explicit ImportAkregatorJobInterfaceTest(QObject *parent = nullptr); ~ImportAkregatorJobInterfaceTest() = default; private Q_SLOTS: - void importCalendarConfig(); - void importCalendarConfig_data(); + void importAkegator_data(); + void importAkegator(); }; #endif // IMPORTAKREGATORJOBINTERFACETEST_H