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
12 const auto* pResult = FGAS_GetUnicodeBitField(0);
13 ASSERT_TRUE(pResult);
14 EXPECT_EQ(0u, pResult->wBitField);
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
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
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}
WideString & operator=(WideString &&that) noexcept
WideString FGAS_FontNameToEnglishName(const WideString &wsLocalName)
const FGAS_FONTUSB * FGAS_GetUnicodeBitField(wchar_t wUnicode)
FX_CodePage
Definition fx_codepage.h:18
@ kMSWin_WesternEuropean
TEST(FXCRYPT, MD5GenerateEmtpyData)
uint16_t wBitField
FX_CodePage wCodePage