File: 20-border.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 (42 lines) | stat: -rw-r--r-- 1,246 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
41
42
use Test::More;

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

use Graphics::Color::RGB;

my $color = Graphics::Color::RGB->new(red => .3);

my $obj = Graphics::Primitive::Border->new;

$obj->color($color);
$obj->width(3);

cmp_ok($obj->left->color->red, '==', $color->red, 'left color');
cmp_ok($obj->right->color->red, '==', $color->red, 'right color');
cmp_ok($obj->top->color->red, '==', $color->red, 'top color');
cmp_ok($obj->bottom->color->red, '==', $color->red, 'bottom color');

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

my $other = $obj->clone;
ok($obj->equal_to($other), 'equal_to');
my $color2 = Graphics::Color::RGB->new(red => 1, green => .3);
$other->left->color($color2);
ok($obj->not_equal_to($other), 'not_equal_to');

ok(!$other->homogeneous, 'not homogeneous');

$other->width(3);
$other->color($color);
ok($other->homogeneous, 'homogenous');

my $b2 = Graphics::Primitive::Border->new( color => $color, width => 5 );
cmp_ok($b2->top->width, '==', 5, 'width in constructor');
cmp_ok($b2->top->color->red, '==', .3, 'color in constructor');

done_testing;