Merge with develop

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-04 16:28:38 +02:00
commit f58f840488
11 changed files with 93 additions and 116 deletions

View File

@ -49,6 +49,10 @@ int main(int argc, char *argv[])
qt_qhash_seed.store(0); // Lock producing random attribute order in XML qt_qhash_seed.store(0); // Lock producing random attribute order in XML
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
#endif
MApplication app(argc, argv); MApplication app(argc, argv);
app.InitOptions(); app.InitOptions();

View File

@ -444,8 +444,16 @@ void TMainWindow::CreateFromExisting()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::Preferences() void TMainWindow::Preferences()
{ {
TapeConfigDialog dlg(this); // Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
dlg.exec(); static QPointer<TapeConfigDialog> guard;// Prevent any second run
if (guard.isNull())
{
TapeConfigDialog *config = new TapeConfigDialog(this);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<TapeConfigDialog> dlg(config);
guard = config;
dlg->exec();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -337,8 +337,8 @@ QGroupBox *ConfigurationPage::SendGroup()
description = new QLabel(tr("After each crash Valentina collects information that may help us fix the " description = new QLabel(tr("After each crash Valentina collects information that may help us fix the "
"problem. We do not collect any personal information. Find more about what " "problem. We do not collect any personal information. Find more about what "
"<a href=\"https://bitbucket.org/dismine/valentina/wiki/manual/" "<a href=\"https://wiki.valentinaproject.org/wiki/UserManual:Crash_reports\">"
"Crash_reports\">kind of information</a> we collect.")); "kind of information</a> we collect."));
description->setTextFormat(Qt::RichText); description->setTextFormat(Qt::RichText);
description->setTextInteractionFlags(Qt::TextBrowserInteraction); description->setTextInteractionFlags(Qt::TextBrowserInteraction);
description->setOpenExternalLinks(true); description->setOpenExternalLinks(true);

View File

@ -229,12 +229,14 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
select = true; select = true;
qApp->getUndoStack()->beginMacro(tr("select all details")); qApp->getUndoStack()->beginMacro(tr("select all details"));
ToggleSectionDetails(select); ToggleSectionDetails(select);
qApp->getUndoStack()->endMacro();
} }
else if (selectedAction == actionSelectNone) else if (selectedAction == actionSelectNone)
{ {
select = false; select = false;
qApp->getUndoStack()->beginMacro(tr("select none details")); qApp->getUndoStack()->beginMacro(tr("select none details"));
ToggleSectionDetails(select); ToggleSectionDetails(select);
qApp->getUndoStack()->endMacro();
} }
else if (selectedAction == actionInvertSelection) else if (selectedAction == actionInvertSelection)
{ {
@ -253,7 +255,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
qApp->getUndoStack()->push(togglePrint); qApp->getUndoStack()->push(togglePrint);
} }
} }
}
qApp->getUndoStack()->endMacro(); qApp->getUndoStack()->endMacro();
} }
}

View File

@ -53,6 +53,10 @@ int main(int argc, char *argv[])
qt_qhash_seed.store(0); // Lock producing random attribute order in XML qt_qhash_seed.store(0); // Lock producing random attribute order in XML
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
#endif
VApplication app(argc, argv); VApplication app(argc, argv);
app.InitOptions(); app.InitOptions();

View File

@ -4017,15 +4017,23 @@ void MainWindow::ShowPaper(int index)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::Preferences() void MainWindow::Preferences()
{ {
ConfigDialog dlg(this); // Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first static QPointer<ConfigDialog> guard;// Prevent any second run
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions); if (guard.isNull())
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles); {
if (dlg.exec() == QDialog::Accepted) ConfigDialog *config = new ConfigDialog(this);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<ConfigDialog> dlg(config);
guard = config;
connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
connect(dlg.data(), &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles);
if (guard->exec() == QDialog::Accepted)
{ {
InitAutoSave(); InitAutoSave();
} }
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::CreateMeasurements() void MainWindow::CreateMeasurements()

View File

@ -99,8 +99,7 @@ QString AbstractTest::TranslationsPath() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &program, const QStringList &arguments, int AbstractTest::Run(int exit, const QString &program, const QStringList &arguments, int msecs)
int msecs)
{ {
const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program).arg(arguments.join(", ")); const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program).arg(arguments.join(", "));
@ -109,8 +108,7 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
{ {
const QString msg = QString("Can't find binary.\n%1").arg(parameters); const QString msg = QString("Can't find binary.\n%1").arg(parameters);
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
exitCode = TST_EX_BIN; return TST_EX_BIN;
return false;
} }
QScopedPointer<QProcess> process(new QProcess()); QScopedPointer<QProcess> process(new QProcess());
@ -121,9 +119,8 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
{ {
const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters); const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters);
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
exitCode = TST_EX_TIME_OUT;
process->kill(); process->kill();
return false; return TST_EX_TIME_OUT;
} }
if (process->exitStatus() == QProcess::CrashExit) if (process->exitStatus() == QProcess::CrashExit)
@ -131,23 +128,17 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
const QString msg = QString("Program crashed.\n%1\n%2").arg(parameters) const QString msg = QString("Program crashed.\n%1\n%2").arg(parameters)
.arg(QString(process->readAllStandardError())); .arg(QString(process->readAllStandardError()));
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
exitCode = TST_EX_CRASH; return TST_EX_CRASH;
return false;
} }
if (process->exitCode() != V_EX_OK) if (process->exitCode() != exit)
{ {
if (showWarn || process->exitCode() != exit) const QString msg = QString("Unexpected finish.\n%1").arg(QString(process->readAllStandardError()));
{
const QString msg = QString("\n%1").arg(QString(process->readAllStandardError()));
QWARN(qUtf8Printable(msg)); QWARN(qUtf8Printable(msg));
} return process->exitCode();
exitCode = process->exitCode();
return false;
} }
exitCode = process->exitCode(); return process->exitCode();
return true;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -69,8 +69,7 @@ protected:
QString TapePath() const; QString TapePath() const;
QString TranslationsPath() const; QString TranslationsPath() const;
bool Run(bool showWarn, int exit, int &exitCode, const QString &program, const QStringList &arguments, int Run(int exit, const QString &program, const QStringList &arguments, int msecs = 30000);
int msecs = 30000);
bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const; bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const;
}; };

View File

@ -101,8 +101,20 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
} }
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) #endif // QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
// Enable support for HiDPI bitmap resources // Enable support for HiDPI bitmap resources
// The attribute is available since Qt 5.1, but by default disabled.
// Because on Windows and Mac OS X we always use last version
// and Linux users send bug reports probably they related to this attribute
// better not enable it before Qt 5.6.
//
// Related issues:
// Issue #584. frequent xcb errors and hangs
// https://bitbucket.org/dismine/valentina/issues/584/frequent-xcb-errors-and-hangs
// Issue #527. Error: Pasting a wrong formula : every dialog box is "glued" to the screen and can't close file
// or Valentina.
// https://bitbucket.org/dismine/valentina/issues/527/error-pasting-a-wrong-formula-every-dialog
setAttribute(Qt::AA_UseHighDpiPixmaps); setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif #endif

View File

@ -59,68 +59,52 @@ void TST_TapeCommandLine::initTestCase()
void TST_TapeCommandLine::OpenMeasurements_data() const void TST_TapeCommandLine::OpenMeasurements_data() const
{ {
QTest::addColumn<QString>("file"); QTest::addColumn<QString>("file");
QTest::addColumn<bool>("result");
QTest::addColumn<int>("exitCode"); QTest::addColumn<int>("exitCode");
// The file doesn't exist! // The file doesn't exist!
QTest::newRow("Send wrong path to a file") << "wrongPath.vit" QTest::newRow("Send wrong path to a file") << "wrongPath.vit"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Old individual format to new version") << "keiko.vit" QTest::newRow("Old individual format to new version") << "keiko.vit"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open empty file") << "empty.vit" QTest::newRow("Open empty file") << "empty.vit"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VIT file with all know measurements (v0.3.0)") << "all_measurements_v0.3.0.vit" QTest::newRow("Open the VIT file with all know measurements (v0.3.0)") << "all_measurements_v0.3.0.vit"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VST file with all know measurements (v0.4.0)") << "all_measurements_v0.4.0.vst" QTest::newRow("Open the VST file with all know measurements (v0.4.0)") << "all_measurements_v0.4.0.vst"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VST file for man ru GOST (v0.3.0).") << "GOST_man_ru_v0.3.0.vst" QTest::newRow("Open the VST file for man ru GOST (v0.3.0).") << "GOST_man_ru_v0.3.0.vst"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VIT file with all know measurements (v0.3.3)") << "all_measurements_v0.3.3.vit" QTest::newRow("Open the VIT file with all know measurements (v0.3.3)") << "all_measurements_v0.3.3.vit"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VST file with all know measurements (v0.4.2)") << "all_measurements_v0.4.2.vst" QTest::newRow("Open the VST file with all know measurements (v0.4.2)") << "all_measurements_v0.4.2.vst"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Open the VST file for man ru GOST (v0.4.2).") << "GOST_man_ru_v0.4.2.vst" QTest::newRow("Open the VST file for man ru GOST (v0.4.2).") << "GOST_man_ru_v0.4.2.vst"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Broken file. Not unique name.") << "broken1.vit" QTest::newRow("Broken file. Not unique name.") << "broken1.vit"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Broken file. Measurement name can't be empty.") << "broken1.vit" QTest::newRow("Broken file. Measurement name can't be empty.") << "broken1.vit"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Broken file. An empty value shouldn't break a file.") << "broken3.vit" QTest::newRow("Broken file. An empty value shouldn't break a file.") << "broken3.vit"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Broken file. Invalid measurement name.") << "broken4.vit" QTest::newRow("Broken file. Invalid measurement name.") << "broken4.vit"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Empty text VIT file.") << "text.vit" QTest::newRow("Empty text VIT file.") << "text.vit"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Empty text VST file.") << "text.vst" QTest::newRow("Empty text VST file.") << "text.vst"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
} }
@ -128,15 +112,12 @@ void TST_TapeCommandLine::OpenMeasurements_data() const
void TST_TapeCommandLine::OpenMeasurements() void TST_TapeCommandLine::OpenMeasurements()
{ {
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(bool, result);
QFETCH(int, exitCode); QFETCH(int, exitCode);
int exit; const int exit = Run(exitCode, TapePath(), QStringList() << "--test"
const bool res = Run(result, exitCode, exit, TapePath(), QStringList() << "--test"
<< QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() + << QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
file); file);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode); QCOMPARE(exit, exitCode);
} }

View File

@ -79,24 +79,19 @@ void TST_ValentinaCommandLine::initTestCase()
void TST_ValentinaCommandLine::OpenPatterns_data() const void TST_ValentinaCommandLine::OpenPatterns_data() const
{ {
QTest::addColumn<QString>("file"); QTest::addColumn<QString>("file");
QTest::addColumn<bool>("result");
QTest::addColumn<int>("exitCode"); QTest::addColumn<int>("exitCode");
// The file doesn't exist! // The file doesn't exist!
QTest::newRow("Send wrong path to a file") << "wrongPath.val" QTest::newRow("Send wrong path to a file") << "wrongPath.val"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Measurement independent empty file") << "empty.val" QTest::newRow("Measurement independent empty file") << "empty.val"
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("File with invalid object type") << "wrong_obj_type.val" QTest::newRow("File with invalid object type") << "wrong_obj_type.val"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Empty text VAL file") << "txt.val" QTest::newRow("Empty text VAL file") << "txt.val"
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
} }
@ -105,15 +100,12 @@ void TST_ValentinaCommandLine::OpenPatterns_data() const
void TST_ValentinaCommandLine::OpenPatterns() void TST_ValentinaCommandLine::OpenPatterns()
{ {
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(bool, result);
QFETCH(int, exitCode); QFETCH(int, exitCode);
int exit;
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const bool res = Run(result, exitCode, exit, ValentinaPath(), QStringList() << "--test" const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test"
<< tmp + QDir::separator() + file); << tmp + QDir::separator() + file);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode); QCOMPARE(exit, exitCode);
} }
@ -123,38 +115,32 @@ void TST_ValentinaCommandLine::ExportMode_data() const
{ {
QTest::addColumn<QString>("file"); QTest::addColumn<QString>("file");
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<bool>("result");
QTest::addColumn<int>("exitCode"); QTest::addColumn<int>("exitCode");
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
QTest::newRow("Issue #372")<< "issue_372.val" QTest::newRow("Issue #372")<< "issue_372.val"
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("A file with limited gradation. Standard measurements. Wrong data.") QTest::newRow("A file with limited gradation. Standard measurements. Wrong data.")
<< "glimited_vst.val" << "glimited_vst.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;46;;--gheight;;164;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;--gsize;;46;;--gheight;;164;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR; << V_EX_DATAERR;
QTest::newRow("A file with limited gradation. Standard measurements. Correct data.") QTest::newRow("A file with limited gradation. Standard measurements. Correct data.")
<< "glimited_vst.val" << "glimited_vst.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("A file with limited gradation. Individual measurements.") QTest::newRow("A file with limited gradation. Individual measurements.")
<< "glimited_vit.val" << "glimited_vit.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR; << V_EX_DATAERR;
QTest::newRow("A file with limited gradation. No measurements.") QTest::newRow("A file with limited gradation. No measurements.")
<< "glimited_no_m.val" << "glimited_no_m.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp) << QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR; << V_EX_DATAERR;
} }
@ -164,16 +150,13 @@ void TST_ValentinaCommandLine::ExportMode()
{ {
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(QString, arguments); QFETCH(QString, arguments);
QFETCH(bool, result);
QFETCH(int, exitCode); QFETCH(int, exitCode);
int exit;
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg); const int exit = Run(exitCode, ValentinaPath(), arg);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode); QCOMPARE(exit, exitCode);
} }
@ -182,48 +165,40 @@ void TST_ValentinaCommandLine::TestMode_data() const
{ {
QTest::addColumn<QString>("file"); QTest::addColumn<QString>("file");
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<bool>("result");
QTest::addColumn<int>("exitCode"); QTest::addColumn<int>("exitCode");
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
QTest::newRow("Issue #256. Correct path.")<< "issue_256.val" QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
<< QString("--test") << QString("--test")
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Issue #256. Wrong path.")<< "issue_256_wrong_path.vit" QTest::newRow("Issue #256. Wrong path.")<< "issue_256_wrong_path.vit"
<< QString("--test") << QString("--test")
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Issue #256. Correct individual measurements.")<< "issue_256.val" QTest::newRow("Issue #256. Correct individual measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + << QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1String("issue_256_correct.vit")) QLatin1String("issue_256_correct.vit"))
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Issue #256. Wrong individual measurements.")<< "issue_256.val" QTest::newRow("Issue #256. Wrong individual measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + << QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1String("issue_256_wrong.vit")) QLatin1String("issue_256_wrong.vit"))
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Issue #256. Correct standard measurements.")<< "issue_256.val" QTest::newRow("Issue #256. Correct standard measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + << QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1String("issue_256_correct.vst")) QLatin1String("issue_256_correct.vst"))
<< true
<< V_EX_OK; << V_EX_OK;
QTest::newRow("Issue #256. Wrong standard measurements.")<< "issue_256.val" QTest::newRow("Issue #256. Wrong standard measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + << QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1String("issue_256_wrong.vst")) QLatin1String("issue_256_wrong.vst"))
<< false
<< V_EX_NOINPUT; << V_EX_NOINPUT;
QTest::newRow("Wrong formula.")<< "wrong_formula.val" QTest::newRow("Wrong formula.")<< "wrong_formula.val"
<< QString("--test") << QString("--test")
<< false
<< V_EX_DATAERR; << V_EX_DATAERR;
} }
@ -232,16 +207,13 @@ void TST_ValentinaCommandLine::TestMode()
{ {
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(QString, arguments); QFETCH(QString, arguments);
QFETCH(bool, result);
QFETCH(int, exitCode); QFETCH(int, exitCode);
int exit;
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg); const int exit = Run(exitCode, ValentinaPath(), arg);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode); QCOMPARE(exit, exitCode);
} }
@ -250,43 +222,42 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const
{ {
QTest::addColumn<QString>("file"); QTest::addColumn<QString>("file");
QTest::addColumn<QString>("arguments"); QTest::addColumn<QString>("arguments");
QTest::addColumn<bool>("result");
QTest::addColumn<int>("exitCode"); QTest::addColumn<int>("exitCode");
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst")); const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
const QString keyTest = QStringLiteral("--test"); const QString keyTest = QStringLiteral("--test");
QTest::newRow("bra") << "bra.val" << keyTest << true << V_EX_OK; QTest::newRow("bra") << "bra.val" << keyTest << V_EX_OK;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
Q_UNUSED(testGOST) Q_UNUSED(testGOST)
#else #else
QTest::newRow("jacketМ1_52-176") << "jacketМ1_52-176.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ1_52-176") << "jacketМ1_52-176.val" << testGOST << V_EX_OK;
QTest::newRow("jacketМ2_40-146") << "jacketМ2_40-146.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ2_40-146") << "jacketМ2_40-146.val" << testGOST << V_EX_OK;
QTest::newRow("jacketМ3_40-146") << "jacketМ3_40-146.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ3_40-146") << "jacketМ3_40-146.val" << testGOST << V_EX_OK;
QTest::newRow("jacketМ4_40-146") << "jacketМ4_40-146.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ4_40-146") << "jacketМ4_40-146.val" << testGOST << V_EX_OK;
QTest::newRow("jacketМ5_30-110") << "jacketМ5_30-110.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ5_30-110") << "jacketМ5_30-110.val" << testGOST << V_EX_OK;
QTest::newRow("jacketМ6_30-110") << "jacketМ6_30-110.val" << testGOST << true << V_EX_OK; QTest::newRow("jacketМ6_30-110") << "jacketМ6_30-110.val" << testGOST << V_EX_OK;
QTest::newRow("pantsМ1_52-176") << "pantsМ1_52-176.val" << testGOST << true << V_EX_OK; QTest::newRow("pantsМ1_52-176") << "pantsМ1_52-176.val" << testGOST << V_EX_OK;
QTest::newRow("pantsМ2_40-146") << "pantsМ2_40-146.val" << testGOST << true << V_EX_OK; QTest::newRow("pantsМ2_40-146") << "pantsМ2_40-146.val" << testGOST << V_EX_OK;
QTest::newRow("pantsМ7") << "pantsМ7.val" << testGOST << true << V_EX_OK; QTest::newRow("pantsМ7") << "pantsМ7.val" << testGOST << V_EX_OK;
#endif #endif
QTest::newRow("TShirt_test") << "TShirt_test.val" << keyTest << true << V_EX_OK; QTest::newRow("TShirt_test") << "TShirt_test.val" << keyTest << V_EX_OK;
QTest::newRow("TestDart") << "TestDart.val" << keyTest << true << V_EX_OK; QTest::newRow("TestDart") << "TestDart.val" << keyTest << V_EX_OK;
QTest::newRow("MaleShirt") << "MaleShirt.val" << keyTest << true << V_EX_OK; QTest::newRow("MaleShirt") << "MaleShirt.val" << keyTest << V_EX_OK;
QTest::newRow("Trousers") << "Trousers.val" << keyTest << true << V_EX_OK; QTest::newRow("Trousers") << "Trousers.val" << keyTest << V_EX_OK;
QTest::newRow("Basic block women") << "Basic_block_women-2016.val" << keyTest << true << V_EX_OK; QTest::newRow("Basic block women") << "Basic_block_women-2016.val" << keyTest << V_EX_OK;
QTest::newRow("Gent Jacket with tummy") << "Gent_Jacket_with_tummy.val" << keyTest << true << V_EX_OK; QTest::newRow("Gent Jacket with tummy") << "Gent_Jacket_with_tummy.val" << keyTest << V_EX_OK;
QTest::newRow("Steampunk_trousers") << "Steampunk_trousers.val" << keyTest << true << V_EX_OK; QTest::newRow("Steampunk_trousers") << "Steampunk_trousers.val" << keyTest << V_EX_OK;
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
QTest::newRow("patrón_blusa") << "patrón_blusa.val" << keyTest << true << V_EX_OK; QTest::newRow("patrón_blusa") << "patrón_blusa.val" << keyTest << V_EX_OK;
QTest::newRow("PajamaTopWrap2") << "PajamaTopWrap2.val" << keyTest << true << V_EX_OK; QTest::newRow("PajamaTopWrap2") << "PajamaTopWrap2.val" << keyTest << V_EX_OK;
QTest::newRow("Keiko_skirt") << "Keiko_skirt.val" << keyTest << true << V_EX_OK; QTest::newRow("Keiko_skirt") << "Keiko_skirt.val" << keyTest << V_EX_OK;
QTest::newRow("pantalon_base_Eli") << "pantalon_base_Eli.val" << keyTest << true << V_EX_OK; QTest::newRow("pantalon_base_Eli") << "pantalon_base_Eli.val" << keyTest << V_EX_OK;
QTest::newRow("modell_2") << "modell_2.val" << keyTest << true << V_EX_OK; QTest::newRow("modell_2") << "modell_2.val" << keyTest << V_EX_OK;
QTest::newRow("IMK_Zhaketa") << "IMK_Zhaketa_poluprilegayuschego_silueta.val" << keyTest << true << V_EX_OK; QTest::newRow("IMK_Zhaketa") << "IMK_Zhaketa_poluprilegayuschego_silueta.val" << keyTest << V_EX_OK;
QTest::newRow("Moulage_0.5_armhole_neckline") << "Moulage_0.5_armhole_neckline.val" << keyTest << true << V_EX_OK; QTest::newRow("Moulage_0.5_armhole_neckline") << "Moulage_0.5_armhole_neckline.val" << keyTest << V_EX_OK;
QTest::newRow("0.7_Armhole_adjustment_0.10") << "0.7_Armhole_adjustment_0.10.val" << keyTest << true << V_EX_OK; QTest::newRow("0.7_Armhole_adjustment_0.10") << "0.7_Armhole_adjustment_0.10.val" << keyTest << V_EX_OK;
#endif #endif
// We have a problem with encoding in Windows when we try to open some files in terminal // We have a problem with encoding in Windows when we try to open some files in terminal
} }
@ -296,16 +267,13 @@ void TST_ValentinaCommandLine::TestOpenCollection()
{ {
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(QString, arguments); QFETCH(QString, arguments);
QFETCH(bool, result);
QFETCH(int, exitCode); QFETCH(int, exitCode);
int exit;
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder; const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
const QStringList arg = QStringList() << tmp + QDir::separator() + file const QStringList arg = QStringList() << tmp + QDir::separator() + file
<< arguments.split(";;"); << arguments.split(";;");
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg); const int exit = Run(exitCode, ValentinaPath(), arg);
QCOMPARE(res, result);
QCOMPARE(exit, exitCode); QCOMPARE(exit, exitCode);
} }