New test case. Wrong object type.
--HG-- branch : develop
This commit is contained in:
parent
bda38a978f
commit
003849649f
|
@ -61,7 +61,7 @@ const static auto LONG_OPTION_GRADATIONSIZE = QStringLiteral("gsize");
|
||||||
const static auto SINGLE_OPTION_GRADATIONSIZE = QStringLiteral("x");
|
const static auto SINGLE_OPTION_GRADATIONSIZE = QStringLiteral("x");
|
||||||
|
|
||||||
const static auto LONG_OPTION_GRADATIONHEIGHT = QStringLiteral("gheight");
|
const static auto LONG_OPTION_GRADATIONHEIGHT = QStringLiteral("gheight");
|
||||||
const static auto SINGLE_OPTION_GRADATIONHEIGHT = QStringLiteral("t");
|
const static auto SINGLE_OPTION_GRADATIONHEIGHT = QStringLiteral("e");
|
||||||
|
|
||||||
//such a tricky initialization is used, because it uses static functions which relay on static variables and order of
|
//such a tricky initialization is used, because it uses static functions which relay on static variables and order of
|
||||||
//initialization is not defined between compiled units. i.e. - segv is possible (I hit it when
|
//initialization is not defined between compiled units. i.e. - segv is possible (I hit it when
|
||||||
|
|
|
@ -196,7 +196,8 @@ TAPE_TEST_FILES += \
|
||||||
|
|
||||||
VALENTINA_TEST_FILES += \
|
VALENTINA_TEST_FILES += \
|
||||||
tst_valentina/empty.val \
|
tst_valentina/empty.val \
|
||||||
tst_valentina/issue_372.val
|
tst_valentina/issue_372.val \
|
||||||
|
tst_valentina/wrong_obj_type.val
|
||||||
|
|
||||||
# Compilation will fail without this files after we added them to this section.
|
# Compilation will fail without this files after we added them to this section.
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
|
|
|
@ -73,7 +73,8 @@ QString AbstractTest::TapePath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool AbstractTest::Run(bool showWarn, int &exitCode, const QString &program, const QStringList &arguments, int msecs)
|
bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &program, const QStringList &arguments,
|
||||||
|
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,7 +110,7 @@ bool AbstractTest::Run(bool showWarn, int &exitCode, const QString &program, con
|
||||||
|
|
||||||
if (process->exitCode() != V_EX_OK)
|
if (process->exitCode() != V_EX_OK)
|
||||||
{
|
{
|
||||||
if (showWarn)
|
if (showWarn || process->exitCode() != exit)
|
||||||
{
|
{
|
||||||
const QString msg = QString("\n%1").arg(QString(process->readAllStandardError()));
|
const QString msg = QString("\n%1").arg(QString(process->readAllStandardError()));
|
||||||
QWARN(qUtf8Printable(msg));
|
QWARN(qUtf8Printable(msg));
|
||||||
|
|
|
@ -48,7 +48,8 @@ protected:
|
||||||
QString ValentinaPath() const;
|
QString ValentinaPath() const;
|
||||||
QString TapePath() const;
|
QString TapePath() const;
|
||||||
|
|
||||||
bool Run(bool showWarn, int &exitCode, const QString &program, const QStringList &arguments, int msecs = 30000);
|
bool Run(bool showWarn, int exit, int &exitCode, const QString &program, const QStringList &arguments,
|
||||||
|
int msecs = 30000);
|
||||||
bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const;
|
bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ void TST_TapeCommandLine::OpenMeasurements()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
int exit;
|
int exit;
|
||||||
const bool res = Run(result, exit, TapePath(), QStringList() << "--test"
|
const bool res = Run(result, exitCode, exit, TapePath(), QStringList() << "--test"
|
||||||
<< QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file);
|
<< QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file);
|
||||||
|
|
||||||
QCOMPARE(res, result);
|
QCOMPARE(res, result);
|
||||||
|
|
21
src/test/ValentinaTest/tst_valentina/wrong_obj_type.val
Normal file
21
src/test/ValentinaTest/tst_valentina/wrong_obj_type.val
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<pattern>
|
||||||
|
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
|
||||||
|
<version>0.2.0</version>
|
||||||
|
<unit>cm</unit>
|
||||||
|
<author/>
|
||||||
|
<description/>
|
||||||
|
<notes/>
|
||||||
|
<measurements>measurements.vit</measurements>
|
||||||
|
<increments>
|
||||||
|
<increment name="#Increment_1" description="" formula="0"/>
|
||||||
|
<increment name="#Increment_2" description="" formula="0"/>
|
||||||
|
</increments>
|
||||||
|
<draw name="Pattern piece 1">
|
||||||
|
<calculation>
|
||||||
|
<point type="sing le" x="0.926042" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
|
||||||
|
</calculation>
|
||||||
|
<modeling/>
|
||||||
|
<details/>
|
||||||
|
</draw>
|
||||||
|
</pattern>
|
|
@ -71,6 +71,10 @@ void TST_ValentinaCommandLine::OpenPatterns_data() const
|
||||||
QTest::newRow("Measurement independent empty file") << "empty.val"
|
QTest::newRow("Measurement independent empty file") << "empty.val"
|
||||||
<< true
|
<< true
|
||||||
<< V_EX_OK;
|
<< V_EX_OK;
|
||||||
|
|
||||||
|
QTest::newRow("File with invalid object type") << "wrong_obj_type.val"
|
||||||
|
<< false
|
||||||
|
<< V_EX_NOINPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -82,7 +86,7 @@ void TST_ValentinaCommandLine::OpenPatterns()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
int exit;
|
int exit;
|
||||||
const bool res = Run(result, exit, ValentinaPath(), QStringList() << "--test"
|
const bool res = Run(result, exitCode, exit, ValentinaPath(), QStringList() << "--test"
|
||||||
<< QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file);
|
<< QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder + QLatin1Char('/') + file);
|
||||||
|
|
||||||
QCOMPARE(res, result);
|
QCOMPARE(res, result);
|
||||||
|
@ -119,7 +123,7 @@ void TST_ValentinaCommandLine::ExportMode()
|
||||||
const QStringList arg = QStringList() << QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder +
|
const QStringList arg = QStringList() << QApplication::applicationDirPath() + QLatin1Char('/') + tmpTestFolder +
|
||||||
QLatin1Char('/') + file
|
QLatin1Char('/') + file
|
||||||
<< arguments.split(";;");
|
<< arguments.split(";;");
|
||||||
const bool res = Run(result, exit, ValentinaPath(), arg);
|
const bool res = Run(result, exitCode, exit, ValentinaPath(), arg);
|
||||||
|
|
||||||
QCOMPARE(res, result);
|
QCOMPARE(res, result);
|
||||||
QCOMPARE(exit, exitCode);
|
QCOMPARE(exit, exitCode);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user