File: 02-east.t

package info (click to toggle)
liblayout-manager-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 336 kB
  • ctags: 133
  • sloc: perl: 1,782; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,217 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 strict;
use Test::More tests => 10;

use Geometry::Primitive::Point;
use Graphics::Primitive::Component;
use Graphics::Primitive::Container;

use Layout::Manager::Flow;

my $foo = Graphics::Primitive::Component->new(
    name => 'one', minimum_height => 20, minimum_width => 20
);

my $foo2 = Graphics::Primitive::Component->new(
    name => 'two', minimum_height => 20, minimum_width => 10
);

my $cont = Graphics::Primitive::Container->new(
    width => 100, height => 20
);

$cont->add_component($foo);
$cont->add_component($foo2);

my $lm = Layout::Manager::Flow->new(anchor => 'east');
$lm->do_layout($cont);

cmp_ok($foo->height, '==', 20, 'right bottom component height');
cmp_ok($foo->width, '==', 20, 'right component width');
cmp_ok($foo->origin->x, '==', 80, 'right component origin x');
cmp_ok($foo->origin->y, '==', 0, 'right component origin y');

cmp_ok($foo2->height, '==', 20, 'left component height');
cmp_ok($foo2->width, '==', 10, 'left component width');
cmp_ok($foo2->origin->x, '==', 70, 'left component origin x');
cmp_ok($foo2->origin->y, '==', 0, 'left component origin y');

my $used = $lm->used;
cmp_ok($used->[0], '==', 30, 'width used');
cmp_ok($used->[1], '==', 20, 'height used');