summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_doc_embeddertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_doc_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_doc_embeddertest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_doc_embeddertest.cpp b/fpdfsdk/fpdf_doc_embeddertest.cpp
index 07b83263be..43af5f26c7 100644
--- a/fpdfsdk/fpdf_doc_embeddertest.cpp
+++ b/fpdfsdk/fpdf_doc_embeddertest.cpp
@@ -3,9 +3,12 @@
// found in the LICENSE file.
#include <memory>
+#include <set>
#include <string>
+#include <vector>
#include "core/fxcrt/fx_string.h"
+#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_doc.h"
#include "public/fpdf_edit.h"
#include "public/fpdfview.h"
@@ -15,6 +18,22 @@
class FPDFDocEmbeddertest : public EmbedderTest {};
+TEST_F(FPDFDocEmbeddertest, MultipleSamePage) {
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
+
+ std::set<FPDF_PAGE> unique_pages;
+ std::vector<ScopedFPDFPage> owned_pages(4);
+ for (auto& ref : owned_pages) {
+ ref.reset(FPDF_LoadPage(document(), 0));
+ unique_pages.insert(ref.get());
+ }
+#ifdef PDF_ENABLE_XFA
+ EXPECT_EQ(1u, unique_pages.size());
+#else // PDF_ENABLE_XFA
+ EXPECT_EQ(4u, unique_pages.size());
+#endif // PDF_ENABLE_XFA
+}
+
TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
EXPECT_TRUE(OpenDocument("named_dests.pdf"));