OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
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 <gdk/gdkkeysyms.h> | |
6 | |
7 #include "base/memory/singleton.h" | |
8 #include "chrome/app/chrome_command_ids.h" | |
9 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 #include "ui/base/accelerators/platform_accelerator_gtk.h" | |
12 | |
13 TEST(AcceleratorsGtkTest, GetAccelerator) { | |
14 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); | |
15 const ui::Accelerator* accelerator = | |
16 keymap->GetPrimaryAcceleratorForCommand(IDC_COPY); | |
17 ASSERT_TRUE(accelerator); | |
18 EXPECT_EQ(static_cast<guint>(GDK_c), | |
19 GetGdkKeyCodeForAccelerator(*accelerator)); | |
20 EXPECT_EQ(GDK_CONTROL_MASK, GetGdkModifierForAccelerator(*accelerator)); | |
21 } | |
22 | |
23 TEST(AcceleratorsGtkTest, GetNullAccelerator) { | |
24 AcceleratorsGtk* keymap = AcceleratorsGtk::GetInstance(); | |
25 const ui::Accelerator* accelerator = | |
26 keymap->GetPrimaryAcceleratorForCommand(IDC_MinimumLabelValue - 1); | |
27 EXPECT_FALSE(accelerator); | |
28 } | |
OLD | NEW |