Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Unified Diff: fpdfsdk/src/fpdftext_embeddertest.cpp

Issue 876393003: Merge to XFA: Add embedder test for stream length beyond end of file. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdftext_embeddertest.cpp
diff --git a/fpdfsdk/src/fpdftext_embeddertest.cpp b/fpdfsdk/src/fpdftext_embeddertest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3198fe0f86b66565887a49844c803c5a6f35f6eb
--- /dev/null
+++ b/fpdfsdk/src/fpdftext_embeddertest.cpp
@@ -0,0 +1,23 @@
+// Copyright 2015 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 "../../testing/embedder_test.h"
+#include "../../fpdfsdk/include/fpdfview.h"
+#include "../../fpdfsdk/include/fpdftext.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class FPDFTextEmbeddertest : public EmbedderTest {
+};
+
+// Test that the page has characters despite a bad stream length.
+TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
+ EXPECT_TRUE(OpenDocument("testing/resources/bug_57.pdf"));
+ FPDF_FORMHANDLE form_handle = SetFormFillEnvironment();
+ FPDF_PAGE page = LoadPage(0, form_handle);
+ EXPECT_NE(nullptr, page);
+ FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
+ EXPECT_NE(nullptr, textpage);
+ EXPECT_EQ(13, FPDFText_CountChars(textpage));
+ ClearFormFillEnvironment(form_handle);
+}
« no previous file with comments | « BUILD.gn ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698