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

Unified Diff: ui/views/cocoa/bridged_native_widget_unittest.mm

Issue 2228833002: MacViews: Fix behavior of move and select commands when selection direction changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_text_commands
Patch Set: Created 4 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: ui/views/cocoa/bridged_native_widget_unittest.mm
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm
index b86413443f2d11ef2020e885267f69aa375e7036..076dd3786a2a5198fcd2f3ce95343b49e4e5c50b 100644
--- a/ui/views/cocoa/bridged_native_widget_unittest.mm
+++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -328,7 +328,7 @@ void InstallTextField(const base::string16& text,
// both the NSTextView and the BridgedContentView hosting a focused
// views::TextField to ensure the resulting text and selection ranges match.
// |selectors| is an NSArray of NSStrings.
- void TestEditingCommands(NSArray* selectors);
+ void TestEditingCommands(NSArray* selectors, bool test_rtl = true);
tapted 2016/08/11 03:44:08 nit(optional): bool arguments with a default can b
karandeepb 2016/08/16 10:24:52 Done.
std::unique_ptr<views::View> view_;
@@ -537,11 +537,12 @@ void InstallTextField(const base::string16& text,
GetActualSelectionRange());
}
-void BridgedNativeWidgetTest::TestEditingCommands(NSArray* selectors) {
- const base::string16 test_strings[] = {
- base::WideToUTF16(L"ab c"),
- base::WideToUTF16(L"\x0634\x0632 \x064A") // RTL string.
- };
+void BridgedNativeWidgetTest::TestEditingCommands(NSArray* selectors,
+ bool test_rtl) {
+ std::vector<base::string16> test_strings;
+ test_strings.push_back(base::WideToUTF16(L"ab c"));
+ if (test_rtl)
+ test_strings.push_back(base::WideToUTF16(L"\x0634\x0632 \x064A"));
for (const base::string16& test_string : test_strings) {
for (NSString* selector_string in selectors) {
@@ -1100,12 +1101,11 @@ void PerformInit() {
TestEditingCommands(kMoveActions);
}
-// Todo(karandeepb): Enable this test once the behavior of all move and select
-// commands are fixed.
// Test move and select commands against expectations set by |dummy_text_view_|.
-TEST_F(BridgedNativeWidgetTest,
- TextInput_MoveAndSelectEditingCommands_DISABLED) {
- TestEditingCommands(kSelectActions);
+TEST_F(BridgedNativeWidgetTest, TextInput_MoveAndSelectEditingCommands) {
+ // The behavior of NSTextView for RTL strings is buggy for some move and
+ // select commands. Hence don't test against an RTL string.
+ TestEditingCommands(kSelectActions, false);
}
// Test delete commands against expectations set by |dummy_text_view_|.

Powered by Google App Engine
This is Rietveld 408576698