summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfsave_embeddertest.cpp
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 /fpdfsdk/fpdfsave_embeddertest.cpp
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 'fpdfsdk/fpdfsave_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdfsave_embeddertest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/fpdfsdk/fpdfsave_embeddertest.cpp b/fpdfsdk/fpdfsave_embeddertest.cpp
index 3122be1b53..bbf7566b1c 100644
--- a/fpdfsdk/fpdfsave_embeddertest.cpp
+++ b/fpdfsdk/fpdfsave_embeddertest.cpp
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "public/fpdf_save.h"
-
+#include <memory>
#include <string>
#include "core/fxcrt/fx_string.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_ppo.h"
+#include "public/fpdf_save.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
@@ -66,7 +66,7 @@ TEST_F(FPDFSaveEmbedderTest, SaveLinearizedDoc) {
EXPECT_TRUE(OpenDocument("linearized.pdf"));
for (int i = 0; i < kPageCount; ++i) {
FPDF_PAGE page = LoadPage(i);
- FPDF_BITMAP bitmap = RenderPage(page);
+ FPDF_BITMAP bitmap = RenderPageDeprecated(page);
EXPECT_EQ(612, FPDFBitmap_GetWidth(bitmap));
EXPECT_EQ(792, FPDFBitmap_GetHeight(bitmap));
original_md5[i] = HashBitmap(bitmap);
@@ -84,9 +84,9 @@ TEST_F(FPDFSaveEmbedderTest, SaveLinearizedDoc) {
EXPECT_TRUE(OpenSavedDocument());
for (int i = 0; i < kPageCount; ++i) {
FPDF_PAGE page = LoadSavedPage(i);
- FPDF_BITMAP bitmap = RenderSavedPage(page);
- EXPECT_EQ(original_md5[i], HashBitmap(bitmap));
- FPDFBitmap_Destroy(bitmap);
+ ASSERT_TRUE(page);
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderSavedPage(page);
+ EXPECT_EQ(original_md5[i], HashBitmap(bitmap.get()));
CloseSavedPage(page);
}
CloseSavedDocument();