OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>PointerEvent: Constructor test</title> | 4 <title>PointerEvent: Constructor test</title> |
5 <meta name="viewport" content="width=device-width"> | 5 <meta name="viewport" content="width=device-width"> |
6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
9 <!-- Additional helper script for common checks across event types --> | 9 <!-- Additional helper script for common checks across event types --> |
10 <script type="text/javascript" src="pointerevent_support.js"></script> | 10 <script type="text/javascript" src="pointerevent_support.js"></script> |
(...skipping 12 matching lines...) Expand all Loading... |
23 var testBubbles = true; | 23 var testBubbles = true; |
24 var testCancelable = true; | 24 var testCancelable = true; |
25 var testPointerId = 42; | 25 var testPointerId = 42; |
26 var testPointerType = 'pen'; | 26 var testPointerType = 'pen'; |
27 var testClientX = 300; | 27 var testClientX = 300; |
28 var testClientY = 500; | 28 var testClientY = 500; |
29 var testWidth = 3; | 29 var testWidth = 3; |
30 var testHeight = 5; | 30 var testHeight = 5; |
31 var testTiltX = -45; | 31 var testTiltX = -45; |
32 var testTiltY = 30; | 32 var testTiltY = 30; |
| 33 var testButton = 0; |
| 34 var testButtons = 1; |
33 var testPressure = 0.4; | 35 var testPressure = 0.4; |
34 var testIsPrimary = true; | 36 var testIsPrimary = true; |
35 | 37 |
36 on_event(target0, "pointerover", this.step_func(function(event) { | 38 on_event(target0, "pointerover", this.step_func(function(event) { |
37 detected_pointertypes[ event.pointerType ] = true; | 39 detected_pointertypes[ event.pointerType ] = true; |
38 generate_tests(assert_equals, [ | 40 generate_tests(assert_equals, [ |
39 ["custom bubbles", event.bubbles, testBubbles], | 41 ["custom bubbles", event.bubbles, testBubbles], |
40 ["custom cancelable", event.cancelable, testCancelable], | 42 ["custom cancelable", event.cancelable, testCancelable], |
41 ["custom pointerId", event.pointerId, testPointerId], | 43 ["custom pointerId", event.pointerId, testPointerId], |
42 ["custom pointerType", event.pointerType, testPointerType], | 44 ["custom pointerType", event.pointerType, testPointerType], |
| 45 ["custom button", event.button, testButton], |
| 46 ["custom buttons", event.buttons, testButtons], |
43 ["custom width", event.width, testWidth], | 47 ["custom width", event.width, testWidth], |
44 ["custom height", event.height, testHeight], | 48 ["custom height", event.height, testHeight], |
45 ["custom clientX", event.clientX, testClientX], | 49 ["custom clientX", event.clientX, testClientX], |
46 ["custom clientY", event.clientY, testClientY], | 50 ["custom clientY", event.clientY, testClientY], |
47 ["custom tiltX", event.tiltX, testTiltX], | 51 ["custom tiltX", event.tiltX, testTiltX], |
48 ["custom tiltY", event.tiltY, testTiltY], | 52 ["custom tiltY", event.tiltY, testTiltY], |
49 ["custom isPrimary", event.isPrimary, testIsPrimary] | 53 ["custom isPrimary", event.isPrimary, testIsPrimary] |
50 ]); | 54 ]); |
51 test(function() { | 55 test(function() { |
52 assert_approx_equals(event.pressure, testPressure, 0.0000000
1, "custom pressure: "); | 56 assert_approx_equals(event.pressure, testPressure, 0.0000000
1, "custom pressure: "); |
(...skipping 20 matching lines...) Expand all Loading... |
73 {bubbles: testBubbles, | 77 {bubbles: testBubbles, |
74 cancelable: testCancelable, | 78 cancelable: testCancelable, |
75 pointerId: testPointerId, | 79 pointerId: testPointerId, |
76 pointerType: testPointerType, | 80 pointerType: testPointerType, |
77 width: testWidth, | 81 width: testWidth, |
78 height: testHeight, | 82 height: testHeight, |
79 clientX: testClientX, | 83 clientX: testClientX, |
80 clientY: testClientY, | 84 clientY: testClientY, |
81 tiltX: testTiltX, | 85 tiltX: testTiltX, |
82 tiltY: testTiltY, | 86 tiltY: testTiltY, |
| 87 button: testButton, |
| 88 buttons: testButtons, |
83 pressure: testPressure, | 89 pressure: testPressure, |
84 isPrimary: testIsPrimary | 90 isPrimary: testIsPrimary |
85 }); | 91 }); |
86 // A PointerEvent created with a PointerEvent constructor must h
ave all its attributes set to the corresponding values provided to the construct
or. | 92 // A PointerEvent created with a PointerEvent constructor must h
ave all its attributes set to the corresponding values provided to the construct
or. |
87 // For attributes where values are not provided to the construct
or, the corresponding default values must be used. | 93 // For attributes where values are not provided to the construct
or, the corresponding default values must be used. |
88 // TA: 12.1 | 94 // TA: 12.1 |
89 target0.dispatchEvent(pointerEventCustom); | 95 target0.dispatchEvent(pointerEventCustom); |
90 var pointerEventDefault = new PointerEvent("pointerout"); | 96 var pointerEventDefault = new PointerEvent("pointerout"); |
91 target0.dispatchEvent(pointerEventDefault); | 97 target0.dispatchEvent(pointerEventDefault); |
92 }, "PointerEvent constructor")); | 98 }, "PointerEvent constructor")); |
93 }) | 99 }) |
94 </script> | 100 </script> |
95 <div id="complete-notice"> | 101 <div id="complete-notice"> |
96 <p>The following pointer types were detected: <span id="pointertype-log"></s
pan>.</p> | 102 <p>The following pointer types were detected: <span id="pointertype-log"></s
pan>.</p> |
97 </div> | 103 </div> |
98 <div id="log"></div> | 104 <div id="log"></div> |
99 </body> | 105 </body> |
100 </html> | 106 </html> |
OLD | NEW |