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
fgas_fontutils_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2021 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
"xfa/fgas/font/fgas_fontutils.h"
6
7
#
include
"core/fxcrt/fx_codepage.h"
8
#
include
"core/fxcrt/widestring.h"
9
#
include
"testing/gtest/include/gtest/gtest.h"
10
11
TEST
(
FGAS
,
GetUnicodeBitField
) {
12
const
auto
* pResult =
FGAS_GetUnicodeBitField
(
0
)
;
13
ASSERT_TRUE(pResult);
14
EXPECT_EQ(0u, pResult
->
wBitField
);
15
EXPECT_EQ(
FX_CodePage
::
kMSWin_WesternEuropean
, pResult
->
wCodePage
);
16
17
pResult =
FGAS_GetUnicodeBitField
(
65535
)
;
18
EXPECT_FALSE(pResult);
19
20
// Try arbitrary values.
21
pResult =
FGAS_GetUnicodeBitField
(
1313
)
;
22
ASSERT_TRUE(pResult);
23
EXPECT_EQ(9u, pResult
->
wBitField
);
24
EXPECT_EQ(
FX_CodePage
::
kFailure
, pResult
->
wCodePage
);
25
26
pResult =
FGAS_GetUnicodeBitField
(
14321
)
;
27
ASSERT_TRUE(pResult);
28
EXPECT_EQ(59u, pResult
->
wBitField
);
29
EXPECT_EQ(
FX_CodePage
::
kFailure
, pResult
->
wCodePage
);
30
}
31
32
TEST
(
FGAS
,
FontNameToEnglishName
) {
33
// These aren't found with spaces.
34
WideString result =
FGAS_FontNameToEnglishName
(
L"Myriad Pro"
)
;
35
EXPECT_EQ(L"Myriad Pro", result);
36
37
result
=
FGAS_FontNameToEnglishName
(
L"mYriad pRo"
)
;
38
EXPECT_EQ(L"mYriad pRo", result);
39
40
result
=
FGAS_FontNameToEnglishName
(
L"MyriadPro"
)
;
41
EXPECT_EQ(L"MyriadPro", result);
42
43
result
=
FGAS_FontNameToEnglishName
(
L"mYriadpRo"
)
;
44
EXPECT_EQ(L"MyriadPro", result);
45
}
46
47
TEST
(
FGAS
,
FontInfoByFontName
) {
48
// And yet, these are found despite spaces.
49
const
auto
* result = FGAS_FontInfoByFontName(L"Myriad Pro");
50
EXPECT_TRUE(result);
51
52
result = FGAS_FontInfoByFontName(L"mYriad pRo");
53
EXPECT_TRUE(result);
54
55
result = FGAS_FontInfoByFontName(L"MyriadPro");
56
EXPECT_TRUE(result);
57
58
result = FGAS_FontInfoByFontName(L"mYriadpRo");
59
EXPECT_TRUE(result);
60
}
fxcrt::WideString::operator=
WideString & operator=(WideString &&that) noexcept
Definition
widestring.cpp:505
FGAS_FontNameToEnglishName
WideString FGAS_FontNameToEnglishName(const WideString &wsLocalName)
Definition
fgas_fontutils.cpp:2450
FGAS_GetUnicodeBitField
const FGAS_FONTUSB * FGAS_GetUnicodeBitField(wchar_t wUnicode)
Definition
fgas_fontutils.cpp:2430
FX_CodePage
FX_CodePage
Definition
fx_codepage.h:18
FX_CodePage::kFailure
@ kFailure
FX_CodePage::kMSWin_WesternEuropean
@ kMSWin_WesternEuropean
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:45
FGAS_FONTUSB::wBitField
uint16_t wBitField
Definition
fgas_fontutils.h:20
FGAS_FONTUSB::wCodePage
FX_CodePage wCodePage
Definition
fgas_fontutils.h:21
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fgas
font
fgas_fontutils_unittest.cpp
Generated on Sat Sep 21 2024 01:00:27 for Qt by
1.12.0