OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 // Test delete commands against expectations set by |dummy_text_view_|. | 1004 // Test delete commands against expectations set by |dummy_text_view_|. |
1005 TEST_F(BridgedNativeWidgetTest, TextInput_DeleteCommands) { | 1005 TEST_F(BridgedNativeWidgetTest, TextInput_DeleteCommands) { |
1006 NSArray* selectors = @[ | 1006 NSArray* selectors = @[ |
1007 @"deleteForward:", @"deleteBackward:", @"deleteWordForward:", | 1007 @"deleteForward:", @"deleteBackward:", @"deleteWordForward:", |
1008 @"deleteWordBackward:", @"deleteToBeginningOfLine:", @"deleteToEndOfLine:", | 1008 @"deleteWordBackward:", @"deleteToBeginningOfLine:", @"deleteToEndOfLine:", |
1009 @"deleteToBeginningOfParagraph:", @"deleteToEndOfParagraph:" | 1009 @"deleteToBeginningOfParagraph:", @"deleteToEndOfParagraph:" |
1010 ]; | 1010 ]; |
1011 TestEditingCommands(selectors); | 1011 TestEditingCommands(selectors); |
1012 } | 1012 } |
1013 | 1013 |
1014 // Test that we don't crash during an action message even if the TextInputClient | |
1015 // is nil. Regression test for crbug.com/615745. | |
1016 TEST_F(BridgedNativeWidgetTest, NilTextInputClient) { | |
1017 [ns_view_ setTextInputClient:nil]; | |
1018 NSArray* selectors = @[ | |
tapted
2016/05/31 01:17:10
We shouldn't repeat these - can we do something li
karandeepb
2016/05/31 01:42:33
Done.
| |
1019 @"insertText:", | |
1020 @"moveForward:", | |
1021 @"moveRight:", | |
1022 @"moveBackward:", | |
1023 @"moveLeft:", | |
1024 @"moveUp:", | |
1025 @"moveDown:", | |
1026 @"moveWordForward:", | |
1027 @"moveWordBackward:", | |
1028 @"moveToBeginningOfLine:", | |
1029 @"moveToEndOfLine:", | |
1030 @"moveToBeginningOfParagraph:", | |
1031 @"moveToEndOfParagraph:", | |
1032 @"moveToEndOfDocument:", | |
1033 @"moveToBeginningOfDocument:", | |
1034 @"pageDown:", | |
1035 @"pageUp:", | |
1036 @"moveBackwardAndModifySelection:", | |
1037 @"moveForwardAndModifySelection:", | |
1038 @"moveWordForwardAndModifySelection:", | |
1039 @"moveWordBackwardAndModifySelection:", | |
1040 @"moveUpAndModifySelection:", | |
1041 @"moveDownAndModifySelection:", | |
1042 @"moveToBeginningOfLineAndModifySelection:", | |
1043 @"moveToEndOfLineAndModifySelection:", | |
1044 @"moveToBeginningOfParagraphAndModifySelection:", | |
1045 @"moveToEndOfParagraphAndModifySelection:", | |
1046 @"moveToEndOfDocumentAndModifySelection:", | |
1047 @"moveToBeginningOfDocumentAndModifySelection:", | |
1048 @"pageDownAndModifySelection:", | |
1049 @"pageUpAndModifySelection:", | |
1050 @"moveParagraphForwardAndModifySelection:", | |
1051 @"moveParagraphBackwardAndModifySelection:", | |
1052 @"moveWordRight:", | |
1053 @"moveWordLeft:", | |
1054 @"moveRightAndModifySelection:", | |
1055 @"moveLeftAndModifySelection:", | |
1056 @"moveWordRightAndModifySelection:", | |
1057 @"moveWordLeftAndModifySelection:", | |
1058 @"moveToLeftEndOfLine:", | |
1059 @"moveToRightEndOfLine:", | |
1060 @"moveToLeftEndOfLineAndModifySelection:", | |
1061 @"moveToRightEndOfLineAndModifySelection:", | |
1062 @"deleteForward:", | |
1063 @"deleteBackward:", | |
1064 @"deleteWordForward:", | |
1065 @"deleteWordBackward:", | |
1066 @"deleteToBeginningOfLine:", | |
1067 @"deleteToEndOfLine:", | |
1068 @"deleteToBeginningOfParagraph:", | |
1069 @"deleteToEndOfParagraph:", | |
1070 @"cancelOperation:" | |
1071 ]; | |
1072 for (NSString* selector in selectors) { | |
1073 SEL sel = NSSelectorFromString(selector); | |
1074 [ns_view_ doCommandBySelector:sel]; | |
1075 } | |
1076 } | |
1077 | |
1014 // Test firstRectForCharacterRange:actualRange for cases where query range is | 1078 // Test firstRectForCharacterRange:actualRange for cases where query range is |
1015 // empty or outside composition range. | 1079 // empty or outside composition range. |
1016 TEST_F(BridgedNativeWidgetTest, TextInput_FirstRectForCharacterRange_Caret) { | 1080 TEST_F(BridgedNativeWidgetTest, TextInput_FirstRectForCharacterRange_Caret) { |
1017 InstallTextField(""); | 1081 InstallTextField(""); |
1018 ui::TextInputClient* client = [ns_view_ textInputClient]; | 1082 ui::TextInputClient* client = [ns_view_ textInputClient]; |
1019 | 1083 |
1020 // No composition. Ensure bounds and range corresponding to the current caret | 1084 // No composition. Ensure bounds and range corresponding to the current caret |
1021 // position are returned. | 1085 // position are returned. |
1022 // Initially selection range will be [0, 0]. | 1086 // Initially selection range will be [0, 0]. |
1023 NSRange caret_range = NSMakeRange(0, 0); | 1087 NSRange caret_range = NSMakeRange(0, 0); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 [center postNotificationName:NSWindowDidExitFullScreenNotification | 1232 [center postNotificationName:NSWindowDidExitFullScreenNotification |
1169 object:window]; | 1233 object:window]; |
1170 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. | 1234 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. |
1171 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 1235 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
1172 | 1236 |
1173 widget_->CloseNow(); | 1237 widget_->CloseNow(); |
1174 } | 1238 } |
1175 | 1239 |
1176 } // namespace test | 1240 } // namespace test |
1177 } // namespace views | 1241 } // namespace views |
OLD | NEW |