File: 01-insets.t

package info (click to toggle)
libgraphics-primitive-perl 0.67-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 372 kB
  • sloc: perl: 2,586; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (5)
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
use Test::More tests => 15;

BEGIN {
    use_ok('Graphics::Primitive::Insets');
}

my $obj = Graphics::Primitive::Insets->new(
    top => 1,
    bottom => 2,
    left => 3,
    right => 4
);

cmp_ok($obj->top, '==', 1, 'top');
cmp_ok($obj->bottom, '==', 2, 'bottoms');
cmp_ok($obj->left, '==', 3, 'left');
cmp_ok($obj->right, '==', 4, 'right');

my $obj2 = Graphics::Primitive::Insets->new(
    top => 1,
    bottom => 2,
    left => 3,
    right => 5
);

ok($obj->not_equal_to($obj2), 'not equal');
$obj2->right(4);
ok($obj->equal_to($obj2), 'equal');

$obj->zero;
cmp_ok($obj->top, '==', 0, 'zero top');
cmp_ok($obj->left, '==', 0, 'zero left');
cmp_ok($obj->bottom, '==', 0, 'zero bottom');
cmp_ok($obj->right, '==', 0, 'zero right');

$obj->width(4);
cmp_ok($obj->top, '==', 4, 'width, top');
cmp_ok($obj->left, '==', 4, 'width, left');
cmp_ok($obj->bottom, '==', 4, 'width, bottom');
cmp_ok($obj->right, '==', 4, 'width, right');