| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 w12->set_ignore_events(true); | 967 w12->set_ignore_events(true); |
| 968 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); | 968 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); |
| 969 w111->set_ignore_events(true); | 969 w111->set_ignore_events(true); |
| 970 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); | 970 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); |
| 971 } | 971 } |
| 972 | 972 |
| 973 // Tests transformation on the root window. | 973 // Tests transformation on the root window. |
| 974 TEST_F(WindowTest, Transform) { | 974 TEST_F(WindowTest, Transform) { |
| 975 gfx::Size size = root_window()->GetHostSize(); | 975 gfx::Size size = root_window()->GetHostSize(); |
| 976 EXPECT_EQ(gfx::Rect(size), | 976 EXPECT_EQ(gfx::Rect(size), |
| 977 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point())); | 977 gfx::Screen::GetMonitorNearestPoint(gfx::Point()).bounds()); |
| 978 | 978 |
| 979 // Rotate it clock-wise 90 degrees. | 979 // Rotate it clock-wise 90 degrees. |
| 980 ui::Transform transform; | 980 ui::Transform transform; |
| 981 transform.SetRotate(90.0f); | 981 transform.SetRotate(90.0f); |
| 982 transform.ConcatTranslate(size.height(), 0); | 982 transform.ConcatTranslate(size.height(), 0); |
| 983 root_window()->SetTransform(transform); | 983 root_window()->SetTransform(transform); |
| 984 | 984 |
| 985 // The size should be the transformed size. | 985 // The size should be the transformed size. |
| 986 gfx::Size transformed_size(size.height(), size.width()); | 986 gfx::Size transformed_size(size.height(), size.width()); |
| 987 EXPECT_EQ(transformed_size.ToString(), | 987 EXPECT_EQ(transformed_size.ToString(), |
| 988 root_window()->bounds().size().ToString()); | 988 root_window()->bounds().size().ToString()); |
| 989 EXPECT_EQ(gfx::Rect(transformed_size).ToString(), | 989 EXPECT_EQ( |
| 990 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()).ToString()); | 990 gfx::Rect(transformed_size).ToString(), |
| 991 gfx::Screen::GetMonitorNearestPoint(gfx::Point()).bounds().ToString()); |
| 991 | 992 |
| 992 // Host size shouldn't change. | 993 // Host size shouldn't change. |
| 993 EXPECT_EQ(size.ToString(), | 994 EXPECT_EQ(size.ToString(), |
| 994 root_window()->GetHostSize().ToString()); | 995 root_window()->GetHostSize().ToString()); |
| 995 } | 996 } |
| 996 | 997 |
| 997 TEST_F(WindowTest, TransformGesture) { | 998 TEST_F(WindowTest, TransformGesture) { |
| 998 gfx::Size size = root_window()->GetHostSize(); | 999 gfx::Size size = root_window()->GetHostSize(); |
| 999 | 1000 |
| 1000 scoped_ptr<GestureTrackPositionDelegate> delegate( | 1001 scoped_ptr<GestureTrackPositionDelegate> delegate( |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 w2->SetParent(w1.get()); | 1933 w2->SetParent(w1.get()); |
| 1933 | 1934 |
| 1934 w1.reset(); | 1935 w1.reset(); |
| 1935 | 1936 |
| 1936 // We should be able to deref w2 still, but its parent should now be NULL. | 1937 // We should be able to deref w2 still, but its parent should now be NULL. |
| 1937 EXPECT_EQ(NULL, w2->parent()); | 1938 EXPECT_EQ(NULL, w2->parent()); |
| 1938 } | 1939 } |
| 1939 | 1940 |
| 1940 } // namespace test | 1941 } // namespace test |
| 1941 } // namespace aura | 1942 } // namespace aura |
| OLD | NEW |