summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-07 20:28:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-07 20:28:35 +0000
commita98e36657d0e5a78e216f828b3e712e85250c1a7 (patch)
tree4621be8a3be00efafe28eea4639b87675db80d2b /core
parent2496f8e3f3cb1cbfffd664c9b5d7983dc192887b (diff)
downloadpdfium-a98e36657d0e5a78e216f828b3e712e85250c1a7.tar.xz
Clean up RenderPage methods in EmbedderTest.
Add replacement methods that make themselves clear as to what they are rendering, and return unique_ptrs to help prevent leakage. Mark existing methods deprecated. Change-Id: I9055407e614dfbe765428fb32a7da64df3418d1d Reviewed-on: https://pdfium-review.googlesource.com/25470 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/edit/cpdf_creator_embeddertest.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp9
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp2
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp6
-rw-r--r--core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp6
-rw-r--r--core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp2
-rw-r--r--core/fxcodec/codec/fx_codec_embeddertest.cpp2
-rw-r--r--core/fxge/fx_ge_text_embeddertest.cpp2
8 files changed, 16 insertions, 15 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
index def7d50a97..7d1fb30595 100644
--- a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
+++ b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
@@ -28,7 +28,7 @@ TEST_F(CPDF_CreatorEmbedderTest, SavedDocsAreEqualAfterParse) {
FPDF_PAGE page = FPDF_LoadPage(document(), 0);
ASSERT_TRUE(page);
FPDF_BITMAP new_bitmap =
- RenderPageWithFlags(page, form_handle(), FPDF_ANNOT);
+ RenderPageWithFlagsDeprecated(page, form_handle(), FPDF_ANNOT);
FPDFBitmap_Destroy(new_bitmap);
UnloadPage(page);
}
diff --git a/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp b/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp
index 6a1b87b570..ebc71926a0 100644
--- a/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp
+++ b/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "testing/embedder_test.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,9 +15,8 @@ TEST_F(FPDFPageFuncEmbeddertest, Bug_551460) {
// and trusted. The number of inputs has to be 1.
EXPECT_TRUE(OpenDocument("bug_551460.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
- CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
- FPDFBitmap_Destroy(bitmap);
+ ASSERT_TRUE(page);
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page);
+ CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
UnloadPage(page);
}
diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
index cc29b8954e..6c1a0e9ae5 100644
--- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
@@ -58,7 +58,7 @@ TEST_F(CPDFSecurityHandlerEmbeddertest, PasswordAfterGenerateSave) {
EXPECT_TRUE(FPDFPath_SetFillColor(red_rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- FPDF_BITMAP page_bitmap = RenderPage(page);
+ FPDF_BITMAP page_bitmap = RenderPageDeprecated(page);
CompareBitmap(page_bitmap, 612, 792, md5);
FPDFBitmap_Destroy(page_bitmap);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
index e95a4cc595..20e8cf775c 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
@@ -93,7 +93,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_552046) {
// crash when rendered.
EXPECT_TRUE(OpenDocument("bug_552046.pdf"));
FPDF_PAGE page = LoadPage(0);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
@@ -104,7 +104,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_555784) {
// Should not cause a crash when rendered.
EXPECT_TRUE(OpenDocument("bug_555784.pdf"));
FPDF_PAGE page = LoadPage(0);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
@@ -115,7 +115,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) {
// Should open successfully.
EXPECT_TRUE(OpenDocument("bug_455199.pdf"));
FPDF_PAGE page = LoadPage(0);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
diff --git a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
index 5b7cbc6f05..caf4673b85 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
@@ -13,7 +13,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_554151) {
EXPECT_TRUE(OpenDocument("bug_554151.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 612, 792, "a14d7ee573c1b2456d7bf6b7762823cf");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
@@ -24,7 +24,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_557223) {
EXPECT_TRUE(OpenDocument("bug_557223.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 24, 24, "dc0ea1b743c2edb22c597cadc8537f7b");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
@@ -35,7 +35,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_603518) {
EXPECT_TRUE(OpenDocument("bug_603518.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 749, 749, "b9e75190cdc5edf0069a408744ca07dc");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
diff --git a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp
index ed6da46f2a..f141590f46 100644
--- a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp
+++ b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp
@@ -11,7 +11,7 @@ TEST_F(FPDFRenderPatternEmbeddertest, LoadError_547706) {
// Test shading where object is a dictionary instead of a stream.
EXPECT_TRUE(OpenDocument("bug_547706.pdf"));
FPDF_PAGE page = LoadPage(0);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
diff --git a/core/fxcodec/codec/fx_codec_embeddertest.cpp b/core/fxcodec/codec/fx_codec_embeddertest.cpp
index fd02f973a1..50a15c3dc2 100644
--- a/core/fxcodec/codec/fx_codec_embeddertest.cpp
+++ b/core/fxcodec/codec/fx_codec_embeddertest.cpp
@@ -13,7 +13,7 @@ TEST_F(FXCodecEmbeddertest, Bug_631912) {
EXPECT_TRUE(OpenDocument("bug_631912.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
CompareBitmap(bitmap, 691, 432, "24d75af646f8772c5ee7ced260452ae4");
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
diff --git a/core/fxge/fx_ge_text_embeddertest.cpp b/core/fxge/fx_ge_text_embeddertest.cpp
index 045b6dc869..7aeb3f3e07 100644
--- a/core/fxge/fx_ge_text_embeddertest.cpp
+++ b/core/fxge/fx_ge_text_embeddertest.cpp
@@ -12,7 +12,7 @@ TEST_F(FXGETextEmbedderTest, BadItalic) {
EXPECT_TRUE(OpenDocument("bug_601362.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
}