diff --git a/src/app/share/collection/jacketМ6_30-110.val b/src/app/share/collection/jacketМ6_30-110.val
new file mode 100644
index 000000000..640c1eecd
--- /dev/null
+++ b/src/app/share/collection/jacketМ6_30-110.val
@@ -0,0 +1,383 @@
+
+
+
+ 0.2.2
+ mm
+
+
+
+ build-Valentina-Desktop-Debug/src/app/valentina/bin/tables/standard/GOST_man_ru.vst
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro
index 98a5ec3d0..56a782947 100644
--- a/src/test/ValentinaTest/ValentinaTest.pro
+++ b/src/test/ValentinaTest/ValentinaTest.pro
@@ -247,11 +247,16 @@ VALENTINA_TEST_FILES += \
tst_valentina/issue_256_correct.vst \
tst_valentina/issue_256_wrong.vit
+COLLECTION_FILES += \
+ $${PWD}/../../app/share/tables/standard/GOST_man_ru.vst \
+ $${PWD}/../../app/share/collection/jacketМ6_30-110.val
+
# Compilation will fail without this files after we added them to this section.
OTHER_FILES += \
$$TAPE_TEST_FILES \
- $$VALENTINA_TEST_FILES
+ $$VALENTINA_TEST_FILES \
+ $$COLLECTION_FILES
for(DIR, TAPE_TEST_FILES) {
#add these absolute paths to a variable which
@@ -268,3 +273,11 @@ for(DIR, VALENTINA_TEST_FILES) {
}
copyToDestdir($$valentina_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina))
+
+for(DIR, COLLECTION_FILES) {
+ #add these absolute paths to a variable which
+ #ends up as 'mkcommands = path1 path2 path3 ...'
+ collection_path += $$DIR
+}
+
+copyToDestdir($$collection_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina_collection))
diff --git a/src/test/ValentinaTest/abstracttest.cpp b/src/test/ValentinaTest/abstracttest.cpp
index 00039288b..a54d1b1b2 100644
--- a/src/test/ValentinaTest/abstracttest.cpp
+++ b/src/test/ValentinaTest/abstracttest.cpp
@@ -147,8 +147,8 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
QDir::System);
foreach (const QString &fileName, fileNames)
{
- const QString newSrcFilePath = srcFilePath + QLatin1Char('/') + fileName;
- const QString newTgtFilePath = tgtFilePath + QLatin1Char('/') + fileName;
+ const QString newSrcFilePath = srcFilePath + QDir::separator() + fileName;
+ const QString newTgtFilePath = tgtFilePath + QDir::separator() + fileName;
if (not CopyRecursively(newSrcFilePath, newTgtFilePath))
{
return false;
diff --git a/src/test/ValentinaTest/tst_tapecommandline.cpp b/src/test/ValentinaTest/tst_tapecommandline.cpp
index 3b72b91d5..f4842fb39 100644
--- a/src/test/ValentinaTest/tst_tapecommandline.cpp
+++ b/src/test/ValentinaTest/tst_tapecommandline.cpp
@@ -48,8 +48,8 @@ void TST_TapeCommandLine::init()
QFAIL("Fail to remove temp directory.");
}
- if (not CopyRecursively(QApplication::applicationDirPath() + QLatin1Char('/') + QStringLiteral("tst_tape"),
- QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder))
+ if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() + QStringLiteral("tst_tape"),
+ QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
{
QFAIL("Fail to prepare files for testing.");
}
@@ -133,7 +133,8 @@ void TST_TapeCommandLine::OpenMeasurements()
int exit;
const bool res = Run(result, exitCode, exit, TapePath(), QStringList() << "--test"
- << QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file);
+ << QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
+ file);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode);
diff --git a/src/test/ValentinaTest/tst_valentinacommandline.cpp b/src/test/ValentinaTest/tst_valentinacommandline.cpp
index a8f1bf3f6..5d75eb978 100644
--- a/src/test/ValentinaTest/tst_valentinacommandline.cpp
+++ b/src/test/ValentinaTest/tst_valentinacommandline.cpp
@@ -32,6 +32,7 @@
#include
const QString tmpTestFolder = QStringLiteral("tst_valentina_tmp");
+const QString tmpTestCollectionFolder = QStringLiteral("tst_valentina_collection_tmp");
TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
:AbstractTest(parent)
@@ -42,16 +43,34 @@ TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
// cppcheck-suppress unusedFunction
void TST_ValentinaCommandLine::init()
{
- QDir tmpDir(tmpTestFolder);
- if (not tmpDir.removeRecursively())
- {
- QFAIL("Fail to remove temp directory.");
+ {// Test files
+ QDir tmpDir(tmpTestFolder);
+ if (not tmpDir.removeRecursively())
+ {
+ QFAIL("Fail to remove test temp directory.");
+ }
+
+ if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
+ QLatin1Literal("tst_valentina"),
+ QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
+ {
+ QFAIL("Fail to prepare test files for testing.");
+ }
}
- if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() + QLatin1Literal("tst_valentina"),
- QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
- {
- QFAIL("Fail to prepare files for testing.");
+ {// Collection
+ QDir tmpDir(tmpTestCollectionFolder);
+ if (not tmpDir.removeRecursively())
+ {
+ QFAIL("Fail to remove collection temp directory.");
+ }
+
+ if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
+ QLatin1Literal("tst_valentina_collection"),
+ QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder))
+ {
+ QFAIL("Fail to prepare collection files for testing.");
+ }
}
}
@@ -90,9 +109,9 @@ void TST_ValentinaCommandLine::OpenPatterns()
QFETCH(int, exitCode);
int exit;
+ const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const bool res = Run(result, exitCode, exit, ValentinaPath(), QStringList() << "--test"
- << QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
- file);
+ << tmp + QDir::separator() + file);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode);
@@ -149,8 +168,8 @@ void TST_ValentinaCommandLine::ExportMode()
QFETCH(int, exitCode);
int exit;
- const QStringList arg = QStringList() << QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder +
- QDir::separator() + file
+ const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
+ const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;");
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg);
@@ -212,8 +231,43 @@ void TST_ValentinaCommandLine::TestMode()
QFETCH(int, exitCode);
int exit;
- const QStringList arg = QStringList() << QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder +
- QDir::separator() + file
+ const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
+ const QStringList arg = QStringList() << tmp + QDir::separator() + file
+ << arguments.split(";;");
+ const bool res = Run(result, exitCode, exit, ValentinaPath(), arg);
+
+ QCOMPARE(res, result);
+ QCOMPARE(exit, exitCode);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void TST_ValentinaCommandLine::TestOpenCollection_data() const
+{
+ QTest::addColumn("file");
+ QTest::addColumn("arguments");
+ QTest::addColumn("result");
+ QTest::addColumn("exitCode");
+
+ const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
+
+ QTest::newRow("jacketМ6_30-110")<< "jacketМ6_30-110.val"
+ << QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
+ QLatin1Literal("GOST_man_ru.vst"))
+ << true
+ << V_EX_OK;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void TST_ValentinaCommandLine::TestOpenCollection()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, arguments);
+ QFETCH(bool, result);
+ QFETCH(int, exitCode);
+
+ int exit;
+ const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
+ const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;");
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg);
@@ -225,9 +279,19 @@ void TST_ValentinaCommandLine::TestMode()
// cppcheck-suppress unusedFunction
void TST_ValentinaCommandLine::cleanup()
{
- QDir tmpDir(tmpTestFolder);
- if (not tmpDir.removeRecursively())
{
- QWARN("Fail to remove temp directory.");
+ QDir tmpDir(tmpTestFolder);
+ if (not tmpDir.removeRecursively())
+ {
+ QWARN("Fail to remove test temp directory.");
+ }
+ }
+
+ {
+ QDir tmpDir(tmpTestCollectionFolder);
+ if (not tmpDir.removeRecursively())
+ {
+ QWARN("Fail to remove collection temp directory.");
+ }
}
}
diff --git a/src/test/ValentinaTest/tst_valentinacommandline.h b/src/test/ValentinaTest/tst_valentinacommandline.h
index 7ac464c1b..eb3459436 100644
--- a/src/test/ValentinaTest/tst_valentinacommandline.h
+++ b/src/test/ValentinaTest/tst_valentinacommandline.h
@@ -45,6 +45,8 @@ private slots:
void ExportMode();
void TestMode_data() const;
void TestMode();
+ void TestOpenCollection_data() const;
+ void TestOpenCollection();
void cleanup();
private: