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

Unified Diff: ash/drag_drop/drag_drop_controller_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: ash/drag_drop/drag_drop_controller_unittest.cc
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 20513e1f0491adb5a6abdc5d59d75657cd7e2b3d..281cd027dfc548458a8277c67edd5f0f32607f99 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -261,7 +261,7 @@ void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) {
widget->SetBounds(contents_view_bounds);
}
-void DispatchGesture(ui::EventType gesture_type, gfx::Point location) {
+void DispatchGesture(ui::EventType gesture_type, const gfx::PointF& location) {
ui::GestureEventDetails event_details(gesture_type);
event_details.set_oldest_touch_id(1);
ui::GestureEvent gesture_event(
@@ -562,7 +562,6 @@ TEST_F(DragDropControllerTest, MAYBE_ViewRemovedWhileInDragDropTest) {
scoped_ptr<views::Widget> widget(CreateNewWidget());
scoped_ptr<DragTestView> drag_view(new DragTestView);
AddViewToWidgetAndResize(widget.get(), drag_view.get());
- gfx::Point point = gfx::Rect(drag_view->bounds()).CenterPoint();
ui::OSExchangeData data;
data.SetString(base::UTF8ToUTF16("I am being dragged"));
@@ -719,7 +718,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) {
// We send a unexpected mouse move event. Note that we cannot use
// EventGenerator since it implicitly turns these into mouse drag events.
// The DragDropController should simply ignore these events.
- gfx::Point mouse_move_location = drag_view->bounds().CenterPoint();
+ auto mouse_move_location = gfx::PointF(drag_view->bounds().CenterPoint());
ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location,
mouse_move_location, ui::EventTimeForNow(), 0, 0);
ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()->
@@ -865,17 +864,17 @@ TEST_F(DragDropControllerTest, TouchDragDropInMultipleWindows) {
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
widget1->GetNativeView());
generator.PressTouch();
- gfx::Point point = gfx::Rect(drag_view1->bounds()).CenterPoint();
+ auto point = gfx::PointF(gfx::Rect(drag_view1->bounds()).CenterPoint());
DispatchGesture(ui::ET_GESTURE_LONG_PRESS, point);
// Because we are not doing a blocking drag and drop, the original
// OSDragExchangeData object is lost as soon as we return from the drag
// initiation in DragDropController::StartDragAndDrop(). Hence we set the
// drag_data_ to a fake drag data object that we created.
UpdateDragData(&data);
- gfx::Point gesture_location = point;
+ gfx::PointF gesture_location = point;
int num_drags = drag_view1->width();
for (int i = 0; i < num_drags; ++i) {
- gesture_location.Offset(1, 0);
+ gesture_location.Offset(1.f, 0.f);
DispatchGesture(ui::ET_GESTURE_SCROLL_UPDATE, gesture_location);
// Execute any scheduled draws to process deferred mouse events.
@@ -916,7 +915,7 @@ TEST_F(DragDropControllerTest, TouchDragDropCancelsOnLongTap) {
widget->GetNativeView());
generator.PressTouch();
- gfx::Point point = gfx::Rect(drag_view->bounds()).CenterPoint();
+ auto point = gfx::PointF(gfx::Rect(drag_view->bounds()).CenterPoint());
DispatchGesture(ui::ET_GESTURE_LONG_PRESS, point);
DispatchGesture(ui::ET_GESTURE_LONG_TAP, point);
@@ -942,7 +941,7 @@ TEST_F(DragDropControllerTest, TouchDragDropLongTapGestureIsForwarded) {
widget->GetNativeView());
generator.PressTouch();
- gfx::Point point = gfx::Rect(drag_view->bounds()).CenterPoint();
+ auto point = gfx::PointF(gfx::Rect(drag_view->bounds()).CenterPoint());
DispatchGesture(ui::ET_GESTURE_LONG_PRESS, point);
// Since we are not running inside a nested loop, the |drag_source_window_|
@@ -1005,15 +1004,15 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) {
GetDragImageWindow()->AddObserver(&observer);
{
- ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0),
- gfx::Point(200, 0), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::PointF(200.f, 0.f),
+ gfx::PointF(200.f, 0.f), ui::EventTimeForNow(),
+ ui::EF_NONE, ui::EF_NONE);
drag_drop_controller_->DragUpdate(window, e);
}
{
- ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(600, 0),
- gfx::Point(600, 0), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::PointF(600.f, 0.f),
+ gfx::PointF(600.f, 0.f), ui::EventTimeForNow(),
+ ui::EF_NONE, ui::EF_NONE);
drag_drop_controller_->DragUpdate(window, e);
}
@@ -1038,15 +1037,15 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) {
GetDragImageWindow()->AddObserver(&observer);
{
- ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(600, 0),
- gfx::Point(600, 0), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::PointF(600.f, 0.f),
+ gfx::PointF(600.f, 0.f), ui::EventTimeForNow(),
+ ui::EF_NONE, ui::EF_NONE);
drag_drop_controller_->DragUpdate(window, e);
}
{
- ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0),
- gfx::Point(200, 0), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::PointF(200.f, 0.f),
+ gfx::PointF(200.f, 0.f), ui::EventTimeForNow(),
+ ui::EF_NONE, ui::EF_NONE);
drag_drop_controller_->DragUpdate(window, e);
}
@@ -1074,9 +1073,11 @@ TEST_F(DragDropControllerTest, TouchDragDropCompletesOnFling) {
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
widget->GetNativeView());
- gfx::Point start = gfx::Rect(drag_view->bounds()).CenterPoint();
- gfx::Point mid = start + gfx::Vector2d(drag_view->bounds().width() / 6, 0);
- gfx::Point end = start + gfx::Vector2d(drag_view->bounds().width() / 3, 0);
+ auto start = gfx::PointF(gfx::Rect(drag_view->bounds()).CenterPoint());
+ gfx::PointF mid =
+ start + gfx::Vector2dF(drag_view->bounds().width() / 6.f, 0.f);
+ gfx::PointF end =
+ start + gfx::Vector2dF(drag_view->bounds().width() / 3.f, 0.f);
base::TimeDelta timestamp = ui::EventTimeForNow();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, 0, timestamp);

Powered by Google App Engine
This is Rietveld 408576698