OLD | NEW |
(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 } |
OLD | NEW |