1<?php
2
3class TestCSSPriority extends GenericTest {
4  function testCSSPriority1() {
5    $tree = $this->runPipeline('
6<html>
7<head>
8<style type="text/css">
9#cell1 { background-color: red; }
10#cell2 { background-color: lime; }
11#cell3 { }
12</style>
13</head>
14<body>
15<table>
16<tr>
17<td bgcolor="green" id="cell1">&nbsp;</td>
18<td id="cell2">&nbsp;</td>
19<td bgcolor="blue" id="cell3">&nbsp;</td>
20</tr>
21</table>
22</body>
23</html>
24');
25
26    $cell1 =& $tree->get_element_by_id('cell1');
27    $color =& $cell1->getCSSProperty(CSS_BACKGROUND_COLOR);
28    $this->assertEqual(1, $color->r);
29    $this->assertEqual(0, $color->g);
30    $this->assertEqual(0, $color->b);
31
32    $cell2 =& $tree->get_element_by_id('cell2');
33    $color =& $cell2->getCSSProperty(CSS_BACKGROUND_COLOR);
34    $this->assertEqual(0, $color->r);
35    $this->assertEqual(1, $color->g);
36    $this->assertEqual(0, $color->b);
37
38    $cell3 =& $tree->get_element_by_id('cell3');
39    $color =& $cell3->getCSSProperty(CSS_BACKGROUND_COLOR);
40    $this->assertEqual(0, $color->r);
41    $this->assertEqual(0, $color->g);
42    $this->assertEqual(1, $color->b);
43  }
44}
45
46?>