diff --git a/src/test/ValentinaTest/abstracttest.cpp b/src/test/ValentinaTest/abstracttest.cpp index 1183ee1f5..ef26e5788 100644 --- a/src/test/ValentinaTest/abstracttest.cpp +++ b/src/test/ValentinaTest/abstracttest.cpp @@ -72,15 +72,18 @@ QString AbstractTest::TapePath() const } //--------------------------------------------------------------------------------------------------------------------- -bool AbstractTest::Run(const QString &program, const QStringList &arguments) +bool AbstractTest::Run(bool showWarn, const QString &program, const QStringList &arguments) { const QString parameters = QString("Program: %1 \nArguments: %2.").arg(program).arg(arguments.join(", ")); QFileInfo info(program); if (not info.exists()) { - const QString msg = QString("Can't find binary.\n%1").arg(parameters); - QWARN(qUtf8Printable(msg)); + if (showWarn) + { + const QString msg = QString("Can't find binary.\n%1").arg(parameters); + QWARN(qUtf8Printable(msg)); + } return false; } @@ -90,24 +93,33 @@ bool AbstractTest::Run(const QString &program, const QStringList &arguments) if (not process->waitForFinished())// 30 sec { - const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters); - QWARN(qUtf8Printable(msg)); + if (showWarn) + { + const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters); + QWARN(qUtf8Printable(msg)); + } return false; } if (process->exitStatus() == QProcess::CrashExit) { - const QString msg = QString("Program crashed.\n%1\n%2").arg(parameters) - .arg(QString(process->readAllStandardError())); - QWARN(qUtf8Printable(msg)); + if (showWarn) + { + const QString msg = QString("Program crashed.\n%1\n%2").arg(parameters) + .arg(QString(process->readAllStandardError())); + QWARN(qUtf8Printable(msg)); + } return false; } if (process->exitCode() != 0) { - const QString msg = QString("Failed.\n%1\n%2").arg(parameters) - .arg(QString(process->readAllStandardError())); - QWARN(qUtf8Printable(msg)); + if (showWarn) + { + const QString msg = QString("Failed.\n%1\n%2").arg(parameters) + .arg(QString(process->readAllStandardError())); + QWARN(qUtf8Printable(msg)); + } return false; } diff --git a/src/test/ValentinaTest/abstracttest.h b/src/test/ValentinaTest/abstracttest.h index f62131b3e..63ccd3bd4 100644 --- a/src/test/ValentinaTest/abstracttest.h +++ b/src/test/ValentinaTest/abstracttest.h @@ -43,7 +43,7 @@ protected: QString ValentinaPath() const; QString TapePath() const; - bool Run(const QString &program, const QStringList &arguments); + bool Run(bool showWarn, const QString &program, const QStringList &arguments); bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const; }; diff --git a/src/test/ValentinaTest/tst_tapecommandline.cpp b/src/test/ValentinaTest/tst_tapecommandline.cpp index a1c041e8e..d72a90cc1 100644 --- a/src/test/ValentinaTest/tst_tapecommandline.cpp +++ b/src/test/ValentinaTest/tst_tapecommandline.cpp @@ -70,7 +70,7 @@ void TST_TapeCommandLine::OpenMeasurements() QFETCH(QString, file); QFETCH(bool, result); - const bool res = Run(TapePath(), QStringList() << "--test" + const bool res = Run(result, TapePath(), QStringList() << "--test" << QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file); QCOMPARE(res, result);