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 TestPagebreakTableLines extends GenericTest {
4
  /**
5
   * Checks if it is possible to make an incorrect page break in a table with
6
   * different font size in different cells
7
   */
8
  function testPagebreakTableLines1() {
9
    $media = new Media(array('width' => 100, 'height' => 200/mm2pt(1)),
10
                       array('top'=>0, 'bottom'=>0, 'left'=>0, 'right'=>0));
11
    $tree = $this->runPipeline('
12
<html>
13
<head>
14
<style type="text/css">
15
body {
16
  font-size: 10pt;
17
  line-height: 1;
18
  padding: 0;
19
  margin: 0;
20
  width: 10pt;
21
}
22
 
23
div {
24
  width: 10pt;
25
  orphans: 0;
26
  widows: 0;
27
}
28
 
29
td#small {
30
  font-size: 20pt;
31
  line-height: 1;
32
  width: 10pt;
33
  vertical-align: top;
34
}
35
 
36
td#large {
37
  font-size: 30pt;
38
  line-height: 1;
39
  width: 10pt;
40
  vertical-align: top;
41
}
42
</style>
43
</head>
44
<body>
45
<table cellpadding="0" cellspacing="0">
46
<tr>
47
<td id="small">
48
<div>
49
SMALL
50
SMALL
51
SMALL
52
SMALL
53
SMALL
54
SMALL
55
SMALL
56
SMALL
57
SMALL
58
SMALL
59
</div>
60
</td>
61
<td id="large">
62
<div>
63
LARGE
64
LARGE
65
LARGE
66
LARGE
67
LARGE
68
LARGE
69
LARGE
70
</div>
71
</td>
72
</tr>
73
</table>
74
</body>
75
</html>
76
', $media);
77
 
78
 
79
    $small = $tree->get_element_by_id('small');
80
    $font_size =& $small->getCSSProperty(CSS_FONT_SIZE);
81
    $this->assertEqual($font_size->getPoints(), 20);
82
 
83
    $large = $tree->get_element_by_id('large');
84
    $font_size =& $large->getCSSProperty(CSS_FONT_SIZE);
85
    $this->assertEqual($font_size->getPoints(), 30);
86
 
87
    $locations = PageBreakLocator::_getBreakLocations($tree);
88
    $this->assertEqual(count($locations), 5);
89
 
90
    $page_heights = PageBreakLocator::getPages($tree,
91
                                               mm2pt($media->real_height()),
92
                                               mm2pt($media->height() - $media->margins['top']));
93
 
94
    $this->assertEqual(count($page_heights), 2,
95
                       sprintf("Two pages expected, got %s",
96
                               count($page_heights)));
97
    $this->assertEqual($page_heights[0],
98
                       pt2pt(180));
99
  }
100
}
101
 
102
?>