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

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

Issue 2524873002: Rename WindowTreeHost G|SetBounds to indicate they are in pixels. (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/views/mus/desktop_window_tree_host_mus.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 <limits.h> 7 #include <limits.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 w121->set_ignore_events(true); 1603 w121->set_ignore_events(true);
1604 EXPECT_EQ(w12.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); 1604 EXPECT_EQ(w12.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
1605 w12->set_ignore_events(true); 1605 w12->set_ignore_events(true);
1606 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); 1606 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
1607 w111->set_ignore_events(true); 1607 w111->set_ignore_events(true);
1608 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160))); 1608 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
1609 } 1609 }
1610 1610
1611 // Tests transformation on the root window. 1611 // Tests transformation on the root window.
1612 TEST_P(WindowTest, Transform) { 1612 TEST_P(WindowTest, Transform) {
1613 gfx::Size size = host()->GetBounds().size(); 1613 gfx::Size size = host()->GetBoundsInPixels().size();
1614 EXPECT_EQ(gfx::Rect(size), display::Screen::GetScreen() 1614 EXPECT_EQ(gfx::Rect(size), display::Screen::GetScreen()
1615 ->GetDisplayNearestPoint(gfx::Point()) 1615 ->GetDisplayNearestPoint(gfx::Point())
1616 .bounds()); 1616 .bounds());
1617 1617
1618 // Rotate it clock-wise 90 degrees. 1618 // Rotate it clock-wise 90 degrees.
1619 gfx::Transform transform; 1619 gfx::Transform transform;
1620 transform.Translate(size.height(), 0); 1620 transform.Translate(size.height(), 0);
1621 transform.Rotate(90.0); 1621 transform.Rotate(90.0);
1622 host()->SetRootTransform(transform); 1622 host()->SetRootTransform(transform);
1623 1623
1624 // The size should be the transformed size. 1624 // The size should be the transformed size.
1625 gfx::Size transformed_size(size.height(), size.width()); 1625 gfx::Size transformed_size(size.height(), size.width());
1626 EXPECT_EQ(transformed_size.ToString(), 1626 EXPECT_EQ(transformed_size.ToString(),
1627 root_window()->bounds().size().ToString()); 1627 root_window()->bounds().size().ToString());
1628 EXPECT_EQ(gfx::Rect(transformed_size).ToString(), 1628 EXPECT_EQ(gfx::Rect(transformed_size).ToString(),
1629 display::Screen::GetScreen() 1629 display::Screen::GetScreen()
1630 ->GetDisplayNearestPoint(gfx::Point()) 1630 ->GetDisplayNearestPoint(gfx::Point())
1631 .bounds() 1631 .bounds()
1632 .ToString()); 1632 .ToString());
1633 1633
1634 // Host size shouldn't change. 1634 // Host size shouldn't change.
1635 EXPECT_EQ(size.ToString(), host()->GetBounds().size().ToString()); 1635 EXPECT_EQ(size.ToString(), host()->GetBoundsInPixels().size().ToString());
1636 } 1636 }
1637 1637
1638 TEST_P(WindowTest, TransformGesture) { 1638 TEST_P(WindowTest, TransformGesture) {
1639 gfx::Size size = host()->GetBounds().size(); 1639 gfx::Size size = host()->GetBoundsInPixels().size();
1640 1640
1641 std::unique_ptr<GestureTrackPositionDelegate> delegate( 1641 std::unique_ptr<GestureTrackPositionDelegate> delegate(
1642 new GestureTrackPositionDelegate); 1642 new GestureTrackPositionDelegate);
1643 std::unique_ptr<Window> window(CreateTestWindowWithDelegate( 1643 std::unique_ptr<Window> window(CreateTestWindowWithDelegate(
1644 delegate.get(), -1234, gfx::Rect(0, 0, 20, 20), root_window())); 1644 delegate.get(), -1234, gfx::Rect(0, 0, 20, 20), root_window()));
1645 1645
1646 // Rotate the root-window clock-wise 90 degrees. 1646 // Rotate the root-window clock-wise 90 degrees.
1647 gfx::Transform transform; 1647 gfx::Transform transform;
1648 transform.Translate(size.height(), 0.0); 1648 transform.Translate(size.height(), 0.0);
1649 transform.Rotate(90.0); 1649 transform.Rotate(90.0);
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 ::testing::Values(BackendType::CLASSIC, 2987 ::testing::Values(BackendType::CLASSIC,
2988 BackendType::MUS)); 2988 BackendType::MUS));
2989 2989
2990 INSTANTIATE_TEST_CASE_P(/* no prefix */, 2990 INSTANTIATE_TEST_CASE_P(/* no prefix */,
2991 WindowObserverTest, 2991 WindowObserverTest,
2992 ::testing::Values(BackendType::CLASSIC, 2992 ::testing::Values(BackendType::CLASSIC,
2993 BackendType::MUS)); 2993 BackendType::MUS));
2994 2994
2995 } // namespace test 2995 } // namespace test
2996 } // namespace aura 2996 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/views/mus/desktop_window_tree_host_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698