| Index: ui/views/controls/textfield/textfield_unittest.cc
|
| diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
|
| index 544340f77cc9f33567fe603a5e45563b2fd04a34..ff0bb91d0cdc4eaeec0cae694a357cf494669ed8 100644
|
| --- a/ui/views/controls/textfield/textfield_unittest.cc
|
| +++ b/ui/views/controls/textfield/textfield_unittest.cc
|
| @@ -608,7 +608,7 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
|
| // Mouse click on the point whose x-axis is |bound|'s x plus |x_offset| and
|
| // y-axis is in the middle of |bound|'s vertical range.
|
| void MouseClick(const gfx::Rect bound, int x_offset) {
|
| - gfx::Point point(bound.x() + x_offset, bound.y() + bound.height() / 2);
|
| + gfx::PointF point(bound.x() + x_offset, bound.y() + bound.height() / 2);
|
| ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -621,12 +621,12 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
|
|
|
| // This is to avoid double/triple click.
|
| void NonClientMouseClick() {
|
| - ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(),
|
| ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| textfield_->OnMousePressed(click);
|
| - ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(),
|
| ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -1087,7 +1087,7 @@ TEST_F(TextfieldTest, FocusTraversalTest) {
|
| // Test if clicking on textfield view sets the focus.
|
| widget_->GetFocusManager()->AdvanceFocus(true);
|
| EXPECT_EQ(3, GetFocusedView()->id());
|
| - ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| textfield_->OnMousePressed(click);
|
| @@ -1139,14 +1139,14 @@ TEST_F(TextfieldTest, ContextMenuDisplayTest) {
|
| TEST_F(TextfieldTest, DoubleAndTripleClickTest) {
|
| InitTextfield();
|
| textfield_->SetText(ASCIIToUTF16("hello world"));
|
| - ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| - ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| - ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
|
| - ui::EventTimeForNow(),
|
| + ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, gfx::PointF(),
|
| + gfx::PointF(), ui::EventTimeForNow(),
|
| ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
|
|
| @@ -1172,17 +1172,17 @@ TEST_F(TextfieldTest, DoubleAndTripleClickTest) {
|
| TEST_F(TextfieldTest, DragToSelect) {
|
| InitTextfield();
|
| textfield_->SetText(ASCIIToUTF16("hello world"));
|
| - const int kStart = GetCursorPositionX(5);
|
| - const int kEnd = 500;
|
| - gfx::Point start_point(kStart, 0);
|
| - gfx::Point end_point(kEnd, 0);
|
| + const float kStart = GetCursorPositionX(5);
|
| + const float kEnd = 500.f;
|
| + gfx::PointF start_point(kStart, 0.f);
|
| + gfx::PointF end_point(kEnd, 0.f);
|
| ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, start_point, start_point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| ui::MouseEvent click_b(ui::ET_MOUSE_PRESSED, end_point, end_point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| - ui::MouseEvent drag_left(ui::ET_MOUSE_DRAGGED, gfx::Point(), gfx::Point(),
|
| + ui::MouseEvent drag_left(ui::ET_MOUSE_DRAGGED, gfx::PointF(), gfx::PointF(),
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
|
| ui::MouseEvent drag_right(ui::ET_MOUSE_DRAGGED, end_point, end_point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
|
| @@ -1292,8 +1292,9 @@ TEST_F(TextfieldTest, DragAndDrop_InitiateDrag) {
|
| textfield_->GetDragOperationsForView(NULL, kStringPoint));
|
| textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
|
| // Ensure that textfields only initiate drag operations inside the selection.
|
| - ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, kStringPoint, kStringPoint,
|
| - ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| + ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, gfx::PointF(kStringPoint),
|
| + gfx::PointF(kStringPoint), ui::EventTimeForNow(),
|
| + ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| textfield_->OnMousePressed(press_event);
|
| EXPECT_EQ(ui::DragDropTypes::DRAG_NONE,
|
| @@ -1321,7 +1322,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheRight) {
|
|
|
| // Start dragging "ello".
|
| textfield_->SelectRange(gfx::Range(1, 5));
|
| - gfx::Point point(GetCursorPositionX(3), 0);
|
| + gfx::PointF point(GetCursorPositionX(3), 0.f);
|
| ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -1340,7 +1341,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheRight) {
|
| EXPECT_TRUE(custom_formats.empty());
|
|
|
| // Drop "ello" after "w".
|
| - const gfx::Point kDropPoint(GetCursorPositionX(7), 0);
|
| + const gfx::PointF kDropPoint(GetCursorPositionX(7), 0.f);
|
| EXPECT_TRUE(textfield_->CanDrop(data));
|
| ui::DropTargetEvent drop_a(data, kDropPoint, kDropPoint, operations);
|
| EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a));
|
| @@ -1375,7 +1376,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheLeft) {
|
|
|
| // Start dragging " worl".
|
| textfield_->SelectRange(gfx::Range(5, 10));
|
| - gfx::Point point(GetCursorPositionX(7), 0);
|
| + gfx::PointF point(GetCursorPositionX(7), 0);
|
| ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -1395,7 +1396,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheLeft) {
|
|
|
| // Drop " worl" after "h".
|
| EXPECT_TRUE(textfield_->CanDrop(data));
|
| - gfx::Point drop_point(GetCursorPositionX(1), 0);
|
| + gfx::PointF drop_point(GetCursorPositionX(1), 0);
|
| ui::DropTargetEvent drop_a(data, drop_point, drop_point, operations);
|
| EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a));
|
| EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnPerformDrop(drop_a));
|
| @@ -1423,7 +1424,7 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) {
|
|
|
| // Start dragging "worl".
|
| textfield_->SelectRange(gfx::Range(6, 10));
|
| - gfx::Point point(GetCursorPositionX(8), 0);
|
| + gfx::PointF point(GetCursorPositionX(8), 0);
|
| ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -1432,12 +1433,12 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) {
|
| textfield_->WriteDragDataForView(NULL, click.location(), &data);
|
| EXPECT_TRUE(textfield_->CanDrop(data));
|
| // Drag the text over somewhere valid, outside the current selection.
|
| - gfx::Point drop_point(GetCursorPositionX(2), 0);
|
| + gfx::PointF drop_point(GetCursorPositionX(2), 0.f);
|
| ui::DropTargetEvent drop(data, drop_point, drop_point,
|
| ui::DragDropTypes::DRAG_MOVE);
|
| EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop));
|
| // "Cancel" the drag, via move and release over the selection, and OnDragDone.
|
| - gfx::Point drag_point(GetCursorPositionX(9), 0);
|
| + gfx::PointF drag_point(GetCursorPositionX(9), 0.f);
|
| ui::MouseEvent drag(ui::ET_MOUSE_DRAGGED, drag_point, drag_point,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
|
| ui::MouseEvent release(ui::ET_MOUSE_RELEASED, drag_point, drag_point,
|
| @@ -2213,12 +2214,12 @@ TEST_F(TextfieldTest, KeepInitiallySelectedWord) {
|
| textfield_->SelectRange(gfx::Range(5, 5));
|
| const gfx::Rect middle_cursor = GetCursorBounds();
|
| textfield_->SelectRange(gfx::Range(0, 0));
|
| - const gfx::Point beginning = GetCursorBounds().origin();
|
| + const auto beginning = gfx::PointF(GetCursorBounds().origin());
|
|
|
| // Double click, but do not release the left button.
|
| MouseClick(middle_cursor, 0);
|
| - const gfx::Point middle(middle_cursor.x(),
|
| - middle_cursor.y() + middle_cursor.height() / 2);
|
| + const gfx::PointF middle(middle_cursor.x(),
|
| + middle_cursor.y() + middle_cursor.height() / 2);
|
| ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, middle, middle,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
| @@ -2237,10 +2238,10 @@ TEST_F(TextfieldTest, KeepInitiallySelectedWord) {
|
| TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
|
| InitTextfield();
|
| textfield_->SetText(ASCIIToUTF16("0123"));
|
| - gfx::Point point_1(GetCursorPositionX(1), 0);
|
| - gfx::Point point_2(GetCursorPositionX(2), 0);
|
| - gfx::Point point_3(GetCursorPositionX(3), 0);
|
| - gfx::Point point_4(GetCursorPositionX(4), 0);
|
| + gfx::PointF point_1(GetCursorPositionX(1), 0.f);
|
| + gfx::PointF point_2(GetCursorPositionX(2), 0.f);
|
| + gfx::PointF point_3(GetCursorPositionX(3), 0.f);
|
| + gfx::PointF point_4(GetCursorPositionX(4), 0.f);
|
|
|
| // Text selected by the mouse should be placed on the selection clipboard.
|
| ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point_1, point_1,
|
| @@ -2338,7 +2339,7 @@ TEST_F(TextfieldTest, DISABLED_SelectionClipboard) {
|
|
|
| // Double and triple clicking should update the clipboard contents.
|
| textfield_->SetText(ASCIIToUTF16("ab cd ef"));
|
| - gfx::Point word(GetCursorPositionX(4), 0);
|
| + gfx::PointF word(GetCursorPositionX(4), 0.f);
|
| ui::MouseEvent press_word(ui::ET_MOUSE_PRESSED, word, word,
|
| ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON);
|
|
|