| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/window/window_win.h" | 5 #include "views/window/window_win.h" |
| 6 | 6 |
| 7 #include "gfx/rect.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/gfx/rect.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 TEST(WindowWinTest, EnsureRectIsVisibleInRect) { | 12 TEST(WindowWinTest, EnsureRectIsVisibleInRect) { |
| 13 gfx::Rect parent_rect(0, 0, 500, 400); | 13 gfx::Rect parent_rect(0, 0, 500, 400); |
| 14 | 14 |
| 15 { | 15 { |
| 16 // Child rect x < 0 | 16 // Child rect x < 0 |
| 17 gfx::Rect child_rect(-50, 20, 100, 100); | 17 gfx::Rect child_rect(-50, 20, 100, 100); |
| 18 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); | 18 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 { | 50 { |
| 51 // Child rect height > parent_rect.height | 51 // Child rect height > parent_rect.height |
| 52 gfx::Rect child_rect(20, 20, 100, 700); | 52 gfx::Rect child_rect(20, 20, 100, 700); |
| 53 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); | 53 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); |
| 54 EXPECT_EQ(gfx::Rect(20, 20, 100, 380), child_rect); | 54 EXPECT_EQ(gfx::Rect(20, 20, 100, 380), child_rect); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace views | 58 } // namespace views |
| OLD | NEW |