diff options
-rw-r--r-- | fpdfsdk/fpdfppo_embeddertest.cpp | 44 | ||||
-rw-r--r-- | testing/resources/bug_750568.in | 77 | ||||
-rw-r--r-- | testing/resources/bug_750568.pdf | 91 |
3 files changed, 212 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfppo_embeddertest.cpp b/fpdfsdk/fpdfppo_embeddertest.cpp index b6b9167f10..d57169221b 100644 --- a/fpdfsdk/fpdfppo_embeddertest.cpp +++ b/fpdfsdk/fpdfppo_embeddertest.cpp @@ -142,6 +142,50 @@ TEST_F(FPDFPPOEmbeddertest, BUG_664284) { UnloadPage(page); } +TEST_F(FPDFPPOEmbeddertest, BUG_750568) { + const char* const kHashes[] = { + "64ad08132a1c5a166768298c8a578f57", "83b83e2f6bc80707d0a917c7634140b9", + "913cd3723a451e4e46fbc2c05702d1ee", "81fb7cfd4860f855eb468f73dfeb6d60"}; + + ASSERT_TRUE(OpenDocument("bug_750568.pdf")); + ASSERT_EQ(4, FPDF_GetPageCount(document())); + + for (size_t i = 0; i < 4; ++i) { + FPDF_PAGE page = LoadPage(i); + ASSERT_NE(nullptr, page); + + FPDF_BITMAP bitmap = RenderPage(page); + ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap)); + ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap)); + ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap)); + + std::string digest = HashBitmap(bitmap, 200, 200); + FPDFBitmap_Destroy(bitmap); + UnloadPage(page); + EXPECT_EQ(kHashes[i], digest); + } + + FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument(); + ASSERT_TRUE(output_doc); + EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "1,2,3,4", 0)); + ASSERT_EQ(4, FPDF_GetPageCount(output_doc)); + for (size_t i = 0; i < 4; ++i) { + FPDF_PAGE page = FPDF_LoadPage(output_doc, i); + ASSERT_NE(nullptr, page); + + FPDF_BITMAP bitmap = RenderPage(page); + ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap)); + ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap)); + ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap)); + + std::string digest = HashBitmap(bitmap, 200, 200); + FPDFBitmap_Destroy(bitmap); + FPDF_ClosePage(page); + EXPECT_EQ(kHashes[i], digest); + } + FPDF_CloseDocument(output_doc); +} + TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) { EXPECT_TRUE(OpenDocument("zero_length_stream.pdf")); FPDF_PAGE page = LoadPage(0); diff --git a/testing/resources/bug_750568.in b/testing/resources/bug_750568.in new file mode 100644 index 0000000000..9d72093827 --- /dev/null +++ b/testing/resources/bug_750568.in @@ -0,0 +1,77 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +endobj +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 4 + /Kids [ 3 0 R 4 0 R 5 0 R 6 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Contents 7 0 R +>> +endobj +{{object 4 0}} << + /Type /Page + /Parent 2 0 R + /Contents 8 0 R +>> +endobj +{{object 5 0}} << + /Type /Page + /Parent 2 0 R + /Contents 9 0 R +>> +endobj +{{object 6 0}} << + /Type /Page + /Parent 2 0 R + /Contents 10 0 R +>> +endobj +{{object 7 0}} << +>> +stream +q +0 0 0 rg +10 80 50 30 re B* +Q +endstream +endobj +{{object 8 0}} << +>> +stream +q +0 0 1 rg +70 135 50 30 re B* +Q +endstream +endobj +{{object 9 0}} << +>> +stream +q +0 1 0 rg +130 80 50 30 re B* +Q +endstream +endobj +{{object 10 0}} << +>> +stream +q +1 0 0 rg +70 25 50 30 re B* +Q +endstream +endobj +{{xref}} +{{trailer}} +{{startxref}} +%%EOF diff --git a/testing/resources/bug_750568.pdf b/testing/resources/bug_750568.pdf new file mode 100644 index 0000000000..5fb60142bd --- /dev/null +++ b/testing/resources/bug_750568.pdf @@ -0,0 +1,91 @@ +%PDF-1.7 +% ò¤ô +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 4 + /Kids [ 3 0 R 4 0 R 5 0 R 6 0 R ] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 7 0 R +>> +endobj +4 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 8 0 R +>> +endobj +5 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 9 0 R +>> +endobj +6 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 10 0 R +>> +endobj +7 0 obj << +>> +stream +q +0 0 0 rg +10 80 50 30 re B* +Q +endstream +endobj +8 0 obj << +>> +stream +q +0 0 1 rg +70 135 50 30 re B* +Q +endstream +endobj +9 0 obj << +>> +stream +q +0 1 0 rg +130 80 50 30 re B* +Q +endstream +endobj +10 0 obj << +>> +stream +q +1 0 0 rg +70 25 50 30 re B* +Q +endstream +endobj +xref +0 11 +0000000000 65535 f +0000000015 00000 n +0000000068 00000 n +0000000179 00000 n +0000000248 00000 n +0000000317 00000 n +0000000386 00000 n +0000000456 00000 n +0000000525 00000 n +0000000595 00000 n +0000000665 00000 n +trailer<< /Root 1 0 R /Size 11 >> +startxref +735 +%%EOF |