| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <title>SVG bounding boxes are valid for a zero-rx or zero-ry ellipse</title> |
| <svg height="0"> |
| <ellipse cx="50" cy="100" rx="0" ry="50"/> |
| <ellipse cx="50" cy="100" rx="50" ry="0"/> |
| <ellipse vector-effect="non-scaling-stroke" cx="50" cy="100" rx="0" ry="50"/> |
| <ellipse vector-effect="non-scaling-stroke" cx="50" cy="100" rx="50" ry="0"/> |
| </svg> |
| <script> |
| BBox = function(x,y,w,h) { |
| this.x = x; |
| this.y = y; |
| this.width = w; |
| this.height = h; |
| }; |
| BBox.prototype.toString = function() { |
| return this.x + "," + this.y + "," + this.width + "," + this.height; |
| }; |
| // The order of expected sizes should equal the document order of the rects. |
| var expectedBoxes = [ |
| new BBox(50, 50, 0, 100), |
| new BBox(0, 100, 100, 0), |
| new BBox(50, 50, 0, 100), |
| new BBox(0, 100, 100, 0), |
| ]; |
| var ellipses = document.getElementsByTagName('ellipse'); |
| for (var i = 0, length = ellipses.length; i < length; ++i) { |
| var ellipseBBox = ellipses[i].getBBox(); |
| test(function() { |
| assert_equals(ellipseBBox.x, expectedBoxes[i].x); |
| assert_equals(ellipseBBox.y, expectedBoxes[i].y); |
| assert_equals(ellipseBBox.width, expectedBoxes[i].width); |
| assert_equals(ellipseBBox.height, expectedBoxes[i].height); |
| }, 'Bounding box size, ellipse ' + (i + 1) + ', ' + expectedBoxes[i]); |
| } |
| </script> |