Chromium Code Reviews| Index: LayoutTests/svg/custom/getBBox-polygon-nodata.html |
| diff --git a/LayoutTests/svg/custom/getBBox-polygon-nodata.html b/LayoutTests/svg/custom/getBBox-polygon-nodata.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3231451bd97c43680021f7a84a173158d2a7cbb3 |
| --- /dev/null |
| +++ b/LayoutTests/svg/custom/getBBox-polygon-nodata.html |
| @@ -0,0 +1,53 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <script> |
| + 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
|
| + { |
| + var result = true; |
| + var result_str = ""; |
| + |
| + if (bbox.x == expected_bbox.x && bbox.y == expected_bbox.y && bbox.width == expected_bbox.width && bbox.height == expected_bbox.height) { |
| + result_str = "Passed"; |
| + } else { |
| + result_str += test_name + ": Failed"; |
| + result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.height+")"; |
| + result = false; |
| + } |
| + |
| + var p_result = document.querySelector("#result"); |
| + p_result.appendChild(document.createTextNode(result_str + "; ")); |
| + return result; |
| + } |
| + |
| + function run() |
| + { |
| + if (window.testRunner) |
| + testRunner.dumpAsText(); |
| + |
| + var p_bbox = document.querySelector("#p1").getBBox(); |
| + var g_bbox = document.querySelector("g").getBBox(); |
| + |
| + var result = true; |
| + |
| + result &= check_rect_bbox(p_bbox, {"x":0, "y":0, "width":0, "height":0}, "getBBox on polygon with no points attribute") |
| + result &= check_rect_bbox(g_bbox, document.querySelector("#r1").getBBox(),"polygon doesn't contribute to parent bbox") |
| + |
| + if (!result) { |
| + var visible_rect = document.querySelector("#r1"); |
| + visible_rect.setAttribute("fill", "red"); |
| + } |
| + } |
| + </script> |
| + |
| +<body onload="run()"> |
| +<p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: getBBox on polygon with no points attribute should return (0,0,0,0) and should not contribute to parent bbox</p> |
| +<p>For this test to pass, you should see 'Passed' twice below.</a> |
| +<p id="result"></p> |
| +<svg xmlns="http://www.w3.org/2000/svg"> |
| +<g> |
| + <polygon id="p1" fill="none" stroke="red" /> |
| + <rect id="r1" x="50" y="50" width="50" height="50" fill="green" /> |
| +</g> |
| +</svg> |
| +</body> |
| +</html> |