pointerevent_pointerout_pen-manual.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>pointerout</title>
  5. <meta name="viewport" content="width=device-width">
  6. <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
  7. <script src="/resources/testharness.js"></script>
  8. <!--script src="/resources/testharnessreport.js"></script-->
  9. <!-- Additional helper script for common checks across event types -->
  10. <script type="text/javascript" src="pointerevent_support.js"></script>
  11. <script type="text/javascript" src="mochitest_support_internal.js"></script>
  12. </head>
  13. <body onload="run()">
  14. <h2>pointerout</h2>
  15. <h4>Test Description: This test checks if pointerout event triggers for pen. Place your pen over the black rectangle and then pull the pen out of the digitizer's detectable range. </h4>
  16. <p>Note: this test is for devices that support hover - for pen only</p>
  17. <div id="target0"></div>
  18. <script>
  19. var test_pointerout = async_test("pointerout event received");
  20. // showPointerTypes is defined in pointerevent_support.js
  21. // Requirements: the callback function will reference the test_pointerEvent object and
  22. // will fail unless the async_test is created with the var name "test_pointerEvent".
  23. add_completion_callback(showPointerTypes);
  24. var eventTested = false;
  25. var isPointerupReceived = false;
  26. var detected_pointertypes = {};
  27. function run() {
  28. var target0 = document.getElementById("target0");
  29. // When a pen stylus leaves the hover range detectable by the digitizer the pointerout event must be dispatched.
  30. // TA: 7.2
  31. on_event(target0, "pointerout", function (event) {
  32. detected_pointertypes[event.pointerType] = true;
  33. if(event.pointerType == 'pen') {
  34. if (eventTested == false) {
  35. eventTested = true;
  36. test_pointerout.done();
  37. }
  38. }
  39. else {
  40. test_pointerout.step(function() {
  41. assert_true(false,
  42. "you have to use pen for this test");
  43. }, "you have to use pen for this test");
  44. }
  45. });
  46. }
  47. </script>
  48. <h1>Pointer Events pointerout tests</h1>
  49. <div id="complete-notice">
  50. <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
  51. </div>
  52. <div id="log"></div>
  53. </body>
  54. </html>