From d3a34fe4665eed1ff09a5d06e565ffefb9a26134 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 22 Oct 2018 20:20:57 +0000 Subject: Add FPDFFormFillEmbeddertest.DocumentAActions. Provides coverage for CJS_EventContext::OnDoc_* methods. Change-Id: I65dff8fe5af4a9c11ac8fffabe209ad497586b1c Reviewed-on: https://pdfium-review.googlesource.com/c/44392 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/fpdf_formfill_embeddertest.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp index 99d30f3cc3..f5b39ae4b1 100644 --- a/fpdfsdk/fpdf_formfill_embeddertest.cpp +++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp @@ -435,6 +435,30 @@ TEST_F(FPDFFormFillEmbeddertest, DisableJavaScript) { UnloadPage(page); } +TEST_F(FPDFFormFillEmbeddertest, DocumentAActions) { + EmbedderTestTimerHandlingDelegate delegate; + SetDelegate(&delegate); + + EXPECT_TRUE(OpenDocument("document_aactions.pdf")); + FPDF_PAGE page = LoadPage(0); + EXPECT_TRUE(page); + + const auto& alerts = delegate.GetAlerts(); + EXPECT_EQ(0U, alerts.size()); + + FORM_DoDocumentAAction(form_handle(), FPDFDOC_AACTION_WS); + FORM_DoDocumentAAction(form_handle(), FPDFDOC_AACTION_DS); + FORM_DoDocumentAAction(form_handle(), FPDFDOC_AACTION_WP); + FORM_DoDocumentAAction(form_handle(), FPDFDOC_AACTION_DP); + UnloadPage(page); + + ASSERT_EQ(4U, alerts.size()); + EXPECT_STREQ(L"Will Save", alerts[0].message.c_str()); + EXPECT_STREQ(L"Did Save", alerts[1].message.c_str()); + EXPECT_STREQ(L"Will Print", alerts[2].message.c_str()); + EXPECT_STREQ(L"Did Print", alerts[3].message.c_str()); +} + TEST_F(FPDFFormFillEmbeddertest, BUG_551248) { // Test that timers fire once and intervals fire repeatedly. EmbedderTestTimerHandlingDelegate delegate; @@ -594,7 +618,6 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_765384) { FORM_OnLButtonUp(form_handle(), page, 0, 140, 590); UnloadPage(page); } - #endif // PDF_ENABLE_V8 TEST_F(FPDFFormFillEmbeddertest, FormText) { -- cgit v1.2.3