OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
oshima
2017/01/30 19:16:14
nit: 2017
yhanada
2017/01/31 06:34:34
Done.
| |
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 "ui/wm/core/coordinate_conversion.h" | |
6 | |
7 #include <memory> | |
oshima
2017/01/30 19:16:14
is this necessary?
yhanada
2017/01/31 06:34:34
Done.
| |
8 | |
9 #include "base/macros.h" | |
10 #include "base/memory/ptr_util.h" | |
oshima
2017/01/30 19:16:14
and these?
yhanada
2017/01/31 06:34:34
Done.
| |
11 #include "testing/gtest/include/gtest/gtest.h" | |
12 #include "ui/aura/client/screen_position_client.h" | |
13 #include "ui/aura/test/aura_test_base.h" | |
14 #include "ui/aura/test/test_windows.h" | |
15 #include "ui/wm/core/default_screen_position_client.h" | |
16 | |
17 namespace wm { | |
18 | |
19 typedef aura::test::AuraTestBase CoordinateConversionTest; | |
20 | |
21 TEST_F(CoordinateConversionTest, ConvertRect) { | |
22 DefaultScreenPositionClient screen_position_client; | |
23 aura::client::SetScreenPositionClient(root_window(), &screen_position_client); | |
24 aura::Window* w = aura::test::CreateTestWindowWithBounds( | |
25 gfx::Rect(10, 20, 100, 200), root_window()); | |
26 | |
27 EXPECT_EQ("0,0 100x120", | |
28 ConvertRectFromScreen(w, gfx::Rect(10, 20, 100, 120)).ToString()); | |
29 EXPECT_EQ("-10,-20 100x200", | |
30 ConvertRectFromScreen(w, gfx::Rect(0, 0, 100, 200)).ToString()); | |
31 EXPECT_EQ("40,50 100x200", | |
32 ConvertRectToScreen(w, gfx::Rect(30, 30, 100, 200)).ToString()); | |
33 EXPECT_EQ("0,0 100x200", | |
34 ConvertRectToScreen(w, gfx::Rect(-10, -20, 100, 200)).ToString()); | |
35 aura::client::SetScreenPositionClient(root_window(), nullptr); | |
36 } | |
37 | |
38 } // namespace wm | |
OLD | NEW |