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

Side by Side Diff: ui/events/x/events_x_unittest.cc

Issue 321963003: aura-linux: Supports deadkey + shift + alphabet for XIM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a unittest. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/x/events_x.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <cstring> 5 #include <cstring>
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 #endif 273 #endif
274 274
275 TEST(EventsXTest, NumpadKeyEvents) { 275 TEST(EventsXTest, NumpadKeyEvents) {
276 XEvent event; 276 XEvent event;
277 Display* display = gfx::GetXDisplay(); 277 Display* display = gfx::GetXDisplay();
278 278
279 struct { 279 struct {
280 bool is_numpad_key; 280 bool is_numpad_key;
281 int x_keysym; 281 int x_keysym;
282 ui::KeyboardCode ui_keycode;
283 } keys[] = { 282 } keys[] = {
284 // XK_KP_Space and XK_KP_Equal are the extrema in the conventional 283 // XK_KP_Space and XK_KP_Equal are the extrema in the conventional
285 // keysymdef.h numbering. 284 // keysymdef.h numbering.
286 { true, XK_KP_Space }, 285 { true, XK_KP_Space },
287 { true, XK_KP_Equal }, 286 { true, XK_KP_Equal },
288 // Other numpad keysyms. (This is actually exhaustive in the current list.) 287 // Other numpad keysyms. (This is actually exhaustive in the current list.)
289 { true, XK_KP_Tab }, 288 { true, XK_KP_Tab },
290 { true, XK_KP_Enter }, 289 { true, XK_KP_Enter },
291 { true, XK_KP_F1 }, 290 { true, XK_KP_F1 },
292 { true, XK_KP_F2 }, 291 { true, XK_KP_F2 },
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F30)); 421 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F30));
423 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F31)); 422 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F31));
424 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F32)); 423 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F32));
425 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F33)); 424 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F33));
426 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F34)); 425 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F34));
427 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F35)); 426 EXPECT_TRUE(HasFunctionKeyFlagSetIfSupported(display, XK_F35));
428 // Max function key code plus 1. 427 // Max function key code plus 1.
429 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F35 + 1)); 428 EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F35 + 1));
430 } 429 }
431 430
431 #if !defined(OS_CHROMEOS)
432 TEST(EventsXTest, ImeFabricatedKeyEvents) {
433 Display* display = gfx::GetXDisplay();
434
435 unsigned int state_to_be_fabricated[] = {
436 0, ShiftMask, LockMask, ShiftMask | LockMask,
437 };
438 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(state_to_be_fabricated); ++i) {
439 unsigned int state = state_to_be_fabricated[i];
440 for (int is_char = 0; is_char < 2; ++is_char) {
441 XEvent x_event;
442 InitKeyEvent(display, &x_event, true, 0, state);
443 ui::KeyEvent key_event(&x_event, is_char);
444 EXPECT_TRUE(key_event.flags() & ui::EF_IME_FABRICATED_KEY);
445 }
446 }
447
448 unsigned int state_to_be_not_fabricated[] = {
449 ControlMask, Mod1Mask, Mod2Mask, ShiftMask | ControlMask,
450 };
451 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(state_to_be_not_fabricated); ++i) {
452 unsigned int state = state_to_be_not_fabricated[i];
453 for (int is_char = 0; is_char < 2; ++is_char) {
454 XEvent x_event;
455 InitKeyEvent(display, &x_event, true, 0, state);
456 ui::KeyEvent key_event(&x_event, is_char);
457 EXPECT_FALSE(key_event.flags() & ui::EF_IME_FABRICATED_KEY);
458 }
459 }
460 }
461 #endif
462
432 } // namespace ui 463 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/x/events_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698