summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_view_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-08 19:20:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-08 19:20:57 +0000
commit9c6204fc6c23ab35ec234781df182da570f6faef (patch)
tree14170cb0685189648b99d6ca786029382d3384f9 /fpdfsdk/fpdf_view_embeddertest.cpp
parent5de481e71bcde25d31452b23a017bb783163a204 (diff)
downloadpdfium-9c6204fc6c23ab35ec234781df182da570f6faef.tar.xz
Add APIs to work with a FPDF_PAGERANGE.
After getting a FPDF_PAGERANGE from FPDF_VIEWERREF_GetPrintPageRange(), one can now use FPDF_VIEWERREF_GetPrintPageRangeCount() to get the number of elements in the FPDF_PAGERANGE. One can then use FPDF_VIEWERREF_GetPrintPageRangeElement() to read the elements. Change-Id: I33eeff9026d01991ae1424e05b67f163245a35f9 Reviewed-on: https://pdfium-review.googlesource.com/32173 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_view_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_view_embeddertest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 9ba406a41c..580ba76e31 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -136,6 +136,9 @@ TEST_F(FPDFViewEmbeddertest, ViewerRefDummy) {
FPDF_PAGERANGE page_range = FPDF_VIEWERREF_GetPrintPageRange(document());
EXPECT_FALSE(page_range);
+ EXPECT_EQ(0U, FPDF_VIEWERREF_GetPrintPageRangeCount(page_range));
+ EXPECT_EQ(-1, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 0));
+ EXPECT_EQ(-1, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 1));
}
TEST_F(FPDFViewEmbeddertest, ViewerRef) {
@@ -178,6 +181,12 @@ TEST_F(FPDFViewEmbeddertest, ViewerRef) {
FPDF_PAGERANGE page_range = FPDF_VIEWERREF_GetPrintPageRange(document());
EXPECT_TRUE(page_range);
+ EXPECT_EQ(4U, FPDF_VIEWERREF_GetPrintPageRangeCount(page_range));
+ EXPECT_EQ(0, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 0));
+ EXPECT_EQ(2, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 1));
+ EXPECT_EQ(4, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 2));
+ EXPECT_EQ(4, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 3));
+ EXPECT_EQ(-1, FPDF_VIEWERREF_GetPrintPageRangeElement(page_range, 4));
}
TEST_F(FPDFViewEmbeddertest, NamedDests) {