~ubuntu-branches/ubuntu/quantal/liblayout-manager-perl/quantal

« back to all changes in this revision

Viewing changes to t/10-compass/25-validity.t

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Yu
  • Date: 2010-02-12 09:05:04 UTC
  • Revision ID: james.westby@ubuntu.com-20100212090504-txofy1idr25w7zc3
Tags: upstream-0.31
ImportĀ upstreamĀ versionĀ 0.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use Test::More tests => 4;
 
2
 
 
3
use lib qw(t/lib lib);
 
4
 
 
5
use DummyDriver;
 
6
 
 
7
use Geometry::Primitive::Point;
 
8
use Graphics::Primitive::Component;
 
9
use Graphics::Primitive::Container;
 
10
 
 
11
BEGIN {
 
12
    use_ok('Layout::Manager::Compass');
 
13
}
 
14
 
 
15
my $foo = Graphics::Primitive::Component->new(
 
16
    name => 'one', minimum_height => 20, minimum_width => 20
 
17
);
 
18
my $foo2 = Graphics::Primitive::Component->new(
 
19
    name => 'two', minimum_height => 20, minimum_width => 20
 
20
);
 
21
my $foo3 = Graphics::Primitive::Component->new(
 
22
    name => 'three', minimum_height => 20, minimum_width => 20
 
23
);
 
24
 
 
25
my $cont = Graphics::Primitive::Container->new(
 
26
    width => 100, height => 40
 
27
);
 
28
 
 
29
$cont->add_component($foo, 'n');
 
30
$cont->add_component($foo2, 'e');
 
31
$cont->add_component($foo3, 'c');
 
32
 
 
33
cmp_ok($cont->component_count, '==', 3, 'component count');
 
34
 
 
35
my $driver = new DummyDriver;
 
36
$driver->prepare($cont);
 
37
 
 
38
my $lm = Layout::Manager::Compass->new;
 
39
$lm->do_layout($cont);
 
40
 
 
41
my $cont2 = Graphics::Primitive::Container->new(
 
42
    width => 100, height => 40,
 
43
    layout_manager => Layout::Manager::Compass->new
 
44
);
 
45
my $foo4 = Graphics::Primitive::Component->new(
 
46
    name => 'four', minimum_height => 20, minumim_width => 20
 
47
);
 
48
$cont2->add_component($foo4, 'c');
 
49
$cont->add_component($cont2, 'w');
 
50
 
 
51
my $ret2 = $lm->do_layout($cont);
 
52
cmp_ok($ret2, '==', 1, 'layout executed');
 
53
 
 
54
$foo4->width(21);
 
55
my $ret4 = $lm->do_layout($cont);
 
56
cmp_ok($ret4, '==', 1, 'layout executed');
 
57