OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 "ash/display/display_util.h" |
| 6 |
| 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" |
| 10 |
| 11 namespace ash { |
| 12 |
| 13 typedef test::AshTestBase DisplayUtilTest; |
| 14 |
| 15 TEST_F(DisplayUtilTest, RotatedDisplay) { |
| 16 { |
| 17 UpdateDisplay("10+10-500x400,600+10-1000x600/r"); |
| 18 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 19 AshWindowTreeHost* host0 = |
| 20 GetRootWindowController(root_windows[0])->ash_host(); |
| 21 AshWindowTreeHost* host1 = |
| 22 GetRootWindowController(root_windows[1])->ash_host(); |
| 23 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); |
| 24 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); |
| 25 EXPECT_EQ("509,20 1x300", rect0.ToString()); |
| 26 EXPECT_EQ("1289,10 300x1", rect1.ToString()); |
| 27 } |
| 28 { |
| 29 UpdateDisplay("10+10-500x400,600+10-1000x600/l"); |
| 30 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 31 AshWindowTreeHost* host0 = |
| 32 GetRootWindowController(root_windows[0])->ash_host(); |
| 33 AshWindowTreeHost* host1 = |
| 34 GetRootWindowController(root_windows[1])->ash_host(); |
| 35 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); |
| 36 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); |
| 37 EXPECT_EQ("509,20 1x300", rect0.ToString()); |
| 38 EXPECT_EQ("610,609 300x1", rect1.ToString()); |
| 39 } |
| 40 { |
| 41 UpdateDisplay("10+10-500x400,600+10-1000x600/u"); |
| 42 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 43 AshWindowTreeHost* host0 = |
| 44 GetRootWindowController(root_windows[0])->ash_host(); |
| 45 AshWindowTreeHost* host1 = |
| 46 GetRootWindowController(root_windows[1])->ash_host(); |
| 47 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); |
| 48 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); |
| 49 EXPECT_EQ("509,20 1x300", rect0.ToString()); |
| 50 EXPECT_EQ("1599,299 1x300", rect1.ToString()); |
| 51 } |
| 52 |
| 53 { |
| 54 UpdateDisplay("10+10-500x400/r,600+10-1000x600"); |
| 55 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 56 AshWindowTreeHost* host0 = |
| 57 GetRootWindowController(root_windows[0])->ash_host(); |
| 58 AshWindowTreeHost* host1 = |
| 59 GetRootWindowController(root_windows[1])->ash_host(); |
| 60 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(399, 10, 1, 300)); |
| 61 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(400, 10, 1, 300)); |
| 62 EXPECT_EQ("199,409 300x1", rect0.ToString()); |
| 63 EXPECT_EQ("600,20 1x300", rect1.ToString()); |
| 64 } |
| 65 { |
| 66 UpdateDisplay("10+10-500x400/l,600+10-1000x600"); |
| 67 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 68 AshWindowTreeHost* host0 = |
| 69 GetRootWindowController(root_windows[0])->ash_host(); |
| 70 AshWindowTreeHost* host1 = |
| 71 GetRootWindowController(root_windows[1])->ash_host(); |
| 72 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); |
| 73 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); |
| 74 EXPECT_EQ("20,10 300x1", rect0.ToString()); |
| 75 EXPECT_EQ("600,20 1x300", rect1.ToString()); |
| 76 } |
| 77 { |
| 78 UpdateDisplay("10+10-500x400/u,600+10-1000x600"); |
| 79 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 80 AshWindowTreeHost* host0 = |
| 81 GetRootWindowController(root_windows[0])->ash_host(); |
| 82 AshWindowTreeHost* host1 = |
| 83 GetRootWindowController(root_windows[1])->ash_host(); |
| 84 gfx::Rect rect0 = GetNativeEdgeBounds(host0, gfx::Rect(499, 10, 1, 300)); |
| 85 gfx::Rect rect1 = GetNativeEdgeBounds(host1, gfx::Rect(500, 10, 1, 300)); |
| 86 EXPECT_EQ("10,99 1x300", rect0.ToString()); |
| 87 EXPECT_EQ("600,20 1x300", rect1.ToString()); |
| 88 } |
| 89 } |
| 90 |
| 91 } // namespace |
OLD | NEW |