image/test/mochitest/test_bug552605-1.html

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:f8dde279d185
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=552605
5 -->
6 <head>
7 <title>Test for Bug 552605</title>
8 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=552605">Mozilla Bug 552605</a>
15 <p id="display"></p>
16 <pre id="test">
17 <script type="application/javascript">
18
19 var first, second;
20
21 SimpleTest.waitForExplicitFinish();
22
23 function checkFirst()
24 {
25 var testimage = document.getElementById('test-image');
26 first = document.createElement('canvas')
27 var ctx = first.getContext('2d');
28 ctx.drawImage(testimage, 0, 0);
29
30 var newimg = new Image();
31 newimg.onload = checkSecond;
32 newimg.src = "bug552605.sjs";
33 document.body.appendChild(newimg);
34 }
35
36 function checkSecond()
37 {
38 var testimage = document.getElementById('test-image');
39 second = document.createElement('canvas')
40 var ctx = second.getContext('2d');
41 ctx.drawImage(testimage, 0, 0);
42
43 // Check that the images are the same, since they're in the same document.
44 [correct, val1, val2] = compareSnapshots(first, second, true);
45 ok(correct, "Image should be the same for all loads.");
46
47 SimpleTest.finish();
48 }
49
50 </script>
51 </pre>
52 <div id="content"> <!-- style="display: none" -->
53 <img src="bug552605.sjs" onload="checkFirst()" id="test-image"></iframe>
54 </div>
55 </body>
56 </html>

mercurial