summaryrefslogtreecommitdiffstats
path: root/ui/views/touchui
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-20 22:12:43 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-20 22:12:43 +0000
commit1e56e29f910ead7011324112194ffbdb3319f394 (patch)
tree9a881fbecb37513be9fb5b7c6a303bcac84b5a60 /ui/views/touchui
parent5e62116ae01b50c75713a0b2d51c48f1c4e2f141 (diff)
downloadchromium_src-1e56e29f910ead7011324112194ffbdb3319f394.zip
chromium_src-1e56e29f910ead7011324112194ffbdb3319f394.tar.gz
chromium_src-1e56e29f910ead7011324112194ffbdb3319f394.tar.bz2
Enable unittests for TouchSelectionController.
BUG=176717,115237 Review URL: https://chromiumcodereview.appspot.com/12288024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/touchui')
-rw-r--r--ui/views/touchui/touch_selection_controller_impl.cc8
-rw-r--r--ui/views/touchui/touch_selection_controller_impl.h2
-rw-r--r--ui/views/touchui/touch_selection_controller_impl_unittest.cc214
3 files changed, 148 insertions, 76 deletions
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc
index 9ce4b7a..59cc211 100644
--- a/ui/views/touchui/touch_selection_controller_impl.cc
+++ b/ui/views/touchui/touch_selection_controller_impl.cc
@@ -376,6 +376,10 @@ gfx::Point TouchSelectionControllerImpl::GetSelectionHandle2Position() {
return selection_handle_2_->GetScreenPosition();
}
+gfx::Point TouchSelectionControllerImpl::GetCursorHandlePosition() {
+ return cursor_handle_->GetScreenPosition();
+}
+
bool TouchSelectionControllerImpl::IsSelectionHandle1Visible() {
return selection_handle_1_->visible();
}
@@ -384,6 +388,10 @@ bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() {
return selection_handle_2_->visible();
}
+bool TouchSelectionControllerImpl::IsCursorHandleVisible() {
+ return cursor_handle_->visible();
+}
+
ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() {
}
diff --git a/ui/views/touchui/touch_selection_controller_impl.h b/ui/views/touchui/touch_selection_controller_impl.h
index 1aff892..8c2cd77 100644
--- a/ui/views/touchui/touch_selection_controller_impl.h
+++ b/ui/views/touchui/touch_selection_controller_impl.h
@@ -71,8 +71,10 @@ class VIEWS_EXPORT TouchSelectionControllerImpl
// Convenience methods for testing.
gfx::Point GetSelectionHandle1Position();
gfx::Point GetSelectionHandle2Position();
+ gfx::Point GetCursorHandlePosition();
bool IsSelectionHandle1Visible();
bool IsSelectionHandle2Visible();
+ bool IsCursorHandleVisible();
ui::TouchEditable* client_view_;
Widget* client_widget_;
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
index 8deba19..1a191f7 100644
--- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc
+++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "base/utf_string_conversions.h"
+#include "ui/base/touch/touch_editing_controller.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/render_text.h"
#include "ui/views/controls/textfield/native_textfield_views.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/views_test_base.h"
-#include "ui/views/touchui/touch_selection_controller.h"
#include "ui/views/touchui/touch_selection_controller_impl.h"
#include "ui/views/widget/widget.h"
@@ -20,7 +22,15 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
TouchSelectionControllerImplTest()
: widget_(NULL),
textfield_(NULL),
- textfield_view_(NULL) {
+ textfield_view_(NULL),
+ views_tsc_factory_(new ViewsTouchSelectionControllerFactory) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableTouchEditing);
+ ui::TouchSelectionControllerFactory::SetInstance(views_tsc_factory_.get());
+ }
+
+ virtual ~TouchSelectionControllerImplTest() {
+ ui::TouchSelectionControllerFactory::SetInstance(NULL);
}
virtual void TearDown() {
@@ -32,7 +42,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
void CreateTextfield() {
textfield_ = new Textfield();
widget_ = new Widget;
- Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
params.bounds = gfx::Rect(0, 0, 200, 200);
widget_->Init(params);
View* container = new View();
@@ -52,7 +62,7 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
gfx::Point GetCursorPosition(const gfx::SelectionModel& sel) {
gfx::RenderText* render_text = textfield_view_->GetRenderText();
gfx::Rect cursor_bounds = render_text->GetCursorBounds(sel, true);
- return gfx::Point(cursor_bounds.x(), cursor_bounds.bottom() - 1);
+ return gfx::Point(cursor_bounds.x(), cursor_bounds.y());
}
TouchSelectionControllerImpl* GetSelectionController() {
@@ -64,9 +74,9 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
TouchSelectionControllerImpl* controller = GetSelectionController();
// Do the work of OnMousePressed().
if (selection_handle == 1)
- controller->dragging_handle_ = controller->selection_handle_1_.get();
+ controller->SetDraggingHandle(controller->selection_handle_1_.get());
else
- controller->dragging_handle_ = controller->selection_handle_2_.get();
+ controller->SetDraggingHandle(controller->selection_handle_2_.get());
controller->SelectionHandleDragged(p);
@@ -74,115 +84,159 @@ class TouchSelectionControllerImplTest : public ViewsTestBase {
controller->dragging_handle_ = NULL;
}
- // If textfield has selection, this method verifies that the selection handles
- // are visible and at the correct positions (at the end points of selection).
- // |cursor_at_selection_handle_1| is used to decide whether selection
- // handle 1's position is matched against the start of selection or the end.
- void VerifySelectionHandlePositions(bool cursor_at_selection_handle_1) {
- if (textfield_->HasSelection()) {
- EXPECT_TRUE(GetSelectionController()->IsSelectionHandle1Visible());
- EXPECT_TRUE(GetSelectionController()->IsSelectionHandle2Visible());
- gfx::SelectionModel sel;
- textfield_view_->GetSelectionModel(&sel);
- gfx::SelectionModel sel_start = textfield_view_->GetRenderText()->
- GetSelectionModelForSelectionStart();
- gfx::Point selection_start = GetCursorPosition(sel_start);
- gfx::Point selection_end = GetCursorPosition(sel);
- gfx::Point sh1 = GetSelectionController()->GetSelectionHandle1Position();
- gfx::Point sh2 = GetSelectionController()->GetSelectionHandle2Position();
- sh1.Offset(10, 0); // offset by kSelectionHandleRadius.
- sh2.Offset(10, 0);
-
- if (cursor_at_selection_handle_1) {
- EXPECT_EQ(sh1, selection_end);
- EXPECT_EQ(sh2, selection_start);
- } else {
- EXPECT_EQ(sh1, selection_start);
- EXPECT_EQ(sh2, selection_end);
- }
- } else {
- EXPECT_FALSE(GetSelectionController()->IsSelectionHandle1Visible());
- EXPECT_FALSE(GetSelectionController()->IsSelectionHandle2Visible());
- }
+ gfx::Point GetSelectionHandle1Position() {
+ return GetSelectionController()->GetSelectionHandle1Position();
+ }
+
+ gfx::Point GetSelectionHandle2Position() {
+ return GetSelectionController()->GetSelectionHandle2Position();
+ }
+
+ gfx::Point GetCursorHandlePosition() {
+ return GetSelectionController()->GetCursorHandlePosition();
+ }
+
+ bool IsSelectionHandle1Visible() {
+ return GetSelectionController()->IsSelectionHandle1Visible();
+ }
+
+ bool IsSelectionHandle2Visible() {
+ return GetSelectionController()->IsSelectionHandle2Visible();
+ }
+
+ bool IsCursorHandleVisible() {
+ return GetSelectionController()->IsCursorHandleVisible();
+ }
+
+ gfx::RenderText* GetRenderText() {
+ return textfield_view_->GetRenderText();
}
Widget* widget_;
Textfield* textfield_;
NativeTextfieldViews* textfield_view_;
+ scoped_ptr<ViewsTouchSelectionControllerFactory> views_tsc_factory_;
private:
DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImplTest);
};
+// If textfield has selection, this macro verifies that the selection handles
+// are visible and at the correct positions (at the end points of selection).
+// |cursor_at_selection_handle_1| is used to decide whether selection
+// handle 1's position is matched against the start of selection or the end.
+#define VERIFY_HANDLE_POSITIONS(cursor_at_selection_handle_1) \
+{ \
+ gfx::SelectionModel sel = textfield_view_->GetSelectionModel(); \
+ if (textfield_->HasSelection()) { \
+ EXPECT_TRUE(IsSelectionHandle1Visible()); \
+ EXPECT_TRUE(IsSelectionHandle2Visible()); \
+ EXPECT_FALSE(IsCursorHandleVisible()); \
+ gfx::SelectionModel sel_start = GetRenderText()-> \
+ GetSelectionModelForSelectionStart(); \
+ gfx::Point selection_start = GetCursorPosition(sel_start); \
+ gfx::Point selection_end = GetCursorPosition(sel); \
+ gfx::Point sh1 = GetSelectionHandle1Position(); \
+ gfx::Point sh2 = GetSelectionHandle2Position(); \
+ sh1.Offset(10, 0); \
+ sh2.Offset(10, 0); \
+ if (cursor_at_selection_handle_1) { \
+ EXPECT_EQ(sh1, selection_end); \
+ EXPECT_EQ(sh2, selection_start); \
+ } else { \
+ EXPECT_EQ(sh1, selection_start); \
+ EXPECT_EQ(sh2, selection_end); \
+ } \
+ } else { \
+ EXPECT_FALSE(IsSelectionHandle1Visible()); \
+ EXPECT_FALSE(IsSelectionHandle2Visible()); \
+ EXPECT_TRUE(IsCursorHandleVisible()); \
+ gfx::Point cursor_pos = GetCursorPosition(sel); \
+ gfx::Point ch_pos = GetCursorHandlePosition(); \
+ ch_pos.Offset(10, 0); \
+ EXPECT_EQ(ch_pos, cursor_pos); \
+ } \
+}
+
// Tests that the selection handles are placed appropriately when selection in
// a Textfield changes.
TEST_F(TouchSelectionControllerImplTest, SelectionInTextfieldTest) {
CreateTextfield();
textfield_->SetText(ASCIIToUTF16("some text"));
+ // Tap the textfield to invoke touch selection.
+ ui::GestureEvent tap(ui::ET_GESTURE_TAP, 0, 0, 0, base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f), 0);
+ textfield_view_->OnGestureEvent(&tap);
// Test selecting a range.
textfield_->SelectRange(ui::Range(3, 7));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Test selecting everything.
- textfield_->SelectAll();
- VerifySelectionHandlePositions(false);
+ textfield_->SelectAll(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Test with no selection.
textfield_->ClearSelection();
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Test with lost focus.
widget_->GetFocusManager()->ClearFocus();
- VerifySelectionHandlePositions(false);
+ EXPECT_FALSE(GetSelectionController());
// Test with focus re-gained.
widget_->GetFocusManager()->SetFocusedView(textfield_);
- VerifySelectionHandlePositions(false);
+ EXPECT_FALSE(GetSelectionController());
+ textfield_view_->OnGestureEvent(&tap);
+ VERIFY_HANDLE_POSITIONS(false);
}
// Tests that the selection handles are placed appropriately in bidi text.
TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) {
CreateTextfield();
textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2"));
+ // Tap the textfield to invoke touch selection.
+ ui::GestureEvent tap(ui::ET_GESTURE_TAP, 0, 0, 0, base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f), 0);
+ textfield_view_->OnGestureEvent(&tap);
// Test cursor at run boundary and with empty selection.
textfield_->SelectSelectionModel(
gfx::SelectionModel(3, gfx::CURSOR_BACKWARD));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Test selection range inside one run and starts or ends at run boundary.
textfield_->SelectRange(ui::Range(2, 3));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(3, 2));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(3, 4));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(4, 3));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(3, 6));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(6, 3));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Test selection range accross runs.
textfield_->SelectRange(ui::Range(0, 6));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(6, 0));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(1, 4));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
textfield_->SelectRange(ui::Range(4, 1));
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
}
// Tests if the SelectRect callback is called appropriately when selection
@@ -190,78 +244,86 @@ TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) {
TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) {
CreateTextfield();
textfield_->SetText(ASCIIToUTF16("textfield with selected text"));
+ // Tap the textfield to invoke touch selection.
+ ui::GestureEvent tap(ui::ET_GESTURE_TAP, 0, 0, 0, base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f), 0);
+ textfield_view_->OnGestureEvent(&tap);
textfield_->SelectRange(ui::Range(3, 7));
EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "tfie");
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 2 to right by 3 chars.
int x = textfield_->font().GetStringWidth(ASCIIToUTF16("ld "));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 2);
EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "tfield ");
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 1 to the left by a large amount (selection should
// just stick to the beginning of the textfield).
SimulateSelectionHandleDrag(gfx::Point(-50, 0), 1);
EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "textfield ");
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Drag selection handle 1 across selection handle 2.
x = textfield_->font().GetStringWidth(ASCIIToUTF16("textfield with "));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 1);
EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "with ");
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Drag selection handle 2 across selection handle 1.
x = textfield_->font().GetStringWidth(ASCIIToUTF16("with selected "));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 2);
EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "selected ");
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
}
TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) {
CreateTextfield();
textfield_->SetText(WideToUTF16(L"abc\x05e1\x05e2\x05e3"L"def"));
+ // Tap the textfield to invoke touch selection.
+ ui::GestureEvent tap(ui::ET_GESTURE_TAP, 0, 0, 0, base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0.0f, 0.0f), 0);
+ textfield_view_->OnGestureEvent(&tap);
// Select [c] from left to right.
textfield_->SelectRange(ui::Range(2, 3));
EXPECT_EQ(WideToUTF16(L"c"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 2 to right by 1 char.
int x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e3"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 2);
EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 1 to left by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"b"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1);
EXPECT_EQ(WideToUTF16(L"bc\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Select [c] from right to left.
textfield_->SelectRange(ui::Range(3, 2));
EXPECT_EQ(WideToUTF16(L"c"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 1 to right by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e3"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 1);
EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Drag selection handle 2 to left by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"b"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2);
EXPECT_EQ(WideToUTF16(L"bc\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Select [\x5e1] from right to left.
textfield_->SelectRange(ui::Range(3, 4));
EXPECT_EQ(WideToUTF16(L"\x05e1"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
/* TODO(xji): for bidi text "abcDEF" whose display is "abcFEDhij", when click
right of 'D' and select [D] then move the left selection handle to left
@@ -275,67 +337,67 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) {
x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2);
EXPECT_EQ(WideToUTF16(L"\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
*/
// Drag selection handle 1 to right by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"d"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 1);
EXPECT_EQ(WideToUTF16(L"\x05e2\x05e3"L"d"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Select [\x5e1] from left to right.
textfield_->SelectRange(ui::Range(4, 3));
EXPECT_EQ(WideToUTF16(L"\x05e1"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
/* TODO(xji): see detail of above commented out test case.
// Drag selection handle 1 to left by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1);
EXPECT_EQ(WideToUTF16(L"\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
*/
// Drag selection handle 2 to right by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"d"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 2);
EXPECT_EQ(WideToUTF16(L"\x05e2\x05e3"L"d"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Select [\x05r3] from right to left.
textfield_->SelectRange(ui::Range(5, 6));
EXPECT_EQ(WideToUTF16(L"\x05e3"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 2 to left by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"c"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2);
EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 1 to right by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 1);
EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Select [\x05r3] from left to right.
textfield_->SelectRange(ui::Range(6, 5));
EXPECT_EQ(WideToUTF16(L"\x05e3"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
// Drag selection handle 1 to left by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"c"));
SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1);
EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(true);
+ VERIFY_HANDLE_POSITIONS(true);
// Drag selection handle 2 to right by 1 char.
x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2"));
SimulateSelectionHandleDrag(gfx::Point(x, 0), 2);
EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText());
- VerifySelectionHandlePositions(false);
+ VERIFY_HANDLE_POSITIONS(false);
}
} // namespace views