Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: ui/views/widget/widget_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/widget_unittest.cc
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index b6a18a94f675921c4f4f6c2607aa01ddf69fdb27..040007d37176d323a1e8f62a72d964deb8f638f9 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -1474,13 +1474,8 @@ TEST_F(WidgetTest, WheelEventsFromScrollEventTarget) {
widget->GetRootView()->AddChildView(cursor_view);
// Generate a scroll event on the cursor view.
- ui::ScrollEvent scroll(ui::ET_SCROLL,
- gfx::Point(65, 5),
- ui::EventTimeForNow(),
- 0,
- 0, 20,
- 0, 20,
- 2);
+ ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::PointF(65.f, 5.f),
+ ui::EventTimeForNow(), 0, 0, 20, 0, 20, 2);
widget->OnScrollEvent(&scroll);
EXPECT_EQ(1, cursor_view->GetEventCount(ui::ET_SCROLL));
@@ -1488,13 +1483,8 @@ TEST_F(WidgetTest, WheelEventsFromScrollEventTarget) {
cursor_view->ResetCounts();
- ui::ScrollEvent scroll2(ui::ET_SCROLL,
- gfx::Point(5, 5),
- ui::EventTimeForNow(),
- 0,
- 0, 20,
- 0, 20,
- 2);
+ ui::ScrollEvent scroll2(ui::ET_SCROLL, gfx::PointF(5.f, 5.f),
+ ui::EventTimeForNow(), 0, 0, 20, 0, 20, 2);
widget->OnScrollEvent(&scroll2);
EXPECT_EQ(0, cursor_view->GetEventCount(ui::ET_SCROLL));
@@ -1595,13 +1585,8 @@ TEST_F(WidgetTest, EventHandlersOnRootView) {
// Dispatch a ui::ET_SCROLL event. The event remains unhandled and should
// bubble up the views hierarchy to be re-dispatched on the root view.
- ui::ScrollEvent scroll(ui::ET_SCROLL,
- gfx::Point(5, 5),
- ui::EventTimeForNow(),
- 0,
- 0, 20,
- 0, 20,
- 2);
+ ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::PointF(5.f, 5.f),
+ ui::EventTimeForNow(), 0, 0, 20, 0, 20, 2);
widget->OnScrollEvent(&scroll);
EXPECT_EQ(2, h1.GetEventCount(ui::ET_SCROLL));
EXPECT_EQ(1, view->GetEventCount(ui::ET_SCROLL));
@@ -1618,13 +1603,8 @@ TEST_F(WidgetTest, EventHandlersOnRootView) {
// Dispatch a ui::ET_SCROLL_FLING_START event. The event remains unhandled and
// should bubble up the views hierarchy to be re-dispatched on the root view.
- ui::ScrollEvent fling(ui::ET_SCROLL_FLING_START,
- gfx::Point(5, 5),
- ui::EventTimeForNow(),
- 0,
- 0, 20,
- 0, 20,
- 2);
+ ui::ScrollEvent fling(ui::ET_SCROLL_FLING_START, gfx::PointF(5.f, 5.f),
+ ui::EventTimeForNow(), 0, 0, 20, 0, 20, 2);
widget->OnScrollEvent(&fling);
EXPECT_EQ(2, h1.GetEventCount(ui::ET_SCROLL_FLING_START));
EXPECT_EQ(1, view->GetEventCount(ui::ET_SCROLL_FLING_START));
@@ -1674,13 +1654,8 @@ TEST_F(WidgetTest, EventHandlersOnRootView) {
// Dispatch a ui::ET_SCROLL event. The event is handled at the target phase
// and should not reach the post-target handler.
- ui::ScrollEvent consumed_scroll(ui::ET_SCROLL,
- gfx::Point(5, 5),
- ui::EventTimeForNow(),
- 0,
- 0, 20,
- 0, 20,
- 2);
+ ui::ScrollEvent consumed_scroll(ui::ET_SCROLL, gfx::PointF(5.f, 5.f),
+ ui::EventTimeForNow(), 0, 0, 20, 0, 20, 2);
widget->OnScrollEvent(&consumed_scroll);
EXPECT_EQ(1, h1.GetEventCount(ui::ET_SCROLL));
EXPECT_EQ(1, view->GetEventCount(ui::ET_SCROLL));
@@ -1715,8 +1690,9 @@ TEST_F(WidgetTest, SynthesizeMouseMoveEvent) {
gfx::Point cursor_location(5, 5);
View::ConvertPointToScreen(widget->GetRootView(), &cursor_location);
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
+ ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::PointF(cursor_location),
+ gfx::PointF(cursor_location), ui::EventTimeForNow(),
+ ui::EF_NONE, ui::EF_NONE);
ui::EventDispatchDetails details =
WidgetTest::GetEventProcessor(widget)->OnEventFromSource(&move);
EXPECT_FALSE(details.dispatcher_destroyed);
@@ -2158,7 +2134,7 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) {
// Check RootView::mouse_pressed_handler_.
widget->Show();
EXPECT_EQ(NULL, GetMousePressedHandler(root_view));
- gfx::Point click_location(45, 15);
+ gfx::PointF click_location(45.f, 15.f);
ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location,
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
@@ -2170,7 +2146,7 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) {
// Check RootView::mouse_move_handler_.
widget->Show();
EXPECT_EQ(NULL, GetMouseMoveHandler(root_view));
- gfx::Point move_location(45, 15);
+ gfx::PointF move_location(45.f, 15.f);
ui::MouseEvent move(ui::ET_MOUSE_MOVED, move_location, move_location,
ui::EventTimeForNow(), 0, 0);
widget->OnMouseEvent(&move);
@@ -2181,10 +2157,7 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) {
// Check RootView::gesture_handler_.
widget->Show();
EXPECT_EQ(NULL, GetGestureHandler(root_view));
- ui::GestureEvent tap_down(15,
- 15,
- 0,
- base::TimeDelta(),
+ ui::GestureEvent tap_down(15.f, 15.f, 0, base::TimeDelta(),
ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN));
widget->OnGestureEvent(&tap_down);
EXPECT_EQ(view, GetGestureHandler(root_view));

Powered by Google App Engine
This is Rietveld 408576698