Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpdf_cidfont_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2019 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
"core/fpdfapi/font/cpdf_cidfont.h"
6
7
#
include
<
utility
>
8
9
#
include
"core/fpdfapi/page/test_with_page_module.h"
10
#
include
"core/fpdfapi/parser/cpdf_array.h"
11
#
include
"core/fpdfapi/parser/cpdf_dictionary.h"
12
#
include
"core/fpdfapi/parser/cpdf_document.h"
13
#
include
"core/fpdfapi/parser/cpdf_name.h"
14
#
include
"core/fpdfapi/parser/cpdf_test_document.h"
15
#
include
"testing/gtest/include/gtest/gtest.h"
16
17
using
CPDF_CIDFontTest
=
TestWithPageModule
;
18
19
TEST_F
(
CPDF_CIDFontTest
,
Bug920636
) {
20
CPDF_TestDocument
doc;
21
auto
font_dict =
pdfium
::MakeRetain<
CPDF_Dictionary
>();
22
font_dict->SetNewFor<CPDF_Name>(
"Encoding"
,
"Identity−H"
);
23
24
{
25
auto
descendant_fonts =
pdfium
::MakeRetain<
CPDF_Array
>();
26
{
27
auto
descendant_font =
pdfium
::MakeRetain<
CPDF_Dictionary
>();
28
descendant_font->SetNewFor<CPDF_Name>(
"BaseFont"
,
"CourierStd"
);
29
descendant_fonts->Append(
std
::move(descendant_font));
30
}
31
font_dict->SetFor(
"DescendantFonts"
,
std
::move(descendant_fonts));
32
}
33
34
auto
font =
pdfium
::MakeRetain<CPDF_CIDFont>(&doc,
std
::move(font_dict));
35
ASSERT_TRUE(font->Load());
36
37
// It would be nice if we can test more values here. However, the glyph
38
// indices are sometimes machine dependent.
39
struct
{
40
uint32_t charcode;
41
int
glyph;
42
}
static
constexpr
kTestCases[] = {
43
{0, 31},
44
{256, 287},
45
{34661, 34692},
46
};
47
48
for
(
const
auto
& test_case : kTestCases) {
49
EXPECT_EQ(test_case.glyph,
50
font->GlyphFromCharCode(test_case.charcode,
nullptr
));
51
}
52
}
CPDF_Array::const_iterator
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition
cpdf_array.h:29
CPDF_Dictionary::DictMap
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
Definition
cpdf_dictionary.h:31
CPDF_TestDocument
Definition
cpdf_test_document.h:13
TestWithPageModule
Definition
test_with_page_module.h:10
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
CPDF_CIDFontTest
TestWithPageModule CPDF_CIDFontTest
Definition
cpdf_cidfont_unittest.cpp:17
TEST_F
TEST_F(CPDF_CIDFontTest, Bug920636)
Definition
cpdf_cidfont_unittest.cpp:19
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
font
cpdf_cidfont_unittest.cpp
Generated on
for Qt by
1.18.0