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 ed69e54b2046d37c8d977588c79ddf2f9873512f..2d63b4f3935e777cd1b56983a01895aa5a9cbfb1 100644 |
--- a/views/controls/textfield/native_textfield_views_unittest.cc |
+++ b/views/controls/textfield/native_textfield_views_unittest.cc |
@@ -223,4 +223,29 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) { |
EXPECT_STR_EQ("my password", last_contents_); |
} |
+TEST_F(NativeTextfieldViewsTest, CursorMovement) { |
+ InitTextfield(Textfield::STYLE_DEFAULT); |
+ textfield_->SetText(ASCIIToUTF16("one two hre ")); |
+ |
+ // Send the cursor at the end. |
+ SendKeyEventToTextfieldViews(app::VKEY_END); |
+ // Ctrl+Left should move the cursor just before the last word. |
+ SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true); |
+ SendKeyEventToTextfieldViews(app::VKEY_T); |
+ EXPECT_STR_EQ("one two thre ", textfield_->text()); |
+ EXPECT_STR_EQ("one two thre ", last_contents_); |
+ |
+ // Ctrl+Right should move the cursor to the end of the last word. |
+ SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true); |
+ SendKeyEventToTextfieldViews(app::VKEY_E); |
+ EXPECT_STR_EQ("one two three ", textfield_->text()); |
+ EXPECT_STR_EQ("one two three ", last_contents_); |
+ |
+ // Ctrl+Right again should move the cursor to the end. |
+ SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true); |
+ SendKeyEventToTextfieldViews(app::VKEY_BACK); |
+ EXPECT_STR_EQ("one two three", textfield_->text()); |
+ EXPECT_STR_EQ("one two three", last_contents_); |
oshima
2011/01/04 21:53:24
can you add another test case with leading white s
sadrul
2011/01/04 23:25:44
Done.
|
+} |
+ |
} // namespace views |