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

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

Issue 7458014: Implement Uniscribe RenderText for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Linux build error. 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/native_textfield_views_unittest.cc
diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc
index f6c4e590ab67c6ea3ed87f9b7a5eddef56d10ee3..8a05bd5bff745f740bf657d33b6956dcfde13a79 100644
--- a/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/views/controls/textfield/native_textfield_views_unittest.cc
@@ -295,16 +295,28 @@ TEST_F(NativeTextfieldViewsTest, ControlAndSelectTest) {
// Insert a test string in a textfield.
InitTextfield(Textfield::STYLE_DEFAULT);
textfield_->SetText(ASCIIToUTF16("one two three"));
- SendKeyEvent(ui::VKEY_RIGHT,
- true /* shift */, false /* control */);
+ SendKeyEvent(ui::VKEY_RIGHT, true /* shift */, false /* control */);
SendKeyEvent(ui::VKEY_RIGHT, true, false);
SendKeyEvent(ui::VKEY_RIGHT, true, false);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // Advance past the space to avoid the word break at "one |two three".
+ SendKeyEvent(ui::VKEY_RIGHT, true, false);
+ EXPECT_STR_EQ("one ", textfield_->GetSelectedText());
+#else
EXPECT_STR_EQ("one", textfield_->GetSelectedText());
+#endif
// Test word select.
SendKeyEvent(ui::VKEY_RIGHT, true, true);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // The current breaks are at "|one |two |three|".
+ EXPECT_STR_EQ("one two ", textfield_->GetSelectedText());
+#else
EXPECT_STR_EQ("one two", textfield_->GetSelectedText());
+#endif
SendKeyEvent(ui::VKEY_RIGHT, true, true);
EXPECT_STR_EQ("one two three", textfield_->GetSelectedText());
SendKeyEvent(ui::VKEY_LEFT, true, true);
@@ -382,14 +394,20 @@ TEST_F(NativeTextfieldViewsTest, InsertionDeletionTest) {
textfield_->SetText(ASCIIToUTF16("one two three four"));
SendKeyEvent(ui::VKEY_HOME);
SendKeyEvent(ui::VKEY_DELETE, false, true, false);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // The current word breaks are at "|one |two |three |four|".
+ EXPECT_STR_EQ("two three four", textfield_->text());
+#else
EXPECT_STR_EQ(" two three four", textfield_->text());
+#endif
// Delete upto the end of the buffer from cursor in chromeos, do nothing
// in windows.
SendKeyEvent(ui::VKEY_RIGHT, false, true, false);
SendKeyEvent(ui::VKEY_DELETE, true, true, false);
#if defined(OS_WIN)
- EXPECT_STR_EQ(" two three four", textfield_->text());
+ EXPECT_STR_EQ("two three four", textfield_->text());
#else
EXPECT_STR_EQ(" two", textfield_->text());
#endif
@@ -454,6 +472,11 @@ TEST_F(NativeTextfieldViewsTest, CursorMovement) {
// Ctrl+Right should move the cursor to the end of the last word.
SendKeyEvent(ui::VKEY_RIGHT, false, true);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // Move the cursor left one space; the breaks are at "|one |two |thre |".
+ SendKeyEvent(ui::VKEY_LEFT, false, false);
+#endif
SendKeyEvent(ui::VKEY_E);
EXPECT_STR_EQ("one two three ", textfield_->text());
EXPECT_STR_EQ("one two three ", last_contents_);
@@ -473,6 +496,11 @@ TEST_F(NativeTextfieldViewsTest, CursorMovement) {
// Ctrl+Right, then Ctrl+Left should move the cursor to the beginning of the
// first word.
SendKeyEvent(ui::VKEY_RIGHT, false, true);
+#if defined(OS_WIN)
+ // TODO(msw): Revise word break algorithms and improve tests.
+ // Move right past the word. The current word breaks are at "| |one |two|".
+ SendKeyEvent(ui::VKEY_RIGHT, false, true);
+#endif
SendKeyEvent(ui::VKEY_LEFT, false, true);
SendKeyEvent(ui::VKEY_O);
EXPECT_STR_EQ(" one two", textfield_->text());

Powered by Google App Engine
This is Rietveld 408576698