From: Breno G. de Oliveira Date: Thu, 10 Sep 2009 00:28:45 +0000 (-0300) Subject: simple rect extension test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98ce5b8c119b2de3aaffce55cf3a9684aea1fa88;p=sdlgit%2FSDL_perl.git simple rect extension test --- diff --git a/t/extendingrect.t b/t/extendingrect.t new file mode 100644 index 0000000..c1bbb9e --- /dev/null +++ b/t/extendingrect.t @@ -0,0 +1,27 @@ +package MyRect; +use base 'SDL::Rect'; + +sub new { + my $class = shift; + my $self = {}; + bless $self, $class; +} + +sub foo { + my $self = shift; + return $self->x; +} + +package main; +use Test::More tests => 6; + +my $rect = MyRect->new; + +isa_ok($rect, 'SDL::Rect'); +isa_ok($rect, 'MyRect'); +can_ok($rect, qw(x y top left w h width height)); +can_ok($rect, qw(new foo)); + +$rect->x(10); +is($rect->x, 10); +is($rect->foo, 10);