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

Unified Diff: ui/aura/window_unittest.cc

Issue 10806055: Fix aura::Window::ContainsPointInRoot(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
« ui/aura/window.cc ('K') | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index d9557191603233d169d986b32305cfcce9066bd7..e13dcdb8364fe507534230afee413fb8fda24e2e 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -268,6 +268,25 @@ TEST_F(WindowTest, Contains) {
EXPECT_FALSE(child2.Contains(&child1));
}
+TEST_F(WindowTest, ContainsPointInRoot) {
+ scoped_ptr<Window> w(
+ CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 5, 5), NULL));
+ EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(9, 9)));
+ EXPECT_TRUE(w->ContainsPointInRoot(gfx::Point(10, 10)));
+ EXPECT_TRUE(w->ContainsPointInRoot(gfx::Point(14, 14)));
+ EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(15, 15)));
+ EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(20, 20)));
+}
+
+TEST_F(WindowTest, ContainsPoint) {
+ scoped_ptr<Window> w(
+ CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 5, 5), NULL));
+ EXPECT_TRUE(w->ContainsPoint(gfx::Point(0, 0)));
+ EXPECT_TRUE(w->ContainsPoint(gfx::Point(4, 4)));
+ EXPECT_FALSE(w->ContainsPoint(gfx::Point(5, 5)));
+ EXPECT_FALSE(w->ContainsPoint(gfx::Point(10, 10)));
+}
+
TEST_F(WindowTest, ConvertPointToWindow) {
// Window::ConvertPointToWindow is mostly identical to
// Layer::ConvertPointToLayer, except NULL values for |source| are permitted,
« ui/aura/window.cc ('K') | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698