summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-16 19:20:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-16 19:20:36 +0000
commit1d273f1cf00676725da6f0cd17e107f114030e87 (patch)
tree97b2411500872f72d74a4bab7e4c8461e9e28deb /fpdfsdk/fpdf_edit_embeddertest.cpp
parentfb709d88935ae85532679d225993741919b23a7b (diff)
downloadpdfium-1d273f1cf00676725da6f0cd17e107f114030e87.tar.xz
Add FPDFFormObj_GetObject() API
To be used together with the existing FPDFFormObj_CountObjects() function. Change-Id: I8ed69624e967708c8db7e8f135e28fbe6a52752f Reviewed-on: https://pdfium-review.googlesource.com/37890 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 0c0776f9d7..227e5c9ef5 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -1769,6 +1769,26 @@ TEST_F(FPDFEditEmbeddertest, TestFormGetObjects) {
ASSERT_EQ(-1, FPDFFormObj_CountObjects(nullptr));
ASSERT_EQ(2, FPDFFormObj_CountObjects(form));
+ // FPDFFormObj_GetObject() positive testing.
+ FPDF_PAGEOBJECT text1 = FPDFFormObj_GetObject(form, 0);
+ ASSERT_TRUE(text1);
+ float left = 0;
+ float bottom = 0;
+ float right = 0;
+ float top = 0;
+ ASSERT_TRUE(FPDFPageObj_GetBounds(text1, &left, &bottom, &right, &top));
+ ASSERT_EQ(271, static_cast<int>(top));
+
+ FPDF_PAGEOBJECT text2 = FPDFFormObj_GetObject(form, 1);
+ ASSERT_TRUE(text2);
+ ASSERT_TRUE(FPDFPageObj_GetBounds(text2, &left, &bottom, &right, &top));
+ ASSERT_EQ(221, static_cast<int>(top));
+
+ // FPDFFormObj_GetObject() negative testing.
+ ASSERT_EQ(nullptr, FPDFFormObj_GetObject(nullptr, 0));
+ ASSERT_EQ(nullptr, FPDFFormObj_GetObject(form, -1));
+ ASSERT_EQ(nullptr, FPDFFormObj_GetObject(form, 2));
+
UnloadPage(page);
}