-
Notifications
You must be signed in to change notification settings - Fork 54
/
pointerevent_pointerrawmove_in_pointerlock-manual.html
88 lines (81 loc) · 4.63 KB
/
pointerevent_pointerrawmove_in_pointerlock-manual.html
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
<!doctype html>
<html>
<head>
<title>pointerrawmove</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="../pointerevent_styles.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Additional helper script for common checks across event types -->
<script type="text/javascript" src="../pointerevent_support.js"></script>
</head>
<body onload="run()">
<h2>pointerrawmove</h2>
<h4>Test Description: This test checks if pointerrawmove is dispatched correctly while in pointerlock mode.
<ol>
<li>Click in the black box (and accept the pointerlock permission if asked).</li>
<li>Move your mouse.</li>
<li>Click in the purple box inside the iframe</li>
<li>Move your mouse.</li>
</ol>
</h4>
<div id="target0"></div>
<iframe id="innerframe" src="../resources/pointerevent_pointerrawmove_in_pointerlock-iframe.html"></iframe>
<script>
window.name="outerframe";
var test_pointerrawmove = async_test("pointerrawmove event received");
var outerframe_pointerrawmoveReceived = false;
var innerframe_pointerrawmoveReceived = false;
function run() {
var target0 = document.getElementById("target0");
var innerframe = document.getElementById('innerframe');
var target1 = innerframe.contentDocument.getElementById('target1');
innerframe.contentWindow.name = "innerframe";
on_event(document, "pointerlockchange", function(event) {
if (document.pointerLockElement == target0) {
on_event(target0, "pointerrawmove", function (event) {
outerframe_pointerrawmoveReceived = true;
test_pointerrawmove.step(function() {
assert_equals(event.view.name, "outerframe", "View attribute of pointerrawmove should be the target frame.");
}, "View attribute of pointerrawmove should be the target frame.");
});
on_event(target0, "pointermove", function (event) {
test_pointerrawmove.step(function() {
assert_true(outerframe_pointerrawmoveReceived,
"Pointerrawmove event should have been received before pointermove while in pointerlock mode.");
assert_equals(event.view.name, "outerframe", "View attribute of pointerrawmove should be the target frame.");
}, "Pointerrawmove event should have been received before pointermove while in pointerlock mode.");
document.exitPointerLock();
on_event(target1, "click", function(event) {
target1.requestPointerLock();
});
on_event(innerframe.contentDocument, "pointerlockchange", function(event) {
if (innerframe.contentDocument.pointerLockElement == target1) {
on_event(target1, "pointerrawmove", function (event) {
innerframe_pointerrawmoveReceived = true;
test_pointerrawmove.step(function() {
assert_equals(event.view.name, "innerframe", "View attribute of pointerrawmove should be the target frame.");
}, "View attribute of pointerrawmove should be the target frame.");
});
on_event(target1, "pointermove", function (event) {
test_pointerrawmove.step(function() {
assert_true(innerframe_pointerrawmoveReceived,
"Pointerrawmove event should have been received before pointermove while in pointerlock mode.");
}, "Pointerrawmove event should have been received before pointermove while in pointerlock mode.");
innerframe.contentDocument.exitPointerLock();
test_pointerrawmove.done();
});
}
});
});
}
});
on_event(target0, "click", function(event) {
target0.requestPointerLock();
});
}
</script>
<div id="complete-notice">
</div>
</body>
</html>