diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-01-06 10:03:59 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-01-06 10:03:59 -0800 |
commit | d483eb46d8920547d1b47351e65fa0299eaba191 (patch) | |
tree | 9b86db31f9f858c767cc58fee110839afdcdeef1 /testing/embedder_test.cpp | |
parent | ec32127b105fc1ff74842dc939cb6fa7d23430b0 (diff) | |
download | pdfium-d483eb46d8920547d1b47351e65fa0299eaba191.tar.xz |
Merge to XFA: Add fpdf_edit basic creation embedder test.
Original Review URL: https://codereview.chromium.org/1554133003 .
(cherry picked from commit d368261cc8d604286e29ca6358700e6bb051dcaa)
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1567643002 .
Diffstat (limited to 'testing/embedder_test.cpp')
-rw-r--r-- | testing/embedder_test.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp index 8d4682eacf..7224e227c6 100644 --- a/testing/embedder_test.cpp +++ b/testing/embedder_test.cpp @@ -102,6 +102,15 @@ void EmbedderTest::TearDown() { free(file_contents_); } +bool EmbedderTest::CreateEmptyDocument() { + document_ = FPDF_CreateNewDocument(); + if (!document_) + return false; + + SetupFormFillEnvironment(); + return true; +} + bool EmbedderTest::OpenDocument(const std::string& filename, bool must_linearize) { std::string file_path; @@ -169,7 +178,11 @@ bool EmbedderTest::OpenDocument(const std::string& filename, #endif // PDF_ENABLE_XFA (void)FPDF_GetDocPermissions(document_); + SetupFormFillEnvironment(); + return true; +} +void EmbedderTest::SetupFormFillEnvironment() { IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this); memset(platform, 0, sizeof(IPDF_JSPLATFORM)); platform->version = 2; @@ -190,8 +203,6 @@ bool EmbedderTest::OpenDocument(const std::string& filename, form_handle_ = FPDFDOC_InitFormFillEnvironment(document_, formfillinfo); FPDF_SetFormFieldHighlightColor(form_handle_, 0, 0xFFE4DD); FPDF_SetFormFieldHighlightAlpha(form_handle_, 100); - - return true; } void EmbedderTest::DoOpenActions() { |