OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium 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 "base/environment.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "ui/base/x/x11_util_internal.h" |
| 8 #include "ui/gfx/x/x11_types.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 class X11UtilTest : public testing::Test { |
| 13 public: |
| 14 X11UtilTest() {} |
| 15 ~X11UtilTest() override {} |
| 16 }; |
| 17 |
| 18 TEST_F(X11UtilTest, ChooseVisualForWindow) { |
| 19 XDisplay* display = gfx::GetXDisplay(); |
| 20 XWindowAttributes attribs; |
| 21 Window root = XDefaultRootWindow(display); |
| 22 Status status = XGetWindowAttributes(display, root, &attribs); |
| 23 DCHECK_NE(0, status); |
| 24 |
| 25 int depth = 0; |
| 26 bool has_compositing_manager = false; |
| 27 ui::ChooseVisualForWindow(has_compositing_manager, nullptr, &depth); |
| 28 EXPECT_EQ(attribs.depth, depth); |
| 29 |
| 30 // Setting to true has no effect because it has been called with false before. |
| 31 has_compositing_manager = true; |
| 32 ui::ChooseVisualForWindow(has_compositing_manager, nullptr, &depth); |
| 33 EXPECT_EQ(attribs.depth, depth); |
| 34 } |
| 35 |
| 36 } // namespace ui |
OLD | NEW |