OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <script src="../resources/input-modifiers.js"></script> | 3 <script src="../resources/input-modifiers.js"></script> |
4 <style> | 4 <style> |
5 div.box { | 5 div.box { |
6 margin: 10px; | 6 margin: 10px; |
7 padding: 50px; | 7 padding: 50px; |
8 float: left; | 8 float: left; |
9 } | 9 } |
10 </style> | 10 </style> |
(...skipping 22 matching lines...) Expand all Loading... |
33 "offsetX", | 33 "offsetX", |
34 "offsetY", | 34 "offsetY", |
35 "pageX", | 35 "pageX", |
36 "pageY", | 36 "pageY", |
37 "screenX", | 37 "screenX", |
38 "screenY", | 38 "screenY", |
39 "x", | 39 "x", |
40 "y", | 40 "y", |
41 "button", | 41 "button", |
42 "buttons", | 42 "buttons", |
| 43 "pressure", |
43 ]; | 44 ]; |
44 | 45 |
45 function init() { | 46 function init() { |
46 var targetDiv = document.getElementById("target"); | 47 var targetDiv = document.getElementById("target"); |
47 | 48 |
48 testEventList.forEach(function(eventName) { | 49 testEventList.forEach(function(eventName) { |
49 | 50 |
50 targetDiv.addEventListener(eventName, function(event) { | 51 targetDiv.addEventListener(eventName, function(event) { |
51 | 52 |
52 debug("Received " + event.type); | 53 debug("Received " + event.type); |
(...skipping 16 matching lines...) Expand all Loading... |
69 | 70 |
70 shouldBeEqualToNumber("lastPointerEvent.pointerId", 1); | 71 shouldBeEqualToNumber("lastPointerEvent.pointerId", 1); |
71 // TODO(crbug.com/557817): linux_chromium_rel_ng fails here, sets to e
mpty string. | 72 // TODO(crbug.com/557817): linux_chromium_rel_ng fails here, sets to e
mpty string. |
72 // shouldBeEqualToString("lastPointerEvent.pointerType", "mouse"); | 73 // shouldBeEqualToString("lastPointerEvent.pointerType", "mouse"); |
73 shouldBeTrue("lastPointerEvent.isPrimary"); | 74 shouldBeTrue("lastPointerEvent.isPrimary"); |
74 | 75 |
75 numericAttributes.forEach(function(attribute) { | 76 numericAttributes.forEach(function(attribute) { |
76 var expectedValue = eval("event." + attribute); | 77 var expectedValue = eval("event." + attribute); |
77 if (attribute == "button" && event.type != "mousedown" && event.type
!= "mouseup") | 78 if (attribute == "button" && event.type != "mousedown" && event.type
!= "mouseup") |
78 expectedValue = -1; | 79 expectedValue = -1; |
| 80 if (attribute == "pressure") { |
| 81 if (event.buttons == 0) |
| 82 expectedValue = 0.0; |
| 83 else |
| 84 expectedValue = 0.5; |
| 85 } |
79 shouldBeEqualToNumber("lastPointerEvent." + attribute, expectedValue
); | 86 shouldBeEqualToNumber("lastPointerEvent." + attribute, expectedValue
); |
80 }); | 87 }); |
81 | 88 |
82 } else { | 89 } else { |
83 | 90 |
84 forEachModifier(function(attr, modifierName) { | 91 forEachModifier(function(attr, modifierName) { |
85 var getModifierStateStr = ".getModifierState('" + modifierName + "')
;" | 92 var getModifierStateStr = ".getModifierState('" + modifierName + "')
;" |
86 if (eval("event" + getModifierStateStr)) | 93 if (eval("event" + getModifierStateStr)) |
87 shouldBeTrue("lastPointerEvent" + getModifierStateStr); | 94 shouldBeTrue("lastPointerEvent" + getModifierStateStr); |
88 else | 95 else |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 eventSender.mouseMoveTo(rect.left - 5, rect.top - 5); | 138 eventSender.mouseMoveTo(rect.left - 5, rect.top - 5); |
132 } | 139 } |
133 | 140 |
134 init(); | 141 init(); |
135 if (window.eventSender) | 142 if (window.eventSender) |
136 runTests(); | 143 runTests(); |
137 else | 144 else |
138 debug("This test requires eventSender"); | 145 debug("This test requires eventSender"); |
139 | 146 |
140 </script> | 147 </script> |
OLD | NEW |