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

$region->get_clipbox copy rect



The program foo.pl below prints some garbage numbers like

	x=0 y=135599760 w=-1078227492 h=32

where I hoped it'd be all zeros for an empty region, or at least zero
width and height.  In gdk_region_get_clipbox, should the return be
"GdkRectangle_copy" for a rectangle that starts life only on the stack?

use Gtk2 '-init';
my $region = Gtk2::Gdk::Region->new;
my $rect = $region->get_clipbox;
print "x=",$rect->x, " y=",$rect->y,
  " w=",$rect->width, " h=",$rect->height, "\n";
exit 0;
--- GdkRegion.xs	10 Jan 2008 09:51:05 +1100	1.10
+++ GdkRegion.xs	12 Jan 2008 15:13:09 +1100	
@@ -116,7 +116,7 @@
 ##  void gdk_region_destroy (GdkRegion *region) 
 
 ##  void gdk_region_get_clipbox (GdkRegion *region, GdkRectangle *rectangle) 
-GdkRectangle *
+GdkRectangle_copy *
 gdk_region_get_clipbox (region)
 	GdkRegion *region
     PREINIT:
--- GdkRegion.t	04 Feb 2004 09:27:20 +1100	1.5
+++ GdkRegion.t	13 Jan 2008 07:28:28 +1100	
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 21, noinit => 1;
+use Gtk2::TestHelper tests => 22, noinit => 1;
 
 # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GdkRegion.t,v 1.5 2004/02/03 22:27:20 kaffeetisch Exp $
 
@@ -26,7 +26,14 @@
 
 $region = Gtk2::Gdk::Region -> rectangle($rectangle_one);
 isa_ok($region, "Gtk2::Gdk::Region");
+
 isa_ok($region -> get_clipbox(), "Gtk2::Gdk::Rectangle");
+{ my $empty = Gtk2::Gdk::Region->new;
+  ok (eq_array ([$empty->get_clipbox->values],
+                [0, 0, 0, 0],
+                '$empty->clipbox'));
+}
+
 isa_ok(($region -> get_rectangles())[0], "Gtk2::Gdk::Rectangle");
 ok($region -> equal($region));
 ok($region -> point_in(30, 50));


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