コード例 #1
0
ファイル: test.default.1.php プロジェクト: isantiago/foswiki
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.default.header.html') . file_get_contents(HTML2PS_DIR . 'default.css') . file_get_contents(dirname(__FILE__) . '/test.default.footer.html'));
     $pipeline = new Pipeline();
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $input_rules = $css->tag_filtered['input'];
     $this->assertEquals(count($input_rules), 10);
 }
コード例 #2
0
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.class.case.html'));
     $pipeline = new Pipeline();
     $pipeline->configure(array('renderimages' => true));
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $this->assertEquals(array(SELECTOR_ID, 'quickSummary'), $rule->selector[1][0]);
 }
コード例 #3
0
ファイル: test.process.2.php プロジェクト: isantiago/foswiki
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.2.html'));
     $pipeline = new Pipeline();
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $selector = $rule->selector;
     $this->assertEquals($selector[1][0][0], SELECTOR_CLASS);
     $this->assertEquals($selector[1][0][1], 'test');
 }
コード例 #4
0
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.margin.left.html'));
     $pipeline = new Pipeline();
     $pipeline->configure(array('renderimages' => true));
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $margin = $rule->body->_properties[0]->_value;
     $this->assertEquals(UNIT_PX, $margin->_units->_unit);
     $this->assertEquals(600, $margin->_units->_number);
 }
コード例 #5
0
ファイル: test.process.7.php プロジェクト: isantiago/foswiki
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.7.html'));
     $pipeline = new Pipeline();
     $pipeline->configure(array('renderimages' => true));
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $this->assertEquals(count($rule->body->_properties), 1);
     $property = $rule->body->_properties[0];
     $this->assertEquals($property->_code, CSS_BACKGROUND);
     $this->assertEquals($property->_value->_image->_url, 'http://localhost/intl/en_com/images/logo_plain.png');
 }
コード例 #6
0
ファイル: test.process.8.php プロジェクト: isantiago/foswiki
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.8.html'));
     $pipeline = new Pipeline();
     $pipeline->configure(array('renderimages' => true));
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $this->assertEquals(count($rule->body->_properties), 1);
     $property = $rule->body->_properties[0];
     $this->assertEquals($property->_code, CSS_BACKGROUND_COLOR);
     $this->assertEquals($property->_value->r, 1);
     $this->assertEquals($property->_value->g, 1);
     $this->assertEquals($property->_value->b, 1);
     $this->assertEquals($property->_value->transparent, false);
 }
コード例 #7
0
 function test()
 {
     $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.padding.html'));
     $pipeline = new Pipeline();
     $pipeline->configure(array('renderimages' => true));
     $pipeline->scan_styles($tree);
     $css = $pipeline->get_current_css();
     $this->assertEquals(count($css->rules), 1);
     $rule = $css->rules[0];
     $padding = $rule->body->_properties[1]->_value;
     $this->assertEquals(UNIT_PX, $padding->top->_units->_unit);
     $this->assertEquals(0, $padding->top->_units->_number);
     $this->assertEquals(UNIT_PX, $padding->right->_units->_unit);
     $this->assertEquals(175, $padding->right->_units->_number);
     $this->assertEquals(UNIT_PX, $padding->bottom->_units->_unit);
     $this->assertEquals(0, $padding->bottom->_units->_number);
     $this->assertEquals(UNIT_PX, $padding->left->_units->_unit);
     $this->assertEquals(110, $padding->left->_units->_number);
 }