blob: 93fa3395c392669a6e48befd64b78049b644e0cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/wayland/wayland_client_input_types.h"
#include "ui/base/wayland/wayland_server_input_types.h"
namespace ui::wayland {
TEST(WaylandInputTypesTest, TextInputType) {
// Checking that roundtrip does not change the value.
for (int i = 0; i <= TEXT_INPUT_TYPE_MAX; ++i) {
const auto input_type = static_cast<ui::TextInputType>(i);
EXPECT_EQ(input_type,
ConvertToTextInputType(ConvertFromTextInputType(input_type)));
}
// Passing the invalid value returns nullopt.
auto kInvalidValue =
static_cast<zcr_extended_text_input_v1_input_type>(0xFFFFFFFF);
EXPECT_FALSE(ConvertToTextInputType(kInvalidValue).has_value());
}
TEST(WaylandInputTypesTest, TextInputMode) {
// Checking that roundtrip does not change the value.
for (int i = 0; i <= TEXT_INPUT_MODE_MAX; ++i) {
const auto input_mode = static_cast<ui::TextInputMode>(i);
EXPECT_EQ(input_mode,
ConvertToTextInputMode(ConvertFromTextInputMode(input_mode)));
}
// Passing the invalid value returns nullopt.
auto kInvalidValue =
static_cast<zcr_extended_text_input_v1_input_mode>(0xFFFFFFFF);
EXPECT_FALSE(ConvertToTextInputMode(kInvalidValue).has_value());
}
} // namespace ui::wayland
|