1<?php
2
3class TestTableBorder extends GenericTest {
4  function TestTableBorder1() {
5    $tree = $this->runPipeline('
6<html><head>
7</head>
8<body>
9<table id="table" border="1" cellspacing="1" cellpadding="2">
10<tr>
11<td id="cell1">TEXT</td>
12<td id="cell2">TEXT</td>
13</tr>
14</table>
15</body>
16</html>
17');
18
19    $table = $tree->get_element_by_id('table');
20    $table_border = $table->getCSSProperty(CSS_BORDER);
21
22    $this->assertEqual($table_border->left->style , BS_SOLID);
23    $this->assertEqual($table_border->right->style , BS_SOLID);
24    $this->assertEqual($table_border->top->style , BS_SOLID);
25    $this->assertEqual($table_border->bottom->style , BS_SOLID);
26
27    $this->assertTrue($table_border->left->width->getPoints() > 0);
28    $this->assertTrue($table_border->right->width->getPoints() > 0);
29    $this->assertTrue($table_border->top->width->getPoints() > 0);
30    $this->assertTrue($table_border->bottom->width->getPoints() > 0);
31
32    $cell1 = $tree->get_element_by_id('cell1');
33    $cell1_border = $cell1->getCSSProperty(CSS_BORDER);
34    $this->assertEqual($cell1_border->left->style , BS_SOLID);
35    $this->assertEqual($cell1_border->right->style , BS_SOLID);
36    $this->assertEqual($cell1_border->top->style , BS_SOLID);
37    $this->assertEqual($cell1_border->bottom->style , BS_SOLID);
38
39    $this->assertTrue($cell1_border->left->width->getPoints() > 0,
40                      'Expected non-zero left border width');
41    $this->assertTrue($cell1_border->right->width->getPoints() > 0,
42                      'Expected non-zero right border width');
43    $this->assertTrue($cell1_border->top->width->getPoints() > 0,
44                      'Expected non-zero top border width');
45    $this->assertTrue($cell1_border->bottom->width->getPoints() > 0,
46                      'Expected non-zero bottom border width');
47
48    $cell2 = $tree->get_element_by_id('cell2');
49    $cell2_border = $cell2->getCSSProperty(CSS_BORDER);
50    $this->assertEqual($cell2_border->left->style , BS_SOLID);
51    $this->assertEqual($cell2_border->right->style , BS_SOLID);
52    $this->assertEqual($cell2_border->top->style , BS_SOLID);
53    $this->assertEqual($cell2_border->bottom->style , BS_SOLID);
54
55    $this->assertTrue($cell2_border->left->width->getPoints() > 0,
56                      'Expected non-zero left border width');
57    $this->assertTrue($cell2_border->right->width->getPoints() > 0,
58                      'Expected non-zero right border width');
59    $this->assertTrue($cell2_border->top->width->getPoints() > 0,
60                      'Expected non-zero top border width');
61    $this->assertTrue($cell2_border->bottom->width->getPoints() > 0,
62                      'Expected non-zero bottom border width');
63  }
64
65  function TestTableBorder2() {
66    $tree = $this->runPipeline('
67<html><head>
68</head>
69<body>
70<table id="table" border="1" cellspacing="1" cellpadding="2">
71<tbody>
72<tr>
73<td id="cell1">TEXT</td>
74<td id="cell2">TEXT</td>
75</tr>
76</tbody>
77</table>
78</body>
79</html>
80');
81
82    $table = $tree->get_element_by_id('table');
83    $table_border = $table->getCSSProperty(CSS_BORDER);
84
85    $this->assertEqual($table_border->left->style , BS_SOLID);
86    $this->assertEqual($table_border->right->style , BS_SOLID);
87    $this->assertEqual($table_border->top->style , BS_SOLID);
88    $this->assertEqual($table_border->bottom->style , BS_SOLID);
89
90    $this->assertTrue($table_border->left->width->getPoints() > 0);
91    $this->assertTrue($table_border->right->width->getPoints() > 0);
92    $this->assertTrue($table_border->top->width->getPoints() > 0);
93    $this->assertTrue($table_border->bottom->width->getPoints() > 0);
94
95    $cell1 = $tree->get_element_by_id('cell1');
96    $cell1_border = $cell1->getCSSProperty(CSS_BORDER);
97    $this->assertEqual($cell1_border->left->style , BS_SOLID);
98    $this->assertEqual($cell1_border->right->style , BS_SOLID);
99    $this->assertEqual($cell1_border->top->style , BS_SOLID);
100    $this->assertEqual($cell1_border->bottom->style , BS_SOLID);
101
102    $this->assertTrue($cell1_border->left->width->getPoints() > 0,
103                      'Expected non-zero left border width');
104    $this->assertTrue($cell1_border->right->width->getPoints() > 0,
105                      'Expected non-zero right border width');
106    $this->assertTrue($cell1_border->top->width->getPoints() > 0,
107                      'Expected non-zero top border width');
108    $this->assertTrue($cell1_border->bottom->width->getPoints() > 0,
109                      'Expected non-zero bottom border width');
110
111    $cell2 = $tree->get_element_by_id('cell2');
112    $cell2_border = $cell2->getCSSProperty(CSS_BORDER);
113    $this->assertEqual($cell2_border->left->style , BS_SOLID);
114    $this->assertEqual($cell2_border->right->style , BS_SOLID);
115    $this->assertEqual($cell2_border->top->style , BS_SOLID);
116    $this->assertEqual($cell2_border->bottom->style , BS_SOLID);
117
118    $this->assertTrue($cell2_border->left->width->getPoints() > 0,
119                      'Expected non-zero left border width');
120    $this->assertTrue($cell2_border->right->width->getPoints() > 0,
121                      'Expected non-zero right border width');
122    $this->assertTrue($cell2_border->top->width->getPoints() > 0,
123                      'Expected non-zero top border width');
124    $this->assertTrue($cell2_border->bottom->width->getPoints() > 0,
125                      'Expected non-zero bottom border width');
126  }
127}
128
129?>