summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html')
-rw-r--r--testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html124
1 files changed, 124 insertions, 0 deletions
diff --git a/testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html b/testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html
new file mode 100644
index 000000000..1e8fc1f53
--- /dev/null
+++ b/testing/web-platform/tests/pointerlock/movementX_Y_basic-manual.html
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name='flags' content='interact'>
+<meta name="timeout" content="long">
+<style type="text/css">
+ #status-log {
+ margin: 10px 0;
+ color: green;
+ color: green;
+ }
+</style>
+</head>
+<body>
+ <h2>Description</h2>
+ <p>This test if movementX/Y can provide the change in position of the pointer, as if movementX/Y = eNow.screenX/Y-ePrevious.screenX/Y</p>
+ <hr/>
+
+ <h2>Manual Test Steps:</h2>
+ <p>
+ <ol>
+ <li>Click to start Test1.</li>
+ <li>Move the mouse within the window, slow and fast, like a scribble.</li>
+ <li>Click again to end test.</li>
+ </ol>
+ </p>
+ <hr/>
+
+ <div id="status-log">Waiting... Click to start loging.</div>
+ <div class="data-log">
+ <table>
+ <tr><td></td><td>X</td><td>Y</td></tr>
+ <tr><td>client_init:</td><td id="clientX_init-log">X</td><td id="clientY_init-log">Y</td></tr>
+ <tr><td>client_last:</td><td id="clientX_last-log">X</td><td id="clientY_last-log">Y</td></tr>
+ <tr><td>client_delta:</td><td id="clientX_delta-log">X</td><td id="clientY_delta-log">Y</td></tr>
+ <tr><td>movement_sum:</td><td id="movementX_sum-log">X</td><td id="movementY_sum-log">Y</td></tr>
+ <tr><td>movement:</td><td id="movementX-log">X</td><td id="movementY-log">Y</td></tr>
+ </table>
+ </div>
+ <hr/>
+
+ <div id="log"></div>
+
+ <script type="text/javascript" >
+ var status_log = document.querySelector('#status-log'),
+ movementX_log = document.querySelector('#movementX-log'),
+ movementY_log = document.querySelector('#movementY-log'),
+ movementX_sum_log = document.querySelector('#movementX_sum-log'),
+ movementY_sum_log = document.querySelector('#movementY_sum-log'),
+ clientX_init_log = document.querySelector('#clientX_init-log'),
+ clientY_init_log = document.querySelector('#clientY_init-log'),
+ clientX_last_log = document.querySelector('#clientX_last-log'),
+ clientY_last_log = document.querySelector('#clientY_last-log');
+ clientX_delta_log = document.querySelector('#clientX_delta-log'),
+ clientY_delta_log = document.querySelector('#clientY_delta-log');
+
+ var click_counter = 0;
+
+ var clientX_init, clientY_init, movementX, movementY, movementX_sum, movementY_sum, clientX_last, clientY_last;
+
+ var movementX_Y_inside_window_Test = async_test("Test that movementX/Y = eNow.screenX/Y-ePrevious.screenX/Y.");
+
+ document.addEventListener("click", function (e) {
+ click_counter++;
+
+ switch(click_counter) {
+ case 1:
+ status_log.innerHTML = "inside window: logging...";
+ break;
+ case 2:
+ status_log.innerHTML = "inside window: done";
+
+ // approximately(+/- 10)
+ // a little drift should be tollerated
+ movementX_Y_inside_window_Test.step(function() {
+ assert_equals(movementX_sum, clientX_last - clientX_init, "sum of movementX = clientX_init - clientX_last");
+ assert_equals(movementY_sum, clientY_last - clientY_init, "sum of movementY = clientY_init - clientY_last");
+ });
+ movementX_Y_inside_window_Test.done();
+ break;
+ }
+ });
+
+ document.addEventListener("mousemove", function (e) {
+ movementX = e.movementX;
+ movementY = e.movementY;
+
+ if(click_counter === 1) {
+ if(!clientX_init) {
+ clientX_init = e.clientX;
+ clientY_init = e.clientY;
+ movementX_sum = movementX;
+ movementY_sum = movementY;
+ }
+
+ movementX_sum += movementX;
+ movementY_sum += movementY;
+
+ clientX_last = e.clientX;
+ clientY_last = e.clientY;
+ clientX_delta = clientX_last - clientX_init;
+ clientY_delta = clientY_last - clientY_init;
+
+ updateData();
+ }
+ });
+
+ function updateData() {
+ clientX_init_log.innerHTML = clientX_init;
+ clientY_init_log.innerHTML = clientY_init;
+ clientX_last_log.innerHTML = clientX_last;
+ clientY_last_log.innerHTML = clientY_last;
+ clientX_delta_log.innerHTML = clientX_delta;
+ clientY_delta_log.innerHTML = clientY_delta;
+ movementX_log.innerHTML = movementX;
+ movementY_log.innerHTML = movementY;
+ movementX_sum_log.innerHTML = movementX_sum;
+ movementY_sum_log.innerHTML = movementY_sum;
+ }
+ </script>
+ </body>
+</html>