Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class TestTableTopBoundary extends GenericTest {
4
  function testTableTopBoundary1() {
5
    $media = new Media(array('width' => 100, 'height' => 200/mm2pt(1)),
6
                       array('top'=>0, 'bottom'=>0, 'left'=>0, 'right'=>0));
7
    $tree = $this->runPipeline('
8
<html>
9
<head>
10
body   { font-size: 10pt; line-height: 1; padding: 0; margin: 0; }
11
</style>
12
</head>
13
<body>
14
<table cellpadding="0" cellspacing="0" id="table">
15
<tr><td id="cell">TEXT1</td></tr>
16
</table>
17
</body>
18
</html>
19
', $media);
20
 
21
    $table = $tree->get_element_by_id('table');
22
    $cell  = $tree->get_element_by_id('cell');
23
 
24
    $this->assertEqual($table->get_top_margin(),
25
                       $cell->get_top_margin(),
26
                       "Comparing table and cell top margins for the table containins one cell [%s]");
27
    $text = $cell->content[0]->content[0];
28
    $this->assertEqual($text->get_top_margin(),
29
                       $cell->get_top_margin(),
30
                       "Comparing cell and cell content top margins for the table containins one cell [%s]");
31
  }
32
 
33
  function testTableTopBoundary2() {
34
    $media = new Media(array('width' => 100, 'height' => 200/mm2pt(1)),
35
                       array('top'=>0, 'bottom'=>0, 'left'=>0, 'right'=>0));
36
    $tree = $this->runPipeline('
37
<html>
38
<head>
39
body   { font-size: 10pt; line-height: 1; padding: 0; margin: 0; }
40
</style>
41
</head>
42
<body>
43
<table cellpadding="0" cellspacing="0" id="table">
44
<tr><td id="cell">TEXT1<br/>TEXT2</td></tr>
45
</table>
46
</body>
47
</html>
48
', $media);
49
 
50
    $table = $tree->get_element_by_id('table');
51
    $cell  = $tree->get_element_by_id('cell');
52
 
53
    $this->assertEqual($table->get_top_margin(),
54
                       $cell->get_top_margin(),
55
                       "Comparing table and cell top margins for the table containins one cell [%s]");
56
    $text = $cell->content[0]->content[0];
57
    $this->assertEqual($text->get_top_margin(),
58
                       $cell->get_top_margin(),
59
                       "Comparing cell and cell content top margins for the table containins one cell [%s]");
60
  }
61
}
62
 
63
?>