diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-01 03:18:39 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-01 03:18:39 +0000 |
commit | 5331978b75a104235ac98eb3be9e7e176994ab8e (patch) | |
tree | aefed5446e6ce6e0d7386e6d4350df874442c83c /ui/views/touchui/touch_selection_controller_impl_unittest.cc | |
parent | b24df959055631ff52b47097053948f597eb0a0c (diff) | |
download | chromium_src-5331978b75a104235ac98eb3be9e7e176994ab8e.zip chromium_src-5331978b75a104235ac98eb3be9e7e176994ab8e.tar.gz chromium_src-5331978b75a104235ac98eb3be9e7e176994ab8e.tar.bz2 |
Touch selection: The touch selection handle widget should only hit test on the
touchable part so that the event fall through when touching on the cursor line.
BUG=236396
R=sadrul@chromium.org
Review URL: https://codereview.chromium.org/14553002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/touchui/touch_selection_controller_impl_unittest.cc')
-rw-r--r-- | ui/views/touchui/touch_selection_controller_impl_unittest.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc index 78a8236..25fc0f1 100644 --- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc +++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc @@ -15,6 +15,11 @@ #include "ui/views/touchui/touch_selection_controller_impl.h" #include "ui/views/widget/widget.h" +#if defined(USE_AURA) +#include "ui/aura/test/event_generator.h" +#include "ui/aura/window.h" +#endif + namespace views { class TouchSelectionControllerImplTest : public ViewsTestBase { @@ -51,8 +56,10 @@ class TouchSelectionControllerImplTest : public ViewsTestBase { textfield_view_ = static_cast<NativeTextfieldViews*>( textfield_->GetNativeWrapperForTesting()); + textfield_->SetBoundsRect(params.bounds); textfield_view_->SetBoundsRect(params.bounds); textfield_->set_id(1); + widget_->Show(); DCHECK(textfield_view_); textfield_->RequestFocus(); @@ -403,4 +410,30 @@ TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { VERIFY_HANDLE_POSITIONS(false); } +#if defined(USE_AURA) +TEST_F(TouchSelectionControllerImplTest, + DoubleTapInTextfieldWithCursorHandleShouldSelectWord) { + CreateTextfield(); + textfield_->SetText(ASCIIToUTF16("some text")); + aura::test::EventGenerator generator( + textfield_->GetWidget()->GetNativeView()->GetRootWindow()); + + // Tap the textfield to invoke touch selection. + generator.GestureTapAt(gfx::Point(10, 10)); + + // Cursor handle should be visible. + EXPECT_FALSE(textfield_->HasSelection()); + VERIFY_HANDLE_POSITIONS(false); + + // Double tap on the cursor handle position. We want to check that the cursor + // handle is not eating the event and that the event is falling through to the + // textfield. + gfx::Point cursor_pos = GetCursorHandlePosition(); + generator.GestureTapAt(cursor_pos); + generator.GestureTapAt(cursor_pos); + EXPECT_TRUE(textfield_->HasSelection()); + VERIFY_HANDLE_POSITIONS(false); +} +#endif + } // namespace views |