summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_ppo_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-08 19:01:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-08 19:01:28 +0000
commitb7c41498ac1f09debe0b12efe1312a22246a18b0 (patch)
tree695be97b644ed76bca59825d862715effe82509f /fpdfsdk/fpdf_ppo_embeddertest.cpp
parent4ec16d7c89f4128e00de7247ef7e36b1f5d7f267 (diff)
downloadpdfium-b7c41498ac1f09debe0b12efe1312a22246a18b0.tar.xz
Add some basic tests for FPDF_VIEWERREF_GetPrintPageRange().
Hand edit viewer_ref.pdf to have a page range and more pages. Fix an invalid stream length in the file as well. Fix tests that depended on viewer_ref.pdf having only 1 page. Change-Id: I95d5cbf1f592d1c51f11d9ab5b26abf2f23ed598 Reviewed-on: https://pdfium-review.googlesource.com/32172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_ppo_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_ppo_embeddertest.cpp7
1 files changed, 6 insertions, 1 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);