OLD | NEW |
| (Empty) |
1 // Copyright 2015 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "public/fpdf_text.h" | |
6 #include "testing/embedder_test.h" | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 class CPDFParserEmbeddertest : public EmbedderTest {}; | |
10 | |
11 TEST_F(CPDFParserEmbeddertest, LoadError_454695) { | |
12 // Test a dictionary with hex string instead of correct content. | |
13 // Verify that the defective pdf shouldn't be opened correctly. | |
14 EXPECT_FALSE(OpenDocument("bug_454695.pdf")); | |
15 } | |
16 | |
17 TEST_F(CPDFParserEmbeddertest, Bug_481363) { | |
18 // Test colorspace object with malformed dictionary. | |
19 EXPECT_TRUE(OpenDocument("bug_481363.pdf")); | |
20 FPDF_PAGE page = LoadPage(0); | |
21 EXPECT_NE(nullptr, page); | |
22 UnloadPage(page); | |
23 } | |
24 | |
25 TEST_F(CPDFParserEmbeddertest, Bug_544880) { | |
26 // Test self referencing /Pages object. | |
27 EXPECT_TRUE(OpenDocument("bug_544880.pdf")); | |
28 // Shouldn't crash. We don't check the return value here because we get the | |
29 // the count from the "/Count 1" in the testcase (at the time of writing) | |
30 // rather than the actual count (0). | |
31 (void)GetPageCount(); | |
32 } | |
33 | |
34 TEST_F(CPDFParserEmbeddertest, Feature_Linearized_Loading) { | |
35 EXPECT_TRUE(OpenDocument("feature_linearized_loading.pdf", nullptr, true)); | |
36 } | |
37 | |
38 TEST_F(CPDFParserEmbeddertest, Bug_325a) { | |
39 EXPECT_FALSE(OpenDocument("bug_325_a.pdf")); | |
40 } | |
41 | |
42 TEST_F(CPDFParserEmbeddertest, Bug_325b) { | |
43 EXPECT_FALSE(OpenDocument("bug_325_b.pdf")); | |
44 } | |
45 | |
46 TEST_F(CPDFParserEmbeddertest, Bug_602650) { | |
47 // Test the case that cross reference entries, which are well formed, | |
48 // but do not match with the objects. | |
49 EXPECT_TRUE(OpenDocument("bug_602650.pdf")); | |
50 FPDF_PAGE page = LoadPage(0); | |
51 EXPECT_NE(nullptr, page); | |
52 FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); | |
53 EXPECT_NE(nullptr, text_page); | |
54 // The page should not be blank. | |
55 EXPECT_LT(0, FPDFText_CountChars(text_page)); | |
56 | |
57 FPDFText_ClosePage(text_page); | |
58 UnloadPage(page); | |
59 } | |
OLD | NEW |