Commit | Line | Data |
8fde61e3 |
1 | #!/usr/bin/perl -w |
2 | # |
3 | # Copyright (C) 2003 Tels |
4 | # Copyright (C) 2004 David J. Goehrig |
5 | # |
6 | # basic testing of SDL::Rect |
7 | |
8 | BEGIN { |
9 | unshift @INC, 'blib/lib','blib/arch'; |
10 | } |
11 | |
12 | use strict; |
13 | |
14 | use Test::More; |
15 | |
16 | plan ( tests => 15 ); |
17 | |
18 | use_ok( 'SDL::Rect' ); |
19 | |
20 | can_ok ('SDL::Rect', qw/ |
21 | new |
22 | x |
23 | y |
24 | width |
25 | height /); |
26 | |
27 | my $rect = SDL::Rect->new(); |
28 | |
29 | # creating with defaults |
30 | is (ref($rect),'SDL::Rect','new went ok'); |
31 | is ($rect->x(), 0, 'x is 0'); |
32 | is ($rect->y(), 0, 'y is 0'); |
33 | is ($rect->width(), 0, 'w is 0'); |
34 | is ($rect->height(), 0, 'h is 0'); |
35 | |
36 | # set and get at the same time |
37 | is ($rect->x(12), 12, 'x is now 12'); |
38 | is ($rect->y(123), 123, 'y is now 12'); |
39 | is ($rect->width(45), 45, 'w is now 45'); |
40 | is ($rect->height(67), 67, 'h is now 67'); |
41 | |
42 | # get alone |
43 | is ($rect->x(), 12, 'x is 12'); |
44 | is ($rect->y(), 123, 'y is 12'); |
45 | is ($rect->width(), 45, 'w is 45'); |
46 | is ($rect->height(), 67, 'h is 67'); |
47 | |