| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 int pageWidth = 640; | 101 int pageWidth = 640; |
| 102 int pageHeight = 480; | 102 int pageHeight = 480; |
| 103 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 103 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 104 webViewImpl->layout(); | 104 webViewImpl->layout(); |
| 105 | 105 |
| 106 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma
inFrame())->document(); | 106 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma
inFrame())->document(); |
| 107 LocalDOMWindow* domWindow = document->domWindow(); | 107 LocalDOMWindow* domWindow = document->domWindow(); |
| 108 LayoutView* documentLayoutView = document->layoutView(); | 108 LayoutView* documentLayoutView = document->layoutView(); |
| 109 | 109 |
| 110 WebTouchPoint p0, p1; | 110 WebTouchPoint p0, p1; |
| 111 p0.id = 1; | 111 p0.pointerId = 1; |
| 112 p1.id = 2; | 112 p1.pointerId = 2; |
| 113 p0.screenPosition = WebFloatPoint(100.f, 50.f); | 113 p0.screenPosition = WebFloatPoint(100.f, 50.f); |
| 114 p1.screenPosition = WebFloatPoint(150.f, 25.f); | 114 p1.screenPosition = WebFloatPoint(150.f, 25.f); |
| 115 p0.position = WebFloatPoint(10.f, 10.f); | 115 p0.position = WebFloatPoint(10.f, 10.f); |
| 116 p1.position = WebFloatPoint(5.f, 5.f); | 116 p1.position = WebFloatPoint(5.f, 5.f); |
| 117 p0.radiusX = p1.radiusY = 10.f; | 117 p0.width = p1.height = 10.f; |
| 118 p0.radiusY = p1.radiusX = 5.f; | 118 p0.width = p1.height = 5.f; |
| 119 p0.rotationAngle = p1.rotationAngle = 1.f; | 119 p0.rotationAngle = p1.rotationAngle = 1.f; |
| 120 p0.force = p1.force = 25.f; | 120 p0.pressure = p1.pressure = 25.f; |
| 121 | 121 |
| 122 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); | 122 RefPtrWillBeRawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p0.pointerId, p0.screenPosition, p0.positio
n, FloatSize(p0.width, p0.height), p0.rotationAngle, p0.pressure); |
| 123 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); | 123 RefPtrWillBeRawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->p
age()->mainFrame()), document.get(), p1.pointerId, p1.screenPosition, p1.positio
n, FloatSize(p1.width, p1.height), p1.rotationAngle, p1.pressure); |
| 124 | 124 |
| 125 // Test touchstart. | 125 // Test touchstart. |
| 126 { | 126 { |
| 127 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 127 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 128 touchList->append(touch0); | 128 touchList->append(touch0); |
| 129 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); | 129 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); |
| 130 | 130 |
| 131 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 131 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 132 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 132 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
| 133 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); | 133 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); |
| 134 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state)
; | 134 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state)
; |
| 135 EXPECT_FLOAT_EQ(p0.screenPosition.x, webTouchBuilder.touches[0].screenPo
sition.x); | 135 EXPECT_FLOAT_EQ(p0.screenPosition.x, webTouchBuilder.touches[0].screenPo
sition.x); |
| 136 EXPECT_FLOAT_EQ(p0.screenPosition.y, webTouchBuilder.touches[0].screenPo
sition.y); | 136 EXPECT_FLOAT_EQ(p0.screenPosition.y, webTouchBuilder.touches[0].screenPo
sition.y); |
| 137 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x); | 137 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x); |
| 138 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y); | 138 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y); |
| 139 EXPECT_FLOAT_EQ(p0.radiusX, webTouchBuilder.touches[0].radiusX); | 139 EXPECT_FLOAT_EQ(p0.width, webTouchBuilder.touches[0].width); |
| 140 EXPECT_FLOAT_EQ(p0.radiusY, webTouchBuilder.touches[0].radiusY); | 140 EXPECT_FLOAT_EQ(p0.height, webTouchBuilder.touches[0].height); |
| 141 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAng
le); | 141 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAng
le); |
| 142 EXPECT_FLOAT_EQ(p0.force, webTouchBuilder.touches[0].force); | 142 EXPECT_FLOAT_EQ(p0.pressure, webTouchBuilder.touches[0].pressure); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Test touchmove. | 145 // Test touchmove. |
| 146 { | 146 { |
| 147 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); | 147 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); |
| 148 RefPtrWillBeRawPtr<TouchList> movedTouchList = TouchList::create(); | 148 RefPtrWillBeRawPtr<TouchList> movedTouchList = TouchList::create(); |
| 149 activeTouchList->append(touch0); | 149 activeTouchList->append(touch0); |
| 150 activeTouchList->append(touch1); | 150 activeTouchList->append(touch1); |
| 151 movedTouchList->append(touch0); | 151 movedTouchList->append(touch0); |
| 152 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), movedTouchList.get(), EventTypeNames::touch
move, domWindow, false, false, false, false, false, false); | 152 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), movedTouchList.get(), EventTypeNames::touch
move, domWindow, false, false, false, false, false, false); |
| 153 | 153 |
| 154 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 154 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 155 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 155 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
| 156 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); | 156 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); |
| 157 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state); | 157 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state); |
| 158 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].sta
te); | 158 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].sta
te); |
| 159 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 159 EXPECT_EQ(p0.pointerId, webTouchBuilder.touches[0].pointerId); |
| 160 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 160 EXPECT_EQ(p1.pointerId, webTouchBuilder.touches[1].pointerId); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Test touchmove, different point yields same ordering. | 163 // Test touchmove, different point yields same ordering. |
| 164 { | 164 { |
| 165 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); | 165 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); |
| 166 RefPtrWillBeRawPtr<TouchList> movedTouchList = TouchList::create(); | 166 RefPtrWillBeRawPtr<TouchList> movedTouchList = TouchList::create(); |
| 167 activeTouchList->append(touch0); | 167 activeTouchList->append(touch0); |
| 168 activeTouchList->append(touch1); | 168 activeTouchList->append(touch1); |
| 169 movedTouchList->append(touch1); | 169 movedTouchList->append(touch1); |
| 170 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), movedTouchList.get(), EventTypeNames::touch
move, domWindow, false, false, false, false, false, false); | 170 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), movedTouchList.get(), EventTypeNames::touch
move, domWindow, false, false, false, false, false, false); |
| 171 | 171 |
| 172 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 172 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 173 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 173 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
| 174 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); | 174 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); |
| 175 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); | 175 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); |
| 176 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state); | 176 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state); |
| 177 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 177 EXPECT_EQ(p0.pointerId, webTouchBuilder.touches[0].pointerId); |
| 178 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 178 EXPECT_EQ(p1.pointerId, webTouchBuilder.touches[1].pointerId); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Test touchend. | 181 // Test touchend. |
| 182 { | 182 { |
| 183 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); | 183 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); |
| 184 RefPtrWillBeRawPtr<TouchList> releasedTouchList = TouchList::create(); | 184 RefPtrWillBeRawPtr<TouchList> releasedTouchList = TouchList::create(); |
| 185 activeTouchList->append(touch0); | 185 activeTouchList->append(touch0); |
| 186 releasedTouchList->append(touch1); | 186 releasedTouchList->append(touch1); |
| 187 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), releasedTouchList.get(), EventTypeNames::to
uchend, domWindow, false, false, false, false, false, false); | 187 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), releasedTouchList.get(), EventTypeNames::to
uchend, domWindow, false, false, false, false, false, false); |
| 188 | 188 |
| 189 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 189 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 190 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 190 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
| 191 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type); | 191 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type); |
| 192 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); | 192 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); |
| 193 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state
); | 193 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state
); |
| 194 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 194 EXPECT_EQ(p0.pointerId, webTouchBuilder.touches[0].pointerId); |
| 195 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 195 EXPECT_EQ(p1.pointerId, webTouchBuilder.touches[1].pointerId); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Test touchcancel. | 198 // Test touchcancel. |
| 199 { | 199 { |
| 200 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); | 200 RefPtrWillBeRawPtr<TouchList> activeTouchList = TouchList::create(); |
| 201 RefPtrWillBeRawPtr<TouchList> cancelledTouchList = TouchList::create(); | 201 RefPtrWillBeRawPtr<TouchList> cancelledTouchList = TouchList::create(); |
| 202 cancelledTouchList->append(touch0); | 202 cancelledTouchList->append(touch0); |
| 203 cancelledTouchList->append(touch1); | 203 cancelledTouchList->append(touch1); |
| 204 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), cancelledTouchList.get(), EventTypeNames::t
ouchcancel, domWindow, false, false, false, false, false, false); | 204 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTou
chList.get(), activeTouchList.get(), cancelledTouchList.get(), EventTypeNames::t
ouchcancel, domWindow, false, false, false, false, false, false); |
| 205 | 205 |
| 206 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 206 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 207 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 207 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
| 208 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type); | 208 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type); |
| 209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].stat
e); | 209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].stat
e); |
| 210 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); | 210 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); |
| 211 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 211 EXPECT_EQ(p0.pointerId, webTouchBuilder.touches[0].pointerId); |
| 212 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 212 EXPECT_EQ(p1.pointerId, webTouchBuilder.touches[1].pointerId); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Test max point limit. | 215 // Test max point limit. |
| 216 { | 216 { |
| 217 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 217 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 218 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create(); | 218 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create(); |
| 219 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) *
2; ++i) { | 219 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) *
2; ++i) { |
| 220 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); | 220 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webView
Impl->page()->mainFrame()), document.get(), i, p0.screenPosition, p0.position, F
loatSize(p0.width, p0.height), p0.rotationAngle, p0.pressure); |
| 221 touchList->append(touch); | 221 touchList->append(touch); |
| 222 changedTouchList->append(touch); | 222 changedTouchList->append(touch); |
| 223 } | 223 } |
| 224 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); | 224 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow,
false, false, false, false, false, false); |
| 225 | 225 |
| 226 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 226 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 227 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); | 227 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 { | 384 { |
| 385 WebTouchEvent webTouchEvent; | 385 WebTouchEvent webTouchEvent; |
| 386 webTouchEvent.type = WebInputEvent::TouchMove; | 386 webTouchEvent.type = WebInputEvent::TouchMove; |
| 387 webTouchEvent.touchesLength = 1; | 387 webTouchEvent.touchesLength = 1; |
| 388 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 388 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 389 webTouchEvent.touches[0].screenPosition.x = 10.6f; | 389 webTouchEvent.touches[0].screenPosition.x = 10.6f; |
| 390 webTouchEvent.touches[0].screenPosition.y = 10.4f; | 390 webTouchEvent.touches[0].screenPosition.y = 10.4f; |
| 391 webTouchEvent.touches[0].position.x = 10.6f; | 391 webTouchEvent.touches[0].position.x = 10.6f; |
| 392 webTouchEvent.touches[0].position.y = 10.4f; | 392 webTouchEvent.touches[0].position.y = 10.4f; |
| 393 webTouchEvent.touches[0].radiusX = 10.6f; | 393 webTouchEvent.touches[0].width = 10.6f; |
| 394 webTouchEvent.touches[0].radiusY = 10.4f; | 394 webTouchEvent.touches[0].height = 10.4f; |
| 395 | 395 |
| 396 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); | 396 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); |
| 397 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); | 397 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); |
| 398 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); | 398 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); |
| 399 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); | 399 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); |
| 400 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].radiusX); | 400 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].width); |
| 401 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].radiusY); | 401 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].height); |
| 402 | 402 |
| 403 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); | 403 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); |
| 404 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos()
.x()); | 404 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos()
.x()); |
| 405 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos()
.y()); | 405 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos()
.y()); |
| 406 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); | 406 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); |
| 407 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); | 407 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); |
| 408 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); | 408 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); |
| 409 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); | 409 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); |
| 410 } | 410 } |
| 411 | 411 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); | 460 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); |
| 461 touchList->append(touch); | 461 touchList->append(touch); |
| 462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); | 462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList
.get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow,
false, false, false, false, false, false); |
| 463 | 463 |
| 464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
| 465 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 465 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
| 466 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 466 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
| 467 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); | 467 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); |
| 468 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); | 468 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); |
| 469 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); | 469 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); |
| 470 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX); | 470 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].width); |
| 471 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY); | 471 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].height); |
| 472 EXPECT_FALSE(webTouchBuilder.cancelable); | 472 EXPECT_FALSE(webTouchBuilder.cancelable); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| 476 TEST(WebInputEventConversionTest, InputEventsTransform) | 476 TEST(WebInputEventConversionTest, InputEventsTransform) |
| 477 { | 477 { |
| 478 const std::string baseURL("http://www.test2.com/"); | 478 const std::string baseURL("http://www.test2.com/"); |
| 479 const std::string fileName("fixed_layout.html"); | 479 const std::string fileName("fixed_layout.html"); |
| 480 | 480 |
| 481 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 481 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 600 |
| 601 { | 601 { |
| 602 WebTouchEvent webTouchEvent; | 602 WebTouchEvent webTouchEvent; |
| 603 webTouchEvent.type = WebInputEvent::TouchMove; | 603 webTouchEvent.type = WebInputEvent::TouchMove; |
| 604 webTouchEvent.touchesLength = 1; | 604 webTouchEvent.touchesLength = 1; |
| 605 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 605 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 606 webTouchEvent.touches[0].screenPosition.x = 100; | 606 webTouchEvent.touches[0].screenPosition.x = 100; |
| 607 webTouchEvent.touches[0].screenPosition.y = 110; | 607 webTouchEvent.touches[0].screenPosition.y = 110; |
| 608 webTouchEvent.touches[0].position.x = 100; | 608 webTouchEvent.touches[0].position.x = 100; |
| 609 webTouchEvent.touches[0].position.y = 110; | 609 webTouchEvent.touches[0].position.y = 110; |
| 610 webTouchEvent.touches[0].radiusX = 30; | 610 webTouchEvent.touches[0].width = 30; |
| 611 webTouchEvent.touches[0].radiusY = 30; | 611 webTouchEvent.touches[0].height = 30; |
| 612 | 612 |
| 613 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); | 613 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); |
| 614 EXPECT_FLOAT_EQ(100, platformTouchBuilder.touchPoints()[0].screenPos().x
()); | 614 EXPECT_FLOAT_EQ(100, platformTouchBuilder.touchPoints()[0].screenPos().x
()); |
| 615 EXPECT_FLOAT_EQ(110, platformTouchBuilder.touchPoints()[0].screenPos().y
()); | 615 EXPECT_FLOAT_EQ(110, platformTouchBuilder.touchPoints()[0].screenPos().y
()); |
| 616 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().x()); | 616 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().x()); |
| 617 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().y()); | 617 EXPECT_FLOAT_EQ(30, platformTouchBuilder.touchPoints()[0].pos().y()); |
| 618 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().width
()); | 618 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().width
()); |
| 619 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().heigh
t()); | 619 EXPECT_FLOAT_EQ(10, platformTouchBuilder.touchPoints()[0].radius().heigh
t()); |
| 620 } | 620 } |
| 621 } | 621 } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 931 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
| 932 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 932 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
| 933 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); | 933 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); |
| 934 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 934 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
| 935 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 935 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
| 936 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); | 936 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); |
| 937 } | 937 } |
| 938 } | 938 } |
| 939 | 939 |
| 940 } // namespace blink | 940 } // namespace blink |
| OLD | NEW |