summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2018-02-19 18:10:34 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-19 18:10:34 +0000
commit6a5b1c96e23bd684d9fec2c59e0d4bc5d883650c (patch)
treeb6ba4042b3e6ad51d240b69e3cec78891e3b583c /xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
parentc8785f736df57d7d20649d803818a30eb55b2ee8 (diff)
downloadpdfium-6a5b1c96e23bd684d9fec2c59e0d4bc5d883650c.tar.xz
Merge FormCalc to JavaScript methods
This CL merges the ToJavaScript and the ToImpliedJS methods in the FormCalc expressions. The type of return is passed as a paramter to ToJavaScript. Change-Id: Idff83677bc70b964d95aa6ff6b0e2c1bf8c603ea Reviewed-on: https://pdfium-review.googlesource.com/27210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
index 96ccb71ca9..e97df41ad7 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp
@@ -26,7 +26,7 @@ TEST(FMCallExpressionTest, more_than_32_arguments) {
CXFA_FMToJavaScriptDepth::Reset();
CXFA_FMCallExpression callExp(0, std::move(exp), std::move(args), true);
CFX_WideTextBuf js;
- callExp.ToJavaScript(js);
+ callExp.ToJavaScript(js, ReturnType::kInfered);
// Generate the result javascript string.
WideString result = L"sign(";
@@ -49,21 +49,24 @@ TEST(FMCallExpressionTest, more_than_32_arguments) {
TEST(FMStringExpressionTest, Empty) {
CXFA_FMToJavaScriptDepth::Reset();
CFX_WideTextBuf accumulator;
- CXFA_FMStringExpression(1, WideStringView()).ToJavaScript(accumulator);
+ CXFA_FMStringExpression(1, WideStringView())
+ .ToJavaScript(accumulator, ReturnType::kInfered);
EXPECT_EQ(L"", accumulator.AsStringView());
}
TEST(FMStringExpressionTest, Short) {
CXFA_FMToJavaScriptDepth::Reset();
CFX_WideTextBuf accumulator;
- CXFA_FMStringExpression(1, L"a").ToJavaScript(accumulator);
+ CXFA_FMStringExpression(1, L"a").ToJavaScript(accumulator,
+ ReturnType::kInfered);
EXPECT_EQ(L"a", accumulator.AsStringView());
}
TEST(FMStringExpressionTest, Medium) {
CXFA_FMToJavaScriptDepth::Reset();
CFX_WideTextBuf accumulator;
- CXFA_FMStringExpression(1, L".abcd.").ToJavaScript(accumulator);
+ CXFA_FMStringExpression(1, L".abcd.")
+ .ToJavaScript(accumulator, ReturnType::kInfered);
EXPECT_EQ(L"\"abcd\"", accumulator.AsStringView());
}
@@ -71,7 +74,8 @@ TEST(FMStringExpressionTest, Long) {
CXFA_FMToJavaScriptDepth::Reset();
CFX_WideTextBuf accumulator;
std::vector<WideStringView::UnsignedType> vec(140000, L'A');
- CXFA_FMStringExpression(1, WideStringView(vec)).ToJavaScript(accumulator);
+ CXFA_FMStringExpression(1, WideStringView(vec))
+ .ToJavaScript(accumulator, ReturnType::kInfered);
EXPECT_EQ(140000u, accumulator.GetLength());
}
@@ -79,6 +83,6 @@ TEST(FMStringExpressionTest, Quoted) {
CXFA_FMToJavaScriptDepth::Reset();
CFX_WideTextBuf accumulator;
CXFA_FMStringExpression(1, L".Simon says \"\"run\"\".")
- .ToJavaScript(accumulator);
+ .ToJavaScript(accumulator, ReturnType::kInfered);
EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringView());
}