OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Test <svg:image>'s sizing </title> | |
fs
2016/08/19 08:59:45
Drop "Test" and add 'auto', so maybe:
<svg:image>
Shanmuga Pandi
2016/09/14 09:20:16
Done.
| |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <svg height="0"> | |
6 <image width="100" height="100" xlink:href="resources/square-green-checker.png " /> | |
7 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="width:auto"/> | |
8 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="height:auto"/> | |
9 <image width="100" height="100" xlink:href="resources/square-green-checker.png " style="width:auto; height:auto"/> | |
10 <image width="200" height="200" | |
11 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>"/> | |
12 <image width="200" height="200" | |
13 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto; height:auto'/> | |
14 <image width="200" height="200" | |
15 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
16 <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
17 <image height="200" | |
18 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/> | |
19 <image width="200" | |
20 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='height:auto;'/> | |
21 <image width="200" height="200" | |
22 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
23 <image height="200" | |
24 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
25 <image width="200" | |
26 xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>" style='width:auto; height:auto'/> | |
27 <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'> </svg>"/> | |
fs
2016/08/19 08:59:45
Still missing tests with no intrinsic dimensions b
Shanmuga Pandi
2016/08/19 11:56:42
Could you please give one sample for that(no intri
fs
2016/08/19 12:01:31
<svg viewBox="0 0 400 200"></svg>
Shanmuga Pandi
2016/09/14 09:20:16
I have added more variation.
| |
28 </svg> | |
29 <script> | |
30 Dimension = function(w,h,desc) { | |
31 this.width = w; | |
32 this.height = h; | |
33 this.desc = desc; | |
34 }; | |
35 Dimension.prototype.toString = function() { | |
36 return this.width + "," + this.height; | |
37 }; | |
38 // The order of expected sizes should equal the document order of the images. | |
39 var expectedBoxes = [ | |
40 new Dimension(100, 100, "400x400 png image, with intrinsic width='100' height= '100'"), | |
fs
2016/08/19 08:59:45
You could probably drop the class, and just do:
{
Shanmuga Pandi
2016/09/14 09:20:16
Done.
| |
41 new Dimension(400, 100, "400x400 png image, with intrinsic width='100' height= '100', and with CSS 'width:auto'"), | |
42 new Dimension(100, 400, "400x400 png image, with intrinsic width='100' height= '100', and with CSS 'height:auto'"), | |
43 new Dimension(400, 400, "400x400 png image, with intrinsic width='100' height= '100', and with CSS 'width:auto; height:auto'"), | |
44 new Dimension(200, 200, "default sized svg image, with intrinsic width='200' h eight='200'"), | |
45 new Dimension(100, 100, "100x100 svg image, with intrinsic width='200' height= '200', and with CSS 'width:auto; height:auto'"), | |
46 new Dimension(100, 200, "100x100 svg image, with intrinsic width='200' height= '200', and with CSS 'width:auto'"), | |
47 new Dimension(100, 100, "100x100 svg image, without intrinsic width and height , and with CSS 'width:auto'"), | |
48 new Dimension(100, 200, "100x100 svg image, with intrinsic height='200', and w ith 'width:auto'"), | |
49 new Dimension(200, 100, "100x100 svg image, with intrinsic width='200', and wi th CSS height:auto"), | |
50 new Dimension(300, 150, "default sized svg image, with intrinsic width='200' h eight='200', and with CSS 'width:auto; height:auto'"), | |
51 new Dimension(300, 150, "default sized svg image, with intrinsic height, and w ith CSS 'width:auto; height:auto'"), | |
52 new Dimension(300, 150, "default sized svg image, with intrinsic width, and wi th CSS 'width:auto; height:auto'"), | |
53 new Dimension(300, 150, "default sized svg image, without intrinsic width and height, no css width/height specified"), | |
fs
2016/08/19 08:59:45
None these four have any intrinsic dimension. Actu
Shanmuga Pandi
2016/08/19 11:56:42
'specified <something>' could be correct ?
fs
2016/08/19 12:01:31
Maybe explicitly say "attributes width='..."' ..."
Shanmuga Pandi
2016/09/14 09:20:16
Done.
| |
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.width, image.expectedBox.width); | |
63 assert_equals(rectBBox.height, image.expectedBox.height); | |
64 }); | |
65 }, document.title + ' with ' + expectedBoxes[i].desc + ' and box size shoul d be ' + expectedBoxes[i]); | |
66 } | |
67 </script> | |
OLD | NEW |