Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Mouse Events with button depressed</title> | |
| 5 <meta name="viewport" content="width=device-width"> | |
| 6 <script src="/resources/testharness.js"></script> | |
| 7 <script src="/resources/testharnessreport.js"></script> | |
| 8 <style> | |
| 9 div.box { | |
| 10 border: 2px solid lightgray; | |
| 11 margin: 25px; | |
| 12 padding: 25px; | |
| 13 float: left; | |
| 14 } | |
| 15 #lightyellow { | |
| 16 background-color: lightyellow; | |
| 17 } | |
| 18 #lightblue { | |
| 19 background-color: lightblue; | |
| 20 } | |
| 21 #lightgreen { | |
| 22 background-color: lightgreen; | |
| 23 } | |
| 24 </style> | |
| 25 </head> | |
| 26 <body onload="run()"> | |
| 27 <h2>Mouse Events</h2> | |
| 28 <h4>Test Description: This test checks if mouse events set button proper ty correctly | |
| 29 <ol> | |
| 30 <li>Put your mouse over the green rectangle</li> | |
| 31 <li>Press a non-primary button and hold it</li> | |
|
Navid Zolghadr
2017/04/25 15:45:08
nit: Since you are asking for any non-primary butt
dtapuska
2017/04/25 17:38:43
Done.
| |
| 32 <li>Drag mouse to blue rectangle</li> | |
| 33 <li>Release mouse button</li> | |
| 34 </ol> | |
| 35 </h4> | |
| 36 <div class="box" id="lightyellow"> | |
| 37 <div class="box" id="lightgreen"></div> | |
| 38 <div class="box" id="lightblue"></div> | |
| 39 </div> | |
| 40 <script> | |
| 41 var test = async_test("mouse events fired without button state"); | |
| 42 | |
| 43 var button = -1; | |
| 44 | |
| 45 function run() { | |
| 46 var lightgreen = document.getElementById("lightgreen"); | |
| 47 var lightyellow = document.getElementById("lightyellow"); | |
| 48 var lightblue = document.getElementById("lightblue"); | |
| 49 | |
| 50 on_event(lightgreen, "mousedown", function (event) { | |
| 51 test.step(function() {assert_true(button === -1, "There must only be one mouse down event.");}); | |
| 52 test.step(function() {assert_true(event.button != 0, "Must n ot be primary button.");}); | |
| 53 button = event.button; | |
| 54 }); | |
| 55 on_event(lightgreen, "click", function (event) { | |
|
Navid Zolghadr
2017/04/25 15:45:09
nit: Although our current implementation sends the
dtapuska
2017/04/25 17:38:43
Done.
| |
| 56 test.step(function() {assert_true(event.button === button, " Button must be the same as mousedown.");}); | |
| 57 }); | |
| 58 on_event(lightyellow, "mousemove", function (event) { | |
| 59 if (button != -1) { | |
| 60 test.step(function() {assert_true(event.button === 0, "B utton must be un-initialized for mousemove.");}); | |
| 61 } | |
| 62 }); | |
| 63 on_event(lightgreen, "mouseleave", function (event) { | |
| 64 if (button != -1) { | |
| 65 test.step(function() {assert_true(event.button === 0, "B utton must be un-initialized for mouseleave.");}); | |
| 66 } | |
| 67 }); | |
| 68 on_event(lightblue, "mouseenter", function (event) { | |
| 69 if (button != -1) { | |
| 70 test.step(function() {assert_true(event.button === 0, "B utton must be un-initialized for mouseenter.");}); | |
| 71 } | |
| 72 }); | |
| 73 on_event(lightblue, "mouseup", function (event) { | |
| 74 if (button != -1) { | |
| 75 test.step(function() {assert_true(event.button === butto n, "Button must be the same as mousedown.");}); | |
| 76 test.done(); | |
| 77 } | |
| 78 }); | |
| 79 } | |
| 80 </script> | |
| 81 </body> | |
| 82 </html> | |
| OLD | NEW |