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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..896b8d1a813727089d27510deceda3d9daefdc1a
--- /dev/null
+++ b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
@@ -0,0 +1,41 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "xfa/fxfa/fm2js/xfa_simpleexpression.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
Lei Zhang 2016/08/03 16:43:23 extra blank line?
dsinclair 2016/08/03 16:55:36 Done.
+#include "xfa/fxfa/fm2js/xfa_lexer.h"
+
+TEST(FMCallExpression, more_than_32_arguments) {
+ // Use sign as it has 3 object parameters at positions 0, 5, and 6.
+ 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.
+ 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.
+
+ CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* args =
Lei Zhang 2016/08/03 16:43:23 Ditto.
dsinclair 2016/08/03 16:55:36 Done.
+ new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>();
+ for (size_t i = 0; i < 50; i++)
+ args->Add(new CXFA_FMSimpleExpression(0, TOKnan));
+
+ CXFA_FMCallExpression callExp(0, exp, args, TRUE);
+ CFX_WideTextBuf js;
+ callExp.ToJavaScript(js);
+
+ // Generate the result javascript string.
+ CFX_WideString result = L"sign(";
+ for (size_t i = 0; i < 50; i++) {
+ if (i > 0)
+ result += L", ";
+
+ result += L"foxit_xfa_formcalc_runtime.get_fm_";
+ // Object positions for sign() method.
+ if (i == 0 || i == 5 || i == 6)
+ result += L"jsobj()";
+ else
+ result += L"value()";
+ }
+ result += L")";
+
+ EXPECT_EQ(result.AsStringC(), js.AsStringC());
+}
« 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