| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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/mus/screen_mus.h" | |
| 6 | |
| 7 #include "ash/mus/window_manager.h" | |
| 8 #include "ash/mus/window_manager_application.h" | |
| 9 #include "ash/test/ash_test_base.h" | |
| 10 #include "ash/test/ash_test_helper.h" | |
| 11 #include "ui/aura/test/test_window_delegate.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 namespace test { | |
| 15 | |
| 16 class ScreenMusTest : public AshTestBase { | |
| 17 public: | |
| 18 ScreenMusTest() {} | |
| 19 ~ScreenMusTest() override {} | |
| 20 | |
| 21 display::Screen* screen_mus() { | |
| 22 return ash_test_helper()->window_manager_app()->window_manager()->screen(); | |
| 23 } | |
| 24 | |
| 25 private: | |
| 26 DISALLOW_COPY_AND_ASSIGN(ScreenMusTest); | |
| 27 }; | |
| 28 | |
| 29 TEST_F(ScreenMusTest, GetWindowAtScreenPoint) { | |
| 30 UpdateDisplay("1024x600"); | |
| 31 | |
| 32 aura::test::TestWindowDelegate test_delegate; | |
| 33 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate( | |
| 34 &test_delegate, 23, gfx::Rect(20, 20, 50, 50))); | |
| 35 | |
| 36 aura::Window* at_point = | |
| 37 screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25)); | |
| 38 EXPECT_EQ(w1.get(), at_point); | |
| 39 | |
| 40 // Create a second window which overlaps with w1. | |
| 41 std::unique_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate( | |
| 42 &test_delegate, 17, gfx::Rect(25, 25, 50, 50))); | |
| 43 at_point = screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25)); | |
| 44 EXPECT_EQ(w2.get(), at_point); | |
| 45 | |
| 46 // Raise w1. | |
| 47 w1->parent()->StackChildAtTop(w1.get()); | |
| 48 at_point = screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25)); | |
| 49 EXPECT_EQ(w1.get(), at_point); | |
| 50 } | |
| 51 | |
| 52 } // namespace test | |
| 53 } // namespace ash | |
| OLD | NEW |