summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten_embeddertest.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-08 17:30:04 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-08 17:30:04 -0800
commitd0ecd899d632461bd6dc53e32b42bbd3a5d030ad (patch)
treebdd07c8e42596dfa500675e2e2afad2bce3a341c /fpdfsdk/fpdf_flatten_embeddertest.cpp
parent788217d77c9933614efbd778b6f6ee0008f4f9d9 (diff)
downloadpdfium-d0ecd899d632461bd6dc53e32b42bbd3a5d030ad.tar.xz
Fix abort above FPDFPage_Flatten
Main issue: FPDFPage_Flatten trying to re-add an indirect object. BUG=662698 Review-Url: https://codereview.chromium.org/2489653003
Diffstat (limited to 'fpdfsdk/fpdf_flatten_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten_embeddertest.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_flatten_embeddertest.cpp b/fpdfsdk/fpdf_flatten_embeddertest.cpp
new file mode 100644
index 0000000000..d709f59053
--- /dev/null
+++ b/fpdfsdk/fpdf_flatten_embeddertest.cpp
@@ -0,0 +1,40 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/fxcrt/fx_basic.h"
+#include "public/fpdf_flatten.h"
+#include "public/fpdfview.h"
+#include "testing/embedder_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
+
+namespace {
+
+class FPDFFlattenEmbeddertest : public EmbedderTest {};
+
+} // namespace
+
+TEST_F(FPDFFlattenEmbeddertest, FlatNothing) {
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_TRUE(page);
+ EXPECT_EQ(FLATTEN_NOTHINGTODO, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY));
+ UnloadPage(page);
+}
+
+TEST_F(FPDFFlattenEmbeddertest, FlatNormal) {
+ EXPECT_TRUE(OpenDocument("annotiter.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_TRUE(page);
+ EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY));
+ UnloadPage(page);
+}
+
+TEST_F(FPDFFlattenEmbeddertest, FlatPrint) {
+ EXPECT_TRUE(OpenDocument("annotiter.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_TRUE(page);
+ EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_PRINT));
+ UnloadPage(page);
+}