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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos()
.y()); | 428 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos()
.y()); |
429 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); | 429 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); |
430 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); | 430 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); |
431 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); | 431 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); |
432 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); | 432 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); |
433 } | 433 } |
434 | 434 |
435 // Reverse builders should *not* go back to physical pixels, as they are use
d for plugins | 435 // Reverse builders should *not* go back to physical pixels, as they are use
d for plugins |
436 // which expect CSS pixel coordinates. | 436 // which expect CSS pixel coordinates. |
437 { | 437 { |
438 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, LeftButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, Platform
MouseEvent::RealOrIndistinguishable, 0); | 438 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, WebPointerProperties::Button::Left, PlatformEvent::MouseMoved, 1, PlatformEven
t::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, 0); |
439 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); | 439 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); |
440 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); | 440 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); |
441 | 441 |
442 EXPECT_EQ(10, webMouseBuilder.x); | 442 EXPECT_EQ(10, webMouseBuilder.x); |
443 EXPECT_EQ(10, webMouseBuilder.y); | 443 EXPECT_EQ(10, webMouseBuilder.y); |
444 EXPECT_EQ(10, webMouseBuilder.globalX); | 444 EXPECT_EQ(10, webMouseBuilder.globalX); |
445 EXPECT_EQ(10, webMouseBuilder.globalY); | 445 EXPECT_EQ(10, webMouseBuilder.globalY); |
446 EXPECT_EQ(10, webMouseBuilder.windowX); | 446 EXPECT_EQ(10, webMouseBuilder.windowX); |
447 EXPECT_EQ(10, webMouseBuilder.windowY); | 447 EXPECT_EQ(10, webMouseBuilder.windowY); |
448 } | 448 } |
449 | 449 |
450 { | 450 { |
451 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo
useEvent::RealOrIndistinguishable, 0); | 451 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 1, Platform
Event::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, 0); |
452 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); | 452 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); |
453 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); | 453 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); |
454 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); | 454 EXPECT_EQ(WebMouseEvent::Button::NoButton, webMouseBuilder.button); |
455 } | 455 } |
456 | 456 |
457 { | 457 { |
458 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, | 458 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, |
459 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); | 459 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); |
460 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel,
40, 42, ScrollInertialPhaseMomentum, true, -1 /* null plugin id */); | 460 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel,
40, 42, ScrollInertialPhaseMomentum, true, -1 /* null plugin id */); |
461 // FIXME: GestureEvent does not preserve velocityX, velocityY, | 461 // FIXME: GestureEvent does not preserve velocityX, velocityY, |
462 // or preventPropagation. It also fails to scale | 462 // or preventPropagation. It also fails to scale |
463 // coordinates (x, y, deltaX, deltaY) to the page scale. This | 463 // coordinates (x, y, deltaX, deltaY) to the page scale. This |
464 // may lead to unexpected bugs if a PlatformGestureEvent is | 464 // may lead to unexpected bugs if a PlatformGestureEvent is |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 1112 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
1113 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); | 1113 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
1114 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia
lPhase()); | 1114 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia
lPhase()); |
1115 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1115 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
1116 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); | 1116 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); |
1117 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); | 1117 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
1118 } | 1118 } |
1119 } | 1119 } |
1120 | 1120 |
1121 } // namespace blink | 1121 } // namespace blink |
OLD | NEW |