Simplify tests that use FORM_GetSelectedText()
- Consistently check return results.
- Consistently pass in uint16_t arrays and convert the output using
GetPlatformString(). Then tests can check against byte strings.
Change-Id: I72fdec0952e48f9e8197e300d6689abc72efc70f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114050
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index c35c785..1de055e 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -127,36 +127,34 @@
EXPECT_TRUE(FORM_SelectAllText(form_handle(), page_));
}
- void CheckSelection(WideStringView expected_string) {
+ void CheckSelection(ByteStringView expected_string) {
unsigned long actual_len =
FORM_GetSelectedText(form_handle(), page_, nullptr, 0);
ASSERT_NE(actual_len, 0U);
ASSERT_LT(actual_len, 1000U);
+ ASSERT_EQ(actual_len % sizeof(FPDF_WCHAR), 0U);
- std::vector<uint8_t> buf(actual_len);
+ std::vector<FPDF_WCHAR> buf(actual_len / sizeof(FPDF_WCHAR));
ASSERT_EQ(actual_len, FORM_GetSelectedText(form_handle(), page_, buf.data(),
actual_len));
-
- EXPECT_EQ(expected_string,
- WideString::FromUTF16LE({buf.data(), actual_len - 2}));
+ EXPECT_EQ(expected_string, ByteStringView(GetPlatformString(buf.data())));
}
void FocusOnPoint(const CFX_PointF& point) {
EXPECT_TRUE(FORM_OnFocus(form_handle(), page(), 0, point.x, point.y));
}
- void CheckFocusedFieldText(WideStringView expected_string) {
+ void CheckFocusedFieldText(ByteStringView expected_string) {
unsigned long actual_len =
FORM_GetFocusedText(form_handle(), page_, nullptr, 0);
ASSERT_NE(actual_len, 0U);
ASSERT_LT(actual_len, 1000U);
+ ASSERT_EQ(actual_len % sizeof(FPDF_WCHAR), 0U);
- std::vector<uint8_t> buf(actual_len);
+ std::vector<FPDF_WCHAR> buf(actual_len / sizeof(FPDF_WCHAR));
ASSERT_EQ(actual_len, FORM_GetFocusedText(form_handle(), page_, buf.data(),
actual_len));
-
- EXPECT_EQ(expected_string,
- WideString::FromUTF16LE({buf.data(), actual_len - 2}));
+ EXPECT_EQ(expected_string, ByteStringView(GetPlatformString(buf.data())));
}
void CheckCanUndo(bool expected_result) {
@@ -1746,52 +1744,52 @@
TEST_F(FPDFFormFillTextFormEmbedderTest, GetSelectedTextEmptyAndBasicKeyboard) {
// Test empty selection.
- CheckFocusedFieldText(L"");
- CheckSelection(L"");
+ CheckFocusedFieldText("");
+ CheckSelection("");
// Test basic selection.
TypeTextIntoTextField(3, RegularFormBegin());
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
SelectTextWithKeyboard(3, FWL_VKEY_Left, RegularFormAtX(123.0));
- CheckSelection(L"ABC");
+ CheckSelection("ABC");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, GetSelectedTextEmptyAndBasicMouse) {
// Test empty selection.
- CheckFocusedFieldText(L"");
- CheckSelection(L"");
+ CheckFocusedFieldText("");
+ CheckSelection("");
// Test basic selection.
TypeTextIntoTextField(3, RegularFormBegin());
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
SelectTextWithMouse(RegularFormAtX(125.0), RegularFormBegin());
- CheckSelection(L"ABC");
+ CheckSelection("ABC");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, GetSelectedTextFragmentsKeyBoard) {
TypeTextIntoTextField(12, RegularFormBegin());
- CheckFocusedFieldText(L"ABCDEFGHIJKL");
+ CheckFocusedFieldText("ABCDEFGHIJKL");
// Test selecting first character in forward direction.
SelectTextWithKeyboard(1, FWL_VKEY_Right, RegularFormBegin());
- CheckSelection(L"A");
+ CheckSelection("A");
// Test selecting entire long string in backwards direction.
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"ABCDEFGHIJKL");
+ CheckSelection("ABCDEFGHIJKL");
// Test selecting middle section in backwards direction.
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(170.0));
- CheckSelection(L"DEFGHI");
+ CheckSelection("DEFGHI");
// Test selecting middle selection in forward direction.
SelectTextWithKeyboard(6, FWL_VKEY_Right, RegularFormAtX(125.0));
- CheckSelection(L"DEFGHI");
+ CheckSelection("DEFGHI");
// Test selecting last character in backwards direction.
SelectTextWithKeyboard(1, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"L");
- CheckFocusedFieldText(L"ABCDEFGHIJKL");
+ CheckSelection("L");
+ CheckFocusedFieldText("ABCDEFGHIJKL");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, GetSelectedTextFragmentsMouse) {
@@ -1799,142 +1797,142 @@
// Test selecting first character in forward direction.
SelectTextWithMouse(RegularFormBegin(), RegularFormAtX(106.0));
- CheckSelection(L"A");
+ CheckSelection("A");
// Test selecting entire long string in backwards direction.
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"ABCDEFGHIJKL");
+ CheckSelection("ABCDEFGHIJKL");
// Test selecting middle section in backwards direction.
SelectTextWithMouse(RegularFormAtX(170.0), RegularFormAtX(125.0));
- CheckSelection(L"DEFGHI");
+ CheckSelection("DEFGHI");
// Test selecting middle selection in forward direction.
SelectTextWithMouse(RegularFormAtX(125.0), RegularFormAtX(170.0));
- CheckSelection(L"DEFGHI");
+ CheckSelection("DEFGHI");
// Test selecting last character in backwards direction.
SelectTextWithMouse(RegularFormEnd(), RegularFormAtX(186.0));
- CheckSelection(L"L");
+ CheckSelection("L");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
GetSelectedTextEmptyAndBasicNormalComboBox) {
// Test empty selection.
- CheckSelection(L"");
- CheckFocusedFieldText(L"");
+ CheckSelection("");
+ CheckFocusedFieldText("");
// Non-editable comboboxes don't allow selection with keyboard.
SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(142.0));
- CheckFocusedFieldText(L"Banana");
- CheckSelection(L"Banana");
+ CheckFocusedFieldText("Banana");
+ CheckSelection("Banana");
// Select other another provided option.
SelectNonEditableFormOption(0);
- CheckFocusedFieldText(L"Apple");
- CheckSelection(L"Apple");
+ CheckFocusedFieldText("Apple");
+ CheckSelection("Apple");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
GetSelectedTextEmptyAndBasicEditableComboBoxKeyboard) {
// Test empty selection.
- CheckSelection(L"");
- CheckFocusedFieldText(L"");
+ CheckSelection("");
+ CheckFocusedFieldText("");
// Test basic selection of text within user editable combobox using keyboard.
TypeTextIntoTextField(3, EditableFormBegin());
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
SelectTextWithKeyboard(3, FWL_VKEY_Left, EditableFormAtX(128.0));
- CheckSelection(L"ABC");
+ CheckSelection("ABC");
// Select a provided option.
SelectEditableFormOption(1);
- CheckSelection(L"Bar");
- CheckFocusedFieldText(L"Bar");
+ CheckSelection("Bar");
+ CheckFocusedFieldText("Bar");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
GetSelectedTextEmptyAndBasicEditableComboBoxMouse) {
// Test empty selection.
- CheckSelection(L"");
+ CheckSelection("");
// Test basic selection of text within user editable combobox using mouse.
TypeTextIntoTextField(3, EditableFormBegin());
SelectTextWithMouse(EditableFormAtX(128.0), EditableFormBegin());
- CheckSelection(L"ABC");
+ CheckSelection("ABC");
// Select a provided option.
SelectEditableFormOption(2);
- CheckFocusedFieldText(L"Qux");
- CheckSelection(L"Qux");
+ CheckFocusedFieldText("Qux");
+ CheckSelection("Qux");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
GetSelectedTextFragmentsNormalComboBox) {
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Test selecting first character in forward direction.
SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(107.0));
- CheckFocusedFieldText(L"Banana");
- CheckSelection(L"B");
+ CheckFocusedFieldText("Banana");
+ CheckSelection("B");
// Test selecting entire string in backwards direction.
SelectTextWithMouse(NonEditableFormAtX(142.0), NonEditableFormBegin());
- CheckSelection(L"Banana");
+ CheckSelection("Banana");
// Test selecting middle section in backwards direction.
SelectTextWithMouse(NonEditableFormAtX(135.0), NonEditableFormAtX(117.0));
- CheckSelection(L"nan");
+ CheckSelection("nan");
// Test selecting middle section in forward direction.
SelectTextWithMouse(NonEditableFormAtX(117.0), NonEditableFormAtX(135.0));
- CheckSelection(L"nan");
+ CheckSelection("nan");
// Test selecting last character in backwards direction.
SelectTextWithMouse(NonEditableFormAtX(142.0), NonEditableFormAtX(138.0));
- CheckSelection(L"a");
- CheckFocusedFieldText(L"Banana");
+ CheckSelection("a");
+ CheckFocusedFieldText("Banana");
// Select another option and then reset selection as first three chars.
SelectNonEditableFormOption(2);
- CheckFocusedFieldText(L"Cherry");
- CheckSelection(L"Cherry");
+ CheckFocusedFieldText("Cherry");
+ CheckSelection("Cherry");
SelectTextWithMouse(NonEditableFormBegin(), NonEditableFormAtX(122.0));
- CheckSelection(L"Che");
+ CheckSelection("Che");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
GetSelectedTextFragmentsEditableComboBoxKeyboard) {
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
TypeTextIntoTextField(10, EditableFormBegin());
- CheckFocusedFieldText(L"ABCDEFGHIJ");
+ CheckFocusedFieldText("ABCDEFGHIJ");
// Test selecting first character in forward direction.
SelectTextWithKeyboard(1, FWL_VKEY_Right, EditableFormBegin());
- CheckSelection(L"A");
+ CheckSelection("A");
// Test selecting entire long string in backwards direction.
SelectTextWithKeyboard(10, FWL_VKEY_Left, EditableFormEnd());
- CheckSelection(L"ABCDEFGHIJ");
+ CheckSelection("ABCDEFGHIJ");
// Test selecting middle section in backwards direction.
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(168.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("DEFGH");
// Test selecting middle selection in forward direction.
SelectTextWithKeyboard(5, FWL_VKEY_Right, EditableFormAtX(127.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("DEFGH");
// Test selecting last character in backwards direction.
SelectTextWithKeyboard(1, FWL_VKEY_Left, EditableFormEnd());
- CheckSelection(L"J");
+ CheckSelection("J");
// Select a provided option and then reset selection as first two chars.
SelectEditableFormOption(0);
- CheckSelection(L"Foo");
+ CheckSelection("Foo");
SelectTextWithKeyboard(2, FWL_VKEY_Right, EditableFormBegin());
- CheckSelection(L"Fo");
- CheckFocusedFieldText(L"Foo");
+ CheckSelection("Fo");
+ CheckFocusedFieldText("Foo");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -1943,24 +1941,24 @@
// Test selecting first character in forward direction.
SelectTextWithMouse(EditableFormBegin(), EditableFormAtX(107.0));
- CheckSelection(L"A");
+ CheckSelection("A");
// Test selecting entire long string in backwards direction.
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEFGHIJ");
+ CheckSelection("ABCDEFGHIJ");
// Test selecting middle section in backwards direction.
SelectTextWithMouse(EditableFormAtX(168.0), EditableFormAtX(127.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("DEFGH");
// Test selecting middle selection in forward direction.
SelectTextWithMouse(EditableFormAtX(127.0), EditableFormAtX(168.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("DEFGH");
// Test selecting last character in backwards direction.
SelectTextWithMouse(EditableFormEnd(), EditableFormAtX(174.0));
- CheckSelection(L"J");
- CheckFocusedFieldText(L"ABCDEFGHIJ");
+ CheckSelection("J");
+ CheckFocusedFieldText("ABCDEFGHIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -1969,33 +1967,33 @@
// This is the value that is present in the field upon opening, we have not
// changed it by setting focus.
FocusOnNonEditableForm();
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
// Make selections to change the value of the focused annotation
// programmatically.
SetIndexSelectedShouldSucceed(0, true);
- CheckFocusedFieldText(L"Apple");
+ CheckFocusedFieldText("Apple");
// Selecting an index that is already selected is success.
SetIndexSelectedShouldSucceed(0, true);
- CheckFocusedFieldText(L"Apple");
+ CheckFocusedFieldText("Apple");
SetIndexSelectedShouldSucceed(9, true);
- CheckFocusedFieldText(L"Jackfruit");
+ CheckFocusedFieldText("Jackfruit");
// Cannot deselect a combobox field - value unchanged.
SetIndexSelectedShouldFail(9, false);
- CheckFocusedFieldText(L"Jackfruit");
+ CheckFocusedFieldText("Jackfruit");
// Cannot select indices that are out of range - value unchanged.
SetIndexSelectedShouldFail(100, true);
SetIndexSelectedShouldFail(-100, true);
- CheckFocusedFieldText(L"Jackfruit");
+ CheckFocusedFieldText("Jackfruit");
// Check that above actions are interchangeable with click actions, should be
// able to use a combination of both.
SelectNonEditableFormOption(1);
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2004,42 +2002,42 @@
// This is the value that is present in the field upon opening, we have not
// changed it by setting focus.
FocusOnEditableForm();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Make selections to change value of the focused annotation
// programmatically.
SetIndexSelectedShouldSucceed(0, true);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
SetIndexSelectedShouldSucceed(1, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
// Selecting an index that is already selected is success.
SetIndexSelectedShouldSucceed(1, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
// Cannot deselect a combobox field - value unchanged.
SetIndexSelectedShouldFail(0, false);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
// Cannot select indices that are out of range - value unchanged.
SetIndexSelectedShouldFail(100, true);
SetIndexSelectedShouldFail(-100, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
// Check that above actions are interchangeable with click actions, should be
// able to use a combination of both.
SelectEditableFormOption(0);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
// Check that above actions are interchangeable with typing actions, should
// be able to use a combination of both. Typing text into a text field after
// selecting indices programmatically should be equivalent to doing so after
// a user selects an index via click on the dropdown.
SetIndexSelectedShouldSucceed(1, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
TypeTextIntoTextField(5, EditableFormBegin());
- CheckFocusedFieldText(L"ABCDEBar");
+ CheckFocusedFieldText("ABCDEBar");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2076,71 +2074,71 @@
// Select entire contents of text field.
TypeTextIntoTextField(12, RegularFormBegin());
SelectAllRegularFormTextWithMouse();
- CheckFocusedFieldText(L"ABCDEFGHIJKL");
- CheckSelection(L"ABCDEFGHIJKL");
+ CheckFocusedFieldText("ABCDEFGHIJKL");
+ CheckSelection("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);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"");
+ CheckSelection("");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, DeleteTextFieldSelectionMiddle) {
// Select middle section of text.
TypeTextIntoTextField(12, RegularFormBegin());
SelectTextWithMouse(RegularFormAtX(170.0), RegularFormAtX(125.0));
- CheckFocusedFieldText(L"ABCDEFGHIJKL");
- CheckSelection(L"DEFGHI");
+ CheckFocusedFieldText("ABCDEFGHIJKL");
+ CheckSelection("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);
- CheckFocusedFieldText(L"ABCJKL");
+ CheckFocusedFieldText("ABCJKL");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"ABCJKL");
+ CheckSelection("ABCJKL");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, DeleteTextFieldSelectionLeft) {
// Select first few characters of text.
TypeTextIntoTextField(12, RegularFormBegin());
SelectTextWithMouse(RegularFormBegin(), RegularFormAtX(132.0));
- CheckSelection(L"ABCD");
+ CheckSelection("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);
- CheckFocusedFieldText(L"EFGHIJKL");
+ CheckFocusedFieldText("EFGHIJKL");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"EFGHIJKL");
+ CheckSelection("EFGHIJKL");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, DeleteTextFieldSelectionRight) {
// Select last few characters of text.
TypeTextIntoTextField(12, RegularFormBegin());
SelectTextWithMouse(RegularFormEnd(), RegularFormAtX(165.0));
- CheckSelection(L"IJKL");
+ CheckSelection("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);
- CheckFocusedFieldText(L"ABCDEFGH");
+ CheckFocusedFieldText("ABCDEFGH");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"ABCDEFGH");
+ CheckSelection("ABCDEFGH");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, DeleteEmptyTextFieldSelection) {
// Do not select text.
TypeTextIntoTextField(12, RegularFormBegin());
- CheckSelection(L"");
+ CheckSelection("");
// Test that attempt to delete empty text selection has no effect.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- CheckFocusedFieldText(L"ABCDEFGHIJKL");
+ CheckFocusedFieldText("ABCDEFGHIJKL");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"ABCDEFGHIJKL");
+ CheckSelection("ABCDEFGHIJKL");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2148,14 +2146,14 @@
// Select entire contents of user-editable combobox text field.
TypeTextIntoTextField(10, EditableFormBegin());
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEFGHIJ");
+ CheckSelection("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);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"");
+ CheckSelection("");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2163,14 +2161,14 @@
// Select middle section of text.
TypeTextIntoTextField(10, EditableFormBegin());
SelectTextWithMouse(EditableFormAtX(168.0), EditableFormAtX(127.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("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);
- CheckFocusedFieldText(L"ABCIJ");
+ CheckFocusedFieldText("ABCIJ");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCIJ");
+ CheckSelection("ABCIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2178,13 +2176,13 @@
// Select first few characters of text.
TypeTextIntoTextField(10, EditableFormBegin());
SelectTextWithMouse(EditableFormBegin(), EditableFormAtX(132.0));
- CheckSelection(L"ABCD");
+ CheckSelection("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);
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"EFGHIJ");
+ CheckSelection("EFGHIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2192,62 +2190,62 @@
// Select last few characters of text.
TypeTextIntoTextField(10, EditableFormBegin());
SelectTextWithMouse(EditableFormEnd(), EditableFormAtX(152.0));
- CheckSelection(L"GHIJ");
+ CheckSelection("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);
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEF");
+ CheckSelection("ABCDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
DeleteEmptyEditableComboBoxSelection) {
// Do not select text.
TypeTextIntoTextField(10, EditableFormBegin());
- CheckSelection(L"");
+ CheckSelection("");
// Test that attempt to delete empty text selection has no effect.
FORM_ReplaceSelection(form_handle(), page(), nullptr);
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEFGHIJ");
+ CheckSelection("ABCDEFGHIJ");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, InsertTextInEmptyTextField) {
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Test inserting text into empty text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Hello");
+ CheckFocusedFieldText("Hello");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"Hello");
+ CheckSelection("Hello");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, InsertTextInPopulatedTextFieldLeft) {
TypeTextIntoTextField(8, RegularFormBegin());
- CheckFocusedFieldText(L"ABCDEFGH");
+ CheckFocusedFieldText("ABCDEFGH");
// Click on the leftmost part of the text field.
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"ABCDEFGH");
+ CheckFocusedFieldText("ABCDEFGH");
// Test inserting text in front of existing text in text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"HelloABCDEFGH");
+ CheckFocusedFieldText("HelloABCDEFGH");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"HelloABCDEFGH");
+ CheckSelection("HelloABCDEFGH");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, InsertTextInPopulatedTextFieldMiddle) {
@@ -2259,13 +2257,13 @@
// Test inserting text in the middle of existing text in text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"ABCDHelloEFGH");
+ CheckFocusedFieldText("ABCDHelloEFGH");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"ABCDHelloEFGH");
+ CheckSelection("ABCDHelloEFGH");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, InsertTextInPopulatedTextFieldRight) {
@@ -2277,13 +2275,13 @@
// Test inserting text behind existing text in text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"ABCDEFGHHello");
+ CheckFocusedFieldText("ABCDEFGHHello");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"ABCDEFGHHello");
+ CheckSelection("ABCDEFGHHello");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2291,20 +2289,20 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(12, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"ABCDEFGHIJKL");
+ CheckSelection("ABCDEFGHIJKL");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Hello");
+ CheckFocusedFieldText("Hello");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"Hello");
+ CheckSelection("Hello");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2312,20 +2310,20 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(148.0));
- CheckSelection(L"ABCDEF");
+ CheckSelection("ABCDEF");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"HelloGHIJKL");
+ CheckFocusedFieldText("HelloGHIJKL");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"HelloGHIJKL");
+ CheckSelection("HelloGHIJKL");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2333,9 +2331,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormAtX(171.0));
- CheckSelection(L"DEFGHI");
+ CheckSelection("DEFGHI");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2343,9 +2341,9 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"ABCHelloJKL");
+ CheckSelection("ABCHelloJKL");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2353,9 +2351,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(6, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"GHIJKL");
+ CheckSelection("GHIJKL");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2363,26 +2361,26 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllRegularFormTextWithMouse();
- CheckSelection(L"ABCDEFHello");
+ CheckSelection("ABCDEFHello");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
InsertTextInEmptyEditableComboBox) {
ClickOnFormFieldAtPoint(EditableFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Test inserting text into empty user-editable combobox.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Hello");
+ CheckFocusedFieldText("Hello");
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"Hello");
+ CheckSelection("Hello");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2398,9 +2396,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"HelloABCDEF");
+ CheckSelection("HelloABCDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2417,9 +2415,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCHelloDEF");
+ CheckSelection("ABCHelloDEF");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2435,9 +2433,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEFHello");
+ CheckSelection("ABCDEFHello");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2445,9 +2443,9 @@
TypeTextIntoTextField(10, EditableFormBegin());
// Select entire string in user-editable combobox.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(10, FWL_VKEY_Left, EditableFormEnd());
- CheckSelection(L"ABCDEFGHIJ");
+ CheckSelection("ABCDEFGHIJ");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2455,9 +2453,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"Hello");
+ CheckSelection("Hello");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2465,9 +2463,9 @@
TypeTextIntoTextField(10, EditableFormBegin());
// Select left portion of string in user-editable combobox.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(142.0));
- CheckSelection(L"ABCDE");
+ CheckSelection("ABCDE");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2475,9 +2473,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"HelloFGHIJ");
+ CheckSelection("HelloFGHIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2485,9 +2483,9 @@
TypeTextIntoTextField(10, EditableFormBegin());
// Select middle portion of string in user-editable combobox.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormAtX(167.0));
- CheckSelection(L"DEFGH");
+ CheckSelection("DEFGH");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2495,9 +2493,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCHelloIJ");
+ CheckSelection("ABCHelloIJ");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2505,9 +2503,9 @@
TypeTextIntoTextField(10, EditableFormBegin());
// Select right portion of string in user-editable combobox.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(5, FWL_VKEY_Left, EditableFormEnd());
- CheckSelection(L"FGHIJ");
+ CheckSelection("FGHIJ");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello");
@@ -2515,9 +2513,9 @@
// Select entire contents of user-editable combobox text field to check that
// insertion worked as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllEditableFormTextWithMouse();
- CheckSelection(L"ABCDEHello");
+ CheckSelection("ABCDEHello");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest,
@@ -2591,60 +2589,60 @@
// Verify that the Space character is handled.
EXPECT_TRUE(FORM_OnChar(form_handle(), page(), pdfium::ascii::kSpace, 0));
- CheckFocusedFieldText(L" ");
+ CheckFocusedFieldText(" ");
CheckIsIndexSelected(0, false);
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
InsertTextInEmptyCharLimitTextFieldOverflow) {
// Click on the textfield.
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
// Delete pre-filled contents of text field with char limit.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Elephant");
+ CheckSelection("Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Test inserting text into now empty text field so text to be inserted
// exceeds the char limit and is cut off.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Hippopotam");
+ CheckFocusedFieldText("Hippopotam");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Hippopotam");
+ CheckSelection("Hippopotam");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
InsertTextInEmptyCharLimitTextFieldFit) {
// Click on the textfield.
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
// Delete pre-filled contents of text field with char limit.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Elephant");
+ CheckSelection("Elephant");
FORM_ReplaceSelection(form_handle(), page(), nullptr);
// Test inserting text into now empty text field so text to be inserted
// exceeds the char limit and is cut off.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Zebra");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Zebra");
+ CheckFocusedFieldText("Zebra");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Zebra");
+ CheckSelection("Zebra");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2658,31 +2656,31 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"HiElephant");
+ CheckSelection("HiElephant");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
InsertTextInPopulatedCharLimitTextFieldMiddle) {
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
TypeTextIntoTextField(8, RegularFormBegin());
- CheckFocusedFieldText(L"ABCDEFGH");
+ CheckFocusedFieldText("ABCDEFGH");
// Click on the middle of the text field.
ClickOnFormFieldAtPoint(CharLimitFormAtX(134.0));
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
// Test inserting text in the middle of existing text in text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"ElephHiant");
+ CheckFocusedFieldText("ElephHiant");
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"ElephHiant");
+ CheckSelection("ElephHiant");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2698,9 +2696,9 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"ElephantHi");
+ CheckSelection("ElephantHi");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2708,9 +2706,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select entire string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(12, FWL_VKEY_Left, CharLimitFormEnd());
- CheckSelection(L"Elephant");
+ CheckSelection("Elephant");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
@@ -2718,9 +2716,9 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Hippopotam");
+ CheckSelection("Hippopotam");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2728,9 +2726,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select left portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(122.0));
- CheckSelection(L"Elep");
+ CheckSelection("Elep");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
@@ -2738,9 +2736,9 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"Hippophant");
+ CheckSelection("Hippophant");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2748,9 +2746,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select middle portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(136.0));
- CheckSelection(L"epha");
+ CheckSelection("epha");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
@@ -2758,9 +2756,9 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"ElHippopnt");
+ CheckSelection("ElHippopnt");
}
TEST_F(FPDFFormFillTextFormEmbedderTest,
@@ -2768,9 +2766,9 @@
TypeTextIntoTextField(12, RegularFormBegin());
// Select right portion of string in text field.
- CheckSelection(L"");
+ CheckSelection("");
SelectTextWithKeyboard(4, FWL_VKEY_Left, CharLimitFormAtX(152.0));
- CheckSelection(L"hant");
+ CheckSelection("hant");
// Test replacing text selection with text to be inserted.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hippopotamus");
@@ -2778,31 +2776,31 @@
// Select entire contents of text field to check that insertion worked
// as expected.
- CheckSelection(L"");
+ CheckSelection("");
SelectAllCharLimitFormTextWithMouse();
- CheckSelection(L"ElepHippop");
+ CheckSelection("ElepHippop");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, DoubleClickInTextField) {
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
// Test inserting text into empty text field.
ScopedFPDFWideString text_to_insert = GetFPDFWideString(L"Hello World");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"Hello World");
+ CheckFocusedFieldText("Hello World");
// Make sure double clicking selects the entire line.
- CheckSelection(L"");
+ CheckSelection("");
DoubleClickOnFormFieldAtPoint(RegularFormBegin());
- CheckSelection(L"Hello World");
+ CheckSelection("Hello World");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, FocusAnnotationUpdateToEmbedder) {
testing::NiceMock<EmbedderTestMockDelegate> mock;
SetDelegate(&mock);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
#ifdef PDF_ENABLE_XFA
EXPECT_CALL(mock, OnFocusChange(_, _, 0)).Times(1);
@@ -2817,7 +2815,7 @@
FocusAnnotationUpdateToEmbedder) {
testing::NiceMock<EmbedderTestMockDelegate> mock;
SetDelegate(&mock);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
EXPECT_CALL(mock, OnFocusChange(_, _, 0)).Times(1);
ClickOnFormFieldAtPoint(RegularFormBegin());
@@ -2825,137 +2823,137 @@
TEST_F(FPDFFormFillTextFormEmbedderTest, FocusChanges) {
static const CFX_PointF kNonFormPoint(1, 1);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
TypeTextIntoTextField(3, CharLimitFormBegin());
- CheckFocusedFieldText(L"ABElephant");
+ CheckFocusedFieldText("ABElephant");
TypeTextIntoTextField(5, RegularFormBegin());
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"ABElephant");
+ CheckFocusedFieldText("ABElephant");
ClickOnFormFieldAtPoint(kNonFormPoint);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(kNonFormPoint);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(CharLimitFormBegin());
- CheckFocusedFieldText(L"ABElephant");
+ CheckFocusedFieldText("ABElephant");
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"ABElephant");
+ CheckFocusedFieldText("ABElephant");
ClickOnFormFieldAtPoint(RegularFormEnd());
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
ClickOnFormFieldAtPoint(CharLimitFormBegin());
- CheckFocusedFieldText(L"ABElephant");
+ CheckFocusedFieldText("ABElephant");
FORM_ForceToKillFocus(form_handle());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
}
TEST_F(FPDFFormFillComboBoxFormEmbedderTest, FocusChanges) {
static const CFX_PointF kNonFormPoint(1, 1);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(NonEditableFormBegin());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
ClickOnFormFieldAtPoint(EditableFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(NonEditableFormEnd());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
ClickOnFormFieldAtPoint(NonEditableFormBegin());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
FORM_ForceToKillFocus(form_handle());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(EditableFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
TypeTextIntoTextField(3, EditableFormBegin());
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
ClickOnFormFieldAtPoint(kNonFormPoint);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
TypeTextIntoTextField(3, EditableFormEnd());
- CheckFocusedFieldText(L"ABCABC");
+ CheckFocusedFieldText("ABCABC");
ClickOnFormFieldAtPoint(kNonFormPoint);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(EditableFormDropDown());
- CheckFocusedFieldText(L"ABCABC");
+ CheckFocusedFieldText("ABCABC");
FORM_ForceToKillFocus(form_handle());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(NonEditableFormDropDown());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
ClickOnFormFieldAtPoint(kNonFormPoint);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
ClickOnFormFieldAtPoint(NonEditableFormEnd());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
// Typing into non-editable field results in selecting a different option.
TypeTextIntoTextField(1, NonEditableFormEnd());
- CheckFocusedFieldText(L"Apple");
+ CheckFocusedFieldText("Apple");
TypeTextIntoTextField(3, NonEditableFormEnd());
- CheckFocusedFieldText(L"Cherry");
+ CheckFocusedFieldText("Cherry");
TypeTextIntoTextField(2, NonEditableFormEnd());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
SelectEditableFormOption(0);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
SelectEditableFormOption(1);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
SelectEditableFormOption(2);
- CheckFocusedFieldText(L"Qux");
+ CheckFocusedFieldText("Qux");
SelectNonEditableFormOption(1);
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
SelectNonEditableFormOption(0);
- CheckFocusedFieldText(L"Apple");
+ CheckFocusedFieldText("Apple");
SelectNonEditableFormOption(2);
- CheckFocusedFieldText(L"Cherry");
+ CheckFocusedFieldText("Cherry");
// Typing into an editable field changes the text in the option.
SelectEditableFormOption(0);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
TypeTextIntoTextField(5, EditableFormBegin());
- CheckFocusedFieldText(L"ABCDEFoo");
+ CheckFocusedFieldText("ABCDEFoo");
SelectEditableFormOption(2);
- CheckFocusedFieldText(L"Qux");
+ CheckFocusedFieldText("Qux");
TypeTextIntoTextField(2, EditableFormEnd());
- CheckFocusedFieldText(L"QuxAB");
+ CheckFocusedFieldText("QuxAB");
// But a previously edited option is reset when selected again.
SelectEditableFormOption(0);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
TypeTextIntoTextField(1, EditableFormBegin());
- CheckFocusedFieldText(L"AFoo");
+ CheckFocusedFieldText("AFoo");
SelectEditableFormOption(0);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, UndoRedo) {
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(false);
TypeTextIntoTextField(5, RegularFormBegin());
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"ABCD");
+ CheckFocusedFieldText("ABCD");
CheckCanUndo(true);
CheckCanRedo(true);
PerformUndo();
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
CheckCanUndo(true);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"ABCD");
+ CheckFocusedFieldText("ABCD");
CheckCanUndo(true);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"ABCDE");
+ CheckFocusedFieldText("ABCDE");
CheckCanUndo(true);
CheckCanRedo(false);
}
@@ -2965,7 +2963,7 @@
TEST_F(FPDFFormFillTextFormEmbedderTest, SetIndexSelectedShouldFailGracefully) {
// set focus and read text to confirm we have it
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
SetIndexSelectedShouldFail(0, true);
SetIndexSelectedShouldFail(0, false);
@@ -2980,7 +2978,7 @@
TEST_F(FPDFFormFillTextFormEmbedderTest, IsIndexSelectedShouldFailGracefully) {
// set focus and read text to confirm we have it
ClickOnFormFieldAtPoint(CharLimitFormEnd());
- CheckFocusedFieldText(L"Elephant");
+ CheckFocusedFieldText("Elephant");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, false);
@@ -2989,35 +2987,35 @@
TEST_F(FPDFFormFillComboBoxFormEmbedderTest, UndoRedo) {
ClickOnFormFieldAtPoint(NonEditableFormBegin());
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
CheckCanUndo(false);
CheckCanRedo(false);
ClickOnFormFieldAtPoint(EditableFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(false);
TypeTextIntoTextField(3, EditableFormBegin());
- CheckFocusedFieldText(L"ABC");
+ CheckFocusedFieldText("ABC");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"AB");
+ CheckFocusedFieldText("AB");
CheckCanUndo(true);
CheckCanRedo(true);
PerformUndo();
- CheckFocusedFieldText(L"A");
+ CheckFocusedFieldText("A");
CheckCanUndo(true);
CheckCanRedo(true);
PerformUndo();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"A");
+ CheckFocusedFieldText("A");
CheckCanUndo(true);
CheckCanRedo(true);
}
@@ -3060,7 +3058,7 @@
SetSelectionProgrammaticallySingleSelectField) {
// Nothing is selected in single select field upon opening.
FocusOnSingleSelectForm();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, false);
CheckIsIndexSelected(2, false);
@@ -3068,13 +3066,13 @@
// Make selections to change the value of the focused annotation
// programmatically showing that only one value remains selected at a time.
SetIndexSelectedShouldSucceed(0, true);
- CheckFocusedFieldText(L"Foo");
+ CheckFocusedFieldText("Foo");
CheckIsIndexSelected(0, true);
CheckIsIndexSelected(1, false);
CheckIsIndexSelected(2, false);
SetIndexSelectedShouldSucceed(1, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, true);
CheckIsIndexSelected(2, false);
@@ -3082,13 +3080,13 @@
// Selecting/deselecting an index that is already selected/deselected is
// success.
SetIndexSelectedShouldSucceed(1, true);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, true);
CheckIsIndexSelected(2, false);
SetIndexSelectedShouldSucceed(2, false);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, true);
CheckIsIndexSelected(2, false);
@@ -3099,14 +3097,14 @@
SetIndexSelectedShouldFail(100, false);
SetIndexSelectedShouldFail(-100, false);
// Confirm that previous values were not changed.
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, true);
CheckIsIndexSelected(2, false);
// Unlike combobox, should be able to deselect all indices.
SetIndexSelectedShouldSucceed(1, false);
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, false);
CheckIsIndexSelected(2, false);
@@ -3114,7 +3112,7 @@
// Check that above actions are interchangeable with click actions, should be
// able to use a combination of both.
ClickOnSingleSelectFormOption(1);
- CheckFocusedFieldText(L"Bar");
+ CheckFocusedFieldText("Bar");
CheckIsIndexSelected(0, false);
CheckIsIndexSelected(1, true);
CheckIsIndexSelected(2, false);
@@ -3130,7 +3128,7 @@
bool expected = i == 1;
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
// Select some more options.
SetIndexSelectedShouldSucceed(5, true);
@@ -3140,7 +3138,7 @@
bool expected = (i == 1 || i == 5 || i == 6 || i == 20);
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Ugli Fruit");
+ CheckFocusedFieldText("Ugli Fruit");
// Selecting indices that are already selected is success - changes nothing.
SetIndexSelectedShouldSucceed(5, true);
@@ -3150,7 +3148,7 @@
bool expected = (i == 1 || i == 5 || i == 6 || i == 20);
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Ugli Fruit");
+ CheckFocusedFieldText("Ugli Fruit");
// Deselect some options.
SetIndexSelectedShouldSucceed(20, false);
@@ -3159,7 +3157,7 @@
bool expected = (i == 5 || i == 6);
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
// Deselecting indices that already aren't selected is success - does not
// change the selected values but moves the focus text caret to last item we
@@ -3170,7 +3168,7 @@
bool expected = (i == 5 || i == 6);
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Date");
+ CheckFocusedFieldText("Date");
// Cannot select indices that are out of range.
SetIndexSelectedShouldFail(100, true);
@@ -3178,7 +3176,7 @@
SetIndexSelectedShouldFail(100, false);
SetIndexSelectedShouldFail(-100, false);
// Confirm that previous values were not changed.
- CheckFocusedFieldText(L"Date");
+ CheckFocusedFieldText("Date");
for (int i = 0; i < 26; i++) {
bool expected = (i == 5 || i == 6);
CheckIsIndexSelected(i, expected);
@@ -3192,7 +3190,7 @@
bool expected = i == 1;
CheckIsIndexSelected(i, expected);
}
- CheckFocusedFieldText(L"Banana");
+ CheckFocusedFieldText("Banana");
}
TEST_F(FPDFFormFillListBoxFormEmbedderTest, CheckIfMultipleSelectedIndices) {
@@ -3266,28 +3264,28 @@
CheckCanRedo(false);
TypeTextIntoTextField(2, RegularFormBegin());
- CheckFocusedFieldText(L"AB");
- CheckSelection(L"");
+ CheckFocusedFieldText("AB");
+ CheckSelection("");
SelectTextWithKeyboard(1, FWL_VKEY_Right, RegularFormBegin());
- CheckSelection(L"A");
+ CheckSelection("A");
FORM_ReplaceAndKeepSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"XYZB");
- CheckSelection(L"XYZ");
+ CheckFocusedFieldText("XYZB");
+ CheckSelection("XYZ");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"AB");
+ CheckFocusedFieldText("AB");
CheckCanUndo(true);
CheckCanRedo(true);
SelectTextWithKeyboard(1, FWL_VKEY_Left, RegularFormEnd());
- CheckSelection(L"B");
+ CheckSelection("B");
FORM_ReplaceAndKeepSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"AXYZ");
- CheckSelection(L"XYZ");
+ CheckFocusedFieldText("AXYZ");
+ CheckSelection("XYZ");
CheckCanUndo(true);
CheckCanRedo(false);
}
@@ -3296,35 +3294,35 @@
ScopedFPDFWideString text_to_insert1 = GetFPDFWideString(L"UVW");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(false);
FORM_ReplaceAndKeepSelection(form_handle(), page(), text_to_insert1.get());
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"UVW");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("UVW");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("");
ScopedFPDFWideString text_to_insert2 = GetFPDFWideString(L"XYZ");
FORM_ReplaceAndKeepSelection(form_handle(), page(), text_to_insert2.get());
- CheckFocusedFieldText(L"UVWXYZ");
- CheckSelection(L"XYZ");
+ CheckFocusedFieldText("UVWXYZ");
+ CheckSelection("XYZ");
CheckCanUndo(true);
PerformUndo();
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, ReplaceSelection) {
@@ -3334,43 +3332,43 @@
CheckCanRedo(false);
TypeTextIntoTextField(2, RegularFormBegin());
- CheckFocusedFieldText(L"AB");
- CheckSelection(L"");
+ CheckFocusedFieldText("AB");
+ CheckSelection("");
SelectTextWithKeyboard(1, FWL_VKEY_Right, RegularFormBegin());
- CheckSelection(L"A");
+ CheckSelection("A");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert.get());
- CheckFocusedFieldText(L"XYZB");
+ CheckFocusedFieldText("XYZB");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"AB");
+ CheckFocusedFieldText("AB");
CheckCanUndo(true);
CheckCanRedo(true);
PerformUndo();
- CheckFocusedFieldText(L"A");
+ CheckFocusedFieldText("A");
CheckCanUndo(true);
CheckCanRedo(true);
PerformUndo();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"A");
+ CheckFocusedFieldText("A");
CheckCanUndo(true);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"AB");
+ CheckFocusedFieldText("AB");
CheckCanUndo(true);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"XYZB");
+ CheckFocusedFieldText("XYZB");
CheckCanUndo(true);
CheckCanRedo(false);
}
@@ -3379,43 +3377,43 @@
ScopedFPDFWideString text_to_insert1 = GetFPDFWideString(L"UVW");
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(false);
FORM_ReplaceSelection(form_handle(), page(), text_to_insert1.get());
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"");
+ CheckFocusedFieldText("");
CheckCanUndo(false);
CheckCanRedo(true);
PerformRedo();
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("");
ScopedFPDFWideString text_to_insert2 = GetFPDFWideString(L"XYZ");
FORM_ReplaceSelection(form_handle(), page(), text_to_insert2.get());
- CheckFocusedFieldText(L"UVWXYZ");
+ CheckFocusedFieldText("UVWXYZ");
CheckCanUndo(true);
CheckCanRedo(false);
PerformUndo();
- CheckFocusedFieldText(L"UVW");
- CheckSelection(L"");
+ CheckFocusedFieldText("UVW");
+ CheckSelection("");
}
TEST_F(FPDFFormFillTextFormEmbedderTest, SelectAllWithKeyboardShortcut) {
// Start with a couple of letters in the text form.
TypeTextIntoTextField(2, RegularFormBegin());
- CheckFocusedFieldText(L"AB");
- CheckSelection(L"");
+ CheckFocusedFieldText("AB");
+ CheckSelection("");
// Select all with the keyboard shortcut.
#if BUILDFLAG(IS_APPLE)
@@ -3425,11 +3423,11 @@
#endif
FORM_OnChar(form_handle(), page(), pdfium::ascii::kControlA,
kCorrectModifier);
- CheckSelection(L"AB");
+ CheckSelection("AB");
// Reset the selection again.
ClickOnFormFieldAtPoint(RegularFormBegin());
- CheckSelection(L"");
+ CheckSelection("");
// Select all with the keyboard shortcut using the wrong modifier key.
#if BUILDFLAG(IS_APPLE)
@@ -3438,7 +3436,7 @@
constexpr int kWrongModifier = FWL_EVENTFLAG_MetaKey;
#endif
FORM_OnChar(form_handle(), page(), pdfium::ascii::kControlA, kWrongModifier);
- CheckSelection(L"");
+ CheckSelection("");
}
class FPDFXFAFormBug1055869EmbedderTest
diff --git a/xfa/fwl/cfwl_edit_embeddertest.cpp b/xfa/fwl/cfwl_edit_embeddertest.cpp
index 25f6dd2..aa58317 100644
--- a/xfa/fwl/cfwl_edit_embeddertest.cpp
+++ b/xfa/fwl/cfwl_edit_embeddertest.cpp
@@ -6,7 +6,6 @@
#include <memory>
-#include "core/fxcrt/widestring.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_formfill.h"
@@ -76,11 +75,12 @@
FORM_OnLButtonDown(form_handle(), page(), FWL_EVENTFLAG_ShiftKey, 152, 58);
// 12 == (2 * strlen(defgh)) + 2 (for \0\0)
- EXPECT_EQ(12UL, FORM_GetSelectedText(form_handle(), page(), nullptr, 0));
+ ASSERT_EQ(12U, FORM_GetSelectedText(form_handle(), page(), nullptr, 0));
- uint8_t buf[128];
- unsigned long len = FORM_GetSelectedText(form_handle(), page(), &buf, 128);
- EXPECT_STREQ(L"defgh", WideString::FromUTF16LE({buf, len}).c_str());
+ uint16_t buf[6];
+ ASSERT_EQ(12U,
+ FORM_GetSelectedText(form_handle(), page(), &buf, sizeof(buf)));
+ EXPECT_EQ("defgh", GetPlatformString(buf));
}
TEST_F(CFWLEditEmbedderTest, DragMouseSelection) {
@@ -99,11 +99,12 @@
FORM_OnMouseMove(form_handle(), page(), FWL_EVENTFLAG_ShiftKey, 152, 58);
// 12 == (2 * strlen(defgh)) + 2 (for \0\0)
- EXPECT_EQ(12UL, FORM_GetSelectedText(form_handle(), page(), nullptr, 0));
+ ASSERT_EQ(12U, FORM_GetSelectedText(form_handle(), page(), nullptr, 0));
- uint8_t buf[128];
- unsigned long len = FORM_GetSelectedText(form_handle(), page(), &buf, 128);
- EXPECT_STREQ(L"defgh", WideString::FromUTF16LE({buf, len}).c_str());
+ uint16_t buf[6];
+ ASSERT_EQ(12U,
+ FORM_GetSelectedText(form_handle(), page(), &buf, sizeof(buf)));
+ EXPECT_EQ("defgh", GetPlatformString(buf));
// TODO(hnakashima): This is incorrect. Visually 'abcdefgh' are selected.
const char kDraggedMD5[] = "f131526c8edd04e44de17b2647ec54c8";