OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "ui/gfx/point.h" | 6 #include "ui/gfx/point.h" |
7 #include "ui/gfx/rect.h" | 7 #include "ui/gfx/rect.h" |
8 #include "ui/gfx/render_text.h" | 8 #include "ui/gfx/render_text.h" |
9 #include "ui/views/controls/textfield/native_textfield_views.h" | 9 #include "ui/views/controls/textfield/native_textfield_views.h" |
10 #include "ui/views/controls/textfield/textfield.h" | 10 #include "ui/views/controls/textfield/textfield.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 VerifySelectionHandlePositions(false); | 142 VerifySelectionHandlePositions(false); |
143 } | 143 } |
144 | 144 |
145 // Tests that the selection handles are placed appropriately in bidi text. | 145 // Tests that the selection handles are placed appropriately in bidi text. |
146 TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) { | 146 TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) { |
147 CreateTextfield(); | 147 CreateTextfield(); |
148 textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); | 148 textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); |
149 | 149 |
150 // Test cursor at run boundary and with empty selection. | 150 // Test cursor at run boundary and with empty selection. |
151 textfield_->SelectSelectionModel( | 151 textfield_->SelectSelectionModel( |
152 gfx::SelectionModel(3, 2, gfx::SelectionModel::TRAILING)); | 152 gfx::SelectionModel(3, gfx::CURSOR_BACKWARD)); |
153 VerifySelectionHandlePositions(false); | 153 VerifySelectionHandlePositions(false); |
154 | 154 |
155 // Test selection range inside one run and starts or ends at run boundary. | 155 // Test selection range inside one run and starts or ends at run boundary. |
156 textfield_->SelectRange(ui::Range(2, 3)); | 156 textfield_->SelectRange(ui::Range(2, 3)); |
157 VerifySelectionHandlePositions(false); | 157 VerifySelectionHandlePositions(false); |
158 | 158 |
159 textfield_->SelectRange(ui::Range(3, 2)); | 159 textfield_->SelectRange(ui::Range(3, 2)); |
160 VerifySelectionHandlePositions(false); | 160 VerifySelectionHandlePositions(false); |
161 | 161 |
162 textfield_->SelectRange(ui::Range(3, 4)); | 162 textfield_->SelectRange(ui::Range(3, 4)); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 VerifySelectionHandlePositions(true); | 332 VerifySelectionHandlePositions(true); |
333 | 333 |
334 // Drag selection handle 2 to right by 1 char. | 334 // Drag selection handle 2 to right by 1 char. |
335 x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2")); | 335 x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2")); |
336 SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); | 336 SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
337 EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText()); | 337 EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText()); |
338 VerifySelectionHandlePositions(false); | 338 VerifySelectionHandlePositions(false); |
339 } | 339 } |
340 | 340 |
341 } // namespace views | 341 } // namespace views |
OLD | NEW |