| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
class GenericTest extends UnitTestCase {
|
|
|
4 |
function layoutPipeline($html, &$pipeline, &$media, &$context, &$positioned_filter) {
|
|
|
5 |
$pipeline->clear_box_id_map();
|
|
|
6 |
$pipeline->fetchers = array(new MyFetcherMemory($html, realpath(dirname(__FILE__))),
|
|
|
7 |
new FetcherURL());
|
|
|
8 |
return $pipeline->_layout_item("", $media, 0, $context, $positioned_filter);
|
|
|
9 |
}
|
|
|
10 |
|
|
|
11 |
function &preparePipeline(&$media) {
|
|
|
12 |
$pipeline = PipelineFactory::create_default_pipeline("", "");
|
|
|
13 |
$pipeline->configure(array('scalepoints' => false));
|
|
|
14 |
|
|
|
15 |
$pipeline->data_filters[] = new DataFilterHTML2XHTML();
|
|
|
16 |
$pipeline->destination = new DestinationFile("test.pdf");
|
|
|
17 |
|
|
|
18 |
$pipeline->_prepare($media);
|
|
|
19 |
return $pipeline;
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
function runPipeline($html, &$media = null, &$pipeline = null, &$context = null, &$postponed = null) {
|
|
|
23 |
parse_config_file('../html2ps.config');
|
|
|
24 |
|
|
|
25 |
if (is_null($media)) {
|
|
|
26 |
$media = Media::predefined("A4");
|
|
|
27 |
};
|
|
|
28 |
|
|
|
29 |
$pipeline = $this->preparePipeline($media);
|
|
|
30 |
$tree = $this->layoutPipeline($html, $pipeline, $media, $context, $postponed);
|
|
|
31 |
return $tree;
|
|
|
32 |
}
|
|
|
33 |
}
|
|
|
34 |
?>
|