2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
4 <title>SVG bounding boxes are valid for a zero-width or zero-height circle
</title>
6 <circle cx=
"300" cy=
"300" r=
"50"/>
7 <circle cx=
"300" cy=
"300" r=
"0"/>
8 <circle vector-effect=
"non-scaling-stroke" cx=
"300" cy=
"300" r=
"50"/>
9 <circle vector-effect=
"non-scaling-stroke" cx=
"300" cy=
"300" r=
"0"/>
12 BBox = function(x
,y
,w
,h
) {
18 BBox
.prototype.toString = function() {
19 return this.x
+ "," + this.y
+ "," + this.width
+ "," + this.height
;
21 // The order of expected sizes should equal the document order of the rects.
23 new BBox(250, 250, 100, 100),
24 new BBox(300, 300, 0, 0),
25 new BBox(250, 250, 100, 100),
26 new BBox(300, 300, 0, 0),
28 var circles
= document
.getElementsByTagName('circle');
29 for (var i
= 0, length
= circles
.length
; i
< length
; ++i
) {
30 var circleBBox
= circles
[i
].getBBox();
32 assert_equals(circleBBox
.x
, expectedBoxes
[i
].x
);
33 assert_equals(circleBBox
.y
, expectedBoxes
[i
].y
);
34 assert_equals(circleBBox
.width
, expectedBoxes
[i
].width
);
35 assert_equals(circleBBox
.height
, expectedBoxes
[i
].height
);
36 }, 'Bounding box size ' + expectedBoxes
[i
]);