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

Side by Side Diff: views/window/window_win_unittest.cc

Issue 6386009: Remove app/win/win_util.h,cc etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with NSApp changes in r73581 Created 9 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
« no previous file with comments | « views/window/window_win.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) 2010 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 "app/win/win_util.h" 5 #include "views/window/window_win.h"
6
6 #include "gfx/rect.h" 7 #include "gfx/rect.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace app { 10 namespace views {
10 namespace win {
11 11
12 TEST(WinUtilTest, 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 EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); 18 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
19 EXPECT_EQ(gfx::Rect(10, 20, 100, 100), child_rect); 19 EXPECT_EQ(gfx::Rect(10, 20, 100, 100), child_rect);
20 } 20 }
21 21
22 { 22 {
23 // Child rect y < 0 23 // Child rect y < 0
24 gfx::Rect child_rect(20, -50, 100, 100); 24 gfx::Rect child_rect(20, -50, 100, 100);
25 EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); 25 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
26 EXPECT_EQ(gfx::Rect(20, 10, 100, 100), child_rect); 26 EXPECT_EQ(gfx::Rect(20, 10, 100, 100), child_rect);
27 } 27 }
28 28
29 { 29 {
30 // Child rect right > parent_rect.right 30 // Child rect right > parent_rect.right
31 gfx::Rect child_rect(450, 20, 100, 100); 31 gfx::Rect child_rect(450, 20, 100, 100);
32 EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); 32 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
33 EXPECT_EQ(gfx::Rect(390, 20, 100, 100), child_rect); 33 EXPECT_EQ(gfx::Rect(390, 20, 100, 100), child_rect);
34 } 34 }
35 35
36 { 36 {
37 // Child rect bottom > parent_rect.bottom 37 // Child rect bottom > parent_rect.bottom
38 gfx::Rect child_rect(20, 350, 100, 100); 38 gfx::Rect child_rect(20, 350, 100, 100);
39 EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); 39 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
40 EXPECT_EQ(gfx::Rect(20, 290, 100, 100), child_rect); 40 EXPECT_EQ(gfx::Rect(20, 290, 100, 100), child_rect);
41 } 41 }
42 42
43 { 43 {
44 // Child rect width > parent_rect.width 44 // Child rect width > parent_rect.width
45 gfx::Rect child_rect(20, 20, 700, 100); 45 gfx::Rect child_rect(20, 20, 700, 100);
46 EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10); 46 internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
47 EXPECT_EQ(gfx::Rect(20, 20, 480, 100), child_rect); 47 EXPECT_EQ(gfx::Rect(20, 20, 480, 100), child_rect);
48 } 48 }
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 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 win 58 } // namespace views
59 } // namespace app
OLDNEW
« no previous file with comments | « views/window/window_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698