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 #include "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "ui/base/ime/input_method_delegate.h" | 28 #include "ui/base/ime/input_method_delegate.h" |
29 #include "ui/base/ime/input_method_factory.h" | 29 #include "ui/base/ime/input_method_factory.h" |
30 #include "ui/base/ime/text_input_client.h" | 30 #include "ui/base/ime/text_input_client.h" |
31 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
32 #include "ui/base/ui_base_switches_util.h" | 32 #include "ui/base/ui_base_switches_util.h" |
33 #include "ui/events/event.h" | 33 #include "ui/events/event.h" |
34 #include "ui/events/event_processor.h" | 34 #include "ui/events/event_processor.h" |
35 #include "ui/events/event_utils.h" | 35 #include "ui/events/event_utils.h" |
36 #include "ui/events/keycodes/keyboard_codes.h" | 36 #include "ui/events/keycodes/keyboard_codes.h" |
37 #include "ui/events/test/event_generator.h" | 37 #include "ui/events/test/event_generator.h" |
38 #include "ui/events/test/keyboard_layout.h" | |
38 #include "ui/gfx/render_text.h" | 39 #include "ui/gfx/render_text.h" |
39 #include "ui/strings/grit/ui_strings.h" | 40 #include "ui/strings/grit/ui_strings.h" |
40 #include "ui/views/controls/textfield/textfield_controller.h" | 41 #include "ui/views/controls/textfield/textfield_controller.h" |
41 #include "ui/views/controls/textfield/textfield_model.h" | 42 #include "ui/views/controls/textfield/textfield_model.h" |
42 #include "ui/views/controls/textfield/textfield_test_api.h" | 43 #include "ui/views/controls/textfield/textfield_test_api.h" |
43 #include "ui/views/focus/focus_manager.h" | 44 #include "ui/views/focus/focus_manager.h" |
44 #include "ui/views/style/platform_style.h" | 45 #include "ui/views/style/platform_style.h" |
45 #include "ui/views/test/test_views_delegate.h" | 46 #include "ui/views/test/test_views_delegate.h" |
46 #include "ui/views/test/views_test_base.h" | 47 #include "ui/views/test/views_test_base.h" |
47 #include "ui/views/test/widget_test.h" | 48 #include "ui/views/test/widget_test.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 SendKeyEvent(ui::VKEY_1, false, false, false, true); | 763 SendKeyEvent(ui::VKEY_1, false, false, false, true); |
763 | 764 |
764 // On Mac, Caps+Shift remains uppercase. | 765 // On Mac, Caps+Shift remains uppercase. |
765 if (TestingNativeMac()) | 766 if (TestingNativeMac()) |
766 EXPECT_STR_EQ("TeXT!1!1", textfield_->text()); | 767 EXPECT_STR_EQ("TeXT!1!1", textfield_->text()); |
767 else | 768 else |
768 EXPECT_STR_EQ("TexT!1!1", textfield_->text()); | 769 EXPECT_STR_EQ("TexT!1!1", textfield_->text()); |
769 } | 770 } |
770 | 771 |
771 TEST_F(TextfieldTest, KeysWithModifiersTest) { | 772 TEST_F(TextfieldTest, KeysWithModifiersTest) { |
773 #if defined(OS_WIN) | |
774 // Activate U.S. English keyboard layout. Modifier keys in other layouts may | |
775 // change the text inserted into a texfield and cause this test to fail. | |
Peter Kasting
2016/08/18 17:48:19
Is this really inherently only an OS_WIN problem,
Tomasz Moniuszko
2016/08/26 08:53:12
The problem also exists on other desktop platforms
| |
776 ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_ENGLISH_US); | |
777 #endif | |
778 | |
772 InitTextfield(); | 779 InitTextfield(); |
773 const int ctrl = ui::EF_CONTROL_DOWN; | 780 const int ctrl = ui::EF_CONTROL_DOWN; |
774 const int alt = ui::EF_ALT_DOWN; | 781 const int alt = ui::EF_ALT_DOWN; |
775 const int command = ui::EF_COMMAND_DOWN; | 782 const int command = ui::EF_COMMAND_DOWN; |
776 const int altgr = ui::EF_ALTGR_DOWN; | 783 const int altgr = ui::EF_ALTGR_DOWN; |
777 const int shift = ui::EF_SHIFT_DOWN; | 784 const int shift = ui::EF_SHIFT_DOWN; |
778 | 785 |
779 SendKeyPress(ui::VKEY_T, shift | alt | altgr); | 786 SendKeyPress(ui::VKEY_T, shift | alt | altgr); |
780 SendKeyPress(ui::VKEY_H, alt); | 787 SendKeyPress(ui::VKEY_H, alt); |
781 SendKeyPress(ui::VKEY_E, altgr); | 788 SendKeyPress(ui::VKEY_E, altgr); |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2753 | 2760 |
2754 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2761 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
2755 ui::AXViewState state_protected; | 2762 ui::AXViewState state_protected; |
2756 textfield_->GetAccessibleState(&state_protected); | 2763 textfield_->GetAccessibleState(&state_protected); |
2757 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2764 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
2758 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2765 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
2759 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2766 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
2760 } | 2767 } |
2761 | 2768 |
2762 } // namespace views | 2769 } // namespace views |
OLD | NEW |