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 TestLineBoxNested extends GenericTest {
4
  function testLineBoxNested1() {
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
<span id="outer" style="border: solid black 1px;">
15
<span id="inner1" style="background-color: red;">TEXT</span>
16
<span id="inner2" style="background-color: green; font-size: 2em;">TEXT</span>
17
<span id="inner3" style="background-color: red;">TEXT</span>
18
</span>
19
</body>
20
</html>
21
', $media);
22
 
23
    $outer = $tree->get_element_by_id('outer');
24
    $outer_line = $outer->getLineBox(0);
25
 
26
    $inner1 = $tree->get_element_by_id('inner1');
27
    $inner1_line = $inner1->getLineBox(0);
28
 
29
    $inner2 = $tree->get_element_by_id('inner2');
30
    $inner2_line = $inner2->getLineBox(0);
31
 
32
    $inner3 = $tree->get_element_by_id('inner3');
33
    $inner3_line = $inner3->getLineBox(0);
34
 
35
    // Note that it will emulate IE behavior (line box includes all
36
    // nested line boxes), which (in my opinion)
37
    // is more standard than Firefox (line box height is calculated
38
    // using the first child line box).
39
 
40
    $this->assertEqual($outer_line->top, $inner2_line->top);
41
    $this->assertEqual($outer_line->bottom, $inner2_line->bottom);
42
    $this->assertEqual($inner1_line->bottom, $inner3_line->bottom);
43
    $this->assertEqual($inner1_line->top, $inner3_line->top);
44
    $this->assertTrue($inner1_line->top < $inner2_line->top);
45
    $this->assertTrue($inner1_line->bottom > $inner2_line->bottom);
46
  }
47
}
48
 
49
?>