/************************************************************************ ** ** @file tst_vdetail.cpp ** @author Roman Telezhynskyi ** @date 9 1, 2016 ** ** @brief ** @copyright ** This source code is part of the Valentina project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2016 Valentina project ** All Rights Reserved. ** ** Valentina is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Valentina. If not, see . ** *************************************************************************/ #include "tst_vpiece.h" #include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vpiece.h" #include "../vpatterndb/vpassmark.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vgeometry/vsplinepath.h" #include "../vmisc/vabstractapplication.h" #include #include "../vpatterndb/vpiece.h" //--------------------------------------------------------------------------------------------------------------------- TST_VPiece::TST_VPiece(QObject *parent) :AbstractTest(parent) { } //--------------------------------------------------------------------------------------------------------------------- void TST_VPiece::Issue620() { // See file /src/app/share/collection/bugs/Issue_#620.vit // Check main path const Unit unit = Unit::Cm; QSharedPointer data(new VContainer(nullptr, &unit, VContainer::UniqueNamespace())); qApp->setPatternUnit(unit); VPiece detail; AbstractTest::PieceFromJson(QStringLiteral("://Issue_620/input.json"), detail, data); const QVector pointsEkv = detail.MainPathPoints(data.data()); QVector origPoints; AbstractTest::VectorFromJson(QStringLiteral("://Issue_620/output.json"), origPoints); // Begin comparison Comparison(pointsEkv, origPoints); } //--------------------------------------------------------------------------------------------------------------------- void TST_VPiece::TestSAPassmark_data() { QTest::addColumn("passmarkData"); QTest::addColumn>("seamAllowance"); QTest::addColumn>("expectedResult"); auto ASSERT_TEST_CASE = [this](const char *title, const QString &passmarkData, const QString &seamAllowance, const QString &shape) { VPiecePassmarkData inputPassmarkData; AbstractTest::PassmarkDataFromJson(passmarkData, inputPassmarkData); QVector inputSeamAllowance; AbstractTest::VectorFromJson(seamAllowance, inputSeamAllowance); QVector inputOutputShape; AbstractTest::PassmarkShapeFromJson(shape, inputOutputShape); QTest::newRow(title) << inputPassmarkData << inputSeamAllowance << inputOutputShape; }; // See file src/app/share/collection/bugs/Issue_#924.val ASSERT_TEST_CASE("Test 1.", QStringLiteral("://Issue_924_Test_1/passmarkData.json"), QStringLiteral("://Issue_924_Test_1/seamAllowance.json"), QStringLiteral("://Issue_924_Test_1/passmarkShape.json")); } //--------------------------------------------------------------------------------------------------------------------- void TST_VPiece::TestSAPassmark() { QFETCH(VPiecePassmarkData, passmarkData); QFETCH(QVector, seamAllowance); QFETCH(QVector, expectedResult); VPassmark passmark(passmarkData); Comparison(passmark.SAPassmark(seamAllowance, PassmarkSide::All), expectedResult); }