Flutter Engine
The Flutter Engine
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
12bool 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.
19TEST(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}
int find(T *array, int N, T item)
static bool b
struct MyStruct a[10]
const std::vector< LayoutGoal > layout_goals
bool operator==(const LayoutGoal &a, const LayoutGoal &b)
TEST(KeyMappingTest, HasExpectedValues)