From: Emmanuel Rodriguez Date: Wed, 29 Jul 2009 20:09:58 +0000 (+0200) Subject: Coverage for Champlain::Polygon X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5deccefc6e835e50f11cfdfeb86fd0112e04c70d;p=libchamplain Coverage for Champlain::Polygon Add the function: - champlain_polygon_remove_point --- diff --git a/bindings/perl/Champlain/t/ChamplainPolygon.t b/bindings/perl/Champlain/t/ChamplainPolygon.t index ff2fea6..4686eee 100644 --- a/bindings/perl/Champlain/t/ChamplainPolygon.t +++ b/bindings/perl/Champlain/t/ChamplainPolygon.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Clutter::TestHelper tests => 48; +use Clutter::TestHelper tests => 49; use Champlain; @@ -88,6 +88,8 @@ sub test_points { my $polygon = Champlain::Polygon->new(); isa_ok($polygon, 'Champlain::Polygon'); + my @remove = (); + $polygon->append_point(8, 4); is_polygon( $polygon, @@ -97,7 +99,7 @@ sub test_points { "append_point()" ); - $polygon->append_point(4, 9); + push @remove, $polygon->append_point(4, 9); is_polygon( $polygon, [ @@ -130,7 +132,7 @@ sub test_points { "polygon: 4 points" ); - $polygon->insert_point(1, 2, 0); + push @remove, $polygon->insert_point(1, 2, 0); is_polygon( $polygon, [ @@ -157,7 +159,7 @@ sub test_points { "insert_point() at the end" ); - $polygon->insert_point(30, 240, 17); + push @remove, $polygon->insert_point(30, 240, 17); is_polygon( $polygon, [ @@ -172,6 +174,21 @@ sub test_points { "insert_point() past the end" ); + foreach my $point (@remove) { + $polygon->remove_point($point); + } + is_polygon( + $polygon, + [ + 8, 4, + 7, 10, + 5, 3, + 10, 20, + ], + "remove_point()" + ); + + # Clear the polygon (it should be empty after) TODO: { local $TODO = "Bug in libchamplain"; diff --git a/bindings/perl/Champlain/xs/ChamplainPolygon.xs b/bindings/perl/Champlain/xs/ChamplainPolygon.xs index c6e28f5..4b81e33 100644 --- a/bindings/perl/Champlain/xs/ChamplainPolygon.xs +++ b/bindings/perl/Champlain/xs/ChamplainPolygon.xs @@ -87,3 +87,7 @@ champlain_polygon_show (ChamplainPolygon *polygon) void champlain_polygon_hide (ChamplainPolygon *polygon) + + +void +champlain_polygon_remove_point (ChamplainPolygon *self, ChamplainPoint *point)