summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-11 13:25:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-11 13:25:02 +0000
commitb66077d3ef7ba594f2a831840783549f4dd70d86 (patch)
tree2a2a79c65d5e389f4878ed3f131414f85ea4a6a9 /fpdfsdk/fpdf_edit_embeddertest.cpp
parentad1f7b410cd6885bd22d9ee49d9f80d3017f131f (diff)
downloadpdfium-b66077d3ef7ba594f2a831840783549f4dd70d86.tar.xz
Add FPDFFormObj_CountObjects() API
To find out the number of sub-objects a form object has, similar to how FPDFPage_CountObjects() does it for page objects. Change-Id: I7e5775dece42b74fd5b71b1d9622a1aa37bf64ac Reviewed-on: https://pdfium-review.googlesource.com/37316 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index be872ee186..e169c46b6d 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -1573,6 +1573,20 @@ TEST_F(FPDFEditEmbeddertest, TestGetTextRenderMode) {
UnloadPage(page);
}
+TEST_F(FPDFEditEmbeddertest, TestFormGetObjects) {
+ EXPECT_TRUE(OpenDocument("form_object.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+ ASSERT_EQ(1, FPDFPage_CountObjects(page));
+
+ FPDF_PAGEOBJECT form = FPDFPage_GetObject(page, 0);
+ EXPECT_EQ(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(form));
+ ASSERT_EQ(-1, FPDFFormObj_CountObjects(nullptr));
+ ASSERT_EQ(2, FPDFFormObj_CountObjects(form));
+
+ UnloadPage(page);
+}
+
// Tests adding text from standard font using FPDFText_LoadStandardFont.
TEST_F(FPDFEditEmbeddertest, AddStandardFontText2) {
// Start with a blank page