summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-12-07 18:17:04 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-07 18:17:04 +0000
commit50a3124a7a1fa7596b9306445786d73e7cac2d90 (patch)
treeb62b191494c56252957944c4b50dd1d8b2c9a42f
parentbb6ecbad918e52c46400caffbff6ffc70a494bce (diff)
downloadpdfium-50a3124a7a1fa7596b9306445786d73e7cac2d90.tar.xz
Change %s to %ls in calls to WideString::Format
This fixes the text in validation pop ups for XFA forms. BUG=pdfium:951,pdfium:950 Change-Id: Iad46a30cae3fafcf9f73a46cb204c2de54b62b68 Reviewed-on: https://pdfium-review.googlesource.com/20490 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fwl/cfwl_edit_embeddertest.cpp12
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp13
2 files changed, 19 insertions, 6 deletions
diff --git a/xfa/fwl/cfwl_edit_embeddertest.cpp b/xfa/fwl/cfwl_edit_embeddertest.cpp
index c1575689eb..59a4ca5947 100644
--- a/xfa/fwl/cfwl_edit_embeddertest.cpp
+++ b/xfa/fwl/cfwl_edit_embeddertest.cpp
@@ -6,12 +6,14 @@
#include "public/fpdf_formfill.h"
#include "public/fpdf_fwlevent.h"
#include "testing/embedder_test.h"
+#include "testing/embedder_test_timer_handling_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
class CFWLEditEmbeddertest : public EmbedderTest {
protected:
void SetUp() override {
EmbedderTest::SetUp();
+ SetDelegate(&delegate_);
CreateAndInitializeFormPDF();
}
@@ -27,11 +29,21 @@ class CFWLEditEmbeddertest : public EmbedderTest {
}
FPDF_PAGE page() const { return page_; }
+ EmbedderTestTimerHandlingDelegate delegate() const { return delegate_; }
private:
FPDF_PAGE page_;
+ EmbedderTestTimerHandlingDelegate delegate_;
};
+TEST_F(CFWLEditEmbeddertest, Trivial) {
+ ASSERT_EQ(1u, delegate().GetAlerts().size());
+ auto alert = delegate().GetAlerts()[0];
+ EXPECT_STREQ(L"PDFium", alert.title.c_str());
+ EXPECT_STREQ(L"The value you entered for Text Field is invalid.",
+ alert.message.c_str());
+}
+
TEST_F(CFWLEditEmbeddertest, LeftClickMouseSelection) {
FORM_OnLButtonDown(form_handle(), page(), 0, 115, 58);
for (size_t i = 0; i < 10; ++i)
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index c55f007584..ef5904c946 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -462,7 +462,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_ValidateData validateData,
if (wsNullMsg.IsEmpty()) {
wsCaptionName = GetValidateCaptionName(bVersionFlag);
wsNullMsg =
- WideString::Format(L"%s cannot be blank.", wsCaptionName.c_str());
+ WideString::Format(L"%ls cannot be blank.", wsCaptionName.c_str());
}
pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
return XFA_EVENTERROR_Error;
@@ -474,7 +474,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_ValidateData validateData,
if (wsNullMsg.IsEmpty()) {
wsCaptionName = GetValidateCaptionName(bVersionFlag);
wsNullMsg = WideString::Format(
- L"%s cannot be blank. To ignore validations for %s, click Ignore.",
+ L"%ls cannot be blank. To ignore validations for %ls, click "
+ L"Ignore.",
wsCaptionName.c_str(), wsCaptionName.c_str());
}
if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
@@ -512,14 +513,14 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, bool bVersionFlag) {
WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
if (bVersionFlag)
- return WideString::Format(L"%s validation failed", wsCaptionName.c_str());
+ return WideString::Format(L"%ls validation failed", wsCaptionName.c_str());
if (bError) {
- return WideString::Format(L"The value you entered for %s is invalid.",
+ return WideString::Format(L"The value you entered for %ls is invalid.",
wsCaptionName.c_str());
}
return WideString::Format(
- L"The value you entered for %s is invalid. To ignore "
- L"validations for %s, click Ignore.",
+ L"The value you entered for %ls is invalid. To ignore "
+ L"validations for %ls, click Ignore.",
wsCaptionName.c_str(), wsCaptionName.c_str());
}