Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: views/controls/textfield/textfield_views_model_unittest.cc

Issue 7458014: Implement Uniscribe RenderText for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix RenderText::RightEndSelectionModel. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: views/controls/textfield/textfield_views_model_unittest.cc
diff --git a/views/controls/textfield/textfield_views_model_unittest.cc b/views/controls/textfield/textfield_views_model_unittest.cc
index 51692313396df48de9ce837ae9f0741670bf9381..99721032b0f4e7619eea414b2520f8d67920dc5c 100644
--- a/views/controls/textfield/textfield_views_model_unittest.cc
+++ b/views/controls/textfield/textfield_views_model_unittest.cc
@@ -198,6 +198,23 @@ TEST_F(TextfieldViewsModelTest, Word) {
model.Append(
ASCIIToUTF16("The answer to Life, the Universe, and Everything"));
model.MoveCursorRight(gfx::WORD_BREAK, false);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // Breaks are at "|The |answer |to |Life, |the |Universe, |and |Everything".
+ EXPECT_EQ(4U, model.GetCursorPosition());
+ model.MoveCursorRight(gfx::WORD_BREAK, false);
+ EXPECT_EQ(11U, model.GetCursorPosition());
+ model.MoveCursorRight(gfx::WORD_BREAK, false);
+ model.MoveCursorRight(gfx::WORD_BREAK, false);
+ EXPECT_EQ(20U, model.GetCursorPosition());
+
+ model.MoveCursorLeft(gfx::CHARACTER_BREAK, false);
+ model.MoveCursorLeft(gfx::CHARACTER_BREAK, false);
+ // Should pass the non word char ',', but stop at ", |the |".
+ model.MoveCursorRight(gfx::WORD_BREAK, true);
+ model.MoveCursorRight(gfx::WORD_BREAK, true);
+ model.MoveCursorLeft(gfx::CHARACTER_BREAK, true);
+#else
EXPECT_EQ(3U, model.GetCursorPosition());
model.MoveCursorRight(gfx::WORD_BREAK, false);
EXPECT_EQ(10U, model.GetCursorPosition());
@@ -205,8 +222,9 @@ TEST_F(TextfieldViewsModelTest, Word) {
model.MoveCursorRight(gfx::WORD_BREAK, false);
EXPECT_EQ(18U, model.GetCursorPosition());
- // Should passes the non word char ','
+ // Should pass the non word char ','.
model.MoveCursorRight(gfx::WORD_BREAK, true);
+#endif
EXPECT_EQ(23U, model.GetCursorPosition());
EXPECT_STR_EQ(", the", model.GetSelectedText());
@@ -214,6 +232,11 @@ TEST_F(TextfieldViewsModelTest, Word) {
model.MoveCursorRight(gfx::WORD_BREAK, true);
model.MoveCursorRight(gfx::WORD_BREAK, true);
model.MoveCursorRight(gfx::WORD_BREAK, true);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // Breaks are at "|The |answer |to |Life, |the |Universe, |and |Everything".
+ model.MoveCursorRight(gfx::WORD_BREAK, true);
+#endif
EXPECT_STR_EQ(", the Universe, and Everything", model.GetSelectedText());
// Should be safe to go next word at the end.
model.MoveCursorRight(gfx::WORD_BREAK, true);
@@ -375,13 +398,25 @@ TEST_F(TextfieldViewsModelTest, RangeTest) {
EXPECT_FALSE(range.is_empty());
EXPECT_FALSE(range.is_reversed());
EXPECT_EQ(0U, range.start());
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // The current breaks are at "|HELLO |WORLD|".
+ EXPECT_EQ(6U, range.end());
+#else
EXPECT_EQ(5U, range.end());
+#endif
model.MoveCursorLeft(gfx::CHARACTER_BREAK, true);
model.GetSelectedRange(&range);
EXPECT_FALSE(range.is_empty());
EXPECT_EQ(0U, range.start());
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // The current breaks are at "|HELLO |WORLD|".
+ EXPECT_EQ(5U, range.end());
+#else
EXPECT_EQ(4U, range.end());
+#endif
model.MoveCursorLeft(gfx::WORD_BREAK, true);
model.GetSelectedRange(&range);

Powered by Google App Engine
This is Rietveld 408576698