diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-10-18 12:28:14 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-18 16:41:35 +0000 |
commit | 854d71c1420eb80ec79755a6cdf829f3f39aead7 (patch) | |
tree | ba5f94431c46bcf8fa5b8e873304f14c8c69088c /fpdfsdk/fpdfformfill_embeddertest.cpp | |
parent | 7c2daec0a5f5d5e0f442db7946e9356daa7c55b2 (diff) | |
download | pdfium-854d71c1420eb80ec79755a6cdf829f3f39aead7.tar.xz |
Refactor HasXFAField into HasFormInfo
The existing API is too restrictive for collection the metrics
information that we want. Specifically it only tells us if there are
XFA forms in the document, but not AcroForms. This refactoring makes
the method more general, so that non-XFA information is provided
also. This change in semantics of the return value required some
changes at the call sites of the API.
BUG=chromium:775519
Change-Id: Id421c66c09b47196c252c64cdc2c711ca1911de0
Reviewed-on: https://pdfium-review.googlesource.com/16210
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfformfill_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdfformfill_embeddertest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp index f5151cc456..7a9ebcfdd2 100644 --- a/fpdfsdk/fpdfformfill_embeddertest.cpp +++ b/fpdfsdk/fpdfformfill_embeddertest.cpp @@ -565,6 +565,26 @@ TEST_F(FPDFFormFillEmbeddertest, FormText) { TestAndCloseSaved(300, 300, md5_3); } +TEST_F(FPDFFormFillEmbeddertest, HasFormInfoNone) { + EXPECT_TRUE(OpenDocument("hello_world.pdf")); + EXPECT_EQ(FORMTYPE_NONE, FPDF_GetFormType(document_)); +} + +TEST_F(FPDFFormFillEmbeddertest, HasFormInfoAcroForm) { + EXPECT_TRUE(OpenDocument("text_form.pdf")); + EXPECT_EQ(FORMTYPE_ACRO_FORM, FPDF_GetFormType(document_)); +} + +TEST_F(FPDFFormFillEmbeddertest, HasFormInfoXFAFull) { + EXPECT_TRUE(OpenDocument("simple_xfa.pdf")); + EXPECT_EQ(FORMTYPE_XFA_FULL, FPDF_GetFormType(document_)); +} + +TEST_F(FPDFFormFillEmbeddertest, HasFormInfoXFAForeground) { + EXPECT_TRUE(OpenDocument("bug_216.pdf")); + EXPECT_EQ(FORMTYPE_XFA_FOREGROUND, FPDF_GetFormType(document_)); +} + TEST_F(FPDFFormFillTextFormEmbeddertest, GetSelectedTextEmptyAndBasicKeyboard) { // Test empty selection. CheckSelection(L""); |