OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 textfield_text += textfield_text; | 546 textfield_text += textfield_text; |
547 textfield_->SetText(ASCIIToUTF16(textfield_text)); | 547 textfield_->SetText(ASCIIToUTF16(textfield_text)); |
548 | 548 |
549 // Tap the textfield to invoke selection. | 549 // Tap the textfield to invoke selection. |
550 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); | 550 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); |
551 details.set_tap_count(1); | 551 details.set_tap_count(1); |
552 ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); | 552 ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), details); |
553 textfield_->OnGestureEvent(&tap); | 553 textfield_->OnGestureEvent(&tap); |
554 | 554 |
555 // Select some text such that one handle is hidden. | 555 // Select some text such that one handle is hidden. |
556 textfield_->SelectRange(gfx::Range(10, textfield_text.length())); | 556 textfield_->SelectRange( |
| 557 gfx::Range(10u, static_cast<uint32_t>(textfield_text.length()))); |
557 | 558 |
558 // Check that one selection handle is hidden. | 559 // Check that one selection handle is hidden. |
559 EXPECT_FALSE(IsSelectionHandle1Visible()); | 560 EXPECT_FALSE(IsSelectionHandle1Visible()); |
560 EXPECT_TRUE(IsSelectionHandle2Visible()); | 561 EXPECT_TRUE(IsSelectionHandle2Visible()); |
561 EXPECT_EQ(gfx::Range(10, textfield_text.length()), | 562 EXPECT_EQ( |
562 textfield_->GetSelectedRange()); | 563 gfx::Range(10u, static_cast<uint32_t>(textfield_text.length())), |
| 564 textfield_->GetSelectedRange()); |
563 | 565 |
564 // Drag the visible handle around and make sure the selection end point of the | 566 // Drag the visible handle around and make sure the selection end point of the |
565 // invisible handle does not change. | 567 // invisible handle does not change. |
566 size_t visible_handle_position = textfield_->GetSelectedRange().end(); | 568 size_t visible_handle_position = textfield_->GetSelectedRange().end(); |
567 for (int i = 0; i < 10; ++i) { | 569 for (int i = 0; i < 10; ++i) { |
568 static const int drag_diff = -10; | 570 static const int drag_diff = -10; |
569 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2); | 571 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2); |
570 // Make sure that the visible handle is being dragged. | 572 // Make sure that the visible handle is being dragged. |
571 EXPECT_NE(visible_handle_position, textfield_->GetSelectedRange().end()); | 573 EXPECT_NE(visible_handle_position, textfield_->GetSelectedRange().end()); |
572 visible_handle_position = textfield_->GetSelectedRange().end(); | 574 visible_handle_position = textfield_->GetSelectedRange().end(); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 // Start touch editing; then press a key and ensure it deactivates touch | 837 // Start touch editing; then press a key and ensure it deactivates touch |
836 // selection. | 838 // selection. |
837 StartTouchEditing(); | 839 StartTouchEditing(); |
838 EXPECT_TRUE(GetSelectionController()); | 840 EXPECT_TRUE(GetSelectionController()); |
839 generator.PressKey(ui::VKEY_A, 0); | 841 generator.PressKey(ui::VKEY_A, 0); |
840 RunPendingMessages(); | 842 RunPendingMessages(); |
841 EXPECT_FALSE(GetSelectionController()); | 843 EXPECT_FALSE(GetSelectionController()); |
842 } | 844 } |
843 | 845 |
844 } // namespace views | 846 } // namespace views |
OLD | NEW |