From: Kartik Thakore Date: Thu, 8 Oct 2009 00:29:56 +0000 (-0400) Subject: Can us SDL::Game::Rect now X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c436bbf6b5bb5e0b498f9aaef99b8ff630adae7;p=sdlgit%2FSDL_perl.git Can us SDL::Game::Rect now --- diff --git a/t/intergation1.t b/t/intergation1.t index 182c280..e0d2426 100644 --- a/t/intergation1.t +++ b/t/intergation1.t @@ -36,7 +36,8 @@ BEGIN { use strict; use SDL; use SDL::Config; -use SDL::Rect; +#use SDL::Rect; +use SDL::Game::Rect; use SDL::Color; use Test::More; @@ -61,16 +62,26 @@ can_ok ('SDL::App', qw/ my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); - my $rect = SDL::Rect->new( 0,0, 10, 20); + my $rect = SDL::Game::Rect->new( 0,0, 10, 20); my $blue = SDL::Color->new( -r => 0x00, -g => 0x00, -b => 0xff, ); + + my $col = SDL::Color->new( + -r => 0xf0, + -g => 0x00, + -b => 0xff, + ); + + + my $grect = SDL::Game::Rect->new(10, 10, 30, 5); $app->fill($rect, $blue); + $app->fill($grect, $col); $app->update($rect); - + $app->update($grect); $app->sync; sleep(1); diff --git a/t/sdlgamerect.t b/t/sdlgamerect.t index d3725e5..cb3af54 100644 --- a/t/sdlgamerect.t +++ b/t/sdlgamerect.t @@ -1,8 +1,6 @@ use Test::More tests => 87; use strict; use SDL; -use SDL::App; -use SDL::Color; use_ok( 'SDL::Game::Rect' ); @@ -22,18 +20,8 @@ can_ok ('SDL::Game::Rect', qw/ my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); -my $rect = SDL::Game::Rect->new(); - - - my $blue = SDL::Color->new( - -r => 0x00, - -g => 0x00, - -b => 0xff, - ); - $app->fill($rect,$blue); - $app->update($rect); - $app->sync; - sleep(1); +my $rect = SDL::Game::Rect->new( 0, 10, 0, 0); + isa_ok ($rect, 'SDL::Game::Rect','new went ok'); foreach my $attr (qw(x y top left width height @@ -53,10 +41,6 @@ is ($rect->y, 132, 'y and top point to the same place'); is ($rect->y(123), 123, 'y is now 123'); is ($rect->top, 123, 'top is an alias to y'); - $app->fill($rect,$blue); - $app->update($rect); - $app->sync; - sleep(1); is ($rect->w(54), 54, 'w is now 54'); @@ -64,6 +48,7 @@ is ($rect->width, 54, 'w and width point to the same place'); is ($rect->width(45), 45, 'w is now 45'); is ($rect->w, 45, 'w is an alias to width'); + is ($rect->h(76), 76, 'h is now 76'); is ($rect->height, 76, 'h and height point to the same place'); is ($rect->height(67), 67, 'h is now 67');