Add qa tests for SHAPE_POLY_SET arcs that wrap around from end to start
This commit is contained in:
parent
5a5af91d88
commit
17407b850c
|
@ -46,6 +46,8 @@ struct CommonTestData
|
||||||
SHAPE_POLY_SET uniqueVertexPolySet;
|
SHAPE_POLY_SET uniqueVertexPolySet;
|
||||||
SHAPE_POLY_SET solidPolySet;
|
SHAPE_POLY_SET solidPolySet;
|
||||||
SHAPE_POLY_SET holeyPolySet;
|
SHAPE_POLY_SET holeyPolySet;
|
||||||
|
SHAPE_POLY_SET curvedPolyWrapRound; ///< Causes arc wraparound when reloading from Clipper
|
||||||
|
///< see https://gitlab.com/kicad/code/kicad/-/issues/9670
|
||||||
SHAPE_POLY_SET holeyCurvedPolySingle; ///< Polygon with a single outline + multiple holes.
|
SHAPE_POLY_SET holeyCurvedPolySingle; ///< Polygon with a single outline + multiple holes.
|
||||||
///< Holes and outline contain arcs
|
///< Holes and outline contain arcs
|
||||||
SHAPE_POLY_SET holeyCurvedPolyMulti; ///< Polygon with a multiple outlines + multiple holes.
|
SHAPE_POLY_SET holeyCurvedPolyMulti; ///< Polygon with a multiple outlines + multiple holes.
|
||||||
|
@ -146,6 +148,12 @@ struct CommonTestData
|
||||||
hole.SetClosed( true );
|
hole.SetClosed( true );
|
||||||
holeyPolySet.AddHole( hole );
|
holeyPolySet.AddHole( hole );
|
||||||
|
|
||||||
|
//GENERATE CURVED POLYGON THAT CAUSES WRAPAROUND
|
||||||
|
SHAPE_LINE_CHAIN wrapLine;
|
||||||
|
wrapLine.Append( SHAPE_ARC( { -4300000, -6950000 }, { 2000000, 0 }, { -4300000, 6950000 }, 0 ) );
|
||||||
|
wrapLine.Append( SHAPE_ARC( { -4300000, 2200000 }, { -2700000, 0 }, { -4300000, -2200000 }, 0 ) );
|
||||||
|
wrapLine.SetClosed( true );
|
||||||
|
curvedPolyWrapRound.AddOutline( wrapLine );
|
||||||
|
|
||||||
// GENERATE CURVED POLYGON WITH HOLES
|
// GENERATE CURVED POLYGON WITH HOLES
|
||||||
// For visualisation, launch test_pns with the arguments "viewcurvedpoly -[single|multi]"
|
// For visualisation, launch test_pns with the arguments "viewcurvedpoly -[single|multi]"
|
||||||
|
|
|
@ -43,7 +43,8 @@ BOOST_AUTO_TEST_CASE( TestSimplify )
|
||||||
std::map<std::string, SHAPE_POLY_SET> polysToTest =
|
std::map<std::string, SHAPE_POLY_SET> polysToTest =
|
||||||
{
|
{
|
||||||
{ "Case 1: Single polygon", testData.holeyCurvedPolySingle },
|
{ "Case 1: Single polygon", testData.holeyCurvedPolySingle },
|
||||||
//{ "Case 2: Multi polygon", testData.holeyCurvedPolyMulti } // This test fails right now:
|
{ "Case 2: Wraparound polygon", testData.curvedPolyWrapRound },
|
||||||
|
//{ "Case 3: Multi polygon", testData.holeyCurvedPolyMulti } // This test fails right now:
|
||||||
// clipper seems to not handle
|
// clipper seems to not handle
|
||||||
// multiple outlines correctly
|
// multiple outlines correctly
|
||||||
};
|
};
|
||||||
|
@ -68,6 +69,7 @@ BOOST_AUTO_TEST_CASE( TestSimplify )
|
||||||
std::vector<SHAPE_ARC> foundArcs;
|
std::vector<SHAPE_ARC> foundArcs;
|
||||||
testPoly.GetArcs( foundArcs );
|
testPoly.GetArcs( foundArcs );
|
||||||
|
|
||||||
|
BOOST_CHECK( GEOM_TEST::IsPolySetValid( testPoly ) );
|
||||||
BOOST_CHECK_EQUAL( testPoly.Area(), originalArea );
|
BOOST_CHECK_EQUAL( testPoly.Area(), originalArea );
|
||||||
BOOST_CHECK_EQUAL( originalArcs.size(), foundArcs.size() );
|
BOOST_CHECK_EQUAL( originalArcs.size(), foundArcs.size() );
|
||||||
KI_TEST::CheckUnorderedMatches( originalArcs, foundArcs,
|
KI_TEST::CheckUnorderedMatches( originalArcs, foundArcs,
|
||||||
|
|
Loading…
Reference in New Issue