From fbcc5d9afb4506eea1003d024a5fac5d601cc196 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 5 Jun 2018 13:57:29 +0000 Subject: Add test for FPDF_GetPageSizeByIndex() Ensure that FPDF_GetPageSizeByIndex() doesn't do a full page parse. Issue was noticed on CL https://pdfium-review.googlesource.com/32830 Change-Id: I51966e0b91e1a002d33ee51f00c0428fa1cda04d Reviewed-on: https://pdfium-review.googlesource.com/33792 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/fpdf_doc_embeddertest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fpdfsdk/fpdf_doc_embeddertest.cpp') diff --git a/fpdfsdk/fpdf_doc_embeddertest.cpp b/fpdfsdk/fpdf_doc_embeddertest.cpp index c1f5e02ed6..a9eb4b8cb7 100644 --- a/fpdfsdk/fpdf_doc_embeddertest.cpp +++ b/fpdfsdk/fpdf_doc_embeddertest.cpp @@ -7,7 +7,9 @@ #include #include +#include "core/fpdfapi/parser/cpdf_document.h" #include "core/fxcrt/fx_string.h" +#include "fpdfsdk/cpdfsdk_helpers.h" #include "public/cpp/fpdf_scopers.h" #include "public/fpdf_doc.h" #include "public/fpdf_edit.h" @@ -20,6 +22,7 @@ class FPDFDocEmbeddertest : public EmbedderTest {}; TEST_F(FPDFDocEmbeddertest, MultipleSamePage) { EXPECT_TRUE(OpenDocument("hello_world.pdf")); + CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document()); std::set unique_pages; std::vector owned_pages(4); @@ -29,8 +32,10 @@ TEST_F(FPDFDocEmbeddertest, MultipleSamePage) { } #ifdef PDF_ENABLE_XFA EXPECT_EQ(1u, unique_pages.size()); + EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting()); #else // PDF_ENABLE_XFA EXPECT_EQ(4u, unique_pages.size()); + EXPECT_EQ(4u, pDoc->GetParsedPageCountForTesting()); #endif // PDF_ENABLE_XFA } -- cgit v1.2.3