From: Kartik Thakore Date: Sat, 12 Sep 2009 18:02:16 +0000 (-0400) Subject: Fixed Rect extension test but still not statisfied X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bdd52efa8fc2c240f12d7b7d9f40e7794996e3a4;hp=79b142355ea8536efc8fbd1443e908136297a8a2;p=sdlgit%2FSDL_perl.git Fixed Rect extension test but still not statisfied --- diff --git a/lib/SDL/Game/Rect.pm b/lib/SDL/Game/Rect.pm index f5b754a..7d443ae 100644 --- a/lib/SDL/Game/Rect.pm +++ b/lib/SDL/Game/Rect.pm @@ -13,7 +13,7 @@ sub new { my $w = shift || 0; my $h = shift || 0; - my $self = \SDL::NewRect($x, $y, $w, $h); + my $self = SDL::Rect->new($x, $y, $w, $h); unless ($$self) { require Carp; Carp::croak SDL::GetError(); diff --git a/t/extendingrect.t b/t/extendingrect.t index c1bbb9e..e6733c6 100644 --- a/t/extendingrect.t +++ b/t/extendingrect.t @@ -2,14 +2,24 @@ package MyRect; use base 'SDL::Rect'; sub new { - my $class = shift; - my $self = {}; - bless $self, $class; + my $class = shift; + my $x = shift || 0; + my $y = shift || 0; + my $w = shift || 0; + my $h = shift || 0; + my $self = SDL::Rect->new($x, $y, $w, $h); + unless ($$self) { + require Carp; + Carp::croak SDL::GetError(); + } + bless $self, $class; + return $self; + } sub foo { - my $self = shift; - return $self->x; + my $self = shift; + return $self->x; } package main;