From 707e0e682d33ded35e4402659bce73c6469e8701 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 4 Mar 2021 13:53:22 +0200 Subject: [PATCH] Improve point comparison. Loose restrictions for distance between points. smart-pattern/valentina#103 - Instead of default value for accuracy use 1 mm. This should help to cover more false positive cases. - All tests are now enabled on all platforms. - Added calculation of a distance between points to see exactly how big is difference. --- .../GAVAUDAN Laure - corsage - figure 4.val | 111 ------------------ .../bugs/mesures GAVAUDAN Laure.vit | 53 --------- src/libs/vtest/abstracttest.cpp | 8 +- .../share/Issue_548_case2/input.json | 34 ++++++ .../share/Issue_548_case2/output.json | 24 ++++ .../share/Issue_548_case3/input.json | 34 ++++++ .../share/Issue_548_case3/output.json | 24 ++++ src/test/ValentinaTest/share/test_data.qrc | 4 + src/test/ValentinaTest/tst_vabstractpiece.cpp | 87 ++------------ src/test/ValentinaTest/tst_vabstractpiece.h | 8 -- 10 files changed, 133 insertions(+), 254 deletions(-) delete mode 100644 src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val delete mode 100644 src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit create mode 100644 src/test/ValentinaTest/share/Issue_548_case2/input.json create mode 100644 src/test/ValentinaTest/share/Issue_548_case2/output.json create mode 100644 src/test/ValentinaTest/share/Issue_548_case3/input.json create mode 100644 src/test/ValentinaTest/share/Issue_548_case3/output.json diff --git a/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val b/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val deleted file mode 100644 index cf7f9c9c3..000000000 --- a/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val +++ /dev/null @@ -1,111 +0,0 @@ - - - - 0.2.4 - cm - - - - mesures GAVAUDAN Laure.vit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
-
-
diff --git a/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit b/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit deleted file mode 100644 index 731a7d553..000000000 --- a/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit +++ /dev/null @@ -1,53 +0,0 @@ - - - - 0.3.3 - false - - cm - 998 - - Gavaudan - Laure - 2003-10-08 - female - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libs/vtest/abstracttest.cpp b/src/libs/vtest/abstracttest.cpp index a10ebdcd1..a26af7143 100644 --- a/src/libs/vtest/abstracttest.cpp +++ b/src/libs/vtest/abstracttest.cpp @@ -274,15 +274,17 @@ void AbstractTest::Comparison(const QVector &ekv, const QVectorpanties_case2/output.json smart_pattern_#99/input.json smart_pattern_#99/output.json + Issue_548_case2/input.json + Issue_548_case2/output.json + Issue_548_case3/input.json + Issue_548_case3/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index c4b9f41b4..941820639 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -116,12 +116,10 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() // https://bitbucket.org/dismine/valentina/issue/298/segmented-curve-isnt-selected-in-seam // See file src/app/share/collection/TestPuzzle.val // Code should clean loops in path. -#if !defined(Q_PROCESSOR_S390) && !defined(Q_PROCESSOR_S390_X) ASSERT_TEST_CASE("Issue 298. Case1", QStringLiteral("://Issue_298_case1/input.json"), QStringLiteral("://Issue_298_case1/output.json"), 75.59055118110237 /*seam allowance width*/); -#endif ASSERT_TEST_CASE("Issue 298. Case2", QStringLiteral("://Issue_298_case2/input.json"), @@ -138,16 +136,15 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() QStringLiteral("://Issue_548_case1/output.json"), 11.338582677165354 /*seam allowance width (0.3 cm)*/); - // Disabled due to "undefined behavior" problem -#if !defined(Q_OS_WIN) && !defined(Q_CC_CLANG) && !defined(Q_PROCESSOR_X86_64) - QTest::newRow("Issue 548. Case2") << InputPointsIssue548Case2() - << 37.795275590551185 // seam allowance width (1.0 cm) - << OutputPointsIssue548Case2(); + ASSERT_TEST_CASE("Issue 548. Case2", + QStringLiteral("://Issue_548_case2/input.json"), + QStringLiteral("://Issue_548_case2/output.json"), + 37.795275590551185 /*seam allowance width (1.0 cm)*/); - QTest::newRow("Issue 548. Case3") << InputPointsIssue548Case3() - << 75.59055118110237 // seam allowance width (2.0 cm) - << OutputPointsIssue548Case3(); -#endif + ASSERT_TEST_CASE("Issue 548. Case3", + QStringLiteral("://Issue_548_case3/input.json"), + QStringLiteral("://Issue_548_case3/output.json"), + 75.59055118110237 /*seam allowance width (2.0 cm)*/); // See file src/app/share/collection/bugs/Issue_#646.val ASSERT_TEST_CASE("Issue 646.", @@ -343,13 +340,11 @@ void TST_VAbstractPiece::LayoutAllowanceRemoveLoop_data() QStringLiteral("://smart_pattern_#58/output.json"), 18.897637795275593 /*seam allowance width (0.5 cm)*/); -#if !(defined(Q_OS_WIN) && defined(Q_PROCESSOR_X86_64)) // See file src/app/share/collection/test/smart_pattern_#99.val ASSERT_TEST_CASE("Incorrect fix of distortion", QStringLiteral("://smart_pattern_#99/input.json"), QStringLiteral("://smart_pattern_#99/output.json"), 28.346456692913389 /*seam allowance width*/); -#endif } //--------------------------------------------------------------------------------------------------------------------- @@ -946,11 +941,7 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() ekvOrig.append(QPointF(796.554931640625, 2597.28125)); ekvOrig.append(QPointF(787.1898456692913, 1663.5186141732283)); - // Disabled due to "undefined behavior" problem -#if !defined(Q_OS_WIN) && !defined(Q_CC_CLANG) && !defined(Q_PROCESSOR_X86_64) && !defined(Q_PROCESSOR_S390) \ - && !defined(Q_PROCESSOR_S390_X) QTest::newRow("GAVAUDAN Laure.") << points << 37.795275590551185 << ekvOrig; -#endif // See the file "collection/bugs/Issue_#604.val" (since 0.5.0) ASSERT_TEST_CASE("Issue #604.", @@ -964,13 +955,11 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() QStringLiteral("://Issue_627/output.json"), 56.692913385826778 /*seam allowance width*/); -#if !defined (Q_PROCESSOR_S390) && !defined(Q_PROCESSOR_S390_X) // See the file "collection/bugs/Issue_#687.val" ASSERT_TEST_CASE("Issue #687.", QStringLiteral("://Issue_687/input.json"), QStringLiteral("://Issue_687/output.json"), 37.795275590551185 /*seam allowance width*/); -#endif // See private test cases in file jacket_issue_#767.val, piece "Fabric_TopCollar" // Curve approximation scale 0.5 @@ -1191,7 +1180,6 @@ void TST_VAbstractPiece::TestCorrectEquidistantPoints() const Comparison(after, expect); } -#ifndef Q_OS_WIN //--------------------------------------------------------------------------------------------------------------------- void TST_VAbstractPiece::PossibleInfiniteClearLoops_data() const { @@ -1308,7 +1296,6 @@ void TST_VAbstractPiece::PossibleInfiniteClearLoops() const QVector res = VAbstractPiece::CheckLoops(path); Comparison(res, expect); } -#endif //#ifndef Q_OS_WIN //--------------------------------------------------------------------------------------------------------------------- void TST_VAbstractPiece::Case3() const @@ -1337,64 +1324,6 @@ void TST_VAbstractPiece::Case5() const QVERIFY(qFuzzyIsNull(result)); } -//--------------------------------------------------------------------------------------------------------------------- -QVector TST_VAbstractPiece::InputPointsIssue548Case2() const -{ - QVector points; - points << VSAPoint(99.86433649395013, 10.166060970128015); - points << VSAPoint(176.0178302829931, 57.36978169486653); - points << VSAPoint(115.46606095399079, 156.67924434657942); - points << VSAPoint(197.43414263641347, 70.64467660756823); - points << VSAPoint(247.18110236220474, 101.48031496062993); - points << VSAPoint(29.858267716535437, 300.85039370078744); - - return points; -} - -//--------------------------------------------------------------------------------------------------------------------- -QVector TST_VAbstractPiece::OutputPointsIssue548Case2() const -{ - QVector points; - points << QPointF(75.35612582031402, -49.49247429729551); - points << QPointF(207.99390662262346, 32.7230151178754); - points << QPointF(309.47290565612207, 95.62474281894228); - points << QPointF(34.78597607721976, 347.62014343263024); - points << QPointF(-13.438975506560153, 319.209057294505); - points << QPointF(75.35612582031402, -49.49247429729551); - - return points; -} - -//--------------------------------------------------------------------------------------------------------------------- -QVector TST_VAbstractPiece::InputPointsIssue548Case3() const -{ - QVector points; - - points += VSAPoint(99.86433649395013, 10.166060970128015); - points += VSAPoint(176.0178302829931, 57.36978169486653); - points += VSAPoint(115.46606095399079, 156.67924434657942); - points += VSAPoint(197.43414263641347, 70.64467660756823); - points += VSAPoint(247.18110236220474, 101.48031496062993); - points += VSAPoint(29.858267716535437, 300.85039370078744); - - return points; -} - -//--------------------------------------------------------------------------------------------------------------------- -QVector TST_VAbstractPiece::OutputPointsIssue548Case3() const -{ - QVector points; - - points += QPointF(50.84791514667799, -109.15100956471929); - points += QPointF(220.96071459087483, -3.7066408675763003); - points += QPointF(371.76470895003956, 89.76917067725468); - points += QPointF(39.71368443790398, 394.38989316447305); - points += QPointF(-56.73621872965576, 337.56772088822254); - points += QPointF(50.84791514667799, -109.15100956471929); - - return points; -} - //--------------------------------------------------------------------------------------------------------------------- QVector TST_VAbstractPiece::InputPointsCase3a() const { diff --git a/src/test/ValentinaTest/tst_vabstractpiece.h b/src/test/ValentinaTest/tst_vabstractpiece.h index 157c068c2..7775d3453 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.h +++ b/src/test/ValentinaTest/tst_vabstractpiece.h @@ -57,10 +57,8 @@ private slots: void CorrectEquidistantPoints() const; void TestCorrectEquidistantPoints_data(); void TestCorrectEquidistantPoints() const; -#ifndef Q_OS_WIN // Disabled due to "undefined behavior" problem void PossibleInfiniteClearLoops_data() const; void PossibleInfiniteClearLoops() const; -#endif private: QVector InputPointsCase3() const; @@ -70,12 +68,6 @@ private: void Case4() const; void Case5() const; - QVector InputPointsIssue548Case2() const; - QVector OutputPointsIssue548Case2() const; - - QVector InputPointsIssue548Case3() const; - QVector OutputPointsIssue548Case3() const; - QVector InputPointsCase3a() const; QVector InputPointsCase4a() const; QVector InputPointsCase5a() const;