| <!doctype html> |
| <html> |
| <head> |
| <title>pointerType conservation</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> |
| <script src="pointerevent_support.js"></script> |
| </head> |
| <body onload="run()"> |
| <h1>pointerType conservation</h1> |
| <h4>Test Description: This test checks if pointerType attribute defined properly.</h4> |
| <div id="instructions"> |
| Press and move a mouse button, touch contact or pen contact on the black rectangle. Only use one device per test run. |
| </div> |
| <p>Note: This test may be run with different pointer devices, however only one device should be used per test run. |
| <p> |
| <div id="target0"></div> |
| <script> |
| var eventTested = false; |
| var pointerTypeGot = false; |
| var pointerdown_event; |
| var detected_pointertypes = {}; |
| |
| setup({ explicit_done: true }); |
| |
| add_completion_callback(showPointerTypes); |
| |
| function run() { |
| var target0 = document.getElementById("target0"); |
| |
| on_event(target0, "pointerover", function(event) { |
| detected_pointertypes[ event.pointerType ] = true; |
| }); |
| |
| // The pointerType attribute of a pointermove event must have the same value as the pointerType attribute of the last pointerdown event with the same pointerId attribute. |
| // TA: 5.1 |
| on_event(target0, "pointerdown", function (event) { |
| pointerdown_event = event; |
| pointerTypeGot = true; |
| }); |
| |
| on_event(target0, "pointermove", function (event) { |
| if(pointerTypeGot == true) { |
| if(!eventTested) { |
| test(function() { |
| assert_equals(event.pointerId, pointerdown_event.pointerId, "pointer IDs are equal: "); |
| assert_equals(event.pointerType, pointerdown_event.pointerType, "pointerType of pointermove event matches pointerdown event: "); |
| }, "pointerType is dispatched properly"); |
| } |
| done(); |
| } |
| }); |
| } |
| </script> |
| <h1>Pointer Events pointerType conservation tests</h1> |
| <div id="complete-notice"> |
| <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> |
| <p>Refresh the page to run the tests again with a different pointer type.</p> |
| </div> |
| <div id="log"></div> |
| </body> |
| </html> |