diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/xfa_js_embedder_test.cpp | 11 | ||||
-rw-r--r-- | testing/xfa_js_embedder_test.h | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp index d72e8762e8..4a29872eab 100644 --- a/testing/xfa_js_embedder_test.cpp +++ b/testing/xfa_js_embedder_test.cpp @@ -38,16 +38,17 @@ void XFAJSEmbedderTest::TearDown() { isolate_ = nullptr; } +CXFA_Document* XFAJSEmbedderTest::GetXFADocument() { + return UnderlyingFromFPDFDocument(document())->GetXFADoc()->GetXFADoc(); +} + bool XFAJSEmbedderTest::OpenDocument(const std::string& filename, const char* password, bool must_linearize) { if (!EmbedderTest::OpenDocument(filename, password, must_linearize)) return false; - script_context_ = UnderlyingFromFPDFDocument(document()) - ->GetXFADoc() - ->GetXFADoc() - ->GetScriptContext(); + script_context_ = GetXFADocument()->GetScriptContext(); return true; } @@ -55,7 +56,7 @@ bool XFAJSEmbedderTest::Execute(const CFX_ByteStringC& input) { value_ = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate()); if (script_context_->RunScript(XFA_SCRIPTLANGTYPE_Formcalc, CFX_WideString::FromUTF8(input).AsStringC(), - value_.get(), nullptr)) { + value_.get(), GetXFADocument()->GetRoot())) { return true; } diff --git a/testing/xfa_js_embedder_test.h b/testing/xfa_js_embedder_test.h index 62c3597b07..afbdb26e1a 100644 --- a/testing/xfa_js_embedder_test.h +++ b/testing/xfa_js_embedder_test.h @@ -11,6 +11,9 @@ #include "fxjs/cfxjse_value.h" #include "fxjs/fxjs_v8.h" #include "testing/embedder_test.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_object.h" class CXFA_ScriptContext; @@ -27,6 +30,7 @@ class XFAJSEmbedderTest : public EmbedderTest { bool must_linearize = false) override; v8::Isolate* GetIsolate() const { return isolate_; } + CXFA_Document* GetXFADocument(); bool Execute(const CFX_ByteStringC& input); CFXJSE_Value* GetValue() const { return value_.get(); } |