| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "ui/base/clipboard/clipboard.h" | 10 #include "ui/base/clipboard/clipboard.h" |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 gfx::Point point(5, 5); | 1972 gfx::Point point(5, 5); |
| 1973 View::ConvertPointToView(child_child, child, &point); | 1973 View::ConvertPointToView(child_child, child, &point); |
| 1974 EXPECT_EQ(42, point.x()); | 1974 EXPECT_EQ(42, point.x()); |
| 1975 EXPECT_EQ(48, point.y()); | 1975 EXPECT_EQ(48, point.y()); |
| 1976 | 1976 |
| 1977 point.SetPoint(42, 48); | 1977 point.SetPoint(42, 48); |
| 1978 View::ConvertPointToView(child, child_child, &point); | 1978 View::ConvertPointToView(child, child_child, &point); |
| 1979 EXPECT_EQ(5, point.x()); | 1979 EXPECT_EQ(5, point.x()); |
| 1980 EXPECT_EQ(5, point.y()); | 1980 EXPECT_EQ(5, point.y()); |
| 1981 } | 1981 } |
| 1982 |
| 1983 // Conversions from top_view to child with a value that should be negative. |
| 1984 // This ensures we don't round up with negative numbers. |
| 1985 { |
| 1986 gfx::Point point(6, 18); |
| 1987 View::ConvertPointToView(&top_view, child, &point); |
| 1988 EXPECT_EQ(-1, point.x()); |
| 1989 EXPECT_EQ(-1, point.y()); |
| 1990 } |
| 1982 } | 1991 } |
| 1983 | 1992 |
| 1984 TEST_F(ViewTest, Contains) { | 1993 TEST_F(ViewTest, Contains) { |
| 1985 TestView v1; | 1994 TestView v1; |
| 1986 TestView* v2 = new TestView(); | 1995 TestView* v2 = new TestView(); |
| 1987 TestView* v3 = new TestView(); | 1996 TestView* v3 = new TestView(); |
| 1988 | 1997 |
| 1989 v1.AddChildView(v2); | 1998 v1.AddChildView(v2); |
| 1990 v2->AddChildView(v3); | 1999 v2->AddChildView(v3); |
| 1991 | 2000 |
| 1992 EXPECT_FALSE(v1.Contains(NULL)); | 2001 EXPECT_FALSE(v1.Contains(NULL)); |
| 1993 EXPECT_TRUE(v1.Contains(&v1)); | 2002 EXPECT_TRUE(v1.Contains(&v1)); |
| 1994 EXPECT_TRUE(v1.Contains(v2)); | 2003 EXPECT_TRUE(v1.Contains(v2)); |
| 1995 EXPECT_TRUE(v1.Contains(v3)); | 2004 EXPECT_TRUE(v1.Contains(v3)); |
| 1996 EXPECT_FALSE(v2->Contains(NULL)); | 2005 EXPECT_FALSE(v2->Contains(NULL)); |
| 1997 EXPECT_TRUE(v2->Contains(v2)); | 2006 EXPECT_TRUE(v2->Contains(v2)); |
| 1998 EXPECT_FALSE(v2->Contains(&v1)); | 2007 EXPECT_FALSE(v2->Contains(&v1)); |
| 1999 EXPECT_TRUE(v2->Contains(v3)); | 2008 EXPECT_TRUE(v2->Contains(v3)); |
| 2000 EXPECT_FALSE(v3->Contains(NULL)); | 2009 EXPECT_FALSE(v3->Contains(NULL)); |
| 2001 EXPECT_TRUE(v3->Contains(v3)); | 2010 EXPECT_TRUE(v3->Contains(v3)); |
| 2002 EXPECT_FALSE(v3->Contains(&v1)); | 2011 EXPECT_FALSE(v3->Contains(&v1)); |
| 2003 EXPECT_FALSE(v3->Contains(v2)); | 2012 EXPECT_FALSE(v3->Contains(v2)); |
| 2004 } | 2013 } |
| 2005 | 2014 |
| 2006 } // namespace views | 2015 } // namespace views |
| OLD | NEW |