summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-17 13:00:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-17 13:00:42 +0000
commitb01628451a54d0f503d6e93d2322fd9e179d2532 (patch)
tree6376a74b5c126ac4affed92f39d3706482b14300
parent190645c34266d7e8ed2a3026d11a7fd5a03de86a (diff)
downloadpdfium-b01628451a54d0f503d6e93d2322fd9e179d2532.tar.xz
Do more selection checks in form fill embedder tests
Make sure there is no text selection before doing an action that triggers a text selection, so we can be more certain the action actually did something. Change-Id: Ibd733bbdbde64dd228a3c66b6de62418560f74e5 Reviewed-on: https://pdfium-review.googlesource.com/c/44112 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/fpdf_formfill_embeddertest.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 3e53753b48..e55997c740 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -1035,6 +1035,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInEmptyTextField) {
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"Hello");
}
@@ -1055,6 +1056,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldLeft) {
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"HelloABCDEFGH");
}
@@ -1073,6 +1075,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldMiddle) {
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDHelloEFGH");
}
@@ -1091,6 +1094,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest, InsertTextInPopulatedTextFieldRight) {
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFGHHello");
}
@@ -1100,6 +1104,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"ABCDEFGHIJKL");
@@ -1111,6 +1116,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"Hello");
}
@@ -1120,6 +1126,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(148.0));
CheckSelection(L"ABCDEF");
@@ -1131,6 +1138,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"HelloGHIJKL");
}
@@ -1140,6 +1148,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(171.0));
CheckSelection(L"DEFGHI");
@@ -1150,6 +1159,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCHelloJKL");
}
@@ -1159,6 +1169,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormEnd());
CheckSelection(L"GHIJKL");
@@ -1169,6 +1180,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllRegularFormTextWithMouse();
CheckSelection(L"ABCDEFHello");
}
@@ -1186,6 +1198,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"Hello");
}
@@ -1204,6 +1217,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"HelloABCDEF");
}
@@ -1223,6 +1237,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCHelloDEF");
}
@@ -1241,6 +1256,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEFHello");
}
@@ -1250,6 +1266,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
TypeTextIntoTextField(10, EditableFormBegin());
// Select entire string in user-editable combobox.
+ CheckSelection(L"");
SelectTextWithKeyboard(10, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"ABCDEFGHIJ");
@@ -1260,6 +1277,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"Hello");
}
@@ -1269,6 +1287,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
TypeTextIntoTextField(10, EditableFormBegin());
// Select left portion of string in user-editable combobox.
+ CheckSelection(L"");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(142.0));
CheckSelection(L"ABCDE");
@@ -1279,6 +1298,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"HelloFGHIJ");
}
@@ -1288,6 +1308,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
TypeTextIntoTextField(10, EditableFormBegin());
// Select middle portion of string in user-editable combobox.
+ CheckSelection(L"");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(167.0));
CheckSelection(L"DEFGH");
@@ -1298,6 +1319,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCHelloIJ");
}
@@ -1307,6 +1329,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
TypeTextIntoTextField(10, EditableFormBegin());
// Select right portion of string in user-editable combobox.
+ CheckSelection(L"");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormEnd());
CheckSelection(L"FGHIJ");
@@ -1317,6 +1340,7 @@ TEST_F(FPDFFormFillComboBoxFormEmbeddertest,
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
+ CheckSelection(L"");
SelectAllEditableFormTextWithMouse();
CheckSelection(L"ABCDEHello");
}
@@ -1329,6 +1353,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
CheckFocusedFieldText(L"Elephant");
// Delete pre-filled contents of text field with char limit.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
@@ -1343,6 +1368,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippopotam");
}
@@ -1354,6 +1380,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
CheckFocusedFieldText(L"Elephant");
// Delete pre-filled contents of text field with char limit.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
@@ -1367,6 +1394,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Zebra");
}
@@ -1383,6 +1411,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"HiElephant");
}
@@ -1405,6 +1434,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElephHiant");
}
@@ -1423,6 +1453,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElephantHi");
}
@@ -1432,6 +1463,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(12, FWL_VKEY_Left, CharLimitFormEnd());
CheckSelection(L"Elephant");
@@ -1442,6 +1474,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippopotam");
}
@@ -1451,6 +1484,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(122.0));
CheckSelection(L"Elep");
@@ -1461,6 +1495,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"Hippophant");
}
@@ -1470,6 +1505,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(136.0));
CheckSelection(L"epha");
@@ -1480,6 +1516,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElHippopnt");
}
@@ -1489,6 +1526,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
+ CheckSelection(L"");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(152.0));
CheckSelection(L"hant");
@@ -1499,6 +1537,7 @@ TEST_F(FPDFFormFillTextFormEmbeddertest,
// Select entire contents of text field to check that insertion worked
// as expected.
+ CheckSelection(L"");
SelectAllCharLimitFormTextWithMouse();
CheckSelection(L"ElepHippop");
}