summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-06-19 11:13:00 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-19 16:13:45 +0000
commitc533f4b7390afc3b372c0184d274053039ac264d (patch)
tree24df6faad75c47ad82a7956d75e7312723ef2dcb /testing
parent3b05743bd072d936f56250514d6b18bfbbde85bf (diff)
downloadpdfium-c533f4b7390afc3b372c0184d274053039ac264d.tar.xz
Added EmbedderTest::RenderPageWithFlags()
Currently, in embedder tests, pages can only be rendered with no flags specified. With the addition of annotation APIs and corresponding embedder tests, it is helpful to add a test method to allow flags to be passed in when rendering pages in embedder tests. This CL adds such a method. Bug=pdfium:737 Change-Id: I277831cb2e228154e9a65b078a241b8e61220664 Reviewed-on: https://pdfium-review.googlesource.com/6711 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
Diffstat (limited to 'testing')
-rw-r--r--testing/embedder_test.cpp6
-rw-r--r--testing/embedder_test.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 6cea598400..f818091cb7 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -255,13 +255,17 @@ FPDF_PAGE EmbedderTest::LoadPage(int page_number) {
}
FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) {
+ return RenderPageWithFlags(page, 0);
+}
+
+FPDF_BITMAP EmbedderTest::RenderPageWithFlags(FPDF_PAGE page, int flags) {
int width = static_cast<int>(FPDF_GetPageWidth(page));
int height = static_cast<int>(FPDF_GetPageHeight(page));
int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
- FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
+ FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, flags);
FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, 0);
return bitmap;
}
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index 2bb796d905..fd48840d28 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -101,6 +101,10 @@ class EmbedderTest : public ::testing::Test,
// Convert a loaded page into a bitmap.
virtual FPDF_BITMAP RenderPage(FPDF_PAGE page);
+ // Convert a loaded page into a bitmap with page rendering flags specified.
+ // See public/fpdfview.h for a list of page rendering flags.
+ virtual FPDF_BITMAP RenderPageWithFlags(FPDF_PAGE page, int flags);
+
// Relese the resources obtained from LoadPage(). Further use of |page|
// is prohibited after this call is made.
virtual void UnloadPage(FPDF_PAGE page);