Merge git://github.com/FROGGS/SDL_perl into redesign
[sdlgit/SDL_perl.git] / t / extendingrect.t
CommitLineData
98ce5b8c 1package MyRect;
2use base 'SDL::Rect';
3
4sub new {
bdd52efa 5 my $class = shift;
987e1542 6 my $self = $class->SUPER::new(@_);
7 unless (ref $self) {
bdd52efa 8 require Carp;
9 Carp::croak SDL::GetError();
10 }
987e1542 11 return bless $self => $class;;
bdd52efa 12
98ce5b8c 13}
14
15sub foo {
bdd52efa 16 my $self = shift;
17 return $self->x;
98ce5b8c 18}
19
20package main;
21use Test::More tests => 6;
22
987e1542 23my $rect = MyRect->new(0,0,0,0);
98ce5b8c 24
25isa_ok($rect, 'SDL::Rect');
26isa_ok($rect, 'MyRect');
05eb21df 27can_ok($rect, qw(x y w h));
98ce5b8c 28can_ok($rect, qw(new foo));
29
30$rect->x(10);
31is($rect->x, 10);
32is($rect->foo, 10);