From 205e870669a43205e7425e6576560f3bdb07eb3b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 29 Aug 2019 15:09:45 +0300 Subject: [PATCH] Refactoring. Lambda to define test data. Better test data structure. --HG-- branch : develop --- .../input.json} | 0 .../output.json} | 0 src/test/ValentinaTest/share/test_data.qrc | 4 ++-- src/test/ValentinaTest/tst_vabstractpiece.cpp | 24 ++++++++++++------- 4 files changed, 17 insertions(+), 11 deletions(-) rename src/test/ValentinaTest/share/{input_loop_by_intersection.json => loop_by_intersection/input.json} (100%) rename src/test/ValentinaTest/share/{output_loop_by_intersection.json => loop_by_intersection/output.json} (100%) diff --git a/src/test/ValentinaTest/share/input_loop_by_intersection.json b/src/test/ValentinaTest/share/loop_by_intersection/input.json similarity index 100% rename from src/test/ValentinaTest/share/input_loop_by_intersection.json rename to src/test/ValentinaTest/share/loop_by_intersection/input.json diff --git a/src/test/ValentinaTest/share/output_loop_by_intersection.json b/src/test/ValentinaTest/share/loop_by_intersection/output.json similarity index 100% rename from src/test/ValentinaTest/share/output_loop_by_intersection.json rename to src/test/ValentinaTest/share/loop_by_intersection/output.json diff --git a/src/test/ValentinaTest/share/test_data.qrc b/src/test/ValentinaTest/share/test_data.qrc index 96e1db03c..16350227e 100644 --- a/src/test/ValentinaTest/share/test_data.qrc +++ b/src/test/ValentinaTest/share/test_data.qrc @@ -1,8 +1,8 @@ - input_loop_by_intersection.json - output_loop_by_intersection.json Issue_620/input.json Issue_620/output.json + loop_by_intersection/input.json + loop_by_intersection/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 73f5e143b..72adde591 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -46,6 +46,17 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() QTest::addColumn("width"); QTest::addColumn>("ekvOrig"); + auto ASSERT_TEST_CASE = [this](const char *title, const QString &input, const QString &output, qreal width) + { + QVector inputPoints; + AbstractTest::VectorFromJson(input, inputPoints); + + QVector outputPoints; + AbstractTest::VectorFromJson(output, outputPoints); + + QTest::newRow(title) << inputPoints << width << outputPoints; + }; + // See file src/app/share/collection/test/seamtest1.val QTest::newRow("Seam test 1. Piece. By angle.") << InputPointsSeamTest1PieceByAngle() << 37.795275590551185 // seam allowance width @@ -187,15 +198,10 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() << OutputPointsIssue923Test6_6(); // See file src/app/share/collection/bugs/loop_by_intersection.val - QVector input; - AbstractTest::VectorFromJson(QStringLiteral("://input_loop_by_intersection.json"), input); - - QVector output; - AbstractTest::VectorFromJson(QStringLiteral("://output_loop_by_intersection.json"), output); - - QTest::newRow("Loop for angle by intersection") << input - << 39.685039370078741 // seam allowance width (1.05 cm) - << output; + ASSERT_TEST_CASE("Loop for angle by intersection", + QStringLiteral("://loop_by_intersection/input.json"), + QStringLiteral("://loop_by_intersection/output.json"), + 39.685039370078741 /*seam allowance width (1.05 cm)*/); } //---------------------------------------------------------------------------------------------------------------------