| 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
|
|
|