Index: ui/aura/window_unittest.cc |
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc |
index 5932a4cc74acd96a075b08a5a0587d3d82e03f5b..f0da477a3cb2ca069d24735b60e3674f98f0b6e3 100644 |
--- a/ui/aura/window_unittest.cc |
+++ b/ui/aura/window_unittest.cc |
@@ -4,6 +4,8 @@ |
#include "ui/aura/window.h" |
+#include <utility> |
+ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/stringprintf.h" |
@@ -322,6 +324,26 @@ TEST_F(WindowTest, HitTest) { |
// TODO(beng): clip Window to parent. |
} |
+TEST_F(WindowTest, HitTestMask) { |
+ Window w1(new MaskedWindowDelegate(gfx::Rect(5, 6, 20, 30))); |
+ w1.Init(ui::LAYER_NOT_DRAWN); |
+ w1.SetBounds(gfx::Rect(10, 20, 50, 60)); |
+ w1.Show(); |
+ w1.SetParent(NULL); |
+ |
+ // Points inside the mask. |
+ EXPECT_TRUE(w1.HitTest(gfx::Point(5, 6))); // top-left |
+ EXPECT_TRUE(w1.HitTest(gfx::Point(15, 21))); // center |
+ EXPECT_TRUE(w1.HitTest(gfx::Point(24, 35))); // bottom-right |
+ |
+ // Points outside the mask. |
+ EXPECT_FALSE(w1.HitTest(gfx::Point(0, 0))); |
+ EXPECT_FALSE(w1.HitTest(gfx::Point(60, 80))); |
+ EXPECT_FALSE(w1.HitTest(gfx::Point(4, 6))); |
+ EXPECT_FALSE(w1.HitTest(gfx::Point(5, 5))); |
+ EXPECT_FALSE(w1.HitTest(gfx::Point(25, 36))); |
+} |
+ |
TEST_F(WindowTest, GetEventHandlerForPoint) { |
scoped_ptr<Window> w1( |
CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), NULL)); |
@@ -1680,7 +1702,7 @@ TEST_F(WindowTest, StackTransientsWhoseLayersHaveNoDelegate) { |
} |
class TestVisibilityClient : public client::VisibilityClient { |
-public: |
+ public: |
explicit TestVisibilityClient(RootWindow* root_window) |
: ignore_visibility_changes_(false) { |
client::SetVisibilityClient(root_window, this); |