[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ark/gsoc2016/implementing-jobs] /: Move AddJob and MoveJob tests to kerfuffle tests (not plugins te
From: Vladyslav Batyrenko <mvlabat () gmail ! com>
Date: 2016-07-31 16:49:57
Message-ID: E1bTtw5-0007ci-NI () code ! kde ! org
[Download RAW message or body]
Git commit c119555e44ad1678c16cab58b796b6f7400ae940 by Vladyslav Batyrenko.
Committed on 31/07/2016 at 16:49.
Pushed by vbatyrenko into branch 'gsoc2016/implementing-jobs'.
Move AddJob and MoveJob tests to kerfuffle tests (not plugins tests any longer)
M +4 -2 autotests/kerfuffle/CMakeLists.txt
A +116 -0 autotests/kerfuffle/addtest.cpp [License: BSD]
M +18 -0 autotests/kerfuffle/addtoarchivetest.cpp
R +0 -0 autotests/kerfuffle/data/dir/textfile1.txt [from: \
autotests/plugins/cli7zplugin/data/a.txt - 100% similarity] R +0 -0 \
autotests/kerfuffle/data/dir/textfile2.txt [from: \
autotests/plugins/cli7zplugin/data/b.txt - 100% similarity] R +- -- \
autotests/kerfuffle/data/test.7z [from: autotests/plugins/cli7zplugin/data/test.7z - \
100% similarity] R +- -- autotests/kerfuffle/data/test.rar [from: \
autotests/plugins/clirarplugin/data/test.rar - 100% similarity] R +- -- \
autotests/kerfuffle/data/test.tar.bz2 [from: \
autotests/plugins/libarchiveplugin/data/test.tar.bz2 - 100% similarity] R +- -- \
autotests/kerfuffle/data/test.zip [from: autotests/plugins/clizipplugin/data/test.zip \
- 100% similarity] R +0 -0 autotests/kerfuffle/data/textfile1.txt [from: \
autotests/plugins/cli7zplugin/data/dir/a.txt - 100% similarity] R +0 -0 \
autotests/kerfuffle/data/textfile2.txt [from: \
autotests/plugins/cli7zplugin/data/dir/b.txt - 100% similarity] R +7 -25 \
autotests/kerfuffle/extracttest.cpp [from: autotests/kerfuffle/archivetest.cpp - 096% \
similarity] A +116 -0 autotests/kerfuffle/movetest.cpp [License: BSD]
M +0 -1 autotests/plugins/CMakeLists.txt
M +8 -114 autotests/plugins/cli7zplugin/cli7ztest.cpp
M +0 -4 autotests/plugins/cli7zplugin/cli7ztest.h
M +8 -114 autotests/plugins/clirarplugin/clirartest.cpp
M +0 -4 autotests/plugins/clirarplugin/clirartest.h
D +0 -1 autotests/plugins/clirarplugin/data/a.txt
D +0 -1 autotests/plugins/clirarplugin/data/b.txt
D +0 -1 autotests/plugins/clirarplugin/data/dir/a.txt
D +0 -1 autotests/plugins/clirarplugin/data/dir/b.txt
M +8 -112 autotests/plugins/clizipplugin/cliziptest.cpp
M +0 -4 autotests/plugins/clizipplugin/cliziptest.h
D +0 -1 autotests/plugins/clizipplugin/data/a.txt
D +0 -1 autotests/plugins/clizipplugin/data/b.txt
D +0 -1 autotests/plugins/clizipplugin/data/dir/a.txt
D +0 -1 autotests/plugins/clizipplugin/data/dir/b.txt
D +0 -15 autotests/plugins/libarchiveplugin/CMakeLists.txt
D +0 -1 autotests/plugins/libarchiveplugin/data/a.txt
D +0 -1 autotests/plugins/libarchiveplugin/data/b.txt
D +0 -1 autotests/plugins/libarchiveplugin/data/dir/a.txt
D +0 -1 autotests/plugins/libarchiveplugin/data/dir/b.txt
D +0 -151 autotests/plugins/libarchiveplugin/libarchivetest.cpp
D +0 -52 autotests/plugins/libarchiveplugin/libarchivetest.h
M +2 -2 autotests/testhelper/testhelper.cpp
M +1 -1 autotests/testhelper/testhelper.h
M +18 -0 kerfuffle/archive_kerfuffle.cpp
M +3 -0 kerfuffle/archive_kerfuffle.h
http://commits.kde.org/ark/c119555e44ad1678c16cab58b796b6f7400ae940
diff --git a/autotests/kerfuffle/CMakeLists.txt b/autotests/kerfuffle/CMakeLists.txt
index d90cdfd..e5dfd87 100644
--- a/autotests/kerfuffle/CMakeLists.txt
+++ b/autotests/kerfuffle/CMakeLists.txt
@@ -9,11 +9,13 @@ target_link_libraries(jsoninterface kerfuffle)
ecm_add_tests(
addtoarchivetest.cpp
- archivetest.cpp
+ extracttest.cpp
+ addtest.cpp
+ movetest.cpp
createdialogtest.cpp
metadatatest.cpp
mimetypetest.cpp
- LINK_LIBRARIES kerfuffle Qt5::Test
+ LINK_LIBRARIES testhelper kerfuffle Qt5::Test
NAME_PREFIX kerfuffle-)
ecm_add_tests(
diff --git a/autotests/kerfuffle/addtest.cpp b/autotests/kerfuffle/addtest.cpp
new file mode 100644
index 0000000..80e1dff
--- /dev/null
+++ b/autotests/kerfuffle/addtest.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2010-2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
+ * Copyright (c) 2016 Elvis Angelaccio <elvis.angelaccio@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "autotests/testhelper/testhelper.h"
+
+using namespace Kerfuffle;
+
+class AddTest : public QObject
+{
+ Q_OBJECT
+
+private:
+void addAllFormatsRows(const QString testName, const QString archiveName, \
QList<Archive::Entry*> entries, Archive::Entry *destination) { + QStringList \
formats = QStringList() + << QStringLiteral("7z")
+ << QStringLiteral("rar")
+ << QStringLiteral("tar.bz2")
+ << QStringLiteral("zip");
+
+ foreach (QString format, formats) {
+ QTest::newRow(testName.toStdString().c_str())
+ << archiveName + QLatin1Char('.') + format
+ << entries
+ << destination;
+ }
+}
+
+private Q_SLOTS:
+ void testAdding_data();
+ void testAdding();
+};
+
+QTEST_GUILESS_MAIN(AddTest)
+
+void AddTest::testAdding_data()
+{
+ QTest::addColumn<QString>("archiveName");
+ QTest::addColumn<QList<Archive::Entry*>>("files");
+ QTest::addColumn<Archive::Entry*>("destination");
+
+ addAllFormatsRows(QStringLiteral("without destination"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("textfile1.txt")),
+ new Archive::Entry(this, QStringLiteral("textfile2.txt")),
+ },
+ new Archive::Entry(this));
+
+ addAllFormatsRows(QStringLiteral("with destination, files"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("textfile1.txt")),
+ new Archive::Entry(this, QStringLiteral("textfile2.txt")),
+ },
+ new Archive::Entry(this, QStringLiteral("empty_dir/")));
+
+ addAllFormatsRows(QStringLiteral("with destination, directory"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("dir/")),
+ },
+ new Archive::Entry(this, QStringLiteral("empty_dir/")));
+}
+
+void AddTest::testAdding()
+{
+ QTemporaryDir temporaryDir;
+
+ QFETCH(QString, archiveName);
+ const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName; + Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + \
archiveName), archivePath)); + Archive *archive = Archive::create(archivePath, \
this); + QVERIFY(archive);
+
+ if (!archive->isValid()) {
+ QSKIP("Could not find a plugin to handle the archive. Skipping test.", \
SkipSingle); + }
+
+ QFETCH(QList<Archive::Entry*>, files);
+ QFETCH(Archive::Entry*, destination);
+
+ CompressionOptions options = CompressionOptions();
+ options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
+ AddJob *addJob = archive->addFiles(files, destination, options);
+ TestHelper::startAndWaitForResult(addJob);
+
+ QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(archive);
+ TestHelper::verifyAddedEntriesWithDestination(files, destination, \
resultedEntries); +
+ archive->deleteLater();
+}
+
+#include "addtest.moc"
diff --git a/autotests/kerfuffle/addtoarchivetest.cpp \
b/autotests/kerfuffle/addtoarchivetest.cpp index e2a3256..410bb96 100644
--- a/autotests/kerfuffle/addtoarchivetest.cpp
+++ b/autotests/kerfuffle/addtoarchivetest.cpp
@@ -40,6 +40,7 @@ private Q_SLOTS:
void testCompressHere_data();
void testCompressHere();
+ void testCreateEncryptedArchive();
};
void AddToArchiveTest::testCompressHere_data()
@@ -135,6 +136,23 @@ void AddToArchiveTest::testCompressHere()
QVERIFY(QFile(archive->fileName()).remove());
}
+void AddToArchiveTest::testCreateEncryptedArchive()
+{
+ Archive *archive = Archive::create(QStringLiteral("foo.zip"));
+ QVERIFY(archive);
+
+ if (!archive->isValid()) {
+ QSKIP("Could not find a plugin to handle the archive. Skipping test.", \
SkipSingle); + }
+
+ QCOMPARE(archive->encryptionType(), Archive::Unencrypted);
+
+ archive->encrypt(QStringLiteral("1234"), false);
+ QCOMPARE(archive->encryptionType(), Archive::Encrypted);
+
+ archive->deleteLater();
+}
+
QTEST_MAIN(AddToArchiveTest)
#include "addtoarchivetest.moc"
diff --git a/autotests/plugins/cli7zplugin/data/a.txt \
b/autotests/kerfuffle/data/dir/textfile1.txt similarity index 100%
rename from autotests/plugins/cli7zplugin/data/a.txt
rename to autotests/kerfuffle/data/dir/textfile1.txt
diff --git a/autotests/plugins/cli7zplugin/data/b.txt \
b/autotests/kerfuffle/data/dir/textfile2.txt similarity index 100%
rename from autotests/plugins/cli7zplugin/data/b.txt
rename to autotests/kerfuffle/data/dir/textfile2.txt
diff --git a/autotests/plugins/cli7zplugin/data/test.7z \
b/autotests/kerfuffle/data/test.7z similarity index 100%
rename from autotests/plugins/cli7zplugin/data/test.7z
rename to autotests/kerfuffle/data/test.7z
diff --git a/autotests/plugins/clirarplugin/data/test.rar \
b/autotests/kerfuffle/data/test.rar similarity index 100%
rename from autotests/plugins/clirarplugin/data/test.rar
rename to autotests/kerfuffle/data/test.rar
diff --git a/autotests/plugins/libarchiveplugin/data/test.tar.bz2 \
b/autotests/kerfuffle/data/test.tar.bz2 similarity index 100%
rename from autotests/plugins/libarchiveplugin/data/test.tar.bz2
rename to autotests/kerfuffle/data/test.tar.bz2
diff --git a/autotests/plugins/clizipplugin/data/test.zip \
b/autotests/kerfuffle/data/test.zip similarity index 100%
rename from autotests/plugins/clizipplugin/data/test.zip
rename to autotests/kerfuffle/data/test.zip
diff --git a/autotests/plugins/cli7zplugin/data/dir/a.txt \
b/autotests/kerfuffle/data/textfile1.txt similarity index 100%
rename from autotests/plugins/cli7zplugin/data/dir/a.txt
rename to autotests/kerfuffle/data/textfile1.txt
diff --git a/autotests/plugins/cli7zplugin/data/dir/b.txt \
b/autotests/kerfuffle/data/textfile2.txt similarity index 100%
rename from autotests/plugins/cli7zplugin/data/dir/b.txt
rename to autotests/kerfuffle/data/textfile2.txt
diff --git a/autotests/kerfuffle/archivetest.cpp \
b/autotests/kerfuffle/extracttest.cpp similarity index 96%
rename from autotests/kerfuffle/archivetest.cpp
rename to autotests/kerfuffle/extracttest.cpp
index 2e04fe2..1b2a88b 100644
--- a/autotests/kerfuffle/archivetest.cpp
+++ b/autotests/kerfuffle/extracttest.cpp
@@ -33,7 +33,7 @@
using namespace Kerfuffle;
-class ArchiveTest : public QObject
+class ExtractTest : public QObject
{
Q_OBJECT
@@ -42,12 +42,11 @@ private Q_SLOTS:
void testProperties();
void testExtraction_data();
void testExtraction();
- void testCreateEncryptedArchive();
};
-QTEST_GUILESS_MAIN(ArchiveTest)
+QTEST_GUILESS_MAIN(ExtractTest)
-void ArchiveTest::testProperties_data()
+void ExtractTest::testProperties_data()
{
QTest::addColumn<QString>("archivePath");
QTest::addColumn<QString>("expectedBaseName");
@@ -173,7 +172,7 @@ void ArchiveTest::testProperties_data()
<< QStringLiteral("test");
}
-void ArchiveTest::testProperties()
+void ExtractTest::testProperties()
{
QFETCH(QString, archivePath);
Archive *archive = Archive::create(archivePath, this);
@@ -210,7 +209,7 @@ void ArchiveTest::testProperties()
archive->deleteLater();
}
-void ArchiveTest::testExtraction_data()
+void ExtractTest::testExtraction_data()
{
QTest::addColumn<QString>("archivePath");
QTest::addColumn<QList<Archive::Entry*>>("entriesToExtract");
@@ -512,7 +511,7 @@ void ArchiveTest::testExtraction_data()
<< 6;
}
-void ArchiveTest::testExtraction()
+void ExtractTest::testExtraction()
{
QFETCH(QString, archivePath);
Archive *archive = Archive::create(archivePath, this);
@@ -550,21 +549,4 @@ void ArchiveTest::testExtraction()
archive->deleteLater();
}
-void ArchiveTest::testCreateEncryptedArchive()
-{
- Archive *archive = Archive::create(QStringLiteral("foo.zip"));
- QVERIFY(archive);
-
- if (!archive->isValid()) {
- QSKIP("Could not find a plugin to handle the archive. Skipping test.", \
SkipSingle);
- }
-
- QCOMPARE(archive->encryptionType(), Archive::Unencrypted);
-
- archive->encrypt(QStringLiteral("1234"), false);
- QCOMPARE(archive->encryptionType(), Archive::Encrypted);
-
- archive->deleteLater();
-}
-
-#include "archivetest.moc"
+#include "extracttest.moc"
diff --git a/autotests/kerfuffle/movetest.cpp b/autotests/kerfuffle/movetest.cpp
new file mode 100644
index 0000000..4c19480
--- /dev/null
+++ b/autotests/kerfuffle/movetest.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2010-2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
+ * Copyright (c) 2016 Elvis Angelaccio <elvis.angelaccio@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "autotests/testhelper/testhelper.h"
+
+using namespace Kerfuffle;
+
+class MoveTest : public QObject
+{
+Q_OBJECT
+
+private:
+ void addAllFormatsRows(const QString testName, const QString archiveName, \
QList<Archive::Entry*> entries, Archive::Entry *destination) { + QStringList \
formats = QStringList() + << QStringLiteral("7z")
+ << QStringLiteral("rar")
+ << QStringLiteral("tar.bz2")
+ << QStringLiteral("zip");
+
+ foreach (QString format, formats) {
+ const QString testNameWithFormat = testName + QStringLiteral(" (") + \
format + QStringLiteral(")"); + \
QTest::newRow(testNameWithFormat.toStdString().c_str()) + << \
archiveName + QLatin1Char('.') + format + << entries
+ << destination;
+ }
+ }
+
+private Q_SLOTS:
+ void testMoveing_data();
+ void testMoveing();
+};
+
+QTEST_GUILESS_MAIN(MoveTest)
+
+void MoveTest::testMoveing_data()
+{
+ QTest::addColumn<QString>("archiveName");
+ QTest::addColumn<QList<Archive::Entry*>>("files");
+ QTest::addColumn<Archive::Entry*>("destination");
+
+ addAllFormatsRows(QStringLiteral("replace a single file"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("a.txt")),
+ },
+ new Archive::Entry(this, QStringLiteral("empty_dir/a.txt")));
+
+ addAllFormatsRows(QStringLiteral("replace several files"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("a.txt")),
+ new Archive::Entry(this, QStringLiteral("b.txt")),
+ },
+ new Archive::Entry(this, QStringLiteral("empty_dir/")));
+
+ addAllFormatsRows(QStringLiteral("replace a directory"),
+ QStringLiteral("test"),
+ QList<Archive::Entry*> {
+ new Archive::Entry(this, QStringLiteral("dir/")),
+ },
+ new Archive::Entry(this, QStringLiteral("empty_dir/dir/")));
+}
+
+void MoveTest::testMoveing()
+{
+ QTemporaryDir temporaryDir;
+
+ QFETCH(QString, archiveName);
+ const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName; + Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + \
archiveName), archivePath)); + Archive *archive = Archive::create(archivePath, \
this); + QVERIFY(archive);
+
+ if (!archive->isValid()) {
+ QSKIP("Could not find a plugin to handle the archive. Skipping test.", \
SkipSingle); + }
+
+ QFETCH(QList<Archive::Entry*>, files);
+ QFETCH(Archive::Entry*, destination);
+
+ CompressionOptions options = CompressionOptions();
+ options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
+ MoveJob *moveJob = archive->moveFiles(files, destination, options);
+ TestHelper::startAndWaitForResult(moveJob);
+
+ QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(archive);
+ TestHelper::verifyMovedEntriesWithDestination(files, destination, \
resultedEntries); +
+ archive->deleteLater();
+}
+
+#include "movetest.moc"
diff --git a/autotests/plugins/CMakeLists.txt b/autotests/plugins/CMakeLists.txt
index 58cdb32..ee10686 100644
--- a/autotests/plugins/CMakeLists.txt
+++ b/autotests/plugins/CMakeLists.txt
@@ -2,4 +2,3 @@ add_subdirectory(clizipplugin)
add_subdirectory(cli7zplugin)
add_subdirectory(clirarplugin)
add_subdirectory(cliunarchiverplugin)
-add_subdirectory(libarchiveplugin)
diff --git a/autotests/plugins/cli7zplugin/cli7ztest.cpp \
b/autotests/plugins/cli7zplugin/cli7ztest.cpp index b60a235..b0afe7a 100644
--- a/autotests/plugins/cli7zplugin/cli7ztest.cpp
+++ b/autotests/plugins/cli7zplugin/cli7ztest.cpp
@@ -301,7 +301,7 @@ void Cli7zTest::testExtractArgs_data()
QTest::newRow("preserve paths, encrypted")
<< QStringLiteral("/tmp/foo.7z")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QStringLiteral("1234")
@@ -309,28 +309,28 @@ void Cli7zTest::testExtractArgs_data()
QStringLiteral("x"),
QStringLiteral("-p1234"),
QStringLiteral("/tmp/foo.7z"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("preserve paths, unencrypted")
<< QStringLiteral("/tmp/foo.7z")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QString()
<< QStringList {
QStringLiteral("x"),
QStringLiteral("/tmp/foo.7z"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, encrypted")
<< QStringLiteral("/tmp/foo.7z")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QStringLiteral("1234")
@@ -338,21 +338,21 @@ void Cli7zTest::testExtractArgs_data()
QStringLiteral("e"),
QStringLiteral("-p1234"),
QStringLiteral("/tmp/foo.7z"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, unencrypted")
<< QStringLiteral("/tmp/foo.7z")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QString()
<< QStringList {
QStringLiteral("e"),
QStringLiteral("/tmp/foo.7z"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
}
@@ -380,109 +380,3 @@ void Cli7zTest::testExtractArgs()
plugin->deleteLater();
}
-
-void Cli7zTest::testAdd_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("without destination")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this);
-
- QTest::newRow("with destination, files")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-
- QTest::newRow("with destination, directory")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-}
-
-void Cli7zTest::testAdd()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- CliPlugin *plugin = new CliPlugin(this, {QVariant(temporaryDir.path() + \
QLatin1Char('/') + archiveName)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- AddJob *addJob = new AddJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(addJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyAddedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
-
-void Cli7zTest::testMove_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("replace a file")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/a.txt"));
-
- QTest::newRow("replace several files")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/"));
-
- QTest::newRow("replace a directory")
- << QStringLiteral("test.7z")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/dir/"));
-}
-
-void Cli7zTest::testMove()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName;
- Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + archiveName), \
archivePath));
-
- CliPlugin *plugin = new CliPlugin(this, {QVariant(archivePath)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- MoveJob *moveJob = new MoveJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(moveJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyMovedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
diff --git a/autotests/plugins/cli7zplugin/cli7ztest.h \
b/autotests/plugins/cli7zplugin/cli7ztest.h index f66a2e1..86307af 100644
--- a/autotests/plugins/cli7zplugin/cli7ztest.h
+++ b/autotests/plugins/cli7zplugin/cli7ztest.h
@@ -49,10 +49,6 @@ private Q_SLOTS:
void testAddArgs();
void testExtractArgs_data();
void testExtractArgs();
- void testAdd_data();
- void testAdd();
- void testMove_data();
- void testMove();
private:
PluginManager m_pluginManger;
diff --git a/autotests/plugins/clirarplugin/clirartest.cpp \
b/autotests/plugins/clirarplugin/clirartest.cpp index 43a3559..1c6f653 100644
--- a/autotests/plugins/clirarplugin/clirartest.cpp
+++ b/autotests/plugins/clirarplugin/clirartest.cpp
@@ -334,7 +334,7 @@ void CliRarTest::testExtractArgs_data()
QTest::newRow("preserve paths, encrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QStringLiteral("1234")
@@ -344,14 +344,14 @@ void CliRarTest::testExtractArgs_data()
QStringLiteral("x"),
QStringLiteral("-p1234"),
QStringLiteral("/tmp/foo.rar"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("preserve paths, unencrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QString()
@@ -360,14 +360,14 @@ void CliRarTest::testExtractArgs_data()
QStringLiteral("-p-"),
QStringLiteral("x"),
QStringLiteral("/tmp/foo.rar"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, encrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QStringLiteral("1234")
@@ -377,14 +377,14 @@ void CliRarTest::testExtractArgs_data()
QStringLiteral("e"),
QStringLiteral("-p1234"),
QStringLiteral("/tmp/foo.rar"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, unencrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QString()
@@ -393,7 +393,7 @@ void CliRarTest::testExtractArgs_data()
QStringLiteral("-p-"),
QStringLiteral("e"),
QStringLiteral("/tmp/foo.rar"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
}
@@ -423,109 +423,3 @@ void CliRarTest::testExtractArgs()
rarPlugin->deleteLater();
}
-
-void CliRarTest::testAdd_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("without destination")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this);
-
- QTest::newRow("with destination, files")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-
- QTest::newRow("with destination, directory")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-}
-
-void CliRarTest::testAdd()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- CliPlugin *plugin = new CliPlugin(this, {QVariant(temporaryDir.path() + \
QLatin1Char('/') + archiveName)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- AddJob *addJob = new AddJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(addJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyAddedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
-
-void CliRarTest::testMove_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("replace a file")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/a.txt"));
-
- QTest::newRow("replace several files")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/"));
-
- QTest::newRow("replace a directory")
- << QStringLiteral("test.rar")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/dir/"));
-}
-
-void CliRarTest::testMove()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName;
- Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + archiveName), \
archivePath));
-
- CliPlugin *plugin = new CliPlugin(this, {QVariant(archivePath)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- MoveJob *moveJob = new MoveJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(moveJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyMovedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
diff --git a/autotests/plugins/clirarplugin/clirartest.h \
b/autotests/plugins/clirarplugin/clirartest.h index 82e981a..c319c10 100644
--- a/autotests/plugins/clirarplugin/clirartest.h
+++ b/autotests/plugins/clirarplugin/clirartest.h
@@ -50,10 +50,6 @@ private Q_SLOTS:
void testAddArgs();
void testExtractArgs_data();
void testExtractArgs();
- void testAdd_data();
- void testAdd();
- void testMove_data();
- void testMove();
private:
PluginManager m_pluginManger;
diff --git a/autotests/plugins/clirarplugin/data/a.txt \
b/autotests/plugins/clirarplugin/data/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clirarplugin/data/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clirarplugin/data/b.txt \
b/autotests/plugins/clirarplugin/data/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clirarplugin/data/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clirarplugin/data/dir/a.txt \
b/autotests/plugins/clirarplugin/data/dir/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clirarplugin/data/dir/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clirarplugin/data/dir/b.txt \
b/autotests/plugins/clirarplugin/data/dir/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clirarplugin/data/dir/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clizipplugin/cliziptest.cpp \
b/autotests/plugins/clizipplugin/cliziptest.cpp index 6a0814f..694feb5 100644
--- a/autotests/plugins/clizipplugin/cliziptest.cpp
+++ b/autotests/plugins/clizipplugin/cliziptest.cpp
@@ -125,34 +125,34 @@ void CliZipTest::testExtractArgs_data()
QTest::newRow("preserve paths, encrypted")
<< QStringLiteral("/tmp/foo.zip")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QStringLiteral("1234")
<< QStringList {
QStringLiteral("-P1234"),
QStringLiteral("/tmp/foo.zip"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("preserve paths, unencrypted")
<< QStringLiteral("/tmp/foo.zip")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< true << QString()
<< QStringList {
QStringLiteral("/tmp/foo.zip"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, encrypted")
<< QStringLiteral("/tmp/foo.zip")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QStringLiteral("1234")
@@ -160,21 +160,21 @@ void CliZipTest::testExtractArgs_data()
QStringLiteral("-j"),
QStringLiteral("-P1234"),
QStringLiteral("/tmp/foo.zip"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
QTest::newRow("without paths, unencrypted")
<< QStringLiteral("/tmp/foo.zip")
<< QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("aDir/b.txt"), \
QStringLiteral("aDir")), + new Archive::Entry(this, \
QStringLiteral("aDir/textfile2.txt"), QStringLiteral("aDir")),
new Archive::Entry(this, QStringLiteral("c.txt"), QString())
}
<< false << QString()
<< QStringList {
QStringLiteral("-j"),
QStringLiteral("/tmp/foo.zip"),
- QStringLiteral("aDir/b.txt"),
+ QStringLiteral("aDir/textfile2.txt"),
QStringLiteral("c.txt"),
};
}
@@ -201,107 +201,3 @@ void CliZipTest::testExtractArgs()
plugin->deleteLater();
}
-
-void CliZipTest::testAdd_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("without destination")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this);
-
- QTest::newRow("with destination, files")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-
- QTest::newRow("with destination, directory")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-}
-
-void CliZipTest::testAdd()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- CliPlugin *plugin = new CliPlugin(this, {QVariant(temporaryDir.path() + \
QLatin1Char('/') + archiveName)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- AddJob *addJob = new AddJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(addJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyAddedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
-
-void CliZipTest::testMove_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("replace a file")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/a.txt"));
-
- QTest::newRow("replace several files")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/"));
-
- QTest::newRow("replace a directory")
- << QStringLiteral("test.zip")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/dir/"));
-}
-
-void CliZipTest::testMove()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName;
- Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + archiveName), \
archivePath));
-
- CliPlugin *plugin = new CliPlugin(this, {QVariant(archivePath)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- MoveJob *moveJob = new MoveJob(files, destination, CompressionOptions(), \
plugin);
- TestHelper::startAndWaitForResult(moveJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyMovedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
diff --git a/autotests/plugins/clizipplugin/cliziptest.h \
b/autotests/plugins/clizipplugin/cliziptest.h index 0cb485c..dabf899 100644
--- a/autotests/plugins/clizipplugin/cliziptest.h
+++ b/autotests/plugins/clizipplugin/cliziptest.h
@@ -44,10 +44,6 @@ private Q_SLOTS:
void testAddArgs();
void testExtractArgs_data();
void testExtractArgs();
- void testAdd_data();
- void testAdd();
- void testMove_data();
- void testMove();
};
#endif
diff --git a/autotests/plugins/clizipplugin/data/a.txt \
b/autotests/plugins/clizipplugin/data/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clizipplugin/data/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clizipplugin/data/b.txt \
b/autotests/plugins/clizipplugin/data/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clizipplugin/data/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clizipplugin/data/dir/a.txt \
b/autotests/plugins/clizipplugin/data/dir/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clizipplugin/data/dir/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/clizipplugin/data/dir/b.txt \
b/autotests/plugins/clizipplugin/data/dir/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/clizipplugin/data/dir/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/libarchiveplugin/CMakeLists.txt \
b/autotests/plugins/libarchiveplugin/CMakeLists.txt deleted file mode 100644
index 52955f3..0000000
--- a/autotests/plugins/libarchiveplugin/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-include_directories(${CMAKE_SOURCE_DIR}/plugins/libarchive/)
-
-file(COPY ${CMAKE_BINARY_DIR}/plugins/libarchive/kerfuffle_libarchive.json
- DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-
-ecm_add_test(
- libarchivetest.cpp
- ${CMAKE_SOURCE_DIR}/plugins/libarchive/libarchiveplugin.cpp
- ${CMAKE_SOURCE_DIR}/plugins/libarchive/readwritelibarchiveplugin.cpp
- ${CMAKE_BINARY_DIR}/plugins/libarchive/ark_debug.cpp
- LINK_LIBRARIES testhelper ${LibArchive_LIBRARIES} kerfuffle Qt5::Test
- TEST_NAME libarchivetest
- NAME_PREFIX plugins-)
diff --git a/autotests/plugins/libarchiveplugin/data/a.txt \
b/autotests/plugins/libarchiveplugin/data/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/libarchiveplugin/data/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/libarchiveplugin/data/b.txt \
b/autotests/plugins/libarchiveplugin/data/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/libarchiveplugin/data/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/libarchiveplugin/data/dir/a.txt \
b/autotests/plugins/libarchiveplugin/data/dir/a.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/libarchiveplugin/data/dir/a.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/libarchiveplugin/data/dir/b.txt \
b/autotests/plugins/libarchiveplugin/data/dir/b.txt deleted file mode 100644
index b72e979..0000000
--- a/autotests/plugins/libarchiveplugin/data/dir/b.txt
+++ /dev/null
@@ -1 +0,0 @@
-A simple text file.
diff --git a/autotests/plugins/libarchiveplugin/libarchivetest.cpp \
b/autotests/plugins/libarchiveplugin/libarchivetest.cpp deleted file mode 100644
index 93ec69c..0000000
--- a/autotests/plugins/libarchiveplugin/libarchivetest.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2016 Elvis Angelaccio <elvis.angelaccio@kdemail.net>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "libarchivetest.h"
-
-#include <QSignalSpy>
-
-#include <KPluginLoader>
-
-QTEST_GUILESS_MAIN(LibarchiveTest)
-
-using namespace Kerfuffle;
-
-void LibarchiveTest::initTestCase()
-{
- m_plugin = new Plugin(this);
- foreach (Plugin *plugin, m_pluginManger.availablePlugins()) {
- if (plugin->metaData().pluginId() == \
QStringLiteral("kerfuffle_libarchive_readonly")) {
- m_plugin = plugin;
- return;
- }
- }
-}
-
-void LibarchiveTest::testAdd_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("without destination")
- << QStringLiteral("test.gz")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this);
-
- QTest::newRow("with destination, files")
- << QStringLiteral("test.gz")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-
- QTest::newRow("with destination, directory")
- << QStringLiteral("test.gz")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("dir/"));
-}
-
-void LibarchiveTest::testAdd()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- ReadWriteLibarchivePlugin *plugin = new ReadWriteLibarchivePlugin(this, \
{QVariant(temporaryDir.path() + QLatin1Char('/') + archiveName)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- AddJob *addJob = new AddJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(addJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyAddedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
-
-void LibarchiveTest::testMove_data()
-{
- QTest::addColumn<QString>("archiveName");
- QTest::addColumn<QList<Archive::Entry*>>("files");
- QTest::addColumn<Archive::Entry*>("destination");
-
- QTest::newRow("replace a file")
- << QStringLiteral("test.tar.bz2")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/a.txt"));
-
- QTest::newRow("replace several files")
- << QStringLiteral("test.tar.bz2")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("a.txt")),
- new Archive::Entry(this, QStringLiteral("b.txt")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/"));
-
- QTest::newRow("replace a directory")
- << QStringLiteral("test.tar.bz2")
- << QList<Archive::Entry*> {
- new Archive::Entry(this, QStringLiteral("dir/")),
- }
- << new Archive::Entry(this, QStringLiteral("empty_dir/dir/"));
-}
-
-void LibarchiveTest::testMove()
-{
- QTemporaryDir temporaryDir;
-
- QFETCH(QString, archiveName);
- const QString archivePath = temporaryDir.path() + QLatin1Char('/') + \
archiveName;
- Q_ASSERT(QFile::copy(QFINDTESTDATA(QStringLiteral("data/") + archiveName), \
archivePath));
-
- ReadWriteLibarchivePlugin *plugin = new ReadWriteLibarchivePlugin(this, \
{QVariant(archivePath)});
- QVERIFY(plugin);
-
- QFETCH(QList<Archive::Entry*>, files);
- QFETCH(Archive::Entry*, destination);
-
- CompressionOptions options = CompressionOptions();
- options.insert(QStringLiteral("GlobalWorkDir"), QFINDTESTDATA("data"));
- MoveJob *moveJob = new MoveJob(files, destination, options, plugin);
- TestHelper::startAndWaitForResult(moveJob);
-
- QList<Archive::Entry*> resultedEntries = TestHelper::getEntryList(plugin);
- TestHelper::verifyMovedEntriesWithDestination(files, destination, \
resultedEntries);
-
- plugin->deleteLater();
-}
diff --git a/autotests/plugins/libarchiveplugin/libarchivetest.h \
b/autotests/plugins/libarchiveplugin/libarchivetest.h deleted file mode 100644
index 1972b8e..0000000
--- a/autotests/plugins/libarchiveplugin/libarchivetest.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2016 Elvis Angelaccio <elvis.angelaccio@kdemail.net>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBARCHIVETEST_H
-#define LIBARCHIVETEST_H
-
-#include "readwritelibarchiveplugin.h"
-#include "pluginmanager.h"
-#include "autotests/testhelper/testhelper.h"
-#include "kerfuffle/jobs.h"
-
-using namespace Kerfuffle;
-
-class LibarchiveTest : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void testAdd_data();
- void testAdd();
- void testMove_data();
- void testMove();
-
-private:
- PluginManager m_pluginManger;
- Plugin *m_plugin;
-};
-
-#endif //LIBARCHIVETEST_H
diff --git a/autotests/testhelper/testhelper.cpp \
b/autotests/testhelper/testhelper.cpp index 1c41139..4b0cc2a 100644
--- a/autotests/testhelper/testhelper.cpp
+++ b/autotests/testhelper/testhelper.cpp
@@ -13,10 +13,10 @@ void TestHelper::startAndWaitForResult(KJob *job)
m_eventLoop.exec();
}
-QList<Archive::Entry*> TestHelper::getEntryList(ReadOnlyArchiveInterface *iface)
+QList<Archive::Entry*> TestHelper::getEntryList(Archive *archive)
{
QList<Archive::Entry*> list = QList<Archive::Entry*>();
- ListJob *listJob = new ListJob(iface);
+ ListJob *listJob = archive->list();
QObject::connect(listJob, &Job::newEntry, [&list](Archive::Entry* entry) { list \
<< entry; }); startAndWaitForResult(listJob);
return list;
diff --git a/autotests/testhelper/testhelper.h b/autotests/testhelper/testhelper.h
index a451b25..bf9364d 100644
--- a/autotests/testhelper/testhelper.h
+++ b/autotests/testhelper/testhelper.h
@@ -40,7 +40,7 @@ class TestHelper
public:
static void startAndWaitForResult(KJob *job);
- static QList<Archive::Entry*> getEntryList(ReadOnlyArchiveInterface *iface);
+ static QList<Archive::Entry*> getEntryList(Archive *archive);
static QStringList getExpectedEntryPaths(const QList<Archive::Entry*> \
&entryList, const Archive::Entry* destination);
static void verifyAddedEntriesWithDestination(const QList<Archive::Entry *> \
&argumentEntries,
const Archive::Entry *destination,
diff --git a/kerfuffle/archive_kerfuffle.cpp b/kerfuffle/archive_kerfuffle.cpp
index 019f244..4c8fc95 100644
--- a/kerfuffle/archive_kerfuffle.cpp
+++ b/kerfuffle/archive_kerfuffle.cpp
@@ -335,6 +335,24 @@ AddJob* Archive::addFiles(const QList<Archive::Entry*> &files, \
const Archive::En return newJob;
}
+MoveJob* Archive::moveFiles(const QList<Archive::Entry*> &files, Archive::Entry \
*destination, const CompressionOptions& options) +{
+ if (!isValid()) {
+ return Q_NULLPTR;
+ }
+
+ CompressionOptions newOptions = options;
+ if (encryptionType() != Unencrypted) {
+ newOptions[QStringLiteral("PasswordProtectedHint")] = true;
+ }
+
+ qCDebug(ARK) << "Going to add files" << files << "with options" << newOptions;
+ Q_ASSERT(!m_iface->isReadOnly());
+
+ MoveJob *newJob = new MoveJob(files, destination, newOptions, \
static_cast<ReadWriteArchiveInterface*>(m_iface)); + return newJob;
+}
+
ExtractJob* Archive::copyFiles(const QList<Archive::Entry*> &files, const QString& \
destinationDir, const ExtractionOptions& options) {
if (!isValid()) {
diff --git a/kerfuffle/archive_kerfuffle.h b/kerfuffle/archive_kerfuffle.h
index b6b6d3e..9857f5d 100644
--- a/kerfuffle/archive_kerfuffle.h
+++ b/kerfuffle/archive_kerfuffle.h
@@ -45,6 +45,7 @@ class ListJob;
class ExtractJob;
class DeleteJob;
class AddJob;
+class MoveJob;
class CommentJob;
class TestJob;
class OpenJob;
@@ -153,6 +154,8 @@ public:
*/
AddJob* addFiles(const QList<Archive::Entry*> &files, const Archive::Entry \
*destination, const CompressionOptions& options = CompressionOptions());
+ MoveJob* moveFiles(const QList<Archive::Entry*> &files, Archive::Entry \
*destination, const CompressionOptions& options = CompressionOptions()); +
ExtractJob* copyFiles(const QList<Archive::Entry*> &files, const QString \
&destinationDir, const ExtractionOptions &options = ExtractionOptions());
PreviewJob* preview(Archive::Entry *entry);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic