From: Breno G. de Oliveira Date: Sun, 30 Aug 2009 04:08:47 +0000 (-0300) Subject: added 20 more tests for new API X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d690c5f9e790bc710ebafe39ac905dd7fe7a28b3;p=sdlgit%2FSDL_perl.git added 20 more tests for new API --- diff --git a/t/rectpm.t b/t/rectpm.t index 422f64a..58a183e 100644 --- a/t/rectpm.t +++ b/t/rectpm.t @@ -39,7 +39,7 @@ use strict; use Test::More; -plan ( tests => 15 ); +plan ( tests => 35 ); use_ok( 'SDL::Rect' ); @@ -48,7 +48,12 @@ can_ok ('SDL::Rect', qw/ x y width - height /); + height + w + h + top + left + /); my $rect = SDL::Rect->new(); @@ -56,18 +61,41 @@ my $rect = SDL::Rect->new(); is (ref($rect),'SDL::Rect','new went ok'); is ($rect->x(), 0, 'x is 0'); is ($rect->y(), 0, 'y is 0'); -is ($rect->width(), 0, 'w is 0'); -is ($rect->height(), 0, 'h is 0'); +is ($rect->top(), 0, 'top is 0'); +is ($rect->left(), 0, 'left is 0'); +is ($rect->width(), 0, 'width is 0'); +is ($rect->height(), 0, 'height is 0'); +is ($rect->w(), 0, 'w is 0'); +is ($rect->h(), 0, 'h is 0'); -# set and get at the same time +# set and get at the same time (and testing method aliases) +is ($rect->left(15), 15, 'left is now 15'); +is ($rect->x, 15, 'x and left point to the same place'); is ($rect->x(12), 12, 'x is now 12'); -is ($rect->y(123), 123, 'y is now 12'); +is ($rect->left, 12, 'left is an alias to x'); + +is ($rect->top(132), 132, 'top is now 132'); +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'); + +is ($rect->w(54), 54, 'w is now 54'); +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'); +is ($rect->h, 67, 'h is an alias to height'); # get alone is ($rect->x(), 12, 'x is 12'); -is ($rect->y(), 123, 'y is 12'); -is ($rect->width(), 45, 'w is 45'); -is ($rect->height(), 67, 'h is 67'); +is ($rect->left(), 12, 'left is 12'); +is ($rect->y(), 123, 'y is 123'); +is ($rect->top(), 123, 'top is 123'); +is ($rect->width(), 45, 'width is 45'); +is ($rect->w(), 45, 'w is 45'); +is ($rect->height(), 67, 'height is 67'); +is ($rect->h(), 67, 'h is 67');