summaryrefslogtreecommitdiffstats
path: root/ui/aura/window_unittest.cc
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 03:18:39 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 03:18:39 +0000
commit4fe110ead2256dfe25a21962240cc3ef4e16d7b3 (patch)
treec04da63d18cad753862d6b6f92fbfc1674021ded /ui/aura/window_unittest.cc
parentb1ed076c8ded017771dc1fee337213d5537a31cf (diff)
downloadchromium_src-4fe110ead2256dfe25a21962240cc3ef4e16d7b3.zip
chromium_src-4fe110ead2256dfe25a21962240cc3ef4e16d7b3.tar.gz
chromium_src-4fe110ead2256dfe25a21962240cc3ef4e16d7b3.tar.bz2
Ash: Allow resize along 1 pixel edge inside window content
Mocks call for resize handles to function along a single pixel edge inside the window, overlapping the web content. Use the aura::Window::set_hit_test_bounds_inset() functionality to make hover/click events along that border pass through to the non-client area of the window frames. This also allows windows to be resized when they are flush against the top/left/right edges of the screen. BUG=117542 TEST=aura_shell_unittests ShelfLayoutManager, manually resize window from left/right/bottom/top edges Review URL: http://codereview.chromium.org/9694012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/window_unittest.cc')
-rw-r--r--ui/aura/window_unittest.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index ee3aeaf..e4c9def 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -282,7 +282,7 @@ TEST_F(WindowTest, HitTest) {
EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1)));
// We can expand the bounds slightly to track events outside our border.
- w1.set_hit_test_bounds_inset(-1);
+ w1.SetHitTestBoundsOverride(1, 0);
EXPECT_TRUE(w1.HitTest(gfx::Point(-1, -1)));
EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
@@ -318,6 +318,23 @@ TEST_F(WindowTest, GetEventHandlerForPoint) {
EXPECT_EQ(w13.get(), root->GetEventHandlerForPoint(gfx::Point(26, 481)));
}
+TEST_F(WindowTest, GetEventHandlerForPointWithOverride) {
+ // If our child is flush to our top-left corner he gets events just inside the
+ // window edges.
+ scoped_ptr<Window> parent(
+ CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 20, 400, 500), NULL));
+ scoped_ptr<Window> child(
+ CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get()));
+ EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
+ EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
+
+ // We can override the hit test bounds of the parent to make the parent grab
+ // events along that edge.
+ parent->SetHitTestBoundsOverride(0, 1);
+ EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
+ EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
+}
+
TEST_F(WindowTest, GetTopWindowContainingPoint) {
Window* root = root_window();
root->SetBounds(gfx::Rect(0, 0, 300, 300));