Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerevent_constructor.html

Issue 2587393004: Add tangentialPressure and twist properties to PointerEvent on Mac (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
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; 33 var testButton = 0;
34 var testButtons = 1; 34 var testButtons = 1;
35 var testPressure = 0.4; 35 var testPressure = 0.4;
36 var testTangentialPressure = 0.5;
37 var testTwist = 286;
36 var testIsPrimary = true; 38 var testIsPrimary = true;
37 39
38 on_event(target0, "pointerover", this.step_func(function(event) { 40 on_event(target0, "pointerover", this.step_func(function(event) {
39 detected_pointertypes[ event.pointerType ] = true; 41 detected_pointertypes[ event.pointerType ] = true;
40 generate_tests(assert_equals, [ 42 generate_tests(assert_equals, [
41 ["custom bubbles", event.bubbles, testBubbles], 43 ["custom bubbles", event.bubbles, testBubbles],
42 ["custom cancelable", event.cancelable, testCancelable], 44 ["custom cancelable", event.cancelable, testCancelable],
43 ["custom pointerId", event.pointerId, testPointerId], 45 ["custom pointerId", event.pointerId, testPointerId],
44 ["custom pointerType", event.pointerType, testPointerType], 46 ["custom pointerType", event.pointerType, testPointerType],
45 ["custom button", event.button, testButton], 47 ["custom button", event.button, testButton],
46 ["custom buttons", event.buttons, testButtons], 48 ["custom buttons", event.buttons, testButtons],
47 ["custom width", event.width, testWidth], 49 ["custom width", event.width, testWidth],
48 ["custom height", event.height, testHeight], 50 ["custom height", event.height, testHeight],
49 ["custom clientX", event.clientX, testClientX], 51 ["custom clientX", event.clientX, testClientX],
50 ["custom clientY", event.clientY, testClientY], 52 ["custom clientY", event.clientY, testClientY],
51 ["custom tiltX", event.tiltX, testTiltX], 53 ["custom tiltX", event.tiltX, testTiltX],
52 ["custom tiltY", event.tiltY, testTiltY], 54 ["custom tiltY", event.tiltY, testTiltY],
55 ["custom twist", event.twist, testTwist],
53 ["custom isPrimary", event.isPrimary, testIsPrimary] 56 ["custom isPrimary", event.isPrimary, testIsPrimary]
54 ]); 57 ]);
55 test(function() { 58 test(function() {
56 assert_approx_equals(event.pressure, testPressure, 0.0000000 1, "custom pressure: "); 59 assert_approx_equals(event.pressure, testPressure, 0.0000000 1, "custom pressure: ");
60 assert_approx_equals(event.tangentialPressure, testTangentia lPressure, 0.00000001, "custom tangential pressure: ");
57 }, "custom pressure: "); 61 }, "custom pressure: ");
58 })); 62 }));
59 63
60 on_event(target0, "pointerout", this.step_func(function(event) { 64 on_event(target0, "pointerout", this.step_func(function(event) {
61 generate_tests(assert_equals, [ 65 generate_tests(assert_equals, [
62 ["default pointerId", event.pointerId, 0], 66 ["default pointerId", event.pointerId, 0],
63 ["default pointerType", event.pointerType, ""], 67 ["default pointerType", event.pointerType, ""],
64 ["default width", event.width, 1], 68 ["default width", event.width, 1],
65 ["default height", event.height, 1], 69 ["default height", event.height, 1],
66 ["default tiltX", event.tiltX, 0], 70 ["default tiltX", event.tiltX, 0],
67 ["default tiltY", event.tiltY, 0], 71 ["default tiltY", event.tiltY, 0],
68 ["default pressure", event.pressure, 0], 72 ["default pressure", event.pressure, 0],
73 ["default tangentialPressure", event.tangentialPressure, 0],
74 ["default twist", event.twist, 0],
69 ["default isPrimary", event.isPrimary, false] 75 ["default isPrimary", event.isPrimary, false]
70 ]); 76 ]);
71 })); 77 }));
72 78
73 on_event(window, "load", this.step_func_done(function() { 79 on_event(window, "load", this.step_func_done(function() {
74 assert_not_equals(window.PointerEvent, undefined); 80 assert_not_equals(window.PointerEvent, undefined);
75 81
76 var pointerEventCustom = new PointerEvent("pointerover", 82 var pointerEventCustom = new PointerEvent("pointerover",
77 {bubbles: testBubbles, 83 {bubbles: testBubbles,
78 cancelable: testCancelable, 84 cancelable: testCancelable,
79 pointerId: testPointerId, 85 pointerId: testPointerId,
80 pointerType: testPointerType, 86 pointerType: testPointerType,
81 width: testWidth, 87 width: testWidth,
82 height: testHeight, 88 height: testHeight,
83 clientX: testClientX, 89 clientX: testClientX,
84 clientY: testClientY, 90 clientY: testClientY,
85 tiltX: testTiltX, 91 tiltX: testTiltX,
86 tiltY: testTiltY, 92 tiltY: testTiltY,
87 button: testButton, 93 button: testButton,
88 buttons: testButtons, 94 buttons: testButtons,
89 pressure: testPressure, 95 pressure: testPressure,
96 tangentialPressure: testTangentialPressure,
97 twist: testTwist,
90 isPrimary: testIsPrimary 98 isPrimary: testIsPrimary
91 }); 99 });
92 // A PointerEvent created with a PointerEvent constructor must h ave all its attributes set to the corresponding values provided to the construct or. 100 // A PointerEvent created with a PointerEvent constructor must h ave all its attributes set to the corresponding values provided to the construct or.
93 // For attributes where values are not provided to the construct or, the corresponding default values must be used. 101 // For attributes where values are not provided to the construct or, the corresponding default values must be used.
94 // TA: 12.1 102 // TA: 12.1
95 target0.dispatchEvent(pointerEventCustom); 103 target0.dispatchEvent(pointerEventCustom);
96 var pointerEventDefault = new PointerEvent("pointerout"); 104 var pointerEventDefault = new PointerEvent("pointerout");
97 target0.dispatchEvent(pointerEventDefault); 105 target0.dispatchEvent(pointerEventDefault);
98 }, "PointerEvent constructor")); 106 }, "PointerEvent constructor"));
99 }) 107 })
100 </script> 108 </script>
101 <div id="complete-notice"> 109 <div id="complete-notice">
102 <p>The following pointer types were detected: <span id="pointertype-log"></s pan>.</p> 110 <p>The following pointer types were detected: <span id="pointertype-log"></s pan>.</p>
103 </div> 111 </div>
104 <div id="log"></div> 112 <div id="log"></div>
105 </body> 113 </body>
106 </html> 114 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698