diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:21:14 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:21:14 +0000 |
commit | aa351ca8d4ec607d94b1559bb78b46d8301daf1b (patch) | |
tree | fad1e2da20e07f483ff3a45ddc4c79a9fc8cccdb /ui/gfx/render_text_unittest.cc | |
parent | 9edeb71c75df9eed63d4e27e90c2ddfc287049b8 (diff) | |
download | chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.zip chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.tar.gz chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.tar.bz2 |
Revert 102006 - fix know issues in RenderText
1. add tests.
2. change SelectWord() to use BreakIterator, so it works for Chinese and Complex script.
3. DELETE/ReplaceChar delete/replace a whole grapheme. ReplaceTextInternal should only replace one grapheme when there is no selection.
4. pointing to position outside of text returns HOME/END position.
5. based on Chrome Linux omnibox and gedit, given
"abc| def", double click should select " " instead of "abc". Change test expectation.
BUG=90426
TEST=compile with touchui=1 test omnibox. run views_unittests.NativeTextfieldViewsTest/TextfieldViewsModelTest
Review URL: http://codereview.chromium.org/7841056
TBR=xji@google.com
Review URL: http://codereview.chromium.org/7982013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_unittest.cc')
-rw-r--r-- | ui/gfx/render_text_unittest.cc | 337 |
1 files changed, 14 insertions, 323 deletions
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 6898537..26389df 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -15,14 +15,14 @@ class RenderTextTest : public testing::Test { TEST_F(RenderTextTest, DefaultStyle) { // Defaults to empty text with no styles. - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); + scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateRenderText()); EXPECT_TRUE(render_text->text().empty()); EXPECT_TRUE(render_text->style_ranges().empty()); // Test that the built-in default style is applied for new text. render_text->SetText(ASCIIToUTF16("abc")); EXPECT_EQ(1U, render_text->style_ranges().size()); - StyleRange style; + gfx::StyleRange style; EXPECT_EQ(style.font.GetFontName(), render_text->style_ranges()[0].font.GetFontName()); EXPECT_EQ(style.foreground, render_text->style_ranges()[0].foreground); @@ -38,8 +38,8 @@ TEST_F(RenderTextTest, DefaultStyle) { TEST_F(RenderTextTest, CustomDefaultStyle) { // Test a custom default style. - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - StyleRange color; + scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateRenderText()); + gfx::StyleRange color; color.foreground = SK_ColorRED; render_text->set_default_style(color); render_text->SetText(ASCIIToUTF16("abc")); @@ -54,7 +54,7 @@ TEST_F(RenderTextTest, CustomDefaultStyle) { EXPECT_EQ(color.foreground, render_text->style_ranges()[0].foreground); // Test ApplyDefaultStyle after setting a new default. - StyleRange strike; + gfx::StyleRange strike; strike.strike = true; render_text->set_default_style(strike); render_text->ApplyDefaultStyle(); @@ -64,24 +64,24 @@ TEST_F(RenderTextTest, CustomDefaultStyle) { } TEST_F(RenderTextTest, ApplyStyleRange) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); + scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateRenderText()); render_text->SetText(ASCIIToUTF16("01234")); EXPECT_EQ(1U, render_text->style_ranges().size()); // Test ApplyStyleRange (no-op on empty range). - StyleRange empty; + gfx::StyleRange empty; empty.range = ui::Range(1, 1); render_text->ApplyStyleRange(empty); EXPECT_EQ(1U, render_text->style_ranges().size()); // Test ApplyStyleRange (no-op on invalid range). - StyleRange invalid; + gfx::StyleRange invalid; invalid.range = ui::Range::InvalidRange(); render_text->ApplyStyleRange(invalid); EXPECT_EQ(1U, render_text->style_ranges().size()); // Apply a style with a range contained by an existing range. - StyleRange underline; + gfx::StyleRange underline; underline.underline = true; underline.range = ui::Range(2, 3); render_text->ApplyStyleRange(underline); @@ -94,7 +94,7 @@ TEST_F(RenderTextTest, ApplyStyleRange) { EXPECT_FALSE(render_text->style_ranges()[2].underline); // Apply a style with a range equal to another range. - StyleRange color; + gfx::StyleRange color; color.foreground = SK_ColorWHITE; color.range = ui::Range(2, 3); render_text->ApplyStyleRange(color); @@ -111,7 +111,7 @@ TEST_F(RenderTextTest, ApplyStyleRange) { // Apply a style with a range containing an existing range. // This new style also overlaps portions of neighboring ranges. - StyleRange strike; + gfx::StyleRange strike; strike.strike = true; strike.range = ui::Range(1, 4); render_text->ApplyStyleRange(strike); @@ -124,7 +124,7 @@ TEST_F(RenderTextTest, ApplyStyleRange) { EXPECT_FALSE(render_text->style_ranges()[2].strike); // Apply a style overlapping all ranges. - StyleRange strike_underline; + gfx::StyleRange strike_underline; strike_underline.strike = true; strike_underline.underline = true; strike_underline.range = ui::Range(0, render_text->text().length()); @@ -144,7 +144,7 @@ TEST_F(RenderTextTest, ApplyStyleRange) { TEST_F(RenderTextTest, StyleRangesAdjust) { // Test that style ranges adjust to the text size. - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); + scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateRenderText()); render_text->SetText(ASCIIToUTF16("abcdef")); EXPECT_EQ(1U, render_text->style_ranges().size()); EXPECT_EQ(ui::Range(0, 6), render_text->style_ranges()[0].range); @@ -155,7 +155,7 @@ TEST_F(RenderTextTest, StyleRangesAdjust) { EXPECT_EQ(ui::Range(0, 3), render_text->style_ranges()[0].range); // Test that the last range extends to the length of longer text. - StyleRange strike; + gfx::StyleRange strike; strike.strike = true; strike.range = ui::Range(2, 3); render_text->ApplyStyleRange(strike); @@ -178,313 +178,4 @@ TEST_F(RenderTextTest, StyleRangesAdjust) { EXPECT_FALSE(render_text->style_ranges()[0].strike); } -void RunMoveCursorLeftRightTest(RenderText* render_text, - const std::vector<SelectionModel>& expected, - bool move_right) { - for (int i = 0; i < static_cast<int>(expected.size()); ++i) { - SelectionModel sel = expected[i]; - EXPECT_TRUE(render_text->selection_model().Equals(sel)); - if (move_right) - render_text->MoveCursorRight(CHARACTER_BREAK, false); - else - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - } - - SelectionModel sel = expected[expected.size() - 1]; - if (move_right) - render_text->MoveCursorRight(LINE_BREAK, false); - else - render_text->MoveCursorLeft(LINE_BREAK, false); - EXPECT_TRUE(render_text->selection_model().Equals(sel)); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInLtr) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - - // Pure LTR. - render_text->SetText(ASCIIToUTF16("abc")); - // |expected| saves the expected SelectionModel when moving cursor from left - // to right. - std::vector<SelectionModel> expected; - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - // The last element is to test the clamped line ends. - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, true); - - expected.clear(); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, false); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInLtrRtl) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - // LTR-RTL - render_text->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); - // The last one is the expected END position. - std::vector<SelectionModel> expected; - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 5, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 4, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, true); - - expected.clear(); - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 3, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 4, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(6, 5, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, false); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInLtrRtlLtr) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - // LTR-RTL-LTR. - render_text->SetText(WideToUTF16(L"a"L"\x05d1"L"b")); - std::vector<SelectionModel> expected; - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, true); - - expected.clear(); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - RunMoveCursorLeftRightTest(render_text.get(), expected, false); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInRtl) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - // Pure RTL. - render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2")); - render_text->MoveCursorRight(LINE_BREAK, false); - std::vector<SelectionModel> expected; - -#if defined(OS_LINUX) - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); -#else - expected.push_back(SelectionModel(3, 0, SelectionModel::LEADING)); -#endif - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); -#if defined(OS_LINUX) - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); -#else - expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); - // TODO(xji): expected (0, 2, TRAILING), actual (3, 0, LEADING). - // cursor moves from leftmost to rightmost. - // expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); -#endif - RunMoveCursorLeftRightTest(render_text.get(), expected, false); - - expected.clear(); - -#if defined(OS_LINUX) - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); -#else - expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); -#endif - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); -#if defined(OS_LINUX) - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); -#else - expected.push_back(SelectionModel(3, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 0, SelectionModel::LEADING)); -#endif - RunMoveCursorLeftRightTest(render_text.get(), expected, true); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtr) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - // RTL-LTR - render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2"L"abc")); - render_text->MoveCursorRight(LINE_BREAK, false); - std::vector<SelectionModel> expected; -#if defined(OS_LINUX) - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 5, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 4, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); -#else - expected.push_back(SelectionModel(6, 5, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 5, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 4, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); - // TODO(xji): expected (0, 2, TRAILING), actual (3, 0, LEADING). - // cursor moves from leftmost to middle. - // expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); -#endif - - RunMoveCursorLeftRightTest(render_text.get(), expected, false); - - expected.clear(); -#if defined(OS_LINUX) - expected.push_back(SelectionModel(6, 3, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 3, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 4, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(6, 5, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); -#else - expected.push_back(SelectionModel(0, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(4, 3, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(5, 4, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(6, 5, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(6, 5, SelectionModel::TRAILING)); -#endif - RunMoveCursorLeftRightTest(render_text.get(), expected, true); -} - -TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtrRtl) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - // RTL-LTR-RTL. - render_text->SetText(WideToUTF16(L"\x05d0"L"a"L"\x05d1")); - render_text->MoveCursorRight(LINE_BREAK, false); - std::vector<SelectionModel> expected; -#if defined(OS_LINUX) - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); -#else - expected.push_back(SelectionModel(3, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(1, 1, SelectionModel::LEADING)); - expected.push_back(SelectionModel(1, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::TRAILING)); - // TODO(xji): expected (0, 0, TRAILING), actual (2, 1, LEADING). - // cursor moves from leftmost to middle. - // expected.push_back(SelectionModel(0, 0, SelectionModel::TRAILING)); -#endif - RunMoveCursorLeftRightTest(render_text.get(), expected, false); - - expected.clear(); -#if defined(OS_LINUX) - expected.push_back(SelectionModel(3, 2, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); -#else - expected.push_back(SelectionModel(0, 0, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(0, 0, SelectionModel::LEADING)); - expected.push_back(SelectionModel(2, 1, SelectionModel::TRAILING)); - expected.push_back(SelectionModel(2, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::LEADING)); - expected.push_back(SelectionModel(3, 2, SelectionModel::LEADING)); -#endif - RunMoveCursorLeftRightTest(render_text.get(), expected, true); -} - -// TODO(xji): temporarily disable in platform Win since the complex script -// characters turned into empty square due to font regression. So, not able -// to test 2 characters belong to the same grapheme. -#if defined(OS_LINUX) -TEST_F(RenderTextTest, MoveCursorLeftRight_ComplexScript) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - - render_text->SetText(WideToUTF16(L"\x0915\x093f\x0915\x094d\x0915")); - EXPECT_EQ(0U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(2U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(4U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(4U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(2U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(0U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(0U, render_text->GetCursorPosition()); -} -#endif - -TEST_F(RenderTextTest, MoveCursorLeftRightWithSelection) { - scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); - render_text->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); - // Left arrow on select ranging (6, 4). - render_text->MoveCursorRight(LINE_BREAK, false); - EXPECT_EQ(6U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(4U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(6U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, true); - EXPECT_EQ(6U, render_text->GetSelectionStart()); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, true); - EXPECT_EQ(6U, render_text->GetSelectionStart()); - EXPECT_EQ(4U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, false); - EXPECT_EQ(6U, render_text->GetCursorPosition()); - - // Right arrow on select ranging (4, 6). - render_text->MoveCursorLeft(LINE_BREAK, false); - EXPECT_EQ(0U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(1U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(2U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(3U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(4U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, true); - EXPECT_EQ(4U, render_text->GetSelectionStart()); - EXPECT_EQ(5U, render_text->GetCursorPosition()); - render_text->MoveCursorLeft(CHARACTER_BREAK, true); - EXPECT_EQ(4U, render_text->GetSelectionStart()); - EXPECT_EQ(6U, render_text->GetCursorPosition()); - render_text->MoveCursorRight(CHARACTER_BREAK, false); - EXPECT_EQ(4U, render_text->GetCursorPosition()); -} - } // namespace gfx |