OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <script> | |
4 function check_rect_bbox(bbox, expected_bbox, test_name) | |
fs
2014/06/25 12:53:20
Really hate to see all this boilerplate and manual
Erik Dahlström (inactive)
2014/06/25 14:57:42
Agreed. Will collect all these into a single testh
| |
5 { | |
6 var result = true; | |
7 var result_str = ""; | |
8 | |
9 if (bbox.x == expected_bbox.x && bbox.y == expected_bbox.y && bbox.width == expected_bbox.width && bbox.height == expected_bbox.height) { | |
10 result_str = "Passed"; | |
11 } else { | |
12 result_str += test_name + ": Failed"; | |
13 result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.heig ht+")"; | |
14 result = false; | |
15 } | |
16 | |
17 var p_result = document.querySelector("#result"); | |
18 p_result.appendChild(document.createTextNode(result_str + "; ")); | |
19 return result; | |
20 } | |
21 | |
22 function run() | |
23 { | |
24 if (window.testRunner) | |
25 testRunner.dumpAsText(); | |
26 | |
27 var p_bbox = document.querySelector("#p1").getBBox(); | |
28 var g_bbox = document.querySelector("g").getBBox(); | |
29 | |
30 var result = true; | |
31 | |
32 result &= check_rect_bbox(p_bbox, {"x":0, "y":0, "width":0, "height":0}, "getBBox on polygon with no points attribute") | |
33 result &= check_rect_bbox(g_bbox, document.querySelector("#r1").getBBox( ),"polygon doesn't contribute to parent bbox") | |
34 | |
35 if (!result) { | |
36 var visible_rect = document.querySelector("#r1"); | |
37 visible_rect.setAttribute("fill", "red"); | |
38 } | |
39 } | |
40 </script> | |
41 | |
42 <body onload="run()"> | |
43 <p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: getB Box on polygon with no points attribute should return (0,0,0,0) and should not c ontribute to parent bbox</p> | |
44 <p>For this test to pass, you should see 'Passed' twice below.</a> | |
45 <p id="result"></p> | |
46 <svg xmlns="http://www.w3.org/2000/svg"> | |
47 <g> | |
48 <polygon id="p1" fill="none" stroke="red" /> | |
49 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" /> | |
50 </g> | |
51 </svg> | |
52 </body> | |
53 </html> | |
OLD | NEW |