image/test/mochitest/test_bug552605-2.html

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:6c4c0b4c6c82
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 count = 0;
20
21 SimpleTest.waitForExplicitFinish();
22
23 function check()
24 {
25 count++;
26 if (count != 2)
27 return;
28
29 var image1 = document.getElementById('test-image1');
30 var image2 = document.getElementById('test-image2');
31 var first = document.createElement('canvas')
32 var ctx = first.getContext('2d');
33 ctx.drawImage(image1, 0, 0);
34
35 var second = document.createElement('canvas');
36 ctx = second.getContext('2d');
37 ctx.drawImage(image2, 0, 0);
38
39 // Check that the images are the same, since they're in the same document.
40 [correct, val1, val2] = compareSnapshots(first, second, true);
41 ok(correct, "Image should be the same for all loads.");
42
43 SimpleTest.finish();
44 }
45
46 </script>
47 </pre>
48 <div id="content"> <!-- style="display: none" -->
49 <img src="bug552605.sjs" onload="check()" id="test-image1"></iframe>
50 <img src="bug552605.sjs" onload="check()" id="test-image2"></iframe>
51 </div>
52 </body>
53 </html>

mercurial