diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-17 20:32:41 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-17 20:32:41 +0000 |
commit | a37989fe53097e4a0b6e87eb6ba01def1e13b675 (patch) | |
tree | 9267a150f8d58d96dc7e8448b235eda8561de75d /fpdfsdk/fpdf_formfill_embeddertest.cpp | |
parent | 5ae6c564d16ce8b625df3d1950abc822f9ecc987 (diff) | |
download | pdfium-a37989fe53097e4a0b6e87eb6ba01def1e13b675.tar.xz |
Add FORM_OnLButtonDoubleClick().
The code for this already exists, but is not hooked up to a public API.
Hook it up and add a test case.
Change-Id: I2ebc8492d8b7347849ff06f664155c6d72ecf76f
Reviewed-on: https://pdfium-review.googlesource.com/c/44130
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_formfill_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdf_formfill_embeddertest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp index e55997c740..99d30f3cc3 100644 --- a/fpdfsdk/fpdf_formfill_embeddertest.cpp +++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp @@ -64,6 +64,12 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest { FORM_OnLButtonUp(form_handle(), page_, 0, point.x, point.y); } + void DoubleClickOnFormFieldAtPoint(const CFX_PointF& point) { + // Click on the text field or combobox as specified by coordinates. + FORM_OnMouseMove(form_handle(), page_, 0, point.x, point.y); + FORM_OnLButtonDoubleClick(form_handle(), page_, 0, point.x, point.y); + } + void TypeTextIntoTextField(int num_chars, const CFX_PointF& point) { EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(point)); ClickOnFormFieldAtPoint(point); @@ -1542,6 +1548,23 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, CheckSelection(L"ElepHippop"); } +TEST_F(FPDFFormFillTextFormEmbeddertest, DoubleClickInTextField) { + CheckFocusedFieldText(L""); + ClickOnFormFieldAtPoint(RegularFormBegin()); + CheckFocusedFieldText(L""); + + // Test inserting text into empty text field. + std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert = + GetFPDFWideString(L"Hello World"); + FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get()); + CheckFocusedFieldText(L"Hello World"); + + // Make sure double clicking selects the entire line. + CheckSelection(L""); + DoubleClickOnFormFieldAtPoint(RegularFormBegin()); + CheckSelection(L"Hello World"); +} + TEST_F(FPDFFormFillTextFormEmbeddertest, FocusChanges) { static const CFX_PointF kNonFormPoint(1, 1); CheckFocusedFieldText(L""); |