[libchamplain] Coverage for Champlain::Polygon



commit 5deccefc6e835e50f11cfdfeb86fd0112e04c70d
Author: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
Date:   Wed Jul 29 22:09:58 2009 +0200

    Coverage for Champlain::Polygon
    
    Add the function:
      - champlain_polygon_remove_point

 bindings/perl/Champlain/t/ChamplainPolygon.t   |   25 ++++++++++++++++++++---
 bindings/perl/Champlain/xs/ChamplainPolygon.xs |    4 +++
 2 files changed, 25 insertions(+), 4 deletions(-)
---
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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]