blob: ac50b695ca88388149da961a0167f47cf527da04 [file] [log] [blame]
Mitsuru Oshima08005372022-11-17 17:14:381// Copyright 2022 The Chromium Authors
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 <limits>
6
7#include "testing/gtest/include/gtest/gtest.h"
8#include "ui/base/wayland/wayland_display_util.h"
9
10namespace ui::wayland {
11
12TEST(WaylandDisplayUtilTest, Basic) {
13 const int64_t kTestIds[] = {
14 std::numeric_limits<int64_t>::min(),
15 std::numeric_limits<int64_t>::min() + 1,
16 static_cast<int64_t>(std::numeric_limits<int32_t>::min()) - 1,
17 std::numeric_limits<int32_t>::min(),
18 std::numeric_limits<int32_t>::min() + 1,
19 -1,
20 0,
21 1,
22 std::numeric_limits<int32_t>::max() - 1,
23 std::numeric_limits<int32_t>::max(),
24 static_cast<int64_t>(std::numeric_limits<int32_t>::max()) + 1,
25 std::numeric_limits<int64_t>::max() - 1,
26 std::numeric_limits<int64_t>::max()};
27
28 for (int64_t id : kTestIds) {
29 auto pair = ToWaylandDisplayIdPair(id);
30 EXPECT_EQ(id, FromWaylandDisplayIdPair({pair.high, pair.low}));
31 }
32}
33
34} // namespace ui::wayland