diff options
author | vng <viktor.govako@gmail.com> | 2011-10-06 00:34:08 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:25:12 +0300 |
commit | 0b2fc2f1429f294d47446e4feb35e9f9951a8047 (patch) | |
tree | 5fc109a494751e02b5f923ecbaa81fc691ce6e38 /geometry/geometry_tests/region2d_binary_op_test.cpp | |
parent | bf2bc5626345b91725c82f12796d8576f4c39841 (diff) |
Fix region results accumulation in binary region operators.
Diffstat (limited to 'geometry/geometry_tests/region2d_binary_op_test.cpp')
-rw-r--r-- | geometry/geometry_tests/region2d_binary_op_test.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/geometry/geometry_tests/region2d_binary_op_test.cpp b/geometry/geometry_tests/region2d_binary_op_test.cpp index 0c29b13aa5..b5c0232001 100644 --- a/geometry/geometry_tests/region2d_binary_op_test.cpp +++ b/geometry/geometry_tests/region2d_binary_op_test.cpp @@ -45,6 +45,22 @@ UNIT_TEST(RegionIntersect_Smoke) TEST_EQUAL(res.size(), 0, ()); } + + { + P arr1[] = { P(-10, -10), P(10, -10), P(10, 10), P(-10, 10) }; + P arr2[] = { P(-5, -5), P(5, -5), P(5, 5), P(-5, 5) }; + + R r1, r2; + r1.Assign(arr1, arr1 + ARRAY_SIZE(arr1)); + r2.Assign(arr2, arr2 + ARRAY_SIZE(arr2)); + + vector<R> res; + res.push_back(r1); // do some smoke + m2::IntersectRegions(r1, r2, res); + + TEST_EQUAL(res.size(), 2, ()); + TEST_EQUAL(res[1].GetRect(), m2::RectI(-5, -5, 5, 5), ()); + } } UNIT_TEST(RegionDifference_Smoke) @@ -65,8 +81,6 @@ UNIT_TEST(RegionDifference_Smoke) TEST_EQUAL(res.size(), 1, ()); TEST_EQUAL(res[0].GetRect(), r2.GetRect(), ()); - - // LOG(LINFO, (res[0])); } { @@ -85,6 +99,7 @@ UNIT_TEST(RegionDifference_Smoke) } } +/* UNIT_TEST(RegionDifference_Data1) { using namespace geom_test; @@ -150,3 +165,4 @@ UNIT_TEST(RegionDifference_Data1) local.swap(res); } } +*/ |