summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp4
-rw-r--r--fpdfsdk/fpdfeditimg_unittest.cpp16
-rw-r--r--fpdfsdk/fpdfeditpage.cpp4
-rw-r--r--fpdfsdk/fpdfview_c_api_test.c1
4 files changed, 15 insertions, 10 deletions
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index f8c053a6ad..44d5aaf438 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -1021,7 +1021,7 @@ TEST_F(FPDFEditEmbeddertest, ExtractImageBitmap) {
ASSERT_TRUE(OpenDocument("embedded_images.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- ASSERT_EQ(39, FPDFPage_CountObject(page));
+ ASSERT_EQ(39, FPDFPage_CountObjects(page));
FPDF_PAGEOBJECT obj = FPDFPage_GetObject(page, 32);
EXPECT_NE(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(obj));
@@ -1075,7 +1075,7 @@ TEST_F(FPDFEditEmbeddertest, GetImageData) {
EXPECT_TRUE(OpenDocument("embedded_images.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- ASSERT_EQ(39, FPDFPage_CountObject(page));
+ ASSERT_EQ(39, FPDFPage_CountObjects(page));
// Retrieve an image object with flate-encoded data stream.
FPDF_PAGEOBJECT obj = FPDFPage_GetObject(page, 33);
diff --git a/fpdfsdk/fpdfeditimg_unittest.cpp b/fpdfsdk/fpdfeditimg_unittest.cpp
index 0ff3db8e2d..fcc081ab76 100644
--- a/fpdfsdk/fpdfeditimg_unittest.cpp
+++ b/fpdfsdk/fpdfeditimg_unittest.cpp
@@ -16,17 +16,17 @@ class PDFEditTest : public testing::Test {
TEST_F(PDFEditTest, InsertObjectWithInvalidPage) {
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 100, 100);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
FPDFPage_InsertObject(nullptr, nullptr);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
FPDFPage_InsertObject(page, nullptr);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImageObj(doc);
FPDFPage_InsertObject(nullptr, page_image);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
FPDF_ClosePage(page);
FPDF_CloseDocument(doc);
@@ -35,11 +35,11 @@ TEST_F(PDFEditTest, InsertObjectWithInvalidPage) {
TEST_F(PDFEditTest, NewImageObj) {
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 100, 100);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImageObj(doc);
FPDFPage_InsertObject(page, page_image);
- EXPECT_EQ(1, FPDFPage_CountObject(page));
+ EXPECT_EQ(1, FPDFPage_CountObjects(page));
EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_ClosePage(page);
@@ -49,7 +49,7 @@ TEST_F(PDFEditTest, NewImageObj) {
TEST_F(PDFEditTest, NewImageObjGenerateContent) {
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 100, 100);
- EXPECT_EQ(0, FPDFPage_CountObject(page));
+ EXPECT_EQ(0, FPDFPage_CountObjects(page));
constexpr int kBitmapSize = 50;
FPDF_BITMAP bitmap = FPDFBitmap_Create(kBitmapSize, kBitmapSize, 0);
@@ -62,7 +62,7 @@ TEST_F(PDFEditTest, NewImageObjGenerateContent) {
ASSERT_TRUE(
FPDFImageObj_SetMatrix(page_image, kBitmapSize, 0, 0, kBitmapSize, 0, 0));
FPDFPage_InsertObject(page, page_image);
- EXPECT_EQ(1, FPDFPage_CountObject(page));
+ EXPECT_EQ(1, FPDFPage_CountObjects(page));
EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDFBitmap_Destroy(bitmap);
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 26f4424d10..b4e71bf254 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -183,6 +183,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page,
}
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObject(FPDF_PAGE page) {
+ return FPDFPage_CountObjects(page);
+}
+
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!IsPageObject(pPage))
return -1;
diff --git a/fpdfsdk/fpdfview_c_api_test.c b/fpdfsdk/fpdfview_c_api_test.c
index cc5d6c995d..996f48af16 100644
--- a/fpdfsdk/fpdfview_c_api_test.c
+++ b/fpdfsdk/fpdfview_c_api_test.c
@@ -120,6 +120,7 @@ int CheckPDFiumCApi() {
CHK(FPDFPage_SetRotation);
CHK(FPDFPage_InsertObject);
CHK(FPDFPage_CountObject);
+ CHK(FPDFPage_CountObjects);
CHK(FPDFPage_GetObject);
CHK(FPDFPage_HasTransparency);
CHK(FPDFPage_GenerateContent);