Test limited gradation list.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-10 12:19:31 +02:00
parent 0c731ea406
commit 3ebac9ce59
9 changed files with 168 additions and 14 deletions

View file

@ -3854,7 +3854,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetSize(const QString &text)
bool MainWindow::SetSize(const QString &text)
{
if (not qApp->IsGUIMode())
{
@ -3870,29 +3870,34 @@ void MainWindow::SetSize(const QString &text)
}
else
{
qCWarning(vMainWindow, "%s",
qCCritical(vMainWindow, "%s",
qUtf8Printable(tr("Not supported size value '%1' for this pattern file.").arg(text)));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s",
qCCritical(vMainWindow, "%s",
qUtf8Printable(tr("Couldn't set size. Need a file with standard measurements.")));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s", qUtf8Printable(tr("Couldn't set size. File wasn't opened.")));
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Couldn't set size. File wasn't opened.")));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s", qUtf8Printable(tr("The method %1 does nothing in GUI mode").arg(Q_FUNC_INFO)));
return false;
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetHeight(const QString &text)
bool MainWindow::SetHeight(const QString &text)
{
if (not qApp->IsGUIMode())
{
@ -3908,25 +3913,30 @@ void MainWindow::SetHeight(const QString &text)
}
else
{
qCWarning(vMainWindow, "%s",
qCCritical(vMainWindow, "%s",
qUtf8Printable(tr("Not supported height value '%1' for this pattern file.").arg(text)));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s",
qCCritical(vMainWindow, "%s",
qUtf8Printable(tr("Couldn't set height. Need a file with standard measurements.")));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s", qUtf8Printable(tr("Couldn't set height. File wasn't opened.")));
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Couldn't set height. File wasn't opened.")));
return false;
}
}
else
{
qCWarning(vMainWindow, "%s", qUtf8Printable(tr("The method %1 does nothing in GUI mode").arg(Q_FUNC_INFO)));
return false;
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
@ -3960,16 +3970,18 @@ void MainWindow::ProcessCMD()
return; // process only one input file
}
bool hSetted = true;
bool sSetted = true;
if (loaded && (cmd->IsTestModeEnabled() || cmd->IsExportEnabled()))
{
if (cmd->IsSetGradationSize())
{
SetSize(cmd->OptGradationSize());
sSetted = SetSize(cmd->OptGradationSize());
}
if (cmd->IsSetGradationHeight())
{
SetHeight(cmd->OptGradationHeight());
hSetted = SetHeight(cmd->OptGradationHeight());
}
}
@ -3977,11 +3989,16 @@ void MainWindow::ProcessCMD()
{
if (cmd->IsExportEnabled())
{
if (loaded)
if (loaded && hSetted && sSetted)
{
DoExport(cmd);
return; // process only one input file
}
else
{
qApp->exit(V_EX_DATAERR);
return;
}
break;
}
}

View file

@ -312,8 +312,8 @@ private:
void ReopenFilesAfterCrash(QStringList &args);
void DoExport(const VCommandLinePtr& expParams);
void SetSize(const QString &text);
void SetHeight(const QString & text);
bool SetSize(const QString &text);
bool SetHeight(const QString & text);
QString GetPatternFileName();
QString GetMeasurementFileName();

View file

@ -230,7 +230,12 @@ VALENTINA_TEST_FILES += \
tst_valentina/empty.val \
tst_valentina/issue_372.val \
tst_valentina/wrong_obj_type.val \
tst_valentina/text.val
tst_valentina/text.val \
tst_valentina/glimited_no_m.val \
tst_valentina/glimited_vit.val \
tst_valentina/glimited.vit \
tst_valentina/glimited_vst.val \
tst_valentina/glimited.vst
# Compilation will fail without this files after we added them to this section.
OTHER_FILES += \

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<vit>
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
<version>0.3.3</version>
<read-only>false</read-only>
<notes/>
<unit>cm</unit>
<pm_system>998</pm_system>
<personal>
<family-name/>
<given-name/>
<birth-date>1800-01-01</birth-date>
<gender>unknown</gender>
<email/>
</personal>
<body-measurements>
<m name="@M_1" value="0"/>
</body-measurements>
</vit>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<vst>
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
<version>0.4.2</version>
<read-only>false</read-only>
<notes/>
<unit>cm</unit>
<pm_system>998</pm_system>
<size base="22"/>
<height base="92"/>
<body-measurements>
<m name="@M_2" base="0" size_increase="0" height_increase="0"/>
</body-measurements>
</vst>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.2.1</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements/>
<increments/>
<draw name="Pattern piece 1">
<calculation>
<point type="single" x="0.79375" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="159.044" length="10"/>
</calculation>
<modeling/>
<details/>
</draw>
</pattern>

View file

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.2.1</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements>glimited.vit</measurements>
<increments/>
<draw name="Pattern piece 1">
<calculation>
<point type="single" x="0.79375" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="159.044" length="10"/>
</calculation>
<modeling/>
<details/>
</draw>
</pattern>

View file

@ -0,0 +1,37 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.2.1</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<gradation>
<heights h116="true" h176="true" h104="true" h164="false" h152="true" h92="true" h140="true" h98="true" h158="true" h146="true" h134="true" h194="true" all="false" h122="true" h182="true" h110="true" h170="true" h128="true" h188="true"/>
<sizes s34="true" s36="true" s22="true" s38="true" s24="true" s26="true" s28="true" s50="true" s52="true" s54="true" s40="true" s56="true" all="false" s42="true" s44="true" s30="true" s46="false" s48="true" s32="true"/>
</gradation>
<measurements>glimited.vst</measurements>
<increments/>
<draw name="Чертеж 1">
<calculation>
<point type="single" x="0.926042" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="3"/>
<point type="endLine" typeLine="hair" id="3" name="A2" basePoint="2" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="3"/>
<line typeLine="hair" id="4" firstPoint="1" secondPoint="3" lineColor="black"/>
</calculation>
<modeling>
<point type="modeling" id="5" idObject="1" mx="0.132292" my="0.264583"/>
<point type="modeling" id="6" idObject="2" mx="0.132292" my="0.264583"/>
<point type="modeling" id="7" idObject="3" mx="0.132292" my="0.264583"/>
<point type="modeling" id="8" idObject="1" mx="0.132292" my="0.264583"/>
</modeling>
<details>
<detail closed="1" id="9" name="Деталь" supplement="1" mx="0.608542" width="1" my="0.608542">
<node type="NodePoint" nodeType="Contour" idObject="5" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="6" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="7" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="8" mx="0" my="0"/>
</detail>
</details>
</draw>
</pattern>

View file

@ -112,6 +112,30 @@ void TST_ValentinaCommandLine::ExportMode_data() const
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
<< true
<< V_EX_OK;
QTest::newRow("A file with limited gradation. Standard measurements. Wrong data.")
<< "glimited_vst.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;46;;--gheight;;164;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR;
QTest::newRow("A file with limited gradation. Standard measurements. Correct data.")
<< "glimited_vst.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< true
<< V_EX_OK;
QTest::newRow("A file with limited gradation. Individual measurements.")
<< "glimited_vit.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR;
QTest::newRow("A file with limited gradation. No measurements.")
<< "glimited_no_m.val"
<< QString("-p;;0;;-d;;%1;;--gsize;;40;;--gheight;;134;;-b;;output").arg(tmp)
<< false
<< V_EX_DATAERR;
}
//---------------------------------------------------------------------------------------------------------------------