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

Unified Diff: ui/views/controls/native/native_view_host_aura_unittest.cc

Issue 27768003: aura: Fix NativeViewHostAura non fast resize clipping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/native/native_view_host_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/native/native_view_host_aura_unittest.cc
diff --git a/ui/views/controls/native/native_view_host_aura_unittest.cc b/ui/views/controls/native/native_view_host_aura_unittest.cc
index 6dc43750ebd36a4699ee6637ccb5eba35f281a7d..05e2e7fc6df12398e330957355b4ad5b337a1968 100644
--- a/ui/views/controls/native/native_view_host_aura_unittest.cc
+++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -228,4 +228,47 @@ TEST_F(NativeViewHostAuraTest, DestroyWidget) {
EXPECT_EQ(1, NativeViewHostTesting::destroyed_count());
}
+// Test that the none fast resize path is clipped and positioned correctly.
+TEST_F(NativeViewHostAuraTest, NonFastResizePath) {
+ const gfx::Rect base_rect = gfx::Rect(0, 0, 100, 100);
+ CreateHost();
+ toplevel()->SetBounds(base_rect);
+ native_host()->ShowWidget(base_rect.x(), base_rect.y(),
+ base_rect.width(), base_rect.height());
+ EXPECT_EQ(base_rect.ToString(),
+ host()->native_view()->bounds().ToString());
+ EXPECT_EQ(base_rect.ToString(),
+ clipping_window()->bounds().ToString());
+
+ const gfx::Rect kTestCases[] = {
+ gfx::Rect(-10, -20, 100, 100),
+ gfx::Rect(0, -20, 100, 100),
+ gfx::Rect(10, -20, 100, 100),
+ gfx::Rect(-10, 0, 100, 100),
+ gfx::Rect(0, 0, 100, 100),
+ gfx::Rect(10, 0, 100, 100),
+ gfx::Rect(-10, 20, 100, 100),
+ gfx::Rect(0, 20, 100, 100),
+ gfx::Rect(10, 20, 100, 100),
+ gfx::Rect(0, 0, 200, 300),
+ gfx::Rect(-50, -100, 200, 300),
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
+ const gfx::Rect& bounds = kTestCases[i];
+
+ host()->SetBoundsRect(bounds);
+
+ gfx::Rect clip_rect = gfx::IntersectRects(bounds, base_rect);
+ EXPECT_EQ(clip_rect.ToString(), clipping_window()->bounds().ToString());
+
+ gfx::Rect native_view_bounds = bounds;
+ native_view_bounds.Offset(-clip_rect.x(), -clip_rect.y());
+ EXPECT_EQ(native_view_bounds.ToString(),
+ host()->native_view()->bounds().ToString());
+ }
+
+ DestroyHost();
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/native/native_view_host_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698