summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index dc61c0d974..3d2e090a36 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -9,6 +9,7 @@
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/page/cpdf_page.h"
+#include "core/fpdfapi/page/cpdf_pageobject.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_number.h"
@@ -655,6 +656,34 @@ TEST_F(FPDFEditEmbeddertest, DISABLED_RemoveExistingPageObject) {
CloseSavedDocument();
}
+// TODO(pdfium:1051): Extend this test to remove some elements and verify
+// saving works.
+TEST_F(FPDFEditEmbeddertest, GetContentStream) {
+ // Load document with some text split across streams.
+ EXPECT_TRUE(OpenDocument("split_streams.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+
+ // Content stream 0: page objects 0-14.
+ // Content stream 1: page objects 15-17.
+ // Content stream 2: page object 18.
+ ASSERT_EQ(19, FPDFPage_CountObjects(page));
+ for (int i = 0; i < 19; i++) {
+ FPDF_PAGEOBJECT page_object = FPDFPage_GetObject(page, i);
+ ASSERT_TRUE(page_object);
+ CPDF_PageObject* cpdf_page_object =
+ CPDFPageObjectFromFPDFPageObject(page_object);
+ if (i < 15)
+ EXPECT_EQ(0, cpdf_page_object->GetContentStream()) << i;
+ else if (i < 18)
+ EXPECT_EQ(1, cpdf_page_object->GetContentStream()) << i;
+ else
+ EXPECT_EQ(2, cpdf_page_object->GetContentStream()) << i;
+ }
+
+ UnloadPage(page);
+}
+
TEST_F(FPDFEditEmbeddertest, InsertPageObjectAndSave) {
// Load document with some text.
EXPECT_TRUE(OpenDocument("hello_world.pdf"));