Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_parser_embeddertest.cpp
Go to the documentation of this file.
1
// Copyright 2015 The PDFium Authors
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
,
LoadErrorBug454695
) {
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
,
Bug481363
) {
18
// Test colorspace object with malformed dictionary.
19
ASSERT_TRUE(OpenDocument(
"bug_481363.pdf"
));
20
FPDF_PAGE page = LoadPage(0);
21
EXPECT_TRUE(page);
22
UnloadPage(page);
23
}
24
25
TEST_F
(
CPDFParserEmbedderTest
,
Bug544880
) {
26
// Test self referencing /Pages object.
27
ASSERT_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
,
Bug325a
) {
35
EXPECT_FALSE(OpenDocument(
"bug_325_a.pdf"
));
36
}
37
38
TEST_F
(
CPDFParserEmbedderTest
,
Bug325b
) {
39
EXPECT_FALSE(OpenDocument(
"bug_325_b.pdf"
));
40
}
41
42
TEST_F
(
CPDFParserEmbedderTest
,
Bug602650
) {
43
// Test the case that cross reference entries, which are well formed,
44
// but do not match with the objects.
45
ASSERT_TRUE(OpenDocument(
"bug_602650.pdf"
));
46
FPDF_PAGE page = LoadPage(0);
47
EXPECT_TRUE(page);
48
FPDF_TEXTPAGE text_page =
FPDFText_LoadPage
(
page
)
;
49
EXPECT_TRUE(text_page);
50
// The page should not be blank.
51
EXPECT_LT(0,
FPDFText_CountChars
(
text_page
)
);
52
53
FPDFText_ClosePage
(
text_page
)
;
54
UnloadPage(page);
55
}
56
57
TEST_F
(
CPDFParserEmbedderTest
,
Bug757705
) {
58
ASSERT_TRUE(OpenDocument(
"bug_757705.pdf"
));
59
}
60
61
TEST_F
(
CPDFParserEmbedderTest
,
LoadMainCrossRefTable
) {
62
ASSERT_TRUE(OpenDocumentLinearized(
"feature_linearized_loading.pdf"
));
63
// To check that main cross ref table is loaded correctly,will be enough to
64
// check that the second page was correctly loaded. Because it is contains
65
// crossrefs for second page.
66
EXPECT_EQ(2, GetPageCount());
67
FPDF_PAGE page = LoadPage(1);
68
EXPECT_TRUE(page);
69
FPDF_TEXTPAGE text_page =
FPDFText_LoadPage
(
page
)
;
70
EXPECT_TRUE(text_page);
71
// The page should not be blank.
72
EXPECT_LT(0,
FPDFText_CountChars
(
text_page
)
);
73
FPDFText_ClosePage
(
text_page
)
;
74
UnloadPage(page);
75
}
76
77
TEST_F
(
CPDFParserEmbedderTest
,
Bug828049
) {
78
ASSERT_TRUE(OpenDocument(
"bug_828049.pdf"
));
79
FPDF_PAGE page = LoadPage(0);
80
EXPECT_TRUE(page);
81
UnloadPage(page);
82
}
83
84
// crbug.com/1191313
85
TEST_F
(
CPDFParserEmbedderTest
,
InvalidDictionaryKeys
) {
86
ASSERT_TRUE(OpenDocument(
"bad_dict_keys.pdf"
));
87
}
CPDFParserEmbedderTest
Definition
cpdf_parser_embeddertest.cpp:9
EmbedderTest
Definition
embedder_test.h:39
TEST_F
TEST_F(CPDFParserEmbedderTest, LoadErrorBug454695)
Definition
cpdf_parser_embeddertest.cpp:11
FPDFText_CountChars
FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page)
Definition
fpdf_text.cpp:59
FPDFText_LoadPage
FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page)
Definition
fpdf_text.cpp:40
FPDFText_ClosePage
FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page)
Definition
fpdf_text.cpp:53
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
parser
cpdf_parser_embeddertest.cpp
Generated on Sat Sep 21 2024 00:53:21 for Qt by
1.12.0