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

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: 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
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 "testing/gtest/include/gtest/gtest.h"
8
Lei Zhang 2016/08/03 16:43:23 extra blank line?
dsinclair 2016/08/03 16:55:36 Done.
9 #include "xfa/fxfa/fm2js/xfa_lexer.h"
10
11 TEST(FMCallExpression, more_than_32_arguments) {
12 // Use sign as it has 3 object parameters at positions 0, 5, and 6.
13 CXFA_FMIdentifierExpressionn* exp =
Lei Zhang 2016/08/03 16:43:23 std::unique_ptr + release() below? And some day,
dsinclair 2016/08/03 16:55:36 Done.
14 new CXFA_FMIdentifierExpressionn(0, CFX_WideStringC(L"sign"));
dsinclair 2016/08/03 14:55:15 I'll fix the double n's in a followup.
15
16 CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* args =
Lei Zhang 2016/08/03 16:43:23 Ditto.
dsinclair 2016/08/03 16:55:36 Done.
17 new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>();
18 for (size_t i = 0; i < 50; i++)
19 args->Add(new CXFA_FMSimpleExpression(0, TOKnan));
20
21 CXFA_FMCallExpression callExp(0, exp, args, TRUE);
22 CFX_WideTextBuf js;
23 callExp.ToJavaScript(js);
24
25 // Generate the result javascript string.
26 CFX_WideString result = L"sign(";
27 for (size_t i = 0; i < 50; i++) {
28 if (i > 0)
29 result += L", ";
30
31 result += L"foxit_xfa_formcalc_runtime.get_fm_";
32 // Object positions for sign() method.
33 if (i == 0 || i == 5 || i == 6)
34 result += L"jsobj()";
35 else
36 result += L"value()";
37 }
38 result += L")";
39
40 EXPECT_EQ(result.AsStringC(), js.AsStringC());
41 }
OLDNEW
« xfa/fxfa/fm2js/xfa_simpleexpression.cpp ('K') | « xfa/fxfa/fm2js/xfa_simpleexpression.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698