]> err.no Git - libchamplain/commitdiff
Coverage for Champlain::Polygon
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Wed, 29 Jul 2009 20:09:58 +0000 (22:09 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 31 Jul 2009 21:12:09 +0000 (17:12 -0400)
Add the function:
  - champlain_polygon_remove_point

bindings/perl/Champlain/t/ChamplainPolygon.t
bindings/perl/Champlain/xs/ChamplainPolygon.xs

index ff2fea6fa9a363aeffa19b5fe8a22bce23c761d8..4686eee13187bccc5388a50e251f34d66296a7e4 100644 (file)
@@ -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";
index c6e28f591149ff3a38520a97979bbaffab01f26d..4b81e33969bde81c3cd89eb0855f430e074e333a 100644 (file)
@@ -87,3 +87,7 @@ champlain_polygon_show (ChamplainPolygon *polygon)
 
 void
 champlain_polygon_hide (ChamplainPolygon *polygon)
+
+
+void
+champlain_polygon_remove_point (ChamplainPolygon *self, ChamplainPoint *point)