Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: samples/pdfium_test.cc

Issue 477873003: Fix a hang issue due to inconsistent page number in the test file (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 72c8c5dcd104c85c75dcadbb4cd15c2d971382d4..7436e9d86cccbd00e834b2b9f79deae908da832a 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -304,8 +304,14 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FORM_DoDocumentJSAction(form);
FORM_DoDocumentOpenAction(form);
+ size_t rendered_pages = 0;
+ size_t bad_pages = 0;
for (int i = 0; i < page_count; ++i) {
FPDF_PAGE page = FPDF_LoadPage(doc, i);
+ if (!page) {
+ bad_pages ++;
+ continue;
+ }
FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
FORM_OnAfterLoadPage(page, form);
FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN);
@@ -316,6 +322,8 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
+ rendered_pages ++;
+
FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0);
int stride = FPDFBitmap_GetStride(bitmap);
const char* buffer =
@@ -351,7 +359,8 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FPDF_CloseDocument(doc);
FPDFAvail_Destroy(pdf_avail);
- printf("Loaded, parsed and rendered %d pages.\n", page_count);
+ printf("Loaded, parsed and rendered %d pages.\n", rendered_pages);
+ printf("Skipped %d bad pages.\n", bad_pages);
}
int main(int argc, const char* argv[]) {
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698