diff --git a/test/geos_capi/tc_polygon.rb b/test/geos_capi/tc_polygon.rb index 9b3454ff..c95cb0fa 100644 --- a/test/geos_capi/tc_polygon.rb +++ b/test/geos_capi/tc_polygon.rb @@ -79,6 +79,18 @@ def test_union end + def test_simplify + xys = [[0, 0], [5, 0], [10, 0], [10, 10], [5, 10.2], [0, 10], [0, 0]] + points = xys.collect { |x,y| @factory.point(x, y) } + poly = @factory.polygon(@factory.linear_ring(points)) + simplified = poly.simplify(0.3) + new_points = simplified.exterior_ring.points + extra = new_points.reject { |p| [0, 10].include?(p.x) and [0, 10].include?(p.y) } + assert_equal 5, new_points.length, "Closed ring of the square should have 5 points" + assert_equal 0, extra.length , "Should only have x/y's on 0 and 10" + end + + end end