diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdf_edit_embeddertest.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/fpdf_editpage.cpp | 15 | ||||
-rw-r--r-- | fpdfsdk/fpdf_view_c_api_test.c | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp index 80191556f3..8f54bf8eab 100644 --- a/fpdfsdk/fpdf_edit_embeddertest.cpp +++ b/fpdfsdk/fpdf_edit_embeddertest.cpp @@ -468,11 +468,14 @@ TEST_F(FPDFEditEmbeddertest, RemoveMarkedObjectsPrime) { GetPlatformWString(reinterpret_cast<unsigned short*>(buffer)); if (name == L"Prime") { prime_count++; + EXPECT_EQ(0, FPDFPageObjMark_CountParams(mark)); primes.push_back(page_object); } else if (name == L"Square") { square_count++; + EXPECT_EQ(1, FPDFPageObjMark_CountParams(mark)); } else if (name == L"GreaterThanTen") { greater_than_ten_count++; + EXPECT_EQ(0, FPDFPageObjMark_CountParams(mark)); } else { FAIL(); } diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index 20d88942c8..7a8bbabf2d 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -269,6 +269,21 @@ FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark, buflen); } +FPDF_EXPORT int FPDF_CALLCONV +FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark) { + if (!mark) + return -1; + + const CPDF_ContentMarkItem* pMarkItem = + CPDFContentMarkItemFromFPDFPageObjectMark(mark); + + const CPDF_Dictionary* pParams = pMarkItem->GetParam(); + if (!pParams) + return 0; + + return pParams->GetCount(); +} + FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { if (!pageObject) diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c index 114693c43e..e23efa2ff2 100644 --- a/fpdfsdk/fpdf_view_c_api_test.c +++ b/fpdfsdk/fpdf_view_c_api_test.c @@ -148,6 +148,7 @@ int CheckPDFiumCApi() { CHK(FPDFPageObj_CountMarks); CHK(FPDFPageObj_GetMark); CHK(FPDFPageObjMark_GetName); + CHK(FPDFPageObjMark_CountParams); CHK(FPDFImageObj_LoadJpegFile); CHK(FPDFImageObj_LoadJpegFileInline); CHK(FPDFImageObj_SetMatrix); |