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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "ui/events/event_constants.h" | 6 #include "ui/events/event_constants.h" |
7 #include "ui/events/keycodes/dom/dom_code.h" | 7 #include "ui/events/keycodes/dom/dom_code.h" |
8 #include "ui/events/keycodes/dom/dom_key.h" | 8 #include "ui/events/keycodes/dom/dom_key.h" |
9 #include "ui/events/keycodes/keyboard_code_conversion.h" | 9 #include "ui/events/keycodes/keyboard_code_conversion.h" |
10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 {{DomCode::CAPS_LOCK, XKB_KEY_Caps_Lock}, VKEY_CAPITAL}, | 810 {{DomCode::CAPS_LOCK, XKB_KEY_Caps_Lock}, VKEY_CAPITAL}, |
811 {{DomCode::ENTER, XKB_KEY_Return}, VKEY_RETURN}, | 811 {{DomCode::ENTER, XKB_KEY_Return}, VKEY_RETURN}, |
812 {{DomCode::NUMPAD_ENTER, XKB_KEY_KP_Enter}, VKEY_RETURN}, | 812 {{DomCode::NUMPAD_ENTER, XKB_KEY_KP_Enter}, VKEY_RETURN}, |
813 {{DomCode::SLEEP, XKB_KEY_XF86Sleep}, VKEY_SLEEP}, | 813 {{DomCode::SLEEP, XKB_KEY_XF86Sleep}, VKEY_SLEEP}, |
814 }; | 814 }; |
815 for (const auto& e : kVkeyTestCase) { | 815 for (const auto& e : kVkeyTestCase) { |
816 SCOPED_TRACE(static_cast<int>(e.test.dom_code)); | 816 SCOPED_TRACE(static_cast<int>(e.test.dom_code)); |
817 layout_engine_->SetEntry(&e.test); | 817 layout_engine_->SetEntry(&e.test); |
818 DomKey dom_key = DomKey::NONE; | 818 DomKey dom_key = DomKey::NONE; |
819 KeyboardCode key_code = VKEY_UNKNOWN; | 819 KeyboardCode key_code = VKEY_UNKNOWN; |
820 uint32_t keysym; | |
821 EXPECT_TRUE(layout_engine_->Lookup(e.test.dom_code, EF_NONE, &dom_key, | 820 EXPECT_TRUE(layout_engine_->Lookup(e.test.dom_code, EF_NONE, &dom_key, |
822 &key_code, &keysym)); | 821 &key_code)); |
823 EXPECT_EQ(e.test.keysym, keysym); | |
824 EXPECT_EQ(e.key_code, key_code); | 822 EXPECT_EQ(e.key_code, key_code); |
825 } | 823 } |
826 } | 824 } |
827 | 825 |
828 | 826 |
829 TEST_F(XkbLayoutEngineVkTest, XkbRuleNamesForLayoutName) { | 827 TEST_F(XkbLayoutEngineVkTest, XkbRuleNamesForLayoutName) { |
830 static const VkTestXkbKeyboardLayoutEngine::RuleNames kVkeyTestCase[] = { | 828 static const VkTestXkbKeyboardLayoutEngine::RuleNames kVkeyTestCase[] = { |
831 /* 0 */ {"us", "us", ""}, | 829 /* 0 */ {"us", "us", ""}, |
832 /* 1 */ {"jp", "jp", ""}, | 830 /* 1 */ {"jp", "jp", ""}, |
833 /* 2 */ {"us(intl)", "us", "intl"}, | 831 /* 2 */ {"us(intl)", "us", "intl"}, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 std::string layout_id; | 885 std::string layout_id; |
888 std::string layout_variant; | 886 std::string layout_variant; |
889 XkbKeyboardLayoutEngine::ParseLayoutName(e->layout_name, &layout_id, | 887 XkbKeyboardLayoutEngine::ParseLayoutName(e->layout_name, &layout_id, |
890 &layout_variant); | 888 &layout_variant); |
891 EXPECT_EQ(layout_id, e->layout); | 889 EXPECT_EQ(layout_id, e->layout); |
892 EXPECT_EQ(layout_variant, e->variant); | 890 EXPECT_EQ(layout_variant, e->variant); |
893 } | 891 } |
894 } | 892 } |
895 | 893 |
896 } // namespace ui | 894 } // namespace ui |
OLD | NEW |