| Flutter Linux Embedder |

key_mapping_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 "key_mapping.h"
6 #include <gmodule.h>
7 #include <algorithm>
8 #include <vector>
9
10 #include "gtest/gtest.h"
11
12 bool operator==(const LayoutGoal& a, const LayoutGoal& b) {
13 return a.keycode == b.keycode && a.logical_key == b.logical_key &&
14 a.mandatory == b.mandatory;
15 }
16
17 // Spot check some expected values so that we know that some classes of key
18 // aren't excluded.
19 TEST(KeyMappingTest, HasExpectedValues) {
20 // Has Space
21 EXPECT_NE(std::find(layout_goals.begin(), layout_goals.end(),
22 LayoutGoal{0x41, 0x20, false}),
23 layout_goals.end());
24 // Has Digit0
25 EXPECT_NE(std::find(layout_goals.begin(), layout_goals.end(),
26 LayoutGoal{0x13, 0x30, true}),
27 layout_goals.end());
28 // Has KeyA
29 EXPECT_NE(std::find(layout_goals.begin(), layout_goals.end(),
30 LayoutGoal{0x26, 0x61, true}),
31 layout_goals.end());
32 // Has Equal
33 EXPECT_NE(std::find(layout_goals.begin(), layout_goals.end(),
34 LayoutGoal{0x15, 0x3d, false}),
35 layout_goals.end());
36 // Has IntlBackslash
37 EXPECT_NE(std::find(layout_goals.begin(), layout_goals.end(),
38 LayoutGoal{0x5e, 0x200000020, false}),
39 layout_goals.end());
40 }
LayoutGoal::mandatory
bool mandatory
Definition: key_mapping.h:49
layout_goals
const std::vector< LayoutGoal > layout_goals
Definition: key_mapping.g.cc:462
LayoutGoal
Definition: key_mapping.h:40
LayoutGoal::keycode
uint16_t keycode
Definition: key_mapping.h:42
LayoutGoal::logical_key
uint64_t logical_key
Definition: key_mapping.h:45
operator==
bool operator==(const LayoutGoal &a, const LayoutGoal &b)
Definition: key_mapping_test.cc:12
TEST
TEST(KeyMappingTest, HasExpectedValues)
Definition: key_mapping_test.cc:19
key_mapping.h