File: rectpm.t

package info (click to toggle)
sdlperl 1.20.3dfsg-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,796 kB
  • ctags: 2,171
  • sloc: perl: 7,394; ansic: 232; makefile: 75; sh: 1
file content (42 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w

# basic testing of SDL::Rect

use Test::More tests => 15;
use strict;
use vars qw/@INC/;

BEGIN
  {
  unshift @INC, ('../blib/lib');
  unshift @INC, ('../blib/arch');
  chdir 't' if -d 't';
  use_ok( 'SDL::Rect' ); 
  }
  
can_ok ('SDL::Rect', qw/
	new
	x y width height
	/);

my $rect = SDL::Rect->new();

# creating with defaults
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');

# set and get at the same time
is ($rect->x(12), 12, 'x is now 12');
is ($rect->y(123), 123, 'y is now 12');
is ($rect->width(45), 45, 'w is now 45');
is ($rect->height(67), 67, 'h is now 67');

# 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');