Fixing issue #548 requre update several tests.

(grafted from 31527cd23897c7ede07be2525f57a6de29da2c82)

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-20 20:14:01 +03:00
parent f67f7d059c
commit 02376b0769
3 changed files with 102 additions and 158 deletions

View File

@ -40,6 +40,25 @@ TST_VAbstractDetail::TST_VAbstractDetail(QObject *parent)
{ {
} }
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::EquidistantRemoveLoop_data()
{
QTest::addColumn<QVector<QPointF>>("points");
QTest::addColumn<int>("eqv");
QTest::addColumn<qreal>("width");
QTest::addColumn<QVector<QPointF>>("ekvOrig");
QTest::newRow("Case1") << InputPointsCase1()
<< static_cast<int>(EquidistantType::CloseEquidistant)
<< 75.5906 // seam allowance width
<< OutputPointsCase1();
QTest::newRow("Case2") << InputPointsCase2()
<< static_cast<int>(EquidistantType::CloseEquidistant)
<< 37.7953 // seam allowance width
<< OutputPointsCase2();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void TST_VAbstractDetail::EquidistantRemoveLoop() const void TST_VAbstractDetail::EquidistantRemoveLoop() const
@ -48,8 +67,15 @@ void TST_VAbstractDetail::EquidistantRemoveLoop() const
// See issue #298. Segmented Curve isn't selected in Seam Allowance tool. // See issue #298. Segmented Curve isn't selected in Seam Allowance tool.
// https://bitbucket.org/dismine/valentina/issue/298/segmented-curve-isnt-selected-in-seam // https://bitbucket.org/dismine/valentina/issue/298/segmented-curve-isnt-selected-in-seam
// Code should clean loops in path. // Code should clean loops in path.
Case1(); QFETCH(QVector<QPointF>, points);
Case2(); QFETCH(int, eqv);
QFETCH(qreal, width);
QFETCH(QVector<QPointF>, ekvOrig);
const QVector<QPointF> ekv = VAbstractDetail::Equidistant(points, static_cast<EquidistantType>(eqv), width);
// Begin comparison
Comparison(ekv, ekvOrig);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -256,11 +282,15 @@ void TST_VAbstractDetail::BrokenDetailEquidistant() const
// We will test only one detail. The second require too accurate data that we cannot get from debuger. // We will test only one detail. The second require too accurate data that we cannot get from debuger.
// The test check an open equdistant of correct detail. // The test check an open equdistant of correct detail.
QVector<QPointF> points;// Input points. QVector<QPointF> points;// Input points.
points.append(QPointF(1062.36226525, 134.022845566)); points.append(QPointF(787.5835464566929, 1701.3138897637796));
points.append(QPointF(1375.53777429, 66.4182791729)); points.append(QPointF(938.7646488188976, 1701.3138897637796));
points.append(QPointF(1422.22769398, 510.762708661)); points.append(QPointF(910.0209091217698, 1792.3369853889722));
points.append(QPointF(1467.89850709, 945.408377953)); points.append(QPointF(878.5244039283091, 1905.2261617043234));
points.append(QPointF(1127.74102677, 510.762708661)); points.append(QPointF(863.9159293830619, 1968.2534932384856));
points.append(QPointF(852.8936778444679, 1919.6965437838999));
points.append(QPointF(819.0677656132684, 1798.6758641921479));
points.append(QPointF(787.5835464566929, 1701.3138897637796));
points.append(QPointF(797.0323653543306, 2608.4005039370077));
const EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path const EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path
const qreal width = 37.795275590551185; // seam allowance width const qreal width = 37.795275590551185; // seam allowance width
@ -268,40 +298,12 @@ void TST_VAbstractDetail::BrokenDetailEquidistant() const
const QVector<QPointF> ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result const QVector<QPointF> ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result
QVector<QPointF> ekvOrig; QVector<QPointF> ekvOrig;
ekvOrig.append(QPointF(1055.89455044, 96.7531583682)); ekvOrig.append(QPointF(787.1898456692913, 1663.5186141732283));
ekvOrig.append(QPointF(1408.72549102, 20.5882538362)); ekvOrig.append(QPointF(989.3402780205395, 1663.5186141732283));
ekvOrig.append(QPointF(1459.81603355, 506.813077611)); ekvOrig.append(QPointF(915.0896841461371, 1914.8556948468406));
ekvOrig.append(QPointF(1508.46179299, 969.771085841)); ekvOrig.append(QPointF(894.0594908835558, 2005.5891221381557));
ekvOrig.append(QPointF(1455.67973006, 991.120774377)); ekvOrig.append(QPointF(834.9361130712198, 2006.4994568398874));
ekvOrig.append(QPointF(1141.4155362, 589.560971108)); ekvOrig.append(QPointF(788.9513624221928, 1832.6242224517807));
// Begin comparison
Comparison(ekv, ekvOrig);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::Case1() const
{
const QVector<QPointF> points = InputPointsCase1(); // Input points.
const EquidistantType eqv = EquidistantType::CloseEquidistant; // Closed path
const qreal width = 75.5906; // seam allowance width
const QVector<QPointF> ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result
const QVector<QPointF> ekvOrig = OutputPointsCase1(); // Expected result
// Begin comparison
Comparison(ekv, ekvOrig);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::Case2() const
{
const QVector<QPointF> points = InputPointsCase2(); // Input points.
const EquidistantType eqv = EquidistantType::CloseEquidistant; // Closed path
const qreal width = 37.7953; // seam allowance width
const QVector<QPointF> ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result
const QVector<QPointF> ekvOrig = OutputPointsCase2(); // Expected result
// Begin comparison // Begin comparison
Comparison(ekv, ekvOrig); Comparison(ekv, ekvOrig);
@ -413,41 +415,27 @@ QVector<QPointF> TST_VAbstractDetail::OutputPointsCase1() const
{ {
QVector<QPointF> points; QVector<QPointF> points;
points += QPointF(-52.3725, -35.5907); points += QPointF(-52.3724798442221, -35.5907);
points += QPointF(487.711, -35.5907); points += QPointF(487.7117748779425, -35.5907);
points += QPointF(493.343, 473.326); points += QPointF(493.3486932130227, 473.81998224542247);
points += QPointF(385.981, 506.845); points += QPointF(384.7625023736152, 506.7228642416019);
points += QPointF(345.647, 447.143); points += QPointF(326.77984549201204, 417.71265429523794);
points += QPointF(326.825, 417.766); points += QPointF(280.4343843787976, 340.220616520921);
points += QPointF(297.492, 369.749); points += QPointF(269.00223298277206, 346.06212334710335);
points += QPointF(280.344, 340.638); points += QPointF(239.6571136552229, 350.73379418002804);
points += QPointF(268.238, 345.564); points += QPointF(205.89523544191223, 345.8623563310819);
points += QPointF(254.389, 348.788); points += QPointF(173.89027296099863, 332.6512960877336);
points += QPointF(240.894, 350.022); points += QPointF(145.31523414712046, 315.34576260355936);
points += QPointF(224.296, 349.294); points += QPointF(117.9921341644787, 294.6948297428524);
points += QPointF(205.506, 345.316); points += QPointF(91.25349438209683, 270.93768759082707);
points += QPointF(188.726, 339.383); points += QPointF(65.22541125346564, 244.39379519957222);
points += QPointF(173.487, 332.257); points += QPointF(40.34791988062461, 215.4153238967542);
points += QPointF(159.093, 324.152); points += QPointF(17.205314383747528, 184.31949780808853);
points += QPointF(145.156, 315.146); points += QPointF(-3.534416178847685, 151.30687894362717);
points += QPointF(131.469, 305.281); points += QPointF(-21.090087790322336, 116.33389217738734);
points += QPointF(117.936, 294.59); points += QPointF(-33.795079640648055, 80.66898804409438);
points += QPointF(104.527, 283.112); points += QPointF(-38.441724866417594, 60.24852451858777);
points += QPointF(91.2504, 270.888); points += QPointF(-52.3724798442221, -35.5907);
points += QPointF(78.1433, 257.963);
points += QPointF(65.2575, 244.383);
points += QPointF(52.6567, 230.194);
points += QPointF(40.4121, 215.44);
points += QPointF(28.6008, 200.16);
points += QPointF(17.3047, 184.387);
points += QPointF(6.61028, 168.141);
points += QPointF(-3.38943, 151.431);
points += QPointF(-12.5922, 134.245);
points += QPointF(-20.8806, 116.548);
points += QPointF(-28.1111, 98.2771);
points += QPointF(-34.0981, 79.3367);
points += QPointF(-38.4416, 60.2487);
points += QPointF(-52.3725, -35.5907);
return points; return points;
} }
@ -531,52 +519,32 @@ QVector<QPointF> TST_VAbstractDetail::OutputPointsCase2() const
{ {
QVector<QPointF> points; QVector<QPointF> points;
points += QPointF(-2.79526, 4.83848); points += QPointF(-2.7952999999999975, 5.7719918429762656);
points += QPointF(67.3445, -0.232496); points += QPointF(65.32544836315374, -0.992801551243895);
points += QPointF(73.1172, 39.482); points += QPointF(75.43676015393824, 49.41505784459415);
points += QPointF(75.4242, 49.6203); points += QPointF(83.37769389516122, 71.70650391130641);
points += QPointF(78.7941, 60.2814); points += QPointF(95.36495808942361, 95.58656052818594);
points += QPointF(83.273, 71.5993); points += QPointF(110.83634280812595, 120.21325109595534);
points += QPointF(88.7999, 83.3999); points += QPointF(128.9510900596877, 144.55333805162292);
points += QPointF(95.2925, 95.5245); points += QPointF(148.8122943732712, 167.68860240021857);
points += QPointF(102.656, 107.829); points += QPointF(169.48075280895182, 188.76665620458672);
points += QPointF(110.787, 120.18); points += QPointF(189.9439329177606, 206.94808512857375);
points += QPointF(119.578, 132.456); points += QPointF(209.03488292644147, 221.3771186982216);
points += QPointF(128.919, 144.54); points += QPointF(215.73126220022726, 225.4325608097815);
points += QPointF(138.697, 156.322); points += QPointF(215.09342206269645, 222.63086681417994);
points += QPointF(148.796, 167.694); points += QPointF(205.6867557893074, 194.5606373284329);
points += QPointF(159.098, 178.552); points += QPointF(193.90240551299544, 154.91725528228594);
points += QPointF(169.482, 188.791); points += QPointF(189.00923093023508, 130.4332749760628);
points += QPointF(179.818, 198.308); points += QPointF(191.70730467606634, 97.53824783614445);
points += QPointF(189.972, 207); points += QPointF(229.19819583315143, 77.54897644999551);
points += QPointF(199.794, 214.759); points += QPointF(256.3345313737502, 91.70119126633715);
points += QPointF(209.115, 221.477); points += QPointF(270.9082046450185, 107.89162042078927);
points += QPointF(216.034, 225.948); points += QPointF(294.3626891097502, 142.42241251279827);
points += QPointF(215.311, 223.266); points += QPointF(355.51936324849004, 244.86019492195868);
points += QPointF(212.945, 216.109); points += QPointF(422.97357725399365, 357.6471728523805);
points += QPointF(205.759, 194.78); points += QPointF(486.8597146913536, 455.7199210117685);
points += QPointF(197.889, 169.298); points += QPointF(-2.795300000000013, 455.7506738094777);
points += QPointF(193.975, 155.081); points += QPointF(-2.7952999999999975, 5.7719918429762656);
points += QPointF(191.164, 142.904);
points += QPointF(189.364, 131.496);
points += QPointF(189.144, 117.752);
points += QPointF(194.429, 100.985);
points += QPointF(210.02, 85.4196);
points += QPointF(231.367, 81.4782);
points += QPointF(246.493, 85.8976);
points += QPointF(256.602, 92.4352);
points += QPointF(264.477, 100.216);
points += QPointF(270.989, 108.11);
points += QPointF(280.35, 121.002);
points += QPointF(294.425, 142.543);
points += QPointF(318.564, 182.007);
points += QPointF(355.648, 245.077);
points += QPointF(394.726, 311.416);
points += QPointF(422.951, 357.621);
points += QPointF(440.373, 384.812);
points += QPointF(488.279, 455.72);
points += QPointF(-2.79526, 455.75);
points += QPointF(-2.79526, 4.83848);
return points; return points;
} }

View File

@ -40,6 +40,7 @@ public:
signals: signals:
private slots: private slots:
void EquidistantRemoveLoop_data();
void EquidistantRemoveLoop() const; void EquidistantRemoveLoop() const;
void SumTrapezoids() const; void SumTrapezoids() const;
void PathRemoveLoop_data() const; void PathRemoveLoop_data() const;
@ -47,8 +48,6 @@ private slots:
void BrokenDetailEquidistant() const; void BrokenDetailEquidistant() const;
private: private:
void Case1() const;
void Case2() const;
void Case3() const; void Case3() const;
void Case4() const; void Case4() const;
void Case5() const; void Case5() const;

View File

@ -99,40 +99,17 @@ void TST_VDetail::ClearLoop()
const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data); const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data);
QVector<QPointF> origPoints; QVector<QPointF> origPoints;
origPoints.append(QPointF(42.464056596, 415.284547056)); origPoints.append(QPointF(42.46405659601934, 415.2845470563871));
origPoints.append(QPointF(669.471111282, 560.191213853)); origPoints.append(QPointF(668.6348763356573, 559.9979528395143));
origPoints.append(QPointF(669.386058691, 594.870268822)); origPoints.append(QPointF(672.5077340045727, 662.2773194632347));
origPoints.append(QPointF(669.853724171, 619.849997563)); origPoints.append(QPointF(682.7797640244206, 723.1972585208631));
origPoints.append(QPointF(670.904422406, 642.3178846)); origPoints.append(QPointF(696.5440854182214, 760.8937002484754));
origPoints.append(QPointF(672.476094621, 662.479332552)); origPoints.append(QPointF(714.3917818918, 792.5896577365422));
origPoints.append(QPointF(674.504307528, 680.4882883)); origPoints.append(QPointF(730.8871996023822, 810.8059842268941));
origPoints.append(QPointF(676.923618554, 696.502389941)); origPoints.append(QPointF(749.7001857069857, 820.4573142312262));
origPoints.append(QPointF(679.668504965, 710.685043438)); origPoints.append(QPointF(774.1450140007969, 824.7139100366174));
origPoints.append(QPointF(682.675134578, 723.207854677)); origPoints.append(QPointF(825.8284608555382, 823.6826266774736));
origPoints.append(QPointF(685.884182534, 734.253021932)); origPoints.append(QPointF(828.6858753986579, 1697.305833468011));
origPoints.append(QPointF(689.244614632, 744.014989124));
origPoints.append(QPointF(692.717799245, 752.700488615));
origPoints.append(QPointF(696.244854868, 760.447827851));
origPoints.append(QPointF(701.80053872, 771.230129596));
origPoints.append(QPointF(709.490850269, 784.462136001));
origPoints.append(QPointF(713.209035073, 790.761640932));
origPoints.append(QPointF(715.012191536, 793.76372792));
origPoints.append(QPointF(718.780883478, 799.17428152));
origPoints.append(QPointF(722.57235226, 803.731752263));
origPoints.append(QPointF(726.490081061, 807.667595608));
origPoints.append(QPointF(730.558043385, 811.069205493));
origPoints.append(QPointF(734.817246318, 814.013788881));
origPoints.append(QPointF(739.318992666, 816.561622842));
origPoints.append(QPointF(744.115969332, 818.753220198));
origPoints.append(QPointF(749.253944798, 820.61090345));
origPoints.append(QPointF(754.766262359, 822.143554621));
origPoints.append(QPointF(760.671847372, 823.352504448));
origPoints.append(QPointF(766.976111339, 824.236813134));
origPoints.append(QPointF(773.673526571, 824.797038187));
origPoints.append(QPointF(780.661572758, 825.034345703));
origPoints.append(QPointF(791.720374143, 824.854420471));
origPoints.append(QPointF(825.821175407, 821.455180638));
origPoints.append(QPointF(828.685875399, 1697.30583347));
// Begin comparison // Begin comparison
Comparison(pointsEkv, origPoints); Comparison(pointsEkv, origPoints);