Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: ui/aura/window_unittest.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/test_screen.cc ('k') | ui/gfx/monitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/aura/test/test_screen.cc ('k') | ui/gfx/monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698