1
use Test::More tests => 4;
7
use Geometry::Primitive::Point;
8
use Graphics::Primitive::Component;
9
use Graphics::Primitive::Container;
12
use_ok('Layout::Manager::Compass');
15
my $foo = Graphics::Primitive::Component->new(
16
name => 'one', minimum_height => 20, minimum_width => 20
18
my $foo2 = Graphics::Primitive::Component->new(
19
name => 'two', minimum_height => 20, minimum_width => 20
21
my $foo3 = Graphics::Primitive::Component->new(
22
name => 'three', minimum_height => 20, minimum_width => 20
25
my $cont = Graphics::Primitive::Container->new(
26
width => 100, height => 40
29
$cont->add_component($foo, 'n');
30
$cont->add_component($foo2, 'e');
31
$cont->add_component($foo3, 'c');
33
cmp_ok($cont->component_count, '==', 3, 'component count');
35
my $driver = new DummyDriver;
36
$driver->prepare($cont);
38
my $lm = Layout::Manager::Compass->new;
39
$lm->do_layout($cont);
41
my $cont2 = Graphics::Primitive::Container->new(
42
width => 100, height => 40,
43
layout_manager => Layout::Manager::Compass->new
45
my $foo4 = Graphics::Primitive::Component->new(
46
name => 'four', minimum_height => 20, minumim_width => 20
48
$cont2->add_component($foo4, 'c');
49
$cont->add_component($cont2, 'w');
51
my $ret2 = $lm->do_layout($cont);
52
cmp_ok($ret2, '==', 1, 'layout executed');
55
my $ret4 = $lm->do_layout($cont);
56
cmp_ok($ret4, '==', 1, 'layout executed');