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
fx_font_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2018 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
<
string
>
6
7
#
include
"core/fxcrt/check.h"
8
#
include
"core/fxge/cfx_folderfontinfo.h"
9
#
include
"core/fxge/cfx_fontmapper.h"
10
#
include
"core/fxge/cfx_gemodule.h"
11
#
include
"core/fxge/fx_font.h"
12
#
include
"testing/gtest/include/gtest/gtest.h"
13
#
include
"testing/utils/path_service.h"
14
15
TEST
(FXFontTest, UnicodeFromAdobeName) {
16
EXPECT_EQ(
static_cast
<
wchar_t
>(0x0000), UnicodeFromAdobeName(
"nonesuch"
));
17
EXPECT_EQ(
static_cast
<
wchar_t
>(0x0000), UnicodeFromAdobeName(
""
));
18
EXPECT_EQ(
static_cast
<
wchar_t
>(0x00b6), UnicodeFromAdobeName(
"paragraph"
));
19
EXPECT_EQ(
static_cast
<
wchar_t
>(0x00d3), UnicodeFromAdobeName(
"Oacute"
));
20
EXPECT_EQ(
static_cast
<
wchar_t
>(0x00fe), UnicodeFromAdobeName(
"thorn"
));
21
EXPECT_EQ(
static_cast
<
wchar_t
>(0x0384), UnicodeFromAdobeName(
"tonos"
));
22
EXPECT_EQ(
static_cast
<
wchar_t
>(0x2022), UnicodeFromAdobeName(
"bullet"
));
23
}
24
25
TEST
(FXFontTest, AdobeNameFromUnicode) {
26
EXPECT_EQ(
""
, AdobeNameFromUnicode(0x0000));
27
EXPECT_EQ(
"divide"
, AdobeNameFromUnicode(0x00f7));
28
EXPECT_EQ(
"Lslash"
, AdobeNameFromUnicode(0x0141));
29
EXPECT_EQ(
"tonos"
, AdobeNameFromUnicode(0x0384));
30
EXPECT_EQ(
"afii57513"
, AdobeNameFromUnicode(0x0691));
31
EXPECT_EQ(
"angkhankhuthai"
, AdobeNameFromUnicode(0x0e5a));
32
EXPECT_EQ(
"Euro"
, AdobeNameFromUnicode(0x20ac));
33
}
34
35
TEST
(
FXFontTest
,
ReadFontNameFromMicrosoftEntries
) {
36
std
::string test_data_dir;
37
PathService
::GetTestDataDir(&test_data_dir);
38
DCHECK
(!test_data_dir.empty());
39
40
CFX_FontMapper
font_mapper
(
nullptr
)
;
41
42
{
43
// |folder_font_info| has to be deallocated before the |font_mapper| or we
44
// run into UnownedPtr class issues with ASAN.
45
CFX_FolderFontInfo
folder_font_info;
46
folder_font_info
.
AddPath
(
47
(test_data_dir +
PATH_SEPARATOR
+
"font_tests"
).c_str()
)
;
48
49
font_mapper.SetSystemFontInfo(
50
CFX_GEModule
::
Get
(
)
->
GetPlatform
(
)
->CreateDefaultSystemFontInfo());
51
ASSERT_TRUE(folder_font_info
.
EnumFontList
(
&font_mapper
)
);
52
}
53
54
ASSERT_EQ(1u, font_mapper.GetFaceSize());
55
ASSERT_EQ(
"Test"
, font_mapper.GetFaceName(0));
56
}
DCHECK
#define DCHECK
Definition
check.h:33
CFX_FolderFontInfo
Definition
cfx_folderfontinfo.h:26
CFX_FolderFontInfo::AddPath
void AddPath(const ByteString &path)
Definition
cfx_folderfontinfo.cpp:140
CFX_FolderFontInfo::EnumFontList
bool EnumFontList(CFX_FontMapper *pMapper) override
Definition
cfx_folderfontinfo.cpp:144
CFX_FontMapper
Definition
cfx_fontmapper.h:31
CFX_FontMapper::CFX_FontMapper
CFX_FontMapper(CFX_FontMgr *mgr)
Definition
cfx_fontmapper.cpp:400
CFX_GEModule
Definition
cfx_gemodule.h:25
CFX_GEModule::GetPlatform
PlatformIface * GetPlatform() const
Definition
cfx_gemodule.h:46
CFX_GEModule::Get
static CFX_GEModule * Get()
Definition
cfx_gemodule.cpp:45
PathService
Definition
path_service.h:17
TEST
TEST(FXCRYPT, CryptToBase16)
Definition
fx_crypt_unittest.cpp:39
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
PATH_SEPARATOR
#define PATH_SEPARATOR
Definition
path_service.h:13
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxge
fx_font_unittest.cpp
Generated on
for Qt by
1.18.0