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

Unified Diff: ui/views/controls/tree/tree_view_unittest.cc

Issue 13646008: Makes tree commit edits when focus is lost rather than (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « ui/views/controls/tree/tree_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/tree/tree_view_unittest.cc
diff --git a/ui/views/controls/tree/tree_view_unittest.cc b/ui/views/controls/tree/tree_view_unittest.cc
index dfb9e6280fa743696ddd0238c12b4d6527086528..94691fc7b2e9432ca3e79923c63146c6276e1664 100644
--- a/ui/views/controls/tree/tree_view_unittest.cc
+++ b/ui/views/controls/tree/tree_view_unittest.cc
@@ -9,6 +9,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "ui/base/models/tree_node_model.h"
+#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/test/views_test_base.h"
using ui::TreeModel;
@@ -381,4 +382,17 @@ TEST_F(TreeViewViewsTest, ExpandOrSelectChild) {
EXPECT_EQ("b1", GetSelectedNodeTitle());
}
+// Verifies edits are committed when focus is lost.
+TEST_F(TreeViewViewsTest, CommitOnFocusLost) {
+ tree_.SetModel(&model_);
+
+ tree_.SetSelectedNode(GetNodeByTitle("root"));
+ ExpandOrSelectChild();
+ tree_.SetEditable(true);
+ tree_.StartEditing(GetNodeByTitle("a"));
+ tree_.editor()->SetText(ASCIIToUTF16("a changed"));
+ tree_.OnDidChangeFocus(NULL, NULL);
+ EXPECT_TRUE(GetNodeByTitle("a changed") != NULL);
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/tree/tree_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698