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 <style> | 3 <style> |
4 #spacer { | 4 #spacer { |
5 height: 1000px; | 5 height: 1000px; |
6 width: 1000px; | 6 width: 1000px; |
7 } | 7 } |
8 iframe { | 8 iframe { |
9 width: 100px; | 9 width: 100px; |
10 height: 100px; | 10 height: 100px; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 document.addEventListener('touchstart', onTouchStart); | 64 document.addEventListener('touchstart', onTouchStart); |
65 var floatPrecision = 0.00001; | 65 var floatPrecision = 0.00001; |
66 | 66 |
67 function runTest() { | 67 function runTest() { |
68 if (!eventSender) { | 68 if (!eventSender) { |
69 debug('This test requires eventSender.'); | 69 debug('This test requires eventSender.'); |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 debug('Testing simple fractional touch'); | 73 debug('Testing simple fractional touch'); |
74 eventSender.addTouchPoint(30.33, 4.5); | 74 eventSender.addTouchPoint(30.33, 4.5, 5.2, 6.3); |
75 if (eventSender.setTouchPointRadius) | |
76 eventSender.setTouchPointRadius(0, 5.2, 6.3, false); | |
77 eventSender.touchStart(); | 75 eventSender.touchStart(); |
78 if (expectEvent('touchstart')) { | 76 if (expectEvent('touchstart')) { |
79 shouldBeCloseTo('lastEvent.changedTouches[0].screenX', 30.33, floatP
recision); | 77 shouldBeCloseTo('lastEvent.changedTouches[0].screenX', 30.33, floatP
recision); |
80 shouldBeCloseTo('lastEvent.changedTouches[0].screenY', 4.5, floatPre
cision); | 78 shouldBeCloseTo('lastEvent.changedTouches[0].screenY', 4.5, floatPre
cision); |
81 shouldBeCloseTo('lastEvent.changedTouches[0].clientX', 30.33, floatP
recision); | 79 shouldBeCloseTo('lastEvent.changedTouches[0].clientX', 30.33, floatP
recision); |
82 shouldBeCloseTo('lastEvent.changedTouches[0].clientY', 4.5, floatPre
cision); | 80 shouldBeCloseTo('lastEvent.changedTouches[0].clientY', 4.5, floatPre
cision); |
83 shouldBeCloseTo('lastEvent.changedTouches[0].pageX', 30.33 + scrollX
, floatPrecision); | 81 shouldBeCloseTo('lastEvent.changedTouches[0].pageX', 30.33 + scrollX
, floatPrecision); |
84 shouldBeCloseTo('lastEvent.changedTouches[0].pageY', 4.5 + scrollY,
floatPrecision); | 82 shouldBeCloseTo('lastEvent.changedTouches[0].pageY', 4.5 + scrollY,
floatPrecision); |
85 if (eventSender.setTouchPointRadius) { | 83 shouldBeCloseTo('lastEvent.changedTouches[0].webkitRadiusX', 5.2, fl
oatPrecision); |
86 shouldBeCloseTo('lastEvent.changedTouches[0].webkitRadiusX', 5.2,
floatPrecision); | 84 shouldBeCloseTo('lastEvent.changedTouches[0].webkitRadiusY', 6.3, fl
oatPrecision); |
87 shouldBeCloseTo('lastEvent.changedTouches[0].webkitRadiusY', 6.3,
floatPrecision); | |
88 } | |
89 } | 85 } |
90 eventSender.releaseTouchPoint(0); | 86 eventSender.releaseTouchPoint(0); |
91 eventSender.touchEnd(); | 87 eventSender.touchEnd(); |
92 debug(''); | 88 debug(''); |
93 | 89 |
94 debug('Testing fractional touch inside simple iframe'); | 90 debug('Testing fractional touch inside simple iframe'); |
95 frameRect = document.getElementById('simpleFrame').getBoundingClientRect
(); | 91 frameRect = document.getElementById('simpleFrame').getBoundingClientRect
(); |
96 eventSender.addTouchPoint(frameRect.left + 4.5, frameRect.top + 2.2); | 92 eventSender.addTouchPoint(frameRect.left + 4.5, frameRect.top + 2.2); |
97 eventSender.touchStart(); | 93 eventSender.touchStart(); |
98 if (expectEvent('touchstart')) { | 94 if (expectEvent('touchstart')) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 shouldBeCloseTo('lastEvent.changedTouches[0].pageX', 4.5 / 2, floatP
recision); | 131 shouldBeCloseTo('lastEvent.changedTouches[0].pageX', 4.5 / 2, floatP
recision); |
136 shouldBeCloseTo('lastEvent.changedTouches[0].pageY', 2.2 / 2, floatP
recision); | 132 shouldBeCloseTo('lastEvent.changedTouches[0].pageY', 2.2 / 2, floatP
recision); |
137 } | 133 } |
138 eventSender.releaseTouchPoint(0); | 134 eventSender.releaseTouchPoint(0); |
139 eventSender.touchEnd(); | 135 eventSender.touchEnd(); |
140 debug(''); | 136 debug(''); |
141 } | 137 } |
142 | 138 |
143 addEventListener('load', runTest); | 139 addEventListener('load', runTest); |
144 </script> | 140 </script> |
OLD | NEW |