Commit 73f33066 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to compare extracted files

parent 3225df54
......@@ -60,19 +60,23 @@ ImportNotesJobInterfaceTest::ImportNotesJobInterfaceTest(QObject *parent)
void ImportNotesJobInterfaceTest::importNoteConfig_data()
{
QTest::addColumn<QString>("zipFilePath");
QTest::addColumn<QString>("testPath");
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/");
QTest::newRow("test1") << QLatin1String(pathConfig) + QStringLiteral("test1/");
QTest::newRow("test1") << QString::fromLatin1(pathConfig) << QStringLiteral("/test1/");
}
void ImportNotesJobInterfaceTest::importNoteConfig()
{
QFETCH(QString, zipFilePath);
QFETCH(QString, testPath);
TestImportFile *file = new TestImportFile(zipFilePath, this);
file->setPathConfig(zipFilePath);
file->setPathConfig(zipFilePath + testPath);
file->setExtractPath(QDir::tempPath() + testPath);
ImportNotesJobInterfaceTestImpl *impl = new ImportNotesJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->start();
delete impl;
delete file;
}
......@@ -40,6 +40,14 @@ TestImportFile::~TestImportFile()
void TestImportFile::start()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
//TODO define extract path
QVERIFY(!mExtractPath.isEmpty());
qputenv("XDG_DATA_HOME", mExtractPath.toLatin1() + "/share");
qputenv("XDG_CONFIG_HOME", mExtractPath.toLatin1() + "/config");
QSignalSpy finish(mAbstractImportExportJob, &AbstractImportExportJob::jobFinished);
QSignalSpy error(mAbstractImportExportJob, &AbstractImportExportJob::error);
mAbstractImportExportJob->start();
......@@ -83,3 +91,8 @@ void TestImportFile::setPathConfig(const QString &pathConfig)
{
mPathConfig = pathConfig;
}
void TestImportFile::setExtractPath(const QString &extractPath)
{
mExtractPath = extractPath;
}
......@@ -40,11 +40,13 @@ public:
Q_REQUIRED_RESULT QString pathConfig() const;
void setPathConfig(const QString &pathConfig);
void setExtractPath(const QString &extractPath);
private:
AbstractImportExportJob *mAbstractImportExportJob = nullptr;
ArchiveStorage *mArchiveStorage = nullptr;
QString mArchivePath;
QString mPathConfig;
QString mExtractPath;
};
#endif // TESTIMPORTFILE_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment