| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 WebInputEvent::NoModifiers, | 311 WebInputEvent::NoModifiers, |
| 312 WebInputEvent::TimeStampForTesting); | 312 WebInputEvent::TimeStampForTesting); |
| 313 webTouchEvent.touchesLength = 1; | 313 webTouchEvent.touchesLength = 1; |
| 314 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; | 314 webTouchEvent.touches[0].state = WebTouchPoint::StateMoved; |
| 315 webTouchEvent.touches[0].screenPosition.x = 10.6f; | 315 webTouchEvent.touches[0].screenPosition.x = 10.6f; |
| 316 webTouchEvent.touches[0].screenPosition.y = 10.4f; | 316 webTouchEvent.touches[0].screenPosition.y = 10.4f; |
| 317 webTouchEvent.touches[0].position.x = 10.6f; | 317 webTouchEvent.touches[0].position.x = 10.6f; |
| 318 webTouchEvent.touches[0].position.y = 10.4f; | 318 webTouchEvent.touches[0].position.y = 10.4f; |
| 319 webTouchEvent.touches[0].radiusX = 10.6f; | 319 webTouchEvent.touches[0].radiusX = 10.6f; |
| 320 webTouchEvent.touches[0].radiusY = 10.4f; | 320 webTouchEvent.touches[0].radiusY = 10.4f; |
| 321 webTouchEvent.touches[0].movementX = 20; |
| 322 webTouchEvent.touches[0].movementY = 20; |
| 321 | 323 |
| 322 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); | 324 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].screenPosition.x); |
| 323 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); | 325 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].screenPosition.y); |
| 324 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); | 326 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].position.x); |
| 325 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); | 327 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); |
| 326 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].radiusX); | 328 EXPECT_FLOAT_EQ(10.6f, webTouchEvent.touches[0].radiusX); |
| 327 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].radiusY); | 329 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].radiusY); |
| 330 EXPECT_EQ(20, webTouchEvent.touches[0].movementX); |
| 331 EXPECT_EQ(20, webTouchEvent.touches[0].movementY); |
| 328 | 332 |
| 329 WebTouchEvent transformedEvent = | 333 WebTouchEvent transformedEvent = |
| 330 TransformWebTouchEvent(view, webTouchEvent); | 334 TransformWebTouchEvent(view, webTouchEvent); |
| 331 WebTouchPoint transformedPoint = transformedEvent.touchPointInRootFrame(0); | 335 WebTouchPoint transformedPoint = transformedEvent.touchPointInRootFrame(0); |
| 332 EXPECT_FLOAT_EQ(10.6f, transformedPoint.screenPosition.x); | 336 EXPECT_FLOAT_EQ(10.6f, transformedPoint.screenPosition.x); |
| 333 EXPECT_FLOAT_EQ(10.4f, transformedPoint.screenPosition.y); | 337 EXPECT_FLOAT_EQ(10.4f, transformedPoint.screenPosition.y); |
| 334 EXPECT_FLOAT_EQ(5.3f, transformedPoint.position.x); | 338 EXPECT_FLOAT_EQ(5.3f, transformedPoint.position.x); |
| 335 EXPECT_FLOAT_EQ(5.2f, transformedPoint.position.y); | 339 EXPECT_FLOAT_EQ(5.2f, transformedPoint.position.y); |
| 336 EXPECT_FLOAT_EQ(5.3f, transformedPoint.radiusX); | 340 EXPECT_FLOAT_EQ(5.3f, transformedPoint.radiusX); |
| 337 EXPECT_FLOAT_EQ(5.2f, transformedPoint.radiusY); | 341 EXPECT_FLOAT_EQ(5.2f, transformedPoint.radiusY); |
| 342 EXPECT_EQ(10, transformedPoint.movementX); |
| 343 EXPECT_EQ(10, transformedPoint.movementY); |
| 338 } | 344 } |
| 339 } | 345 } |
| 340 | 346 |
| 341 TEST(WebInputEventConversionTest, InputEventsTransform) { | 347 TEST(WebInputEventConversionTest, InputEventsTransform) { |
| 342 const std::string baseURL("http://www.test2.com/"); | 348 const std::string baseURL("http://www.test2.com/"); |
| 343 const std::string fileName("fixed_layout.html"); | 349 const std::string fileName("fixed_layout.html"); |
| 344 | 350 |
| 345 registerMockedURL(baseURL, fileName); | 351 registerMockedURL(baseURL, fileName); |
| 346 FrameTestHelpers::WebViewHelper webViewHelper; | 352 FrameTestHelpers::WebViewHelper webViewHelper; |
| 347 WebViewImpl* webViewImpl = | 353 WebViewImpl* webViewImpl = |
| (...skipping 532 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 |