From 38adfc184a53fbe472e48867acfc201ed940e8ee Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 25 Aug 2017 22:05:18 -0700 Subject: Implicitly create CFX_WideString() in form tests. Change-Id: I042c5e843dcf535b2d6676d41c0037e87c59c219 Reviewed-on: https://pdfium-review.googlesource.com/12050 Reviewed-by: Ryan Harrison Commit-Queue: Lei Zhang --- fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp | 26 ++++++++-------- fpdfsdk/pwl/cpwl_edit_embeddertest.cpp | 48 ++++++++++++++--------------- 2 files changed, 37 insertions(+), 37 deletions(-) (limited to 'fpdfsdk/pwl') diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp index 308ee4ac40..9fd8eec173 100644 --- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp @@ -211,7 +211,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, DeleteEntireTextSelection) { EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString()); + GetCPWLComboBox()->ReplaceSelection(L""); EXPECT_TRUE(GetCPWLComboBox()->GetText().IsEmpty()); } @@ -222,7 +222,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, DeleteTextSelectionMiddle) { GetCPWLComboBox()->SetEditSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString()); + GetCPWLComboBox()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetText().c_str()); } @@ -234,7 +234,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, DeleteTextSelectionLeft) { GetCPWLComboBox()->SetEditSelection(0, 5); EXPECT_STREQ(L"ABCDE", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString()); + GetCPWLComboBox()->ReplaceSelection(L""); EXPECT_STREQ(L"FGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetText().c_str()); } @@ -246,7 +246,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, DeleteTextSelectionRight) { GetCPWLComboBox()->SetEditSelection(45, 50); EXPECT_STREQ(L"nopqr", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString()); + GetCPWLComboBox()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm", GetCPWLComboBox()->GetText().c_str()); } @@ -255,14 +255,14 @@ TEST_F(CPWLComboBoxEditEmbeddertest, DeleteEmptyTextSelection) { FormFillerAndWindowSetup(GetCPDFSDKAnnotUserEditable()); TypeTextIntoTextField(50); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString()); + GetCPWLComboBox()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetText().c_str()); } TEST_F(CPWLComboBoxEditEmbeddertest, InsertTextInEmptyEditableComboBox) { FormFillerAndWindowSetup(GetCPDFSDKAnnotUserEditable()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"Hello", GetCPWLComboBox()->GetText().c_str()); } @@ -275,7 +275,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, EXPECT_TRUE(GetCFFLFormFiller()->OnKeyDown(GetCPDFSDKAnnotUserEditable(), FWL_VKEY_Home, 0)); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"HelloABCDEFGHIJ", GetCPWLComboBox()->GetText().c_str()); } @@ -290,7 +290,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, FWL_VKEY_Left, 0)); } - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEHelloFGHIJ", GetCPWLComboBox()->GetText().c_str()); } @@ -299,7 +299,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, FormFillerAndWindowSetup(GetCPDFSDKAnnotUserEditable()); TypeTextIntoTextField(10); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEFGHIJHello", GetCPWLComboBox()->GetText().c_str()); } @@ -310,7 +310,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetCPWLComboBox()->SetEditSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJ", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"Hello", GetCPWLComboBox()->GetText().c_str()); } @@ -321,7 +321,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetCPWLComboBox()->SetEditSelection(0, 5); EXPECT_STREQ(L"ABCDE", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"HelloFGHIJ", GetCPWLComboBox()->GetText().c_str()); } @@ -332,7 +332,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetCPWLComboBox()->SetEditSelection(2, 7); EXPECT_STREQ(L"CDEFG", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABHelloHIJ", GetCPWLComboBox()->GetText().c_str()); } @@ -343,6 +343,6 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetCPWLComboBox()->SetEditSelection(5, 10); EXPECT_STREQ(L"FGHIJ", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLComboBox()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEHello", GetCPWLComboBox()->GetText().c_str()); } diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp index 34569b2491..3574de9345 100644 --- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp @@ -155,7 +155,7 @@ TEST_F(CPWLEditEmbeddertest, DeleteEntireTextSelection) { EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); EXPECT_TRUE(GetCPWLEdit()->GetText().IsEmpty()); } @@ -166,7 +166,7 @@ TEST_F(CPWLEditEmbeddertest, DeleteTextSelectionMiddle) { GetCPWLEdit()->SetSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetText().c_str()); } @@ -178,7 +178,7 @@ TEST_F(CPWLEditEmbeddertest, DeleteTextSelectionLeft) { GetCPWLEdit()->SetSelection(0, 5); EXPECT_STREQ(L"ABCDE", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); EXPECT_STREQ(L"FGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetText().c_str()); } @@ -190,7 +190,7 @@ TEST_F(CPWLEditEmbeddertest, DeleteTextSelectionRight) { GetCPWLEdit()->SetSelection(45, 50); EXPECT_STREQ(L"nopqr", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm", GetCPWLEdit()->GetText().c_str()); } @@ -199,14 +199,14 @@ TEST_F(CPWLEditEmbeddertest, DeleteEmptyTextSelection) { FormFillerAndWindowSetup(GetCPDFSDKAnnot()); TypeTextIntoTextField(50); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetText().c_str()); } TEST_F(CPWLEditEmbeddertest, InsertTextInEmptyTextField) { FormFillerAndWindowSetup(GetCPDFSDKAnnot()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"Hello", GetCPWLEdit()->GetText().c_str()); } @@ -218,7 +218,7 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedTextFieldLeft) { EXPECT_TRUE( GetCFFLFormFiller()->OnKeyDown(GetCPDFSDKAnnot(), FWL_VKEY_Home, 0)); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"HelloABCDEFGHIJ", GetCPWLEdit()->GetText().c_str()); } @@ -232,7 +232,7 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedTextFieldMiddle) { GetCFFLFormFiller()->OnKeyDown(GetCPDFSDKAnnot(), FWL_VKEY_Left, 0)); } - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEHelloFGHIJ", GetCPWLEdit()->GetText().c_str()); } @@ -240,7 +240,7 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedTextFieldRight) { FormFillerAndWindowSetup(GetCPDFSDKAnnot()); TypeTextIntoTextField(10); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEFGHIJHello", GetCPWLEdit()->GetText().c_str()); } @@ -251,7 +251,7 @@ TEST_F(CPWLEditEmbeddertest, GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJ", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"Hello", GetCPWLEdit()->GetText().c_str()); } @@ -262,7 +262,7 @@ TEST_F(CPWLEditEmbeddertest, GetCPWLEdit()->SetSelection(0, 5); EXPECT_STREQ(L"ABCDE", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"HelloFGHIJ", GetCPWLEdit()->GetText().c_str()); } @@ -273,7 +273,7 @@ TEST_F(CPWLEditEmbeddertest, GetCPWLEdit()->SetSelection(2, 7); EXPECT_STREQ(L"CDEFG", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABHelloHIJ", GetCPWLEdit()->GetText().c_str()); } @@ -284,7 +284,7 @@ TEST_F(CPWLEditEmbeddertest, GetCPWLEdit()->SetSelection(5, 10); EXPECT_STREQ(L"FGHIJ", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hello")); + GetCPWLEdit()->ReplaceSelection(L"Hello"); EXPECT_STREQ(L"ABCDEHello", GetCPWLEdit()->GetText().c_str()); } @@ -292,9 +292,9 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInEmptyCharLimitTextFieldOverflow) { FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"Elephant", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"Hippopotam", GetCPWLEdit()->GetText().c_str()); } @@ -302,15 +302,15 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInEmptyCharLimitTextFieldFit) { FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"Elephant", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString()); + GetCPWLEdit()->ReplaceSelection(L""); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Zebra")); + GetCPWLEdit()->ReplaceSelection(L"Zebra"); EXPECT_STREQ(L"Zebra", GetCPWLEdit()->GetText().c_str()); } TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedCharLimitTextFieldLeft) { FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"HiElephant", GetCPWLEdit()->GetText().c_str()); } @@ -322,7 +322,7 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedCharLimitTextFieldMiddle) { FWL_VKEY_Right, 0)); } - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"ElephHiant", GetCPWLEdit()->GetText().c_str()); } @@ -332,7 +332,7 @@ TEST_F(CPWLEditEmbeddertest, InsertTextInPopulatedCharLimitTextFieldRight) { EXPECT_TRUE(GetCFFLFormFiller()->OnKeyDown(GetCPDFSDKAnnotCharLimit(), FWL_VKEY_End, 0)); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"ElephantHi", GetCPWLEdit()->GetText().c_str()); } @@ -341,7 +341,7 @@ TEST_F(CPWLEditEmbeddertest, FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"Elephant", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"Hippopotam", GetCPWLEdit()->GetText().c_str()); } @@ -350,7 +350,7 @@ TEST_F(CPWLEditEmbeddertest, FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(0, 4); EXPECT_STREQ(L"Elep", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"Hippophant", GetCPWLEdit()->GetText().c_str()); } @@ -359,7 +359,7 @@ TEST_F(CPWLEditEmbeddertest, FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(2, 6); EXPECT_STREQ(L"epha", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"ElHippopnt", GetCPWLEdit()->GetText().c_str()); } @@ -368,6 +368,6 @@ TEST_F(CPWLEditEmbeddertest, FormFillerAndWindowSetup(GetCPDFSDKAnnotCharLimit()); GetCPWLEdit()->SetSelection(4, 8); EXPECT_STREQ(L"hant", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->ReplaceSelection(CFX_WideString(L"Hippopotamus")); + GetCPWLEdit()->ReplaceSelection(L"Hippopotamus"); EXPECT_STREQ(L"ElepHippop", GetCPWLEdit()->GetText().c_str()); } -- cgit v1.2.3