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

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

Issue 6314012: Make uneditable when readonly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 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
« no previous file with comments | « views/controls/textfield/textfield_views_model.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f7018b835a243e4e1b0e778da54d2575c266804e..1c45d74e1c51fa4e0f16efd201501dd0154dd90d 100644
--- a/views/controls/textfield/textfield_views_model_unittest.cc
+++ b/views/controls/textfield/textfield_views_model_unittest.cc
@@ -104,6 +104,11 @@ TEST_F(TextfieldViewsModelTest, Selection) {
EXPECT_EQ(string16(), model.GetSelectedText());
model.SelectAll();
EXPECT_STR_EQ("HELLO", model.GetSelectedText());
+ // SelectAll should select towards the end.
+ TextRange range;
+ model.GetSelectedRange(&range);
+ EXPECT_EQ(0U, range.start());
+ EXPECT_EQ(5U, range.end());
// Select and move cursor
model.MoveCursorTo(1U, false);
@@ -168,7 +173,7 @@ TEST_F(TextfieldViewsModelTest, Password) {
model.SelectAll();
EXPECT_STR_EQ("ELLO", model.GetSelectedText());
- EXPECT_EQ(0U, model.cursor_pos());
+ EXPECT_EQ(4U, model.cursor_pos());
model.Insert('X');
EXPECT_STR_EQ("*", model.GetVisibleText());
@@ -288,10 +293,11 @@ TEST_F(TextfieldViewsModelTest, SetText) {
EXPECT_EQ(5U, model.cursor_pos());
model.SelectAll();
EXPECT_STR_EQ("GOODBYE", model.GetSelectedText());
- // Selection move the current pos to the begining.
+ // Selection move the current pos to the end.
+ EXPECT_EQ(7U, model.cursor_pos());
+ model.MoveCursorToStart(false);
EXPECT_EQ(0U, model.cursor_pos());
model.MoveCursorToEnd(false);
- EXPECT_EQ(7U, model.cursor_pos());
model.SetText(ASCIIToUTF16("BYE"));
EXPECT_EQ(3U, model.cursor_pos());
@@ -342,7 +348,7 @@ TEST_F(TextfieldViewsModelTest, Clipboard) {
clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_text);
EXPECT_STR_EQ("HELLO HELLO WORLD", clipboard_text);
EXPECT_STR_EQ("HELLO HELLO WORLD", model.text());
- EXPECT_EQ(0U, model.cursor_pos());
+ EXPECT_EQ(17U, model.cursor_pos());
// Test for paste.
model.ClearSelection();
« no previous file with comments | « views/controls/textfield/textfield_views_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698