version 1.2, 2008/12/09 11:50:08
|
version 1.4, 2008/12/29 11:57:37
|
Line 219 ok($cell->{'colspan'} == 1, 'Colspan 2,2
|
Line 219 ok($cell->{'colspan'} == 1, 'Colspan 2,2
|
# +----------+---------+----+-----------+---------+ |
# +----------+---------+----+-----------+---------+ |
|
|
|
|
$testobject = new Apache::lontable(); |
$testobject = new Apache::lontable({theme => "Dresden", |
|
caption => "This is the table caption", |
|
outer_border => 1, |
|
inner_border => 1, |
|
width => '1.0\textwidth', |
|
alignment => 'left'}); |
|
|
$testobject->start_row(); |
$testobject->start_row(); |
$testobject->add_cell('2 cols 3 rows', {rowspan => 3, colspan => 2}); |
$testobject->add_cell('2 cols 3 rows', {rowspan => 3, colspan => 2}); |
$testobject->add_cell('2 cols 1 row', {colspan => 2}); |
$testobject->add_cell('2 cols 1 row', {colspan => 2}); |
$testobject->end_row(); |
$testobject->end_row(); |
|
|
$testobject->start_row(); |
$testobject->start_row({default_halign => 'left'}); |
$testobject->add_cell('ordinary cell'); |
|
$testobject->add_cell('ordinary cell'); |
$testobject->add_cell('ordinary cell'); |
|
$testobject->add_cell('ordinary cell', {halign => 'center'}); |
$testobject->end_row(); |
$testobject->end_row(); |
|
|
$testobject->start_row(); |
$testobject->start_row({default_halign => 'right'}); |
$testobject->add_cell('2 rows 1 col', {rowspan => 2}); |
$testobject->add_cell('2 rows 1 col', {rowspan => 2, halign => 'right'}); |
$testobject->add_cell('ordinary cell'); |
$testobject->add_cell('ordinary cell'); |
$testobject->end_row(); |
$testobject->end_row(); |
|
|
$testobject->start_row(); |
$testobject->start_row({default_halign => 'center'}); |
$testobject->add_cell('ordinary cell'); |
|
$testobject->add_cell('ordinary cell'); |
$testobject->add_cell('ordinary cell'); |
$testobject->add_cell('ordinary cell'); |
$testobject->add_cell('ordinary cell'); |
|
$testobject->add_cell('ordinary cell', {halign => 'left'}); |
$testobject->end_row(); |
$testobject->end_row(); |
|
|
# First of all the table should have figured out tere are 4 cols and 4 rows: |
# First of all the table should have figured out there are 4 cols and 4 rows: |
|
|
ok($testobject->get_object_attribute('column_count') == 4, 'col count with spans'); |
ok($testobject->get_object_attribute('column_count') == 4, 'col count with spans'); |
|
|
Line 264 ok($cells->[1]->{'contents'} eq '2 cols
|
Line 269 ok($cells->[1]->{'contents'} eq '2 cols
|
|
|
$row = $testobject->get_row(1); |
$row = $testobject->get_row(1); |
$cells = $row->{'cells'}; |
$cells = $row->{'cells'}; |
|
|
ok(scalar(@$cells) == 3, ' 3 cell hashes in row 1'); |
ok(scalar(@$cells) == 3, ' 3 cell hashes in row 1'); |
ok($cells->[0]->{'rowspan'} == 2, '2,1 rowspan carried from above'); |
ok($cells->[0]->{'rowspan'} == 2, '2,1 rowspan carried from above'); |
ok($cells->[0]->{'colspan'} == 2, '2,1 colspan carried from above'); |
ok($cells->[0]->{'colspan'} == 2, '2,1 colspan carried from above'); |
Line 305 ok($cells->[0]->{'contents'} eq 'ordinar
|
Line 311 ok($cells->[0]->{'contents'} eq 'ordinar
|
|
|
ok($cells->[1]->{'rowspan'} == 1, '4,2 rowspan'); |
ok($cells->[1]->{'rowspan'} == 1, '4,2 rowspan'); |
ok($cells->[1]->{'colspan'} == 1, '4,2 colspan'); |
ok($cells->[1]->{'colspan'} == 1, '4,2 colspan'); |
|
my $contents = $cells->[1]->{'contents'}; |
ok($cells->[1]->{'contents'} eq 'ordinary cell', '4,2, contents'); |
ok($cells->[1]->{'contents'} eq 'ordinary cell', '4,2, contents'); |
|
|
ok($cells->[2]->{'rowspan'} == 1, "4,3 rowspan carried down"); |
ok($cells->[2]->{'rowspan'} == 1, "4,3 rowspan carried down"); |
Line 312 ok($cells->[2]->{'colspan'} == 1, '4,3 c
|
Line 319 ok($cells->[2]->{'colspan'} == 1, '4,3 c
|
ok($cells->[2]->{'contents'} eq '', '4,3 contents empty'); |
ok($cells->[2]->{'contents'} eq '', '4,3 contents empty'); |
|
|
ok($cells->[3]->{'rowspan'} == 1, "4,4 rowspan"); |
ok($cells->[3]->{'rowspan'} == 1, "4,4 rowspan"); |
ok($cells->[3]->{'colspan'} == 2, '4,4 colspan'); |
ok($cells->[3]->{'colspan'} == 1, '4,4 colspan'); |
ok($cells->[3]->{'contents'} eq 'ordinary cell', '4,4 contents'); |
ok($cells->[3]->{'contents'} eq 'ordinary cell', '4,4 contents'); |
|
|
|
|
|
|
|
my $table = $testobject->generate(); |
|
$table->set_filename('table.tex'); |
|
$table->generate(); |
|
|
|
|
|
|