diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-05-25 10:32:18 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-25 14:43:21 +0000 |
commit | 13115ecf2087f5db33deea16dd1c72c7b976cafd (patch) | |
tree | 9bb2764c9dc7d6c98620e485cd62fa501bada8e5 | |
parent | a7c9c0127f47b9dd9768ca4c256a269ab1c07a86 (diff) | |
download | pdfium-13115ecf2087f5db33deea16dd1c72c7b976cafd.tar.xz |
Fix FM2JSContext Round return type
This Cl fixes the return type of the Round method to return a double instead
of a string.
Change-Id: I740e375bdedfe22cb9f81d4beeaa079eac64b1bd
Reviewed-on: https://pdfium-review.googlesource.com/5896
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp index 8fe5199dee..4b3b5e2ab1 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp @@ -957,9 +957,8 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, uPrecision = static_cast<uint8_t>(pdfium::clamp(dPrecision, 0.0, 12.0)); } - CFX_Decimal decimalValue((float)dValue, uPrecision); - CFX_WideString wsValue = decimalValue; - args.GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC()); + CFX_Decimal decimalValue(static_cast<float>(dValue), uPrecision); + args.GetReturnValue()->SetDouble(decimalValue); } // static diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp index a61203cc0b..45f1d16e35 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp @@ -251,6 +251,8 @@ TEST_F(FM2JSContextEmbedderTest, Min) { const char* program; int result; } tests[] = {{"Min(234, 15, 107)", 15}, + // TODO(dsinclair): Verify with Reader; I believe this should + // have a return of 0. // {"Min(\"abc\", 15, \"Tony Blue\")", 15}, {"Min(\"abc\")", 0}}; @@ -282,7 +284,7 @@ TEST_F(FM2JSContextEmbedderTest, Mod) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Round) { +TEST_F(FM2JSContextEmbedderTest, Round) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { |