tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / svg / as-object / embedded-svg-size-changes.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body style="margin: 0px">
7
8 <script type="text/javascript">
9     function test1() {
10         debug("Check initial &lt;object&gt; size, before external resource loaded");
11
12         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "300px");
13         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "150px");
14     }
15
16     function test2() {
17         debug("");
18         debug("Check initial &lt;object&gt; size, after external resource loaded");
19         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "200px");
20         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
21
22         var svgDoc = object1.getSVGDocument();
23         var svgWindow = svgDoc.defaultView;
24         svgWindow.changeSize();
25         test3();
26     }
27
28     function test3() {
29         debug("");
30         debug("Check final &lt;object&gt; size, after resizing finished");
31         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
32         shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");
33
34         debug("");
35         debug("Test passed if you see two green rectangles");
36
37         completeTest();
38     }
39
40     function completeTest() {
41         var script = document.createElement("script");
42
43         script.onload = function() {
44             if (window.layoutTestController)
45                 layoutTestController.notifyDone();
46         };
47
48         script.src = "../../fast/js/resources/js-test-post.js";
49         document.body.appendChild(script);
50     }
51 </script>
52
53 <object style="border: 1px red solid" onload="test2()" data="resources/embedded-svg-size-changes.svg"></object>
54 <p id="description"></p>
55 <div id="console"></div>
56
57 <script>
58     if (window.layoutTestController)
59         layoutTestController.waitUntilDone();
60     var object1 = document.getElementsByTagName("object")[0];
61     description("This test checks that intrinsic size changes of an embedded SVG cause immediate updates of the object that embeds it.");
62     test1();
63 </script>
64 </body>
65 </html>