OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../resources/testharness.js"></script> | |
fs
2016/08/16 12:43:07
I'd suggest adding a <title> ("<svg:image> 'auto'
Shanmuga Pandi
2016/08/19 07:20:28
Done.
| |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <svg height="0"> | |
5 <image width="100" height="100" xlink:href="resources/square-green-checker.png " /> | |
6 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="width:auto"/> | |
7 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="height:auto"/> | |
8 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="width:auto; height:auto"/> | |
9 <image width="200" height="200" | |
10 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>"/> | |
11 <image width="200" height="200" | |
12 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto; height:auto'/> | |
13 <image width="200" height="200" | |
14 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
15 <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
16 <image x="100" height="200" | |
17 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
18 <image y="100" width="200" | |
19 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='height:auto;'/> | |
20 <image width="200" height="200" | |
21 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
22 <image height="200" | |
23 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
24 <image width="200" | |
25 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
26 <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>"/> | |
27 </svg> | |
28 <script> | |
29 BBox = function(x,y,w,h) { | |
30 this.x = x; | |
31 this.y = y; | |
32 this.width = w; | |
33 this.height = h; | |
34 }; | |
35 BBox.prototype.toString = function() { | |
36 return this.x + "," + this.y + "," + this.width + "," + this.height; | |
37 }; | |
38 // The order of expected sizes should equal the document order of the images. | |
39 var expectedBoxes = [ | |
40 new BBox(0, 0, 100, 100), | |
fs
2016/08/16 12:43:08
Should probably add a description (string) as well
Shanmuga Pandi
2016/08/19 07:20:28
Done.
| |
41 new BBox(0, 0, 400, 100), | |
42 new BBox(0, 0, 100, 400), | |
43 new BBox(0, 0, 400, 400), | |
44 new BBox(0, 0, 200, 200), | |
45 new BBox(0, 0, 100, 100), | |
46 new BBox(0, 0, 100, 200), | |
47 new BBox(0, 0, 100, 100), | |
48 new BBox(100, 0, 100, 200), | |
49 new BBox(0, 100, 200, 100), | |
50 new BBox(0, 0, 300, 150), | |
51 new BBox(0, 0, 300, 150), | |
52 new BBox(0, 0, 300, 150), | |
53 new BBox(0, 0, 300, 150), | |
54 ]; | |
55 var images = document.getElementsByTagName('image'); | |
56 for (var i = 0, length = images.length; i < length; ++i) { | |
57 async_test(function(t) { | |
58 var image = images[i]; | |
59 image.expectedBox = expectedBoxes[i]; | |
60 image.onload = t.step_func_done(function() { | |
61 var rectBBox = image.getBBox(); | |
62 assert_equals(rectBBox.x, image.expectedBox.x); | |
63 assert_equals(rectBBox.y, image.expectedBox.y); | |
64 assert_equals(rectBBox.width, image.expectedBox.width); | |
65 assert_equals(rectBBox.height, image.expectedBox.height); | |
66 }); | |
67 }, 'Bounding box size ' + expectedBoxes[i]); | |
68 } | |
69 </script> | |
OLD | NEW |