Chromium Code Reviews| Index: ui/views/touchui/touch_selection_controller_impl_unittest.cc |
| diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc |
| index 9177099817b4d202ad605ab64d50087b11c330bf..2dd02082395bf50eca5c647e6099a61b6d69c561 100644 |
| --- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc |
| +++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc |
| @@ -284,7 +284,7 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 2 to right by 3 chars. |
| - int x = textfield_->font().GetStringWidth(ASCIIToUTF16("ld ")); |
| + int x = textfield_->GetPrimaryFont().GetStringWidth(ASCIIToUTF16("ld ")); |
|
msw
2013/07/30 21:32:27
nit: cache local gfx::Font instances for this test
Yuki
2013/07/31 05:38:43
Done.
|
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
| EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "tfield "); |
| VERIFY_HANDLE_POSITIONS(false); |
| @@ -296,13 +296,15 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(true); |
| // Drag selection handle 1 across selection handle 2. |
| - x = textfield_->font().GetStringWidth(ASCIIToUTF16("textfield with ")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth( |
| + ASCIIToUTF16("textfield with ")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 1); |
| EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "with "); |
| VERIFY_HANDLE_POSITIONS(true); |
| // Drag selection handle 2 across selection handle 1. |
| - x = textfield_->font().GetStringWidth(ASCIIToUTF16("with selected ")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth( |
| + ASCIIToUTF16("with selected ")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
| EXPECT_EQ(UTF16ToUTF8(textfield_->GetSelectedText()), "selected "); |
| VERIFY_HANDLE_POSITIONS(false); |
| @@ -322,13 +324,13 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 2 to right by 1 char. |
| - int x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e3")); |
| + int x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e3")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 1 to left by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"b")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"b")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"bc\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| @@ -339,13 +341,13 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 1 to right by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e3")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e3")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| // Drag selection handle 2 to left by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"b")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"b")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"bc\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |
| @@ -364,14 +366,14 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| Need further investigation on whether this is a bug in Pango and how to |
| work around it. |
| // Drag selection handle 2 to left by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e2")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |
| */ |
| // Drag selection handle 1 to right by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"d")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"d")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"\x05e2\x05e3" L"d"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| @@ -383,14 +385,14 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| /* 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")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e2")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| */ |
| // Drag selection handle 2 to right by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"d")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"d")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"\x05e2\x05e3" L"d"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |
| @@ -401,13 +403,13 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 2 to left by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"c")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"c")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 1 to right by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e2")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| @@ -418,13 +420,13 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { |
| VERIFY_HANDLE_POSITIONS(false); |
| // Drag selection handle 1 to left by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"c")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"c")); |
| SimulateSelectionHandleDrag(gfx::Point(-x, 0), 1); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1\x05e2"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(true); |
| // Drag selection handle 2 to right by 1 char. |
| - x = textfield_->font().GetStringWidth(WideToUTF16(L"\x05e2")); |
| + x = textfield_->GetPrimaryFont().GetStringWidth(WideToUTF16(L"\x05e2")); |
| SimulateSelectionHandleDrag(gfx::Point(x, 0), 2); |
| EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText()); |
| VERIFY_HANDLE_POSITIONS(false); |