| Flutter Linux Embedder |

fl_keyboard_layout_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 "flutter/shell/platform/linux/fl_keyboard_layout.h"
6
7 #include "gtest/gtest.h"
8
9 TEST(FlKeyboardLayoutTest, SetLogicalKey) {
10 g_autoptr(FlKeyboardLayout) layout = fl_keyboard_layout_new();
11
12 EXPECT_EQ(fl_keyboard_layout_get_logical_key(layout, 0, 42),
13 static_cast<uint64_t>(0));
14
15 fl_keyboard_layout_set_logical_key(layout, 0, 42, 1234);
16
17 EXPECT_EQ(fl_keyboard_layout_get_logical_key(layout, 0, 42),
18 static_cast<uint64_t>(1234));
19 }
20
21 TEST(FlKeyboardLayoutTest, MaxValues) {
22 g_autoptr(FlKeyboardLayout) layout = fl_keyboard_layout_new();
23
24 EXPECT_EQ(fl_keyboard_layout_get_logical_key(layout, 255, 127),
25 static_cast<uint64_t>(0));
26
27 fl_keyboard_layout_set_logical_key(layout, 255, 127, 12345678);
28
29 EXPECT_EQ(fl_keyboard_layout_get_logical_key(layout, 255, 127),
30 static_cast<uint64_t>(12345678));
31 }
32
33 TEST(FlKeyboardLayoutTest, HasGroup) {
34 g_autoptr(FlKeyboardLayout) layout = fl_keyboard_layout_new();
35
36 EXPECT_FALSE(fl_keyboard_layout_has_group(layout, 42));
37
38 fl_keyboard_layout_set_logical_key(layout, 42, 11, 22);
39
40 EXPECT_TRUE(fl_keyboard_layout_has_group(layout, 42));
41 }
g_autoptr
g_autoptr(FlEngine) engine
fl_keyboard_layout_get_logical_key
uint64_t fl_keyboard_layout_get_logical_key(FlKeyboardLayout *self, uint8_t group, uint16_t keycode)
Definition: fl_keyboard_layout.cc:65
fl_keyboard_layout_set_logical_key
void fl_keyboard_layout_set_logical_key(FlKeyboardLayout *self, uint8_t group, uint16_t keycode, uint64_t logical_key)
Definition: fl_keyboard_layout.cc:49
fl_keyboard_layout_new
FlKeyboardLayout * fl_keyboard_layout_new()
Definition: fl_keyboard_layout.cc:40
fl_keyboard_layout_has_group
gboolean fl_keyboard_layout_has_group(FlKeyboardLayout *self, uint8_t group)
Definition: fl_keyboard_layout.cc:45
fl_keyboard_layout.h
TEST
TEST(FlKeyboardLayoutTest, SetLogicalKey)
Definition: fl_keyboard_layout_test.cc:9