OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test for Buzilla Bug 15359: JPEG image not shown when height is specified
as percentage inside a table</title> | 3 <title>Test for Buzilla Bug 15359: JPEG image not shown when height is specified
as percentage inside a table</title> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 if (window.testRunner) { | 6 if (window.testRunner) { |
7 testRunner.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 } | 9 } |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 function parsePixelValue(str) | 35 function parsePixelValue(str) |
36 { | 36 { |
37 if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) !
= "px") { | 37 if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) !
= "px") { |
38 testFailed(str + " is unparsable."); | 38 testFailed(str + " is unparsable."); |
39 return -1; | 39 return -1; |
40 } | 40 } |
41 return parseFloat(str); | 41 return parseFloat(str); |
42 } | 42 } |
43 | 43 |
44 function is75PercentOf(expression75, expression100) | |
45 { | |
46 var str75 = eval(expression75); | |
47 var str100 = eval(expression100); | |
48 var num75 = parsePixelValue(str75); | |
49 var num100 = parsePixelValue(str100); | |
50 if (num75 < 0 || num100 < 0) | |
51 return; | |
52 var expectedValue = num100 * 75 / 100; | |
53 if (num75 == expectedValue) | |
54 testPassed(expression75 + " is 75% of " + expression100 + "."); | |
55 else | |
56 testFailed(expression75 + " [" + str75 + "] is not 75% of " + expression
100 + " [" + str100 + "]."); | |
57 } | |
58 | |
59 function test() | 44 function test() |
60 { | 45 { |
61 description("This test checks that replaced elements with percentage heights
within table cells have the correct height.<br>Note, some of the button height
tests fail on the Windows ports. See bug #34071."); | 46 description("This test checks that replaced elements with percentage heights
within table cells have the correct height.<br>Note, some of the button height
tests fail on the Windows ports. See bug #34071."); |
62 | 47 |
63 shouldBe("getWidth('canvas-75')", "'225px'"); | 48 shouldBe("getWidth('canvas-75')", "'225px'"); |
64 shouldBe("getHeight('canvas-75')", "'112.5px'"); | 49 shouldBe("getHeight('canvas-75')", "'112.5px'"); |
65 shouldBe("getWidth('canvas-100')", "'300px'"); | 50 shouldBe("getWidth('canvas-100')", "'300px'"); |
66 shouldBe("getHeight('canvas-100')", "'150px'"); | 51 shouldBe("getHeight('canvas-100')", "'150px'"); |
67 | 52 |
68 shouldBe("getWidth('embed-75')", "'300px'"); | 53 shouldBe("getWidth('embed-75')", "'300px'"); |
(...skipping 18 matching lines...) Expand all Loading... |
87 | 72 |
88 shouldBe("getWidth('button-75')", "getWidth('button-100')"); | 73 shouldBe("getWidth('button-75')", "getWidth('button-100')"); |
89 shouldBeTrue("getHeight('button-75') != '0px'"); | 74 shouldBeTrue("getHeight('button-75') != '0px'"); |
90 shouldBe("getHeight('button-75')", "getHeight('button-100')"); | 75 shouldBe("getHeight('button-75')", "getHeight('button-100')"); |
91 | 76 |
92 shouldBe("getWidth('input-button-75')", "getWidth('input-button-100')"); | 77 shouldBe("getWidth('input-button-75')", "getWidth('input-button-100')"); |
93 shouldBeTrue("getHeight('input-button-75') != '0px'"); | 78 shouldBeTrue("getHeight('input-button-75') != '0px'"); |
94 shouldBe("getHeight('input-button-75')", "getHeight('input-button-100')"); | 79 shouldBe("getHeight('input-button-75')", "getHeight('input-button-100')"); |
95 | 80 |
96 shouldBe("getWidth('input-checkbox-75')", "getWidth('input-checkbox-100')"); | 81 shouldBe("getWidth('input-checkbox-75')", "getWidth('input-checkbox-100')"); |
97 shouldBeTrue("getHeight('input-checkbox-75') != '0px'"); | 82 shouldBeTrue("getHeight('input-checkbox-75') == '0px'"); |
98 // Note: This behavior doesn't match to Firefox 3.5 and Opera 10. | 83 shouldBe("getHeight('input-checkbox-75')", "getHeight('input-checkbox-100')"
); |
99 is75PercentOf("getHeight('input-checkbox-75')", "getHeight('input-checkbox-1
00')"); | |
100 | 84 |
101 shouldBe("getWidth('input-file-75')", "getWidth('input-file-100')"); | 85 shouldBe("getWidth('input-file-75')", "getWidth('input-file-100')"); |
102 shouldBeTrue("getHeight('input-file-75') != '0px'"); | 86 shouldBeTrue("getHeight('input-file-75') != '0px'"); |
103 // Note: This behavior doesn't match to Firefox 3.5 and Opera 10. | 87 shouldBe("getHeight('input-file-75')", "getHeight('input-file-100')"); |
104 is75PercentOf("getHeight('input-file-75')", "getHeight('input-file-100')"); | |
105 | 88 |
106 // Note: This behavior doesn't match to Firefox 3.5 and Opera 10. | 89 // Note: This behavior doesn't match to Firefox 3.5 and Opera 10. |
107 shouldBe("getWidth('input-image-75')", "'75px'"); | 90 shouldBe("getWidth('input-image-75')", "'75px'"); |
108 shouldBe("getHeight('input-image-75')", "'75px'"); | 91 shouldBe("getHeight('input-image-75')", "'75px'"); |
109 shouldBe("getWidth('input-image-100')", "'100px'"); | 92 shouldBe("getWidth('input-image-100')", "'100px'"); |
110 shouldBe("getHeight('input-image-100')", "'100px'"); | 93 shouldBe("getHeight('input-image-100')", "'100px'"); |
111 | 94 |
112 shouldBe("getWidth('input-radio-75')", "getWidth('input-radio-100')"); | 95 shouldBe("getWidth('input-radio-75')", "getWidth('input-radio-100')"); |
113 shouldBeTrue("getHeight('input-radio-75') != '0px'"); | 96 shouldBeTrue("getHeight('input-radio-75') == '0px'"); |
114 // Note: This behavior doesn't match to Firefox 3.5 and Opera 10. | 97 shouldBe("getHeight('input-radio-75')", "getHeight('input-radio-100')"); |
115 is75PercentOf("getHeight('input-radio-75')", "getHeight('input-radio-100')")
; | |
116 | 98 |
117 shouldBe("getWidth('input-reset-75')", "getWidth('input-reset-100')"); | 99 shouldBe("getWidth('input-reset-75')", "getWidth('input-reset-100')"); |
118 shouldBeTrue("getHeight('input-reset-75') != '0px'"); | 100 shouldBeTrue("getHeight('input-reset-75') != '0px'"); |
119 shouldBe("getHeight('input-reset-75')", "getHeight('input-reset-100')"); | 101 shouldBe("getHeight('input-reset-75')", "getHeight('input-reset-100')"); |
120 | 102 |
121 shouldBe("getWidth('input-submit-75')", "getWidth('input-submit-100')"); | 103 shouldBe("getWidth('input-submit-75')", "getWidth('input-submit-100')"); |
122 shouldBeTrue("getHeight('input-submit-75') != '0px'"); | 104 shouldBeTrue("getHeight('input-submit-75') != '0px'"); |
123 shouldBe("getHeight('input-submit-75')", "getHeight('input-submit-100')"); | 105 shouldBe("getHeight('input-submit-75')", "getHeight('input-submit-100')"); |
124 | 106 |
125 shouldBe("getWidth('select-75')", "getWidth('select-100')"); | 107 shouldBe("getWidth('select-75')", "getWidth('select-100')"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 <table><tr><td><input type="submit" id="input-submit-75" style="height: 75%;"></
td></tr></table> | 157 <table><tr><td><input type="submit" id="input-submit-75" style="height: 75%;"></
td></tr></table> |
176 <table><tr><td><input type="submit" id="input-submit-100" style="height: 100%;">
</td></tr></table> | 158 <table><tr><td><input type="submit" id="input-submit-100" style="height: 100%;">
</td></tr></table> |
177 | 159 |
178 <table><tr><td><select id="select-75" style="height: 75%;"><option>Option</optio
n></select></td></tr></table> | 160 <table><tr><td><select id="select-75" style="height: 75%;"><option>Option</optio
n></select></td></tr></table> |
179 <table><tr><td><select id="select-100" style="height: 100%;"><option>Option</opt
ion></select></td></tr></table> | 161 <table><tr><td><select id="select-100" style="height: 100%;"><option>Option</opt
ion></select></td></tr></table> |
180 | 162 |
181 <p id="description"></p> | 163 <p id="description"></p> |
182 <div id="console"></div> | 164 <div id="console"></div> |
183 </body> | 165 </body> |
184 </html> | 166 </html> |
OLD | NEW |