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

Unified Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2829823002: [Textfield] Consider select all status for select all context menu (Closed)
Patch Set: Add test for empty text Created 3 years, 8 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: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index 71d3ad8ca556465e47b116b7506401dc885914d7..915ad06138f2426b7b52b042e727a42f63edfad6 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -948,6 +948,21 @@ TEST_F(TextfieldTest, LineSelection) {
EXPECT_FALSE(textfield_->GetSelectedRange().is_reversed());
}
+TEST_F(TextfieldTest, IsAllSelected) {
+ InitTextfield();
+ EXPECT_FALSE(textfield_->IsAllSelected());
+
+ textfield_->SetText(ASCIIToUTF16("12 34567 89"));
+ textfield_->SelectAll(false);
+ EXPECT_TRUE(textfield_->IsAllSelected());
+
+ textfield_->SetSelectionRange(gfx::Range(0, 2));
+ EXPECT_FALSE(textfield_->IsAllSelected());
+
+ textfield_->SetText(base::string16());
Peter Kasting 2017/04/20 00:08:30 Maybe after this we should SelectAll(), before che
simonhong 2017/04/20 13:11:51 We don't need to that because when different text
+ EXPECT_FALSE(textfield_->IsAllSelected());
+}
+
TEST_F(TextfieldTest, MoveUpDownAndModifySelection) {
InitTextfield();
textfield_->SetText(ASCIIToUTF16("12 34567 89"));
« ui/views/controls/textfield/textfield.cc ('K') | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698