File: test_bug558663.html

package info (click to toggle)
wine-gecko-2.24 2.24%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 740,092 kB
  • ctags: 688,789
  • sloc: cpp: 3,160,639; ansic: 1,619,153; python: 164,084; java: 128,022; asm: 114,527; xml: 69,863; sh: 55,281; makefile: 49,648; perl: 20,454; objc: 2,344; yacc: 2,066; pascal: 995; lex: 982; exp: 449; php: 244; lisp: 228; awk: 211; sed: 61; csh: 21; ada: 16; ruby: 3
file content (101 lines) | stat: -rw-r--r-- 3,826 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=558663
-->
<head>
  <title>Test for Bug 558663</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=558663">Mozilla Bug 514127</a></p>

 <!-- 20x20 of red -->
<iframe id="iframe" src="data:text/html,<img id='image' border='0' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC'>"></iframe>

<pre id="test">
<script type="application/javascript">

/** Test for Bug 558663 **/

SimpleTest.waitForExplicitFinish();
window.addEventListener("load", runTest, false);

function checkSnapshots(s1, s2, shouldBeEqual, testName) {
  var res = compareSnapshots(s1, s2, shouldBeEqual);
  if (res[0]) {
    ok(true, testName + " snapshots compare correctly");
  } else {
    ok(false, testName + " snapshots compare incorrectly. snapshot 1: " +
              res[1] + " snapshot 2: " + res[2]); 
  }
}

function runTest() {
  document.getElementById("iframe").contentWindow.document.designMode = "on";

  // The editor requires the event loop to spin after you turn on design mode
  // before it takes effect.
  setTimeout(continueTest, 100);
}

function continueTest() {
  var win = document.getElementById("iframe").contentWindow;
  var doc = win.document;
  var image = doc.getElementById("image");

  // We want to test that clicking on the image and then clicking on one of the
  // draggers doesn't make the draggers disappear.

  // clean snapshot
  var before = snapshotWindow(win);

  // click to get the draggers
  synthesizeMouse(image, 1, 1, {type: "mousedown"}, win);
  synthesizeMouse(image, 1, 1, {type: "mouseup"}, win);

  // mouse over a dragger will change its color, so move the mouse away
  synthesizeMouse(doc.documentElement, 50, 50, {type: "mousemove"}, win);

  // snapshot with hopefully draggers
  var middle = snapshotWindow(win);

  // clicking on the top left dragger shouldn't change anything
  synthesizeMouse(image, 1, 1, {type: "mousedown"}, win);
  synthesizeMouse(image, 1, 1, {type: "mouseup"}, win);

  // mouse over a dragger will change its color, so move the mouse away
  synthesizeMouse(doc.documentElement, 50, 50, {type: "mousemove"}, win);

  // snapshot with hopefully draggers again
  var middle2 = snapshotWindow(win);

  // click outside the image (but inside the document) to unselect it
  synthesizeMouse(doc.documentElement, 50, 50, {type: "mousedown"}, win);
  synthesizeMouse(doc.documentElement, 50, 50, {type: "mouseup"}, win);

  // and then click outside the document so we don't draw a caret
  synthesizeMouse(document.documentElement, 1, 1, {type: "mousedown"}, window);
  synthesizeMouse(document.documentElement, 1, 1, {type: "mouseup"}, window);

  // hopefully clean snapshot
  var end = snapshotWindow(win);

  // before == end && middle == middle2 && before/end != middle/middle2
  checkSnapshots(before, end, true, "before and after should be the same")
  checkSnapshots(middle, middle2, true, "middle two should be the same");
  checkSnapshots(before, middle, false, "before and middle should not be the same");
  checkSnapshots(before, middle2, false, "before and middle2 should not be the same");
  checkSnapshots(middle, end, false, "middle and end should not be the same");
  checkSnapshots(middle2, end, false, "middle2 and end should not be the same");

  SimpleTest.finish();
}

</script>
</pre>
</body>
</html>