| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
class TestPagebreakBorder extends GenericTest {
|
|
|
4 |
function testPagebreakBorder1() {
|
|
|
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 |
<style type="text/css">
|
|
|
11 |
body { font-size: 10pt; line-height: 1; orphans:0; widows: 0; padding: 0; margin: 0; }
|
|
|
12 |
#first { line-height: 1; height: 180pt; }
|
|
|
13 |
#second { width: 3em; border: solid black 1pt; }
|
|
|
14 |
</style>
|
|
|
15 |
</head>
|
|
|
16 |
<body>
|
|
|
17 |
<div id="first"> </div>
|
|
|
18 |
<div id="second"><!--Page break should be here-->
|
|
|
19 |
LINE1
|
|
|
20 |
LINE2
|
|
|
21 |
LINE3
|
|
|
22 |
LINE4
|
|
|
23 |
LINE5
|
|
|
24 |
</div>
|
|
|
25 |
</body>
|
|
|
26 |
</html>
|
|
|
27 |
', $media);
|
|
|
28 |
|
|
|
29 |
/**
|
|
|
30 |
* Calculate page heights
|
|
|
31 |
*/
|
|
|
32 |
$page_heights = PageBreakLocator::getPages($tree,
|
|
|
33 |
mm2pt($media->real_height()),
|
|
|
34 |
mm2pt($media->height() - $media->margins['top']));
|
|
|
35 |
|
|
|
36 |
$first_div = $tree->get_element_by_id('first');
|
|
|
37 |
$second_div = $tree->get_element_by_id('second');
|
|
|
38 |
|
|
|
39 |
$this->assertEqual(count($page_heights), 2,
|
|
|
40 |
sprintf("Two pages expected, got %s",
|
|
|
41 |
count($page_heights)));
|
|
|
42 |
$this->assertEqual($page_heights[0],
|
|
|
43 |
$first_div->get_full_height());
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
function testPagebreakBorderTestNoBorder() {
|
|
|
47 |
$media = new Media(array('width' => 100, 'height' => 200/mm2pt(1)),
|
|
|
48 |
array('top'=>0, 'bottom'=>0, 'left'=>0, 'right'=>0));
|
|
|
49 |
$tree = $this->runPipeline('
|
|
|
50 |
<html>
|
|
|
51 |
<head>
|
|
|
52 |
<style type="text/css">
|
|
|
53 |
body { font-size: 10pt; line-height: 1; orphans:0; widows: 0; padding: 0; margin: 0; }
|
|
|
54 |
#first { line-height: 1; height: 180pt; }
|
|
|
55 |
#second { width: 3em; }
|
|
|
56 |
</style>
|
|
|
57 |
</head>
|
|
|
58 |
<body>
|
|
|
59 |
<div id="first"> </div>
|
|
|
60 |
<div id="second">
|
|
|
61 |
LINE1<!--Page break should be here-->
|
|
|
62 |
LINE2
|
|
|
63 |
LINE3
|
|
|
64 |
LINE4
|
|
|
65 |
LINE5
|
|
|
66 |
</div>
|
|
|
67 |
</body>
|
|
|
68 |
</html>
|
|
|
69 |
', $media);
|
|
|
70 |
|
|
|
71 |
/**
|
|
|
72 |
* Calculate page heights
|
|
|
73 |
*/
|
|
|
74 |
$page_heights = PageBreakLocator::getPages($tree,
|
|
|
75 |
mm2pt($media->real_height()),
|
|
|
76 |
mm2pt($media->height() - $media->margins['top']));
|
|
|
77 |
|
|
|
78 |
$first_div = $tree->get_element_by_id('first');
|
|
|
79 |
$second_div = $tree->get_element_by_id('second');
|
|
|
80 |
|
|
|
81 |
$this->assertEqual(count($page_heights), 2,
|
|
|
82 |
sprintf("Two pages expected, got %s",
|
|
|
83 |
count($page_heights)));
|
|
|
84 |
$this->assertEqual($page_heights[0],
|
|
|
85 |
$first_div->get_full_height() + pt2pt(20));
|
|
|
86 |
}
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
?>
|