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

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

Issue 173443002: aura: Take transformation into account when computing window bounds in root-window/screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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
« ui/aura/window.cc ('K') | « ui/aura/window_targeter_unittest.cc ('k') | no next file » | 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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); 1118 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString());
1119 1119
1120 // The |child| window's screen bounds should move along with the |viewport|. 1120 // The |child| window's screen bounds should move along with the |viewport|.
1121 viewport->SetBounds(gfx::Rect(-100, -100, 300, 300)); 1121 viewport->SetBounds(gfx::Rect(-100, -100, 300, 300));
1122 EXPECT_EQ("-100,-100 100x100", child->GetBoundsInRootWindow().ToString()); 1122 EXPECT_EQ("-100,-100 100x100", child->GetBoundsInRootWindow().ToString());
1123 1123
1124 // The |child| window is moved to the 0,0 in screen coordinates. 1124 // The |child| window is moved to the 0,0 in screen coordinates.
1125 // |GetBoundsInRootWindow()| should return 0,0. 1125 // |GetBoundsInRootWindow()| should return 0,0.
1126 child->SetBounds(gfx::Rect(100, 100, 100, 100)); 1126 child->SetBounds(gfx::Rect(100, 100, 100, 100));
1127 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); 1127 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString());
1128
1129 gfx::Transform transform;
1130 transform.Scale(0.5, 0.5);
1131 viewport->SetTransform(transform);
1132 EXPECT_EQ(gfx::Rect(-100, -100, 150, 150).ToString(),
1133 viewport->GetBoundsInRootWindow().ToString());
1134 EXPECT_EQ(gfx::Rect(-50, -50, 50, 50).ToString(),
1135 child->GetBoundsInRootWindow().ToString());
1128 } 1136 }
1129 1137
1130 class MouseEnterExitWindowDelegate : public TestWindowDelegate { 1138 class MouseEnterExitWindowDelegate : public TestWindowDelegate {
1131 public: 1139 public:
1132 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} 1140 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {}
1133 1141
1134 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 1142 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
1135 switch (event->type()) { 1143 switch (event->type()) {
1136 case ui::ET_MOUSE_ENTERED: 1144 case ui::ET_MOUSE_ENTERED:
1137 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); 1145 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED);
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 BuildRootLayerTreeDescription(*root.layer())) 3331 BuildRootLayerTreeDescription(*root.layer()))
3324 << "layer tree doesn't match at " << i; 3332 << "layer tree doesn't match at " << i;
3325 EXPECT_EQ(data[i].expected_description, 3333 EXPECT_EQ(data[i].expected_description,
3326 BuildRootWindowTreeDescription(root)) 3334 BuildRootWindowTreeDescription(root))
3327 << "window tree doesn't match at " << i; 3335 << "window tree doesn't match at " << i;
3328 } 3336 }
3329 } 3337 }
3330 3338
3331 } // namespace test 3339 } // namespace test
3332 } // namespace aura 3340 } // namespace aura
OLDNEW
« ui/aura/window.cc ('K') | « ui/aura/window_targeter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698