| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 p0.id = 1; | 115 p0.id = 1; |
| 116 p1.id = 2; | 116 p1.id = 2; |
| 117 p0.screenPosition = WebFloatPoint(100.f, 50.f); | 117 p0.screenPosition = WebFloatPoint(100.f, 50.f); |
| 118 p1.screenPosition = WebFloatPoint(150.f, 25.f); | 118 p1.screenPosition = WebFloatPoint(150.f, 25.f); |
| 119 p0.position = WebFloatPoint(10.f, 10.f); | 119 p0.position = WebFloatPoint(10.f, 10.f); |
| 120 p1.position = WebFloatPoint(5.f, 5.f); | 120 p1.position = WebFloatPoint(5.f, 5.f); |
| 121 p0.radiusX = p1.radiusY = 10.f; | 121 p0.radiusX = p1.radiusY = 10.f; |
| 122 p0.radiusY = p1.radiusX = 5.f; | 122 p0.radiusY = p1.radiusX = 5.f; |
| 123 p0.rotationAngle = p1.rotationAngle = 1.f; | 123 p0.rotationAngle = p1.rotationAngle = 1.f; |
| 124 p0.force = p1.force = 25.f; | 124 p0.force = p1.force = 25.f; |
| 125 p0.tilt = p1.tilt = 30.f; |
| 126 p0.tiltDirection = p1.tiltDirection = 45.f; |
| 125 | 127 |
| 126 RefPtrWillBeRawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p0.id, p0.screenPosition, p0.position, Floa
tSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force); | 128 RefPtrWillBeRawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p0.id, p0.screenPosition, p0.position, Floa
tSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force, p0.tilt, p0.tiltDirec
tion); |
| 127 RefPtrWillBeRawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p1.id, p1.screenPosition, p1.position, Floa
tSize(p1.radiusX, p1.radiusY), p1.rotationAngle, p1.force); | 129 RefPtrWillBeRawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p1.id, p1.screenPosition, p1.position, Floa
tSize(p1.radiusX, p1.radiusY), p1.rotationAngle, p1.force, p1.tilt, p1.tiltDirec
tion); |
| 128 | 130 |
| 129 // Test touchstart. | 131 // Test touchstart. |
| 130 { | 132 { |
| 131 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 133 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 132 touchList->append(touch0); | 134 touchList->append(touch0); |
| 133 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); | 135 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); |
| 134 | 136 |
| 135 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); | 137 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); |
| 136 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 138 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
| 137 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); | 139 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); | 198 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); |
| 197 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 199 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); |
| 198 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 200 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); |
| 199 } | 201 } |
| 200 | 202 |
| 201 // Test max point limit. | 203 // Test max point limit. |
| 202 { | 204 { |
| 203 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 205 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 204 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create(); | 206 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create(); |
| 205 for (unsigned i = 0; i <= static_cast<unsigned>(WebTouchEvent::touchesLe
ngthCap) * 2; ++i) { | 207 for (unsigned i = 0; i <= static_cast<unsigned>(WebTouchEvent::touchesLe
ngthCap) * 2; ++i) { |
| 206 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webView
Impl->page()->mainFrame()), document.get(), i, p0.screenPosition, p0.position, F
loatSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force); | 208 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webView
Impl->page()->mainFrame()), document.get(), i, p0.screenPosition, p0.position, F
loatSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force, p0.tilt, p0.tiltDi
rection); |
| 207 touchList->append(touch); | 209 touchList->append(touch); |
| 208 changedTouchList->append(touch); | 210 changedTouchList->append(touch); |
| 209 } | 211 } |
| 210 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); | 212 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); |
| 211 | 213 |
| 212 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); | 214 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); |
| 213 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); | 215 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); |
| 214 } | 216 } |
| 215 } | 217 } |
| 216 | 218 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 EXPECT_EQ(22, webGestureBuilder.globalY); | 437 EXPECT_EQ(22, webGestureBuilder.globalY); |
| 436 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); | 438 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); |
| 437 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); | 439 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); |
| 438 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); | 440 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); |
| 439 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); | 441 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); |
| 440 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.inertial); | 442 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.inertial); |
| 441 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); | 443 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); |
| 442 } | 444 } |
| 443 | 445 |
| 444 { | 446 { |
| 445 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl
->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5,
2), FloatSize(4, 4.5), 0, 0); | 447 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl
->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5,
2), FloatSize(4, 4.5), 0, 0, 0, 0); |
| 446 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 448 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 447 touchList->append(touch); | 449 touchList->append(touch); |
| 448 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); | 450 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); |
| 449 | 451 |
| 450 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); | 452 WebTouchEventBuilder webTouchBuilder(view, documentLayoutView, *touchEve
nt); |
| 451 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 453 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
| 452 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 454 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
| 453 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); | 455 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); |
| 454 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); | 456 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); |
| 455 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); | 457 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 EXPECT_EQ(5, platformWheelBuilder.position().y()); | 876 EXPECT_EQ(5, platformWheelBuilder.position().y()); |
| 875 EXPECT_EQ(10, platformWheelBuilder.deltaX()); | 877 EXPECT_EQ(10, platformWheelBuilder.deltaX()); |
| 876 EXPECT_EQ(15, platformWheelBuilder.deltaY()); | 878 EXPECT_EQ(15, platformWheelBuilder.deltaY()); |
| 877 EXPECT_EQ(WebInputEvent::ControlKey, platformWheelBuilder.modifiers()); | 879 EXPECT_EQ(WebInputEvent::ControlKey, platformWheelBuilder.modifiers()); |
| 878 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 880 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
| 879 EXPECT_TRUE(platformWheelBuilder.canScroll()); | 881 EXPECT_TRUE(platformWheelBuilder.canScroll()); |
| 880 } | 882 } |
| 881 } | 883 } |
| 882 | 884 |
| 883 } // anonymous namespace | 885 } // anonymous namespace |
| OLD | NEW |