From b8ac50f1c7a4d09b879bdbf3f5a42aae787a8b6b Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 27 Mar 2024 10:42:39 +0100 Subject: [PATCH] test: add test case for issue #1262 --- test/algorithms/buffer/buffer_polygon.cpp | 13 +++++++++++++ test/algorithms/buffer/test_buffer_svg_per_turn.hpp | 3 +++ 2 files changed, 16 insertions(+) diff --git a/test/algorithms/buffer/buffer_polygon.cpp b/test/algorithms/buffer/buffer_polygon.cpp index 9a671016a3..4fa2d62856 100644 --- a/test/algorithms/buffer/buffer_polygon.cpp +++ b/test/algorithms/buffer/buffer_polygon.cpp @@ -154,6 +154,8 @@ static std::string const issue_555 static std::string const issue_1019 = "POLYGON((577255 928582,577255 928582,577228 928786,577245 932654,577619 933122,580589 933287,580929 933297,583237 932957,583504 932546,583652 929953,582964 928631,577255 928582))"; +static std::string const issue_1262 + = "POLYGON((-2.447356204196278639528828 57.21240623671037894837355,34.00960378453005006349485 54.01542955431686721112783,-0.000789642333984375 18.712947845458984375,-41.480987548828125 60.193248748779296875,-3.12519073486328125 57.271846771240234375,-2.447356204196278639528828 57.21240623671037894837355),(-36.24821876005196230607908 57.78889760314127244100746,-0.000785932392148191993896944 21.54137477179954629491476,30.75139677038663066355184 52.2934724874262641947098,-36.24821876005196230607908 57.78889760314127244100746))"; // CCW Polygons not working in 1.56 static std::string const mysql_report_2014_10_24 @@ -614,6 +616,17 @@ void test_all() test_one("issue_1019", issue_1019, join_miter, end_flat, 34835787.44782, 300.0); + { + // The reported issue created a huge polygon, instead of 0.0 (because the negative distance should fill + // the whole input polygon) + bg::strategy::buffer::join_round join_round4(4); + bg::strategy::buffer::end_round end_round4(4); + test_one("issue_1262", issue_1262, join_round4, end_round4, 0.0, -1.8); + test_one("issue_1262_1", issue_1262, join_round4, end_round4, 8.9161, -1.0); + test_one("issue_1262_2", issue_1262, join_round4, end_round4, 62.5276, -0.8); + test_one("issue_1262_3", issue_1262, join_round4, end_round4, 193.47288, -0.4); + } + { bg::strategy::buffer::join_round join_round32(32); bg::strategy::buffer::end_round end_round32(32); diff --git a/test/algorithms/buffer/test_buffer_svg_per_turn.hpp b/test/algorithms/buffer/test_buffer_svg_per_turn.hpp index 1a32323a68..fa0d0ad0bd 100644 --- a/test/algorithms/buffer/test_buffer_svg_per_turn.hpp +++ b/test/algorithms/buffer/test_buffer_svg_per_turn.hpp @@ -15,6 +15,8 @@ #ifndef BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP #define BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP +#if defined(TEST_WITH_SVG_PER_TURN) + #include #include @@ -163,5 +165,6 @@ public : } }; +#endif #endif // BOOST_GEOMETRY_TEST_BUFFER_SVG_PER_TURN_HPP