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
code_point_view_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2023 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/fxcrt/code_point_view.h"
6
7
#
include
<
string
>
8
9
#
include
"build/build_config.h"
10
#
include
"testing/gtest/include/gtest/gtest.h"
11
12
namespace
{
13
14
using
::
pdfium
::CodePointView;
15
16
std
::u32string Materialize(
CodePointView
view) {
17
std
::u32string materialized;
18
for
(
char32_t
code_point : view) {
19
materialized += code_point;
20
}
21
return
materialized;
22
}
23
24
}
// namespace
25
26
TEST
(
CodePointViewTest
,
Empty
) {
27
EXPECT_EQ(U"", Materialize(CodePointView(L"")));
28
}
29
30
TEST
(
CodePointViewTest
,
Basic
) {
31
EXPECT_EQ(U"(\u0080\uffff)", Materialize(CodePointView(L"(\u0080\uffff)")));
32
}
33
34
TEST
(
CodePointViewTest
,
Supplementary
) {
35
EXPECT_EQ(U"(🎨)", Materialize(CodePointView(L"(🎨)")));
36
}
37
38
TEST
(
CodePointViewTest
,
UnpairedHighSurrogate
) {
39
EXPECT_EQ(U"\xd800", Materialize(CodePointView(L"\xd800")));
40
}
41
42
TEST
(
CodePointViewTest
,
UnpairedLowSurrogate
) {
43
EXPECT_EQ(U"\xdc00", Materialize(CodePointView(L"\xdc00")));
44
}
45
46
#
if
defined
(
WCHAR_T_IS_16_BIT
)
47
TEST(CodePointViewTest, SurrogateErrorRecovery) {
48
EXPECT_EQ(U"(\xd800)", Materialize(CodePointView(L"(\xd800)"))) <<
"High"
;
49
EXPECT_EQ(U"(\xdc00)", Materialize(CodePointView(L"(\xdc00)"))) <<
"Low"
;
50
EXPECT_EQ(U"(\xd800🎨)", Materialize(CodePointView(L"(\xd800\xd83c\xdfa8)")))
51
<<
"High-high"
;
52
EXPECT_EQ(U"(🎨\xdc00)", Materialize(CodePointView(L"(\xd83c\xdfa8\xdc00)")))
53
<<
"Low-low"
;
54
}
55
#
endif
// defined(WCHAR_T_IS_16_BIT)
fxcrt::StringViewTemplate
Definition
string_view_template.h:38
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
code_point_view_unittest.cpp
Generated on
for Qt by
1.18.0