summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdf_ppo_embeddertest.cpp7
-rw-r--r--fpdfsdk/fpdf_view_embeddertest.cpp6
-rw-r--r--testing/resources/viewer_ref.pdf23
3 files changed, 26 insertions, 10 deletions
diff --git a/fpdfsdk/fpdf_ppo_embeddertest.cpp b/fpdfsdk/fpdf_ppo_embeddertest.cpp
index 8412771aaf..84e97dc96d 100644
--- a/fpdfsdk/fpdf_ppo_embeddertest.cpp
+++ b/fpdfsdk/fpdf_ppo_embeddertest.cpp
@@ -151,7 +151,7 @@ TEST_F(FPDFPPOEmbeddertest, BadCircularViewerPref) {
}
TEST_F(FPDFPPOEmbeddertest, BadRanges) {
- EXPECT_TRUE(OpenDocument("viewer_ref.pdf"));
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_TRUE(page);
@@ -183,8 +183,13 @@ TEST_F(FPDFPPOEmbeddertest, GoodRanges) {
EXPECT_TRUE(output_doc);
EXPECT_TRUE(FPDF_CopyViewerPreferences(output_doc, document()));
EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "1,1,1,1", 0));
+ EXPECT_EQ(4, FPDF_GetPageCount(output_doc));
EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "1-1", 0));
EXPECT_EQ(5, FPDF_GetPageCount(output_doc));
+ EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "5-5", 0));
+ EXPECT_EQ(6, FPDF_GetPageCount(output_doc));
+ EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "2-4", 0));
+ EXPECT_EQ(9, FPDF_GetPageCount(output_doc));
FPDF_CloseDocument(output_doc);
UnloadPage(page);
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 40e1c9df5d..9ba406a41c 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -133,6 +133,9 @@ TEST_F(FPDFViewEmbeddertest, ViewerRefDummy) {
char buf[100];
EXPECT_EQ(0U, FPDF_VIEWERREF_GetName(document(), "foo", nullptr, 0));
EXPECT_EQ(0U, FPDF_VIEWERREF_GetName(document(), "foo", buf, sizeof(buf)));
+
+ FPDF_PAGERANGE page_range = FPDF_VIEWERREF_GetPrintPageRange(document());
+ EXPECT_FALSE(page_range);
}
TEST_F(FPDFViewEmbeddertest, ViewerRef) {
@@ -172,6 +175,9 @@ TEST_F(FPDFViewEmbeddertest, ViewerRef) {
ASSERT_EQ(8U,
FPDF_VIEWERREF_GetName(document(), "ViewArea", buf, sizeof(buf)));
EXPECT_STREQ("CropBox", buf);
+
+ FPDF_PAGERANGE page_range = FPDF_VIEWERREF_GetPrintPageRange(document());
+ EXPECT_TRUE(page_range);
}
TEST_F(FPDFViewEmbeddertest, NamedDests) {
diff --git a/testing/resources/viewer_ref.pdf b/testing/resources/viewer_ref.pdf
index 851ea273e7..ca53771694 100644
--- a/testing/resources/viewer_ref.pdf
+++ b/testing/resources/viewer_ref.pdf
@@ -4,19 +4,24 @@
/Type /Catalog
/Pages 2 0 R
/ViewerPreferences <<
+ /Direction /R2L
/Foo /foo
/HideToolbar true
- /Direction /R2L
- /ViewArea /CropBox
/NumCopies 5
+ /PrintPageRange [0 2 4 4]
+ /ViewArea /CropBox
>>
>>
endobj
2 0 obj <<
/Type /Pages
- /Count 1
+ /Count 5
/Kids [
3 0 R
+ 3 0 R
+ 3 0 R
+ 3 0 R
+ 3 0 R
]
>>
endobj
@@ -40,7 +45,7 @@ endobj
endobj
% Content for page 0.
21 0 obj <<
- /Length 0
+ /Length 37
>>
stream
BT
@@ -53,8 +58,8 @@ xref
0 22
0000000000 65535 f
0000000015 00000 n
-0000000193 00000 n
-0000000281 00000 n
+0000000223 00000 n
+0000000351 00000 n
0000000000 65535 f
0000000000 65535 f
0000000000 65535 f
@@ -66,14 +71,14 @@ xref
0000000000 65535 f
0000000000 65535 f
0000000000 65535 f
-0000000442 00000 n
+0000000512 00000 n
0000000000 65535 f
0000000000 65535 f
0000000000 65535 f
0000000000 65535 f
0000000000 65535 f
-0000000537 00000 n
+0000000607 00000 n
trailer<< /Root 1 0 R /Size 22 >>
startxref
-625
+696
%%EOF