summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfformfill_embeddertest.cpp467
1 files changed, 297 insertions, 170 deletions
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp
index e5f517f673..93350874dc 100644
--- a/fpdfsdk/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/fpdfformfill_embeddertest.cpp
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "public/cpp/fpdf_deleters.h"
@@ -52,17 +53,20 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest {
FPDF_PAGE page() { return page_; }
- void ClickOnFormFieldAtPoint(double x, double y) {
+ int GetFormTypeAtPoint(const CFX_PointF& point) {
+ return FPDFPage_HasFormFieldAtPoint(form_handle(), page_, point.x, point.y);
+ }
+
+ void ClickOnFormFieldAtPoint(const CFX_PointF& point) {
// Click on the text field or combobox as specified by coordinates.
- FORM_OnMouseMove(form_handle(), page_, 0, x, y);
- FORM_OnLButtonDown(form_handle(), page_, 0, x, y);
- FORM_OnLButtonUp(form_handle(), page_, 0, x, y);
+ FORM_OnMouseMove(form_handle(), page_, 0, point.x, point.y);
+ FORM_OnLButtonDown(form_handle(), page_, 0, point.x, point.y);
+ FORM_OnLButtonUp(form_handle(), page_, 0, point.x, point.y);
}
- void TypeTextIntoTextField(int num_chars, double x, double y) {
- EXPECT_EQ(GetFormType(),
- FPDFPage_HasFormFieldAtPoint(form_handle(), page_, x, y));
- ClickOnFormFieldAtPoint(x, y);
+ void TypeTextIntoTextField(int num_chars, const CFX_PointF& point) {
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(point));
+ ClickOnFormFieldAtPoint(point);
// Type text starting with 'A' to as many chars as specified by |num_chars|.
for (int i = 0; i < num_chars; ++i) {
@@ -74,10 +78,9 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest {
// shift and specfied left or right arrow key.
void SelectTextWithKeyboard(int num_chars,
int arrow_key,
- double x,
- double y) {
+ const CFX_PointF& point) {
// Navigate to starting position for selection.
- ClickOnFormFieldAtPoint(x, y);
+ ClickOnFormFieldAtPoint(point);
// Hold down shift (and don't release until entire text is selected).
FORM_OnKeyDown(form_handle(), page_, FWL_VKEY_Shift, 0);
@@ -91,14 +94,16 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest {
}
// Uses the mouse to navigate to text field and select text.
- void SelectTextWithMouse(double start_x, double end_x, double y) {
+ void SelectTextWithMouse(const CFX_PointF& start, const CFX_PointF& end) {
+ ASSERT(start.y == end.y);
+
// Navigate to starting position and click mouse.
- FORM_OnMouseMove(form_handle(), page_, 0, start_x, y);
- FORM_OnLButtonDown(form_handle(), page_, 0, start_x, y);
+ FORM_OnMouseMove(form_handle(), page_, 0, start.x, start.y);
+ FORM_OnLButtonDown(form_handle(), page_, 0, start.x, start.y);
// Hold down mouse until reach end of desired selection.
- FORM_OnMouseMove(form_handle(), page_, 0, end_x, y);
- FORM_OnLButtonUp(form_handle(), page_, 0, end_x, y);
+ FORM_OnMouseMove(form_handle(), page_, 0, end.x, end.y);
+ FORM_OnLButtonUp(form_handle(), page_, 0, end.x, end.y);
}
void CheckSelection(const CFX_WideStringC& expected_string) {
@@ -132,13 +137,66 @@ class FPDFFormFillTextFormEmbeddertest
const char* GetDocumentName() const override {
// PDF with several form text fields:
- // - "Text Box" - No special attributes.
+ // - "Text Box" - Regular text box with no special attributes.
// - "ReadOnly" - Ff: 1.
// - "CharLimit" - MaxLen: 10, V: Elephant.
return "text_form_multiple.pdf";
}
int GetFormType() const override { return FPDF_FORMFIELD_TEXTFIELD; }
+
+ void FormSanityChecks() override {
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(CharLimitFormBegin()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(CharLimitFormEnd()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(RegularFormBegin()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(RegularFormEnd()));
+ }
+
+ void SelectAllCharLimitFormTextWithMouse() {
+ SelectTextWithMouse(CharLimitFormEnd(), CharLimitFormBegin());
+ }
+
+ void SelectAllRegularFormTextWithMouse() {
+ SelectTextWithMouse(RegularFormEnd(), RegularFormBegin());
+ }
+
+ const CFX_PointF& CharLimitFormBegin() const {
+ static const CFX_PointF point = CharLimitFormAtX(kFormBeginX);
+ return point;
+ }
+
+ const CFX_PointF& CharLimitFormEnd() const {
+ static const CFX_PointF point = CharLimitFormAtX(kFormEndX);
+ return point;
+ }
+
+ const CFX_PointF& RegularFormBegin() const {
+ static const CFX_PointF point = RegularFormAtX(kFormBeginX);
+ return point;
+ }
+
+ const CFX_PointF& RegularFormEnd() const {
+ static const CFX_PointF point = RegularFormAtX(kFormEndX);
+ return point;
+ }
+
+ static CFX_PointF CharLimitFormAtX(float x) {
+ ASSERT(x >= kFormBeginX);
+ ASSERT(x <= kFormEndX);
+ return CFX_PointF(x, kCharLimitFormY);
+ }
+
+ static CFX_PointF RegularFormAtX(float x) {
+ ASSERT(x >= kFormBeginX);
+ ASSERT(x <= kFormEndX);
+ return CFX_PointF(x, kRegularFormY);
+ }
+
+ private:
+ static constexpr float kFormBeginX = 102.0;
+ static constexpr float kFormEndX = 195.0;
+ static constexpr float kCharLimitFormY = 60.0;
+ static constexpr float kRegularFormY = 115.0;
};
class FPDFFormFillComboBoxFormEmbeddertest
@@ -148,35 +206,104 @@ class FPDFFormFillComboBoxFormEmbeddertest
~FPDFFormFillComboBoxFormEmbeddertest() override = default;
const char* GetDocumentName() const override {
- // PDF with form comboboxes.
+ // PDF with form comboboxes:
+ // - "Combo_Editable" - Ff: 393216, 3 options with pair values.
+ // - "Combo1" - Ff: 131072, 3 options with single values.
+ // - "Combo_ReadOnly" - Ff: 131073, 3 options with single values.
return "combobox_form.pdf";
}
int GetFormType() const override { return FPDF_FORMFIELD_COMBOBOX; }
void FormSanityChecks() override {
- EXPECT_EQ(GetFormType(), FPDFPage_HasFormFieldAtPoint(form_handle(), page(),
- 102.0, 113.0));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(EditableFormBegin()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(EditableFormEnd()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(EditableFormDropDown()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(NonEditableFormBegin()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(NonEditableFormEnd()));
+ EXPECT_EQ(GetFormType(), GetFormTypeAtPoint(NonEditableFormDropDown()));
}
+ void SelectEditableFormOption(int item_index) {
+ SelectOption(item_index, EditableFormDropDown());
+ }
+
+ void SelectNonEditableFormOption(int item_index) {
+ SelectOption(item_index, NonEditableFormDropDown());
+ }
+
+ void SelectAllEditableFormTextWithMouse() {
+ SelectTextWithMouse(EditableFormEnd(), EditableFormBegin());
+ }
+
+ const CFX_PointF& EditableFormBegin() const {
+ static const CFX_PointF point = EditableFormAtX(kFormBeginX);
+ return point;
+ }
+
+ const CFX_PointF& EditableFormEnd() const {
+ static const CFX_PointF point = EditableFormAtX(kFormEndX);
+ return point;
+ }
+
+ const CFX_PointF& EditableFormDropDown() const {
+ static const CFX_PointF point(kFormDropDownX, kEditableFormY);
+ return point;
+ }
+
+ const CFX_PointF& NonEditableFormBegin() const {
+ static const CFX_PointF point = NonEditableFormAtX(kFormBeginX);
+ return point;
+ }
+
+ const CFX_PointF& NonEditableFormEnd() const {
+ static const CFX_PointF point = NonEditableFormAtX(kFormEndX);
+ return point;
+ }
+
+ const CFX_PointF& NonEditableFormDropDown() const {
+ static const CFX_PointF point(kFormDropDownX, kNonEditableFormY);
+ return point;
+ }
+
+ static CFX_PointF EditableFormAtX(float x) {
+ ASSERT(x >= kFormBeginX);
+ ASSERT(x <= kFormEndX);
+ return CFX_PointF(x, kEditableFormY);
+ }
+
+ static CFX_PointF NonEditableFormAtX(float x) {
+ ASSERT(x >= kFormBeginX);
+ ASSERT(x <= kFormEndX);
+ return CFX_PointF(x, kNonEditableFormY);
+ }
+
+ private:
// Selects one of the pre-selected values from a combobox with three options.
// Options are specified by |item_index|, which is 0-based.
- void SelectOption(int32_t item_index, double x, double y) {
+ void SelectOption(int item_index, const CFX_PointF& point) {
// Only relevant for comboboxes with three choices and the same dimensions
// as those in combobox_form.pdf.
ASSERT(item_index >= 0);
ASSERT(item_index < 3);
// Navigate to button for drop down and click mouse to reveal options.
- ClickOnFormFieldAtPoint(x, y);
+ ClickOnFormFieldAtPoint(point);
- // Y coordinate of dropdown option to be selected.
+ // Calculate to Y-coordinate of dropdown option to be selected.
constexpr double kChoiceHeight = 15;
- double option_y = y - kChoiceHeight * (item_index + 1);
+ CFX_PointF option_point = point;
+ option_point.y -= kChoiceHeight * (item_index + 1);
// Navigate to option and click mouse to select it.
- ClickOnFormFieldAtPoint(x, option_y);
+ ClickOnFormFieldAtPoint(option_point);
}
+
+ static constexpr float kFormBeginX = 102.0;
+ static constexpr float kFormEndX = 183.0;
+ static constexpr float kFormDropDownX = 192.0;
+ static constexpr float kEditableFormY = 60.0;
+ static constexpr float kNonEditableFormY = 110.0;
};
TEST_F(FPDFFormFillEmbeddertest, FirstTest) {
@@ -433,8 +560,8 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, GetSelectedTextEmptyAndBasicKeyboard) {
CheckSelection(L"");
// Test basic selection.
- TypeTextIntoTextField(3, 120.0, 120.0);
- SelectTextWithKeyboard(3, FWL_VKEY_Left, 123.0, 115.5);
+ TypeTextIntoTextField(3, RegularFormBegin());
+ SelectTextWithKeyboard(3, FWL_VKEY_Left, RegularFormAtX(123.0));
CheckSelection(L"ABC");
}
@@ -443,56 +570,56 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, GetSelectedTextEmptyAndBasicMouse) {
CheckSelection(L"");
// Test basic selection.
- TypeTextIntoTextField(3, 120.0, 120.0);
- SelectTextWithMouse(125.0, 102.0, 115.5);
+ TypeTextIntoTextField(3, RegularFormBegin());
+ SelectTextWithMouse(RegularFormAtX(125.0), RegularFormBegin());
CheckSelection(L"ABC");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, GetSelectedTextFragmentsKeyBoard) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Test selecting first character in forward direction.
- SelectTextWithKeyboard(1, FWL_VKEY_Right, 102.0, 115.5);
+ SelectTextWithKeyboard(1, FWL_VKEY_Right, RegularFormBegin());
CheckSelection(L"A");
// Test selecting entire long string in backwards direction.
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCDEFGHIJKL");
// Test selecting middle section in backwards direction.
- SelectTextWithKeyboard(6, FWL_VKEY_Left, 170.0, 115.5);
+ SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(170.0));
CheckSelection(L"DEFGHI");
// Test selecting middle selection in forward direction.
- SelectTextWithKeyboard(6, FWL_VKEY_Right, 125.0, 115.5);
+ SelectTextWithKeyboard(6, FWL_VKEY_Right, RegularFormAtX(125.0));
CheckSelection(L"DEFGHI");
// Test selecting last character in backwards direction.
- SelectTextWithKeyboard(1, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(1, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"L");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, GetSelectedTextFragmentsMouse) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Test selecting first character in forward direction.
- SelectTextWithMouse(102.0, 106.0, 115.5);
+ SelectTextWithMouse(RegularFormBegin(), RegularFormAtX(106.0));
CheckSelection(L"A");
// Test selecting entire long string in backwards direction.
- SelectTextWithMouse(191.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFGHIJKL");
// Test selecting middle section in backwards direction.
- SelectTextWithMouse(170.0, 125.0, 115.5);
+ SelectTextWithMouse(RegularFormAtX(170.0), RegularFormAtX(125.0));
CheckSelection(L"DEFGHI");
// Test selecting middle selection in forward direction.
- SelectTextWithMouse(125.0, 170.0, 115.5);
+ SelectTextWithMouse(RegularFormAtX(125.0), RegularFormAtX(170.0));
CheckSelection(L"DEFGHI");
// Test selecting last character in backwards direction.
- SelectTextWithMouse(191.0, 186.0, 115.5);
+ SelectTextWithMouse(RegularFormEnd(), RegularFormAtX(186.0));
CheckSelection(L"L");
}
@@ -502,11 +629,11 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
CheckSelection(L"");
// Non-editable comboboxes don't allow selection with keyboard.
- SelectTextWithMouse(102.0, 142.0, 113.0);
+ SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(142.0));
CheckSelection(L"Banana");
// Select other another provided option.
- SelectOption(0, 192.0, 110.0);
+ SelectNonEditableFormOption(0);
CheckSelection(L"Apple");
}
@@ -516,12 +643,12 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
CheckSelection(L"");
// Test basic selection of text within user editable combobox using keyboard.
- TypeTextIntoTextField(3, 102.0, 62.0);
- SelectTextWithKeyboard(3, FWL_VKEY_Left, 128.0, 62.0);
+ TypeTextIntoTextField(3, EditableFormBegin());
+ SelectTextWithKeyboard(3, FWL_VKEY_Left, EditableFormAtX(128.0));
CheckSelection(L"ABC");
// Select a provided option.
- SelectOption(1, 192.0, 60.0);
+ SelectEditableFormOption(1);
CheckSelection(L"Bar");
}
@@ -531,234 +658,234 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
CheckSelection(L"");
// Test basic selection of text within user editable combobox using mouse.
- TypeTextIntoTextField(3, 102.0, 62.0);
- SelectTextWithMouse(128.0, 103.0, 62.0);
+ TypeTextIntoTextField(3, EditableFormBegin());
+ SelectTextWithMouse(EditableFormAtX(128.0), EditableFormBegin());
CheckSelection(L"ABC");
// Select a provided option.
- SelectOption(2, 192.0, 60.0);
+ SelectEditableFormOption(2);
CheckSelection(L"Qux");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
GetSelectedTextFragmentsNormalComboBox) {
// Test selecting first character in forward direction.
- SelectTextWithMouse(102.0, 107.0, 113.0);
+ SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(107.0));
CheckSelection(L"B");
// Test selecting entire string in backwards direction.
- SelectTextWithMouse(142.0, 102.0, 113.0);
+ SelectTextWithMouse(NonEditableFormAtX(142.0), NonEditableFormBegin());
CheckSelection(L"Banana");
// Test selecting middle section in backwards direction.
- SelectTextWithMouse(135.0, 117.0, 113.0);
+ SelectTextWithMouse(NonEditableFormAtX(135.0), NonEditableFormAtX(117.0));
CheckSelection(L"nan");
// Test selecting middle section in forward direction.
- SelectTextWithMouse(117.0, 135.0, 113.0);
+ SelectTextWithMouse(NonEditableFormAtX(117.0), NonEditableFormAtX(135.0));
CheckSelection(L"nan");
// Test selecting last character in backwards direction.
- SelectTextWithMouse(142.0, 138.0, 113.0);
+ SelectTextWithMouse(NonEditableFormAtX(142.0), NonEditableFormAtX(138.0));
CheckSelection(L"a");
// Select another option and then reset selection as first three chars.
- SelectOption(2, 192.0, 110.0);
+ SelectNonEditableFormOption(2);
CheckSelection(L"Cherry");
- SelectTextWithMouse(102.0, 122.0, 113.0);
+ SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(122.0));
CheckSelection(L"Che");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
GetSelectedTextFragmentsEditableComboBoxKeyboard) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Test selecting first character in forward direction.
- SelectTextWithKeyboard(1, FWL_VKEY_Right, 102.0, 62.0);
+ SelectTextWithKeyboard(1, FWL_VKEY_Right, EditableFormBegin());
CheckSelection(L"A");
// Test selecting entire long string in backwards direction.
- SelectTextWithKeyboard(10, FWL_VKEY_Left, 178.0, 62.0);
+ SelectTextWithKeyboard(10, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"ABCDEFGHIJ");
// Test selecting middle section in backwards direction.
- SelectTextWithKeyboard(5, FWL_VKEY_Left, 168.0, 62.0);
+ SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(168.0));
CheckSelection(L"DEFGH");
// Test selecting middle selection in forward direction.
- SelectTextWithKeyboard(5, FWL_VKEY_Right, 127.0, 62.0);
+ SelectTextWithKeyboard(5, FWL_VKEY_Right, EditableFormAtX(127.0));
CheckSelection(L"DEFGH");
// Test selecting last character in backwards direction.
- SelectTextWithKeyboard(1, FWL_VKEY_Left, 178.0, 62.0);
+ SelectTextWithKeyboard(1, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"J");
// Select a provided option and then reset selection as first two chars.
- SelectOption(0, 192.0, 60.0);
+ SelectEditableFormOption(0);
CheckSelection(L"Foo");
- SelectTextWithKeyboard(2, FWL_VKEY_Right, 102.0, 62.0);
+ SelectTextWithKeyboard(2, FWL_VKEY_Right, EditableFormBegin());
CheckSelection(L"Fo");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
GetSelectedTextFragmentsEditableComboBoxMouse) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Test selecting first character in forward direction.
- SelectTextWithMouse(102.0, 107.0, 62.0);
+ SelectTextWithMouse(EditableFormBegin(), EditableFormAtX(107.0));
CheckSelection(L"A");
// Test selecting entire long string in backwards direction.
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEFGHIJ");
// Test selecting middle section in backwards direction.
- SelectTextWithMouse(168.0, 127.0, 62.0);
+ SelectTextWithMouse(EditableFormAtX(168.0), EditableFormAtX(127.0));
CheckSelection(L"DEFGH");
// Test selecting middle selection in forward direction.
- SelectTextWithMouse(127.0, 168.0, 62.0);
+ SelectTextWithMouse(EditableFormAtX(127.0), EditableFormAtX(168.0));
CheckSelection(L"DEFGH");
// Test selecting last character in backwards direction.
- SelectTextWithMouse(178.0, 174.0, 62.0);
+ SelectTextWithMouse(EditableFormEnd(), EditableFormAtX(174.0));
CheckSelection(L"J");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, DeleteTextFieldEntireSelection) {
// Select entire contents of text field.
- TypeTextIntoTextField(12, 120.0, 120.0);
- SelectTextWithMouse(191.0, 102.0, 115.5);
+ TypeTextIntoTextField(12, RegularFormBegin());
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFGHIJKL");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, DeleteTextFieldSelectionMiddle) {
// Select middle section of text.
- TypeTextIntoTextField(12, 120.0, 120.0);
- SelectTextWithMouse(170.0, 125.0, 115.5);
+ TypeTextIntoTextField(12, RegularFormBegin());
+ SelectTextWithMouse(RegularFormAtX(170.0), RegularFormAtX(125.0));
CheckSelection(L"DEFGHI");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCJKL");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, DeleteTextFieldSelectionLeft) {
// Select first few characters of text.
- TypeTextIntoTextField(12, 120.0, 120.0);
- SelectTextWithMouse(102.0, 132.0, 115.5);
+ TypeTextIntoTextField(12, RegularFormBegin());
+ SelectTextWithMouse(RegularFormBegin(), RegularFormAtX(132.0));
CheckSelection(L"ABCD");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"EFGHIJKL");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, DeleteTextFieldSelectionRight) {
// Select last few characters of text.
- TypeTextIntoTextField(12, 120.0, 120.0);
- SelectTextWithMouse(191.0, 165.0, 115.5);
+ TypeTextIntoTextField(12, RegularFormBegin());
+ SelectTextWithMouse(RegularFormEnd(), RegularFormAtX(165.0));
CheckSelection(L"IJKL");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCDEFGH");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, DeleteEmptyTextFieldSelection) {
// Do not select text.
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
CheckSelection(L"");
// Test that attempt to delete empty text selection has no effect.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 191.0, 115.5);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCDEFGHIJKL");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
DeleteEditableComboBoxEntireSelection) {
// Select entire contents of user-editable combobox text field.
- TypeTextIntoTextField(10, 102.0, 62.0);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEFGHIJ");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
DeleteEditableComboBoxSelectionMiddle) {
// Select middle section of text.
- TypeTextIntoTextField(10, 102.0, 62.0);
- SelectTextWithMouse(168.0, 127.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
+ SelectTextWithMouse(EditableFormAtX(168.0), EditableFormAtX(127.0));
CheckSelection(L"DEFGH");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
DeleteEditableComboBoxSelectionLeft) {
// Select first few characters of text.
- TypeTextIntoTextField(10, 102.0, 62.0);
- SelectTextWithMouse(102.0, 132.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
+ SelectTextWithMouse(EditableFormBegin(), EditableFormAtX(132.0));
CheckSelection(L"ABCD");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"EFGHIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
DeleteEditableComboBoxSelectionRight) {
// Select last few characters of text.
- TypeTextIntoTextField(10, 102.0, 62.0);
- SelectTextWithMouse(178.0, 152.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
+ SelectTextWithMouse(EditableFormEnd(), EditableFormAtX(152.0));
CheckSelection(L"GHIJ");
// Test deleting current text selection. Select what remains after deletion to
// check that remaining text is as expected.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
DeleteEmptyEditableComboBoxSelection) {
// Do not select text.
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
CheckSelection(L"");
// Test that attempt to delete empty text selection has no effect.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- SelectTextWithMouse(178.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEFGHIJ");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInEmptyTextField) {
- ClickOnFormFieldAtPoint(120.0, 120.0);
+ ClickOnFormFieldAtPoint(RegularFormBegin());
// Test inserting text into empty text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -767,15 +894,15 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInEmptyTextField) {
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"Hello");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldLeft) {
- TypeTextIntoTextField(8, 120.0, 120.0);
+ TypeTextIntoTextField(8, RegularFormBegin());
// Click on the leftmost part of the text field.
- ClickOnFormFieldAtPoint(102.0, 115.5);
+ ClickOnFormFieldAtPoint(RegularFormBegin());
// Test inserting text in front of existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -784,15 +911,15 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldLeft) {
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"HelloABCDEFGH");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldMiddle) {
- TypeTextIntoTextField(8, 120.0, 120.0);
+ TypeTextIntoTextField(8, RegularFormBegin());
// Click on the middle of the text field.
- ClickOnFormFieldAtPoint(134.0, 115.5);
+ ClickOnFormFieldAtPoint(RegularFormAtX(134.0));
// Test inserting text in the middle of existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -801,15 +928,15 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldMiddle) {
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDHelloEFGH");
}
TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldRight) {
- TypeTextIntoTextField(8, 120.0, 120.0);
+ TypeTextIntoTextField(8, RegularFormBegin());
// Click on the rightmost part of the text field.
- ClickOnFormFieldAtPoint(166.0, 115.5);
+ ClickOnFormFieldAtPoint(RegularFormAtX(166.0));
// Test inserting text behind existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -818,16 +945,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldRight) {
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFGHHello");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedTextFieldWhole) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 195.0, 115.0);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCDEFGHIJKL");
// Test replacing text selection with text to be inserted.
@@ -837,16 +964,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"Hello");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedTextFieldLeft) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
- SelectTextWithKeyboard(6, FWL_VKEY_Left, 148.0, 115.0);
+ SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(148.0));
CheckSelection(L"ABCDEF");
// Test replacing text selection with text to be inserted.
@@ -856,16 +983,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"HelloGHIJKL");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedTextFieldMiddle) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
- SelectTextWithKeyboard(6, FWL_VKEY_Left, 171.0, 115.0);
+ SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(171.0));
CheckSelection(L"DEFGHI");
// Test replacing text selection with text to be inserted.
@@ -875,16 +1002,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCHelloJKL");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedTextFieldRight) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
- SelectTextWithKeyboard(6, FWL_VKEY_Left, 195.0, 115.0);
+ SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"GHIJKL");
// Test replacing text selection with text to be inserted.
@@ -894,13 +1021,13 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 115.5);
+ SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFHello");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextInEmptyEditableComboBox) {
- ClickOnFormFieldAtPoint(102.0, 62.0);
+ ClickOnFormFieldAtPoint(EditableFormBegin());
// Test inserting text into empty user-editable combobox.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -909,16 +1036,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"Hello");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextInPopulatedEditableComboBoxLeft) {
- TypeTextIntoTextField(6, 102.0, 62.0);
+ TypeTextIntoTextField(6, EditableFormBegin());
// Click on the leftmost part of the user-editable combobox.
- ClickOnFormFieldAtPoint(102.0, 62.0);
+ ClickOnFormFieldAtPoint(EditableFormBegin());
// Test inserting text in front of existing text in user-editable combobox.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -927,16 +1054,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"HelloABCDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextInPopulatedEditableComboBoxMiddle) {
- TypeTextIntoTextField(6, 102.0, 62.0);
+ TypeTextIntoTextField(6, EditableFormBegin());
// Click on the middle of the user-editable combobox.
- ClickOnFormFieldAtPoint(126.0, 62.0);
+ ClickOnFormFieldAtPoint(EditableFormAtX(126.0));
// Test inserting text in the middle of existing text in user-editable
// combobox.
@@ -946,16 +1073,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCHelloDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextInPopulatedEditableComboBoxRight) {
- TypeTextIntoTextField(6, 102.0, 62.0);
+ TypeTextIntoTextField(6, EditableFormBegin());
// Click on the rightmost part of the user-editable combobox.
- ClickOnFormFieldAtPoint(150.0, 62.0);
+ ClickOnFormFieldAtPoint(EditableFormEnd());
// Test inserting text behind existing text in user-editable combobox.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -964,16 +1091,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEFHello");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedEditableComboBoxWhole) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Select entire string in user-editable combobox.
- SelectTextWithKeyboard(10, FWL_VKEY_Left, 183.0, 62.0);
+ SelectTextWithKeyboard(10, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"ABCDEFGHIJ");
// Test replacing text selection with text to be inserted.
@@ -983,16 +1110,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"Hello");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedEditableComboBoxLeft) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Select left portion of string in user-editable combobox.
- SelectTextWithKeyboard(5, FWL_VKEY_Left, 142.0, 62.0);
+ SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(142.0));
CheckSelection(L"ABCDE");
// Test replacing text selection with text to be inserted.
@@ -1002,16 +1129,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"HelloFGHIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedEditableComboBoxMiddle) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Select middle portion of string in user-editable combobox.
- SelectTextWithKeyboard(5, FWL_VKEY_Left, 167.0, 62.0);
+ SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(167.0));
CheckSelection(L"DEFGH");
// Test replacing text selection with text to be inserted.
@@ -1021,16 +1148,16 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCHelloIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedEditableComboBoxRight) {
- TypeTextIntoTextField(10, 102.0, 62.0);
+ TypeTextIntoTextField(10, EditableFormBegin());
// Select right portion of string in user-editable combobox.
- SelectTextWithKeyboard(5, FWL_VKEY_Left, 183.0, 62.0);
+ SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"FGHIJ");
// Test replacing text selection with text to be inserted.
@@ -1040,17 +1167,17 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- SelectTextWithMouse(183.0, 102.0, 62.0);
+ SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEHello");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextInEmptyCharLimitTextFieldOverflow) {
// Click on the textfield.
- ClickOnFormFieldAtPoint(195.0, 60.0);
+ ClickOnFormFieldAtPoint(CharLimitFormEnd());
// Delete pre-filled contents of text field with char limit.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
@@ -1062,17 +1189,17 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippopotam");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextInEmptyCharLimitTextFieldFit) {
// Click on the textfield.
- ClickOnFormFieldAtPoint(195.0, 60.0);
+ ClickOnFormFieldAtPoint(CharLimitFormEnd());
// Delete pre-filled contents of text field with char limit.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
@@ -1084,14 +1211,14 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Zebra");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextInPopulatedCharLimitTextFieldLeft) {
// Click on the leftmost part of the text field.
- ClickOnFormFieldAtPoint(102.0, 60.0);
+ ClickOnFormFieldAtPoint(CharLimitFormBegin());
// Test inserting text in front of existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -1100,16 +1227,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"HiElephant");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextInPopulatedCharLimitTextFieldMiddle) {
- TypeTextIntoTextField(8, 120.0, 120.0);
+ TypeTextIntoTextField(8, RegularFormBegin());
// Click on the middle of the text field.
- ClickOnFormFieldAtPoint(134.0, 60.0);
+ ClickOnFormFieldAtPoint(CharLimitFormAtX(134.0));
// Test inserting text in the middle of existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -1118,16 +1245,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElephHiant");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextInPopulatedCharLimitTextFieldRight) {
- TypeTextIntoTextField(8, 120.0, 120.0);
+ TypeTextIntoTextField(8, RegularFormBegin());
// Click on the rightmost part of the text field.
- ClickOnFormFieldAtPoint(166.0, 60.0);
+ ClickOnFormFieldAtPoint(CharLimitFormAtX(166.0));
// Test inserting text behind existing text in text field.
std::unique_ptr<unsigned short, pdfium::FreeDeleter> text_to_insert =
@@ -1136,16 +1263,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElephantHi");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedCharLimitTextFieldWhole) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
- SelectTextWithKeyboard(12, FWL_VKEY_Left, 195.0, 60.0);
+ SelectTextWithKeyboard(12, FWL_VKEY_Left, CharLimitFormEnd());
CheckSelection(L"Elephant");
// Test replacing text selection with text to be inserted.
@@ -1155,16 +1282,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippopotam");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedCharLimitTextFieldLeft) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
- SelectTextWithKeyboard(4, FWL_VKEY_Left, 122.0, 60.0);
+ SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(122.0));
CheckSelection(L"Elep");
// Test replacing text selection with text to be inserted.
@@ -1174,16 +1301,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippophant");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedCharLimitTextFieldMiddle) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
- SelectTextWithKeyboard(4, FWL_VKEY_Left, 136.0, 60.0);
+ SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(136.0));
CheckSelection(L"epha");
// Test replacing text selection with text to be inserted.
@@ -1193,16 +1320,16 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElHippopnt");
}
TEST_F(FPDFFormFillTextFormEmbeddertest,
InsertTextAndReplaceSelectionInPopulatedCharLimitTextFieldRight) {
- TypeTextIntoTextField(12, 120.0, 120.0);
+ TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
- SelectTextWithKeyboard(4, FWL_VKEY_Left, 152.0, 60.0);
+ SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(152.0));
CheckSelection(L"hant");
// Test replacing text selection with text to be inserted.
@@ -1212,6 +1339,6 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
- SelectTextWithMouse(195.0, 102.0, 60.0);
+ SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElepHippop");
}