diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/root_window.cc | 1 | ||||
-rw-r--r-- | ui/aura/window_unittest.cc | 40 |
2 files changed, 1 insertions, 40 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 6dc9b4c..dd84728 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -245,6 +245,7 @@ bool RootWindow::DispatchTouchEvent(TouchEvent* event) { } bool RootWindow::DispatchGestureEvent(GestureEvent* event) { + event->UpdateForTransform(layer()->transform()); Window* target = gesture_handler_ ? gesture_handler_ : capture_window_; if (!target) target = GetEventHandlerForPoint(event->location()); diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 76a70ca..3ef60ff 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -146,24 +146,6 @@ class CaptureWindowDelegateImpl : public TestWindowDelegate { DISALLOW_COPY_AND_ASSIGN(CaptureWindowDelegateImpl); }; -// Keeps track of the location of the gesture. -class GestureTrackPositionDelegate : public TestWindowDelegate { - public: - GestureTrackPositionDelegate() {} - - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { - position_ = event->location(); - return ui::GESTURE_STATUS_CONSUMED; - } - - const gfx::Point& position() const { return position_; } - - private: - gfx::Point position_; - - DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); -}; - } // namespace TEST_F(WindowTest, GetChildById) { @@ -795,28 +777,6 @@ TEST_F(WindowTest, Transform) { gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()).ToString()); } -// Tests that gesture events are transformed correctly. -TEST_F(WindowTest, TransformGesture) { - RootWindow* root_window = RootWindow::GetInstance(); - gfx::Size size = root_window->GetHostSize(); - - scoped_ptr<GestureTrackPositionDelegate> delegate( - new GestureTrackPositionDelegate); - scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234, - gfx::Rect(0, 0, 20, 20), NULL)); - - // Rotate the root-window clock-wise 90 degrees. - ui::Transform transform; - transform.SetRotate(90.0f); - transform.ConcatTranslate(size.width(), 0); - root_window->SetTransform(transform); - - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(size.height() - 10, 10), 0); - root_window->DispatchTouchEvent(&press); - EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); -} - // Various assertions for transient children. TEST_F(WindowTest, TransientChildren) { scoped_ptr<Window> parent(CreateTestWindowWithId(0, NULL)); |