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

Side by Side Diff: ui/events/keycodes/keyboard_lookup_win_unittest.cc

Issue 1585193002: Build key map DomCodeToKey() for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned API, added unittest Created 4 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
dtapuska 2016/01/21 01:59:36 2016
chongz 2016/01/21 15:47:40 Acknowledged.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/events/keycodes/keyboard_lookup_win.h"
6
7 #include "base/macros.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/events/event_constants.h"
10 #include "ui/events/keycodes/dom/dom_key.h"
11 #include "ui/events/keycodes/dom/keycode_converter.h"
12 #include "ui/events/keycodes/keyboard_codes_win.h"
13
14 namespace ui {
15
16 namespace {
17
18 struct TestKey {
19 KeyboardCode vk;
20 DomKey basic_key;
21 DomKey shifted_key;
22 };
23
24 const TestKey USKeys[] = {
25 {VKEY_2, DomKey::Constant<'2'>::Character, DomKey::Constant<'@'>::Character},
26 {VKEY_A, DomKey::Constant<'a'>::Character, DomKey::Constant<'A'>::Character},
27 {VKEY_TAB, DomKey::TAB, DomKey::TAB},
28 {VKEY_DELETE, DomKey::DEL, DomKey::DEL},
29 {VKEY_F16, DomKey::F16, DomKey::F16},
30 {VKEY_SHIFT, DomKey::SHIFT, DomKey::SHIFT},
31 };
32
33 } // namespace
34
35 class WindowsKeyboardLookupTest : public testing::Test {
36 public:
37 WindowsKeyboardLookupTest() {}
38 ~WindowsKeyboardLookupTest() override {}
39
40 void SetUp() override {}
41
42 private:
43 DISALLOW_COPY_AND_ASSIGN(WindowsKeyboardLookupTest);
44 };
45
46 TEST_F(WindowsKeyboardLookupTest, USLayout) {
47 // Haven't figure how to switch layout
48 HKL us_iden = ::GetKeyboardLayout(0);//::LoadKeyboardLayout(L"00000409", 0);
49 WindowsKeyboardLookup *lookup = WindowsKeyboardLookup::Create(us_iden);
dtapuska 2016/01/21 01:59:36 use a scoped_ptr for the keyboard lookup...
chongz 2016/01/21 15:47:40 Acknowledged.
50
51 for (const auto &k : USKeys) {
52 EXPECT_EQ(k.basic_key, lookup->VirtualKeyToDomKey(k.vk, EF_NONE));
53 EXPECT_EQ(k.shifted_key, lookup->VirtualKeyToDomKey(k.vk, EF_SHIFT_DOWN));
54 }
55
56 delete lookup;
57 }
58
59 } // namespace ui
OLDNEW
« ui/events/keycodes/keyboard_lookup_win.cc ('K') | « ui/events/keycodes/keyboard_lookup_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698