Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp

Issue 2206253002: Fix FMCallExpression undefined shift behaviour. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review cleanup Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_simpleexpression.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h"
6
7 #include <memory>
8
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "xfa/fxfa/fm2js/xfa_lexer.h"
11
12 TEST(FMCallExpression, more_than_32_arguments) {
13 // Use sign as it has 3 object parameters at positions 0, 5, and 6.
14 std::unique_ptr<CXFA_FMIdentifierExpressionn> exp(
15 new CXFA_FMIdentifierExpressionn(0, CFX_WideStringC(L"sign")));
16
17 std::unique_ptr<CFX_ArrayTemplate<CXFA_FMSimpleExpression*>> args(
18 new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>());
19 for (size_t i = 0; i < 50; i++)
20 args->Add(new CXFA_FMSimpleExpression(0, TOKnan));
21
22 CXFA_FMCallExpression callExp(0, exp.release(), args.release(), TRUE);
23 CFX_WideTextBuf js;
24 callExp.ToJavaScript(js);
25
26 // Generate the result javascript string.
27 CFX_WideString result = L"sign(";
28 for (size_t i = 0; i < 50; i++) {
29 if (i > 0)
30 result += L", ";
31
32 result += L"foxit_xfa_formcalc_runtime.get_fm_";
33 // Object positions for sign() method.
34 if (i == 0 || i == 5 || i == 6)
35 result += L"jsobj()";
36 else
37 result += L"value()";
38 }
39 result += L")";
40
41 EXPECT_EQ(result.AsStringC(), js.AsStringC());
42 }
OLDNEW
« no previous file with comments | « xfa/fxfa/fm2js/xfa_simpleexpression.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698