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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 WebInputEvent::NoModifiers, | 301 WebInputEvent::NoModifiers, |
302 WebInputEvent::TimeStampForTesting); | 302 WebInputEvent::TimeStampForTesting); |
303 webTouchEvent.touchesLength = 1; | 303 webTouchEvent.touchesLength = 1; |
304 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 304 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
305 webTouchEvent.touches[0].screenPosition.x = 10.6f; | 305 webTouchEvent.touches[0].screenPosition.x = 10.6f; |
306 webTouchEvent.touches[0].screenPosition.y = 10.4f; | 306 webTouchEvent.touches[0].screenPosition.y = 10.4f; |
307 webTouchEvent.touches[0].position.x = 10.6f; | 307 webTouchEvent.touches[0].position.x = 10.6f; |
308 webTouchEvent.touches[0].position.y = 10.4f; | 308 webTouchEvent.touches[0].position.y = 10.4f; |
309 webTouchEvent.touches[0].radiusX = 10.6f; | 309 webTouchEvent.touches[0].radiusX = 10.6f; |
310 webTouchEvent.touches[0].radiusY = 10.4f; | 310 webTouchEvent.touches[0].radiusY = 10.4f; |
| 311 webTouchEvent.touches[0].movementX = 20; |
| 312 webTouchEvent.touches[0].movementY = 20; |
311 | 313 |
312 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); | 314 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); |
313 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); | 315 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); |
314 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); | 316 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); |
315 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); | 317 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); |
316 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].radiusX); | 318 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].radiusX); |
317 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].radiusY); | 319 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].radiusY); |
| 320 EXPECT_EQ(20, webTouchEvent.touches[0].movementX); |
| 321 EXPECT_EQ(20, webTouchEvent.touches[0].movementY); |
318 | 322 |
319 WebTouchEvent transformedEvent = | 323 WebTouchEvent transformedEvent = |
320 TransformWebTouchEvent(view, webTouchEvent); | 324 TransformWebTouchEvent(view, webTouchEvent); |
321 WebTouchPoint transformedPoint = transformedEvent.touchPointInRootFrame(0); | 325 WebTouchPoint transformedPoint = transformedEvent.touchPointInRootFrame(0); |
322 EXPECT_FLOAT_EQ(10.6f, transformedPoint.screenPosition.x); | 326 EXPECT_FLOAT_EQ(10.6f, transformedPoint.screenPosition.x); |
323 EXPECT_FLOAT_EQ(10.4f, transformedPoint.screenPosition.y); | 327 EXPECT_FLOAT_EQ(10.4f, transformedPoint.screenPosition.y); |
324 EXPECT_FLOAT_EQ(5.3f, transformedPoint.position.x); | 328 EXPECT_FLOAT_EQ(5.3f, transformedPoint.position.x); |
325 EXPECT_FLOAT_EQ(5.2f, transformedPoint.position.y); | 329 EXPECT_FLOAT_EQ(5.2f, transformedPoint.position.y); |
326 EXPECT_FLOAT_EQ(5.3f, transformedPoint.radiusX); | 330 EXPECT_FLOAT_EQ(5.3f, transformedPoint.radiusX); |
327 EXPECT_FLOAT_EQ(5.2f, transformedPoint.radiusY); | 331 EXPECT_FLOAT_EQ(5.2f, transformedPoint.radiusY); |
| 332 EXPECT_EQ(10, transformedPoint.movementX); |
| 333 EXPECT_EQ(10, transformedPoint.movementY); |
328 } | 334 } |
329 } | 335 } |
330 | 336 |
331 TEST(WebInputEventConversionTest, InputEventsTransform) { | 337 TEST(WebInputEventConversionTest, InputEventsTransform) { |
332 const std::string baseURL("http://www.test2.com/"); | 338 const std::string baseURL("http://www.test2.com/"); |
333 const std::string fileName("fixed_layout.html"); | 339 const std::string fileName("fixed_layout.html"); |
334 | 340 |
335 URLTestHelpers::registerMockedURLFromBaseURL( | 341 URLTestHelpers::registerMockedURLFromBaseURL( |
336 WebString::fromUTF8(baseURL.c_str()), | 342 WebString::fromUTF8(baseURL.c_str()), |
337 WebString::fromUTF8("fixed_layout.html")); | 343 WebString::fromUTF8("fixed_layout.html")); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); | 886 flooredIntPoint(transformedMouseEvent.positionInRootFrame()); |
881 | 887 |
882 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), position.x()); | 888 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), position.x()); |
883 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), position.y()); | 889 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), position.y()); |
884 EXPECT_EQ(webMouseEvent.globalX, transformedMouseEvent.globalX); | 890 EXPECT_EQ(webMouseEvent.globalX, transformedMouseEvent.globalX); |
885 EXPECT_EQ(webMouseEvent.globalY, transformedMouseEvent.globalY); | 891 EXPECT_EQ(webMouseEvent.globalY, transformedMouseEvent.globalY); |
886 } | 892 } |
887 } | 893 } |
888 | 894 |
889 } // namespace blink | 895 } // namespace blink |
OLD | NEW |