diff --git a/ChangeLog.txt b/ChangeLog.txt
index 689dfa1b7..55a8e3a1d 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -54,6 +54,7 @@
- [#594] Broken export on Mac.
- Math parser allows apostrophe in variable name.
- [#603] Wrong layout caused by wrong seam allowance.
+- [#604] Seams allowances gets "weird" and turns inward when changing measurment file.
# Version 0.4.5 October 15, 2016
- [#435] Valentina doesn't change the cursor.
diff --git a/src/app/share/collection/bugs/Issue_#604.val b/src/app/share/collection/bugs/Issue_#604.val
new file mode 100644
index 000000000..084ddd57b
--- /dev/null
+++ b/src/app/share/collection/bugs/Issue_#604.val
@@ -0,0 +1,123 @@
+
+
+
+ 0.3.9
+ cm
+
+
+
+ 3XL.vit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/share/collection/bugs/Issue_#604.vit b/src/app/share/collection/bugs/Issue_#604.vit
new file mode 100644
index 000000000..8f8189885
--- /dev/null
+++ b/src/app/share/collection/bugs/Issue_#604.vit
@@ -0,0 +1,53 @@
+
+
+
+ 0.3.3
+ false
+
+ cm
+ 998
+
+
+
+ 1800-01-01
+ unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp
index c28f2f10e..2fb3325fa 100644
--- a/src/libs/vlayout/vabstractdetail.cpp
+++ b/src/libs/vlayout/vabstractdetail.cpp
@@ -614,7 +614,8 @@ QPointF VAbstractDetail::UnclosedEkvPoint(const QLineF &line, const QLineF &help
return QPointF();
}
- if (not (line.p2() == helpLine.p2() || line.p1() == helpLine.p1()))
+ const bool firstPoint = line.p1() == helpLine.p1();
+ if (not (line.p2() == helpLine.p2() || firstPoint))
{
qDebug()<<"Two points of two lines must be equal.";
return QPointF();
@@ -634,9 +635,10 @@ QPointF VAbstractDetail::UnclosedEkvPoint(const QLineF &line, const QLineF &help
// User can create very wrong path that will create crospoint far from main path.
// Such an annomaly we try to catch and fix.
// If don't do this the program will crash.
- QLineF test( line.p2(), CrosPoint );
+ QLineF test;
+ firstPoint ? test = QLineF(line.p1(), CrosPoint) : test = QLineF(line.p2(), CrosPoint);
const qreal length = test.length();
- if (length > width*50) // Why 50? Try to avoid cutting correct cases.
+ if (length > width*2.4)
{
test.setLength(width);
return test.p2();
@@ -649,7 +651,14 @@ QPointF VAbstractDetail::UnclosedEkvPoint(const QLineF &line, const QLineF &help
}
case (QLineF::NoIntersection):
/*If we have correct lines this means lines lie on a line.*/
- return bigLine.p2();
+ if (firstPoint)
+ {
+ return bigLine.p1();
+ }
+ else
+ {
+ return bigLine.p2();
+ }
break;
default:
break;
diff --git a/src/test/ValentinaTest/tst_vabstractdetail.cpp b/src/test/ValentinaTest/tst_vabstractdetail.cpp
index 2566d0d19..9b61fba77 100644
--- a/src/test/ValentinaTest/tst_vabstractdetail.cpp
+++ b/src/test/ValentinaTest/tst_vabstractdetail.cpp
@@ -570,37 +570,80 @@ void TST_VAbstractDetail::PathRemoveLoop() const
}
//---------------------------------------------------------------------------------------------------------------------
-void TST_VAbstractDetail::BrokenDetailEquidistant() const
+void TST_VAbstractDetail::BrokenDetailEquidistant_data() const
{
+ QTest::addColumn>("points");
+ QTest::addColumn("eqv");
+ QTest::addColumn("width");
+ QTest::addColumn>("ekvOrig");
+
// For more details see the file "collection/bugs/GAVAUDAN Laure - corsage - figure 4.val".
// 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.
QVector points;// Input points.
points.append(QPointF(787.5835464566929, 1701.3138897637796));
points.append(QPointF(938.7646488188976, 1701.3138897637796));
+ points.append(QPointF(928.6149958683911, 1732.4440719866434));
points.append(QPointF(910.0209091217698, 1792.3369853889722));
+ points.append(QPointF(893.3643262819251, 1849.7845131987456));
points.append(QPointF(878.5244039283091, 1905.2261617043234));
- points.append(QPointF(863.9159293830619, 1968.2534932384856));
+ points.append(QPointF(865.3802986403739, 1959.101437194065));
+ points.append(QPointF(863.9366982685195, 1965.6834024491068));
points.append(QPointF(852.8936778444679, 1919.6965437838999));
+ points.append(QPointF(837.0628180560684, 1860.2846653184251));
points.append(QPointF(819.0677656132684, 1798.6758641921479));
+ points.append(QPointF(798.7585839758027, 1734.54810216256));
points.append(QPointF(787.5835464566929, 1701.3138897637796));
- points.append(QPointF(797.0323653543306, 2608.4005039370077));
- const EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path
- const qreal width = 37.795275590551185; // seam allowance width
-
- const QVector ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result
+ EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path
+ qreal width = 37.795275590551185; // seam allowance width
QVector ekvOrig;
- ekvOrig.append(QPointF(938.7646488188976, 1663.5186141732283));
- ekvOrig.append(QPointF(990.3348131440238, 1663.5186141732283));
- ekvOrig.append(QPointF(946.2541789190154, 1803.1092111713983));
- ekvOrig.append(QPointF(915.1544461790318, 1914.5762831871607));
- ekvOrig.append(QPointF(893.9371203604946, 2006.1170819537472));
- ekvOrig.append(QPointF(833.7229784629903, 2005.9802605640884));
- ekvOrig.append(QPointF(816.2424908106893, 1928.9724774988724));
- ekvOrig.append(QPointF(782.8721775719547, 1809.5818175001634));
- ekvOrig.append(QPointF(751.6217900811182, 1712.9429454154488));
+ ekvOrig.append(QPointF(774.8748468280837, 1663.5186141732283));
+ ekvOrig.append(QPointF(990.8407795072413, 1663.5186141732283));
+ ekvOrig.append(QPointF(964.6314912875667, 1743.9055911653147));
+ ekvOrig.append(QPointF(946.2221157804494, 1803.203536155223));
+ ekvOrig.append(QPointF(929.7733291125676, 1859.9343877726233));
+ ekvOrig.append(QPointF(915.1430746962241, 1914.5927211230298));
+ ekvOrig.append(QPointF(902.2033544443959, 1967.630259856634));
+ ekvOrig.append(QPointF(894.4064781634931, 2003.1794116713015));
+ ekvOrig.append(QPointF(834.213891302752, 2003.7742535883901));
+ ekvOrig.append(QPointF(816.2523103379473, 1928.9761772004185));
+ ekvOrig.append(QPointF(800.6574884611877, 1870.4501290629887));
+ ekvOrig.append(QPointF(782.9077417718742, 1809.6811695225983));
+ ekvOrig.append(QPointF(786.7126382487066, 1698.723835966227));
+
+ QTest::newRow("GAVAUDAN Laure.") << points << static_cast(eqv) << width << ekvOrig;
+
+ points.clear();
+ points.append(QPointF(97.33089106412862, -223.03306117556497));
+ points.append(QPointF(990.7494050554426, 2.819093995045));
+ points.append(QPointF(908.3966357321774, 379.5839357215547));
+ points.append(QPointF(-135.41154226686143, 697.6417881399819));
+
+ eqv = EquidistantType::OpenEquidistant;
+ width = 11.338582677165354;
+
+ ekvOrig.clear();
+ ekvOrig.append(QPointF(100.10981413873267, -234.02583351343978));
+ ekvOrig.append(QPointF(1004.1704360325447, -5.483401649771952));
+ ekvOrig.append(QPointF(918.0553412376563, 388.4941212347381));
+ ekvOrig.append(QPointF(-138.65807550610091, 710.4843173601864));
+
+ // See the file "collection/bugs/Issue_#604.val" (since 0.5.0)
+ QTest::newRow("Issue #604.") << points << static_cast(eqv) << width << ekvOrig;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void TST_VAbstractDetail::BrokenDetailEquidistant() const
+{
+ QFETCH(QVector, points);
+ QFETCH(int, eqv);
+ QFETCH(qreal, width);
+ QFETCH(QVector, ekvOrig);
+
+ const QVector ekv = VAbstractDetail::Equidistant(points, static_cast(eqv),
+ width);// Take result
// Begin comparison
Comparison(ekv, ekvOrig);
diff --git a/src/test/ValentinaTest/tst_vabstractdetail.h b/src/test/ValentinaTest/tst_vabstractdetail.h
index 6ca23f3f6..2bab00570 100644
--- a/src/test/ValentinaTest/tst_vabstractdetail.h
+++ b/src/test/ValentinaTest/tst_vabstractdetail.h
@@ -45,6 +45,7 @@ private slots:
void SumTrapezoids() const;
void PathRemoveLoop_data() const;
void PathRemoveLoop() const;
+ void BrokenDetailEquidistant_data() const;
void BrokenDetailEquidistant() const;
void CorrectEquidistantPoints_data() const;
void CorrectEquidistantPoints() const;