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
utf16_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/utf16.h"
6
7
#
include
"testing/gtest/include/gtest/gtest.h"
8
9
namespace
pdfium
{
10
11
static_assert
(
kSurrogateMask
== 0x3ff);
12
static_assert
(
kMaximumSupplementaryCodePoint
== 0x10ffff);
13
static_assert
(
kMaximumHighSurrogateCodeUnit
== 0xdbff);
14
static_assert
(
kMinimumLowSurrogateCodeUnit
== 0xdc00);
15
static_assert
(
kMaximumLowSurrogateCodeUnit
== 0xdfff);
16
17
static_assert
(!
IsSupplementary
(
0xffff
)
);
18
static_assert
(
IsSupplementary
(
0x10000
)
);
19
static_assert
(
IsSupplementary
(
0x10ffff
)
);
20
static_assert
(!
IsSupplementary
(
0x110000
)
);
21
22
static_assert
(!
IsHighSurrogate
(
0xd7ff
)
);
23
static_assert
(
IsHighSurrogate
(
0xd800
)
);
24
static_assert
(
IsHighSurrogate
(
0xdbff
)
);
25
static_assert
(!
IsHighSurrogate
(
0xdc00
)
);
26
27
static_assert
(!
IsLowSurrogate
(
0xdbff
)
);
28
static_assert
(
IsLowSurrogate
(
0xdc00
)
);
29
static_assert
(
IsLowSurrogate
(
0xdfff
)
);
30
static_assert
(!
IsLowSurrogate
(
0xe000
)
);
31
32
static_assert
(SurrogatePair
(
0xd800
,
0xdc00
)
.
high
(
)
== 0xd800);
33
static_assert
(SurrogatePair
(
0xd800
,
0xdc00
)
.
low
(
)
== 0xdc00);
34
static_assert
(SurrogatePair
(
0xd800
,
0xdc00
)
.
ToCodePoint
(
)
== 0x10000);
35
36
static_assert
(SurrogatePair
(
0xdbff
,
0xdfff
)
.
high
(
)
== 0xdbff);
37
static_assert
(SurrogatePair
(
0xdbff
,
0xdfff
)
.
low
(
)
== 0xdfff);
38
static_assert
(SurrogatePair
(
0xdbff
,
0xdfff
)
.
ToCodePoint
(
)
== 0x10ffff);
39
40
static_assert
(SurrogatePair
(
0x10000
)
.
high
(
)
== 0xd800);
41
static_assert
(SurrogatePair
(
0x10000
)
.
low
(
)
== 0xdc00);
42
static_assert
(SurrogatePair
(
0x10000
)
.
ToCodePoint
(
)
== 0x10000);
43
44
static_assert
(SurrogatePair
(
0x10ffff
)
.
high
(
)
== 0xdbff);
45
static_assert
(SurrogatePair
(
0x10ffff
)
.
low
(
)
== 0xdfff);
46
static_assert
(SurrogatePair
(
0x10ffff
)
.
ToCodePoint
(
)
== 0x10ffff);
47
48
TEST
(
SurrogatePairTest
,
RoundTrip
) {
49
for
(
char32_t
code_point =
kMinimumSupplementaryCodePoint
;
50
code_point <=
kMaximumSupplementaryCodePoint
; ++code_point) {
51
SurrogatePair from_code_point
(
code_point
)
;
52
EXPECT_EQ(code_point, from_code_point
.
ToCodePoint
(
)
);
53
54
SurrogatePair from_pair
(
from_code_point
.
high
(
)
,
from_code_point
.
low
(
)
)
;
55
EXPECT_EQ(from_code_point
.
high
(
)
, from_pair
.
high
(
)
);
56
EXPECT_EQ(from_code_point
.
low
(
)
, from_pair
.
low
(
)
);
57
EXPECT_EQ(code_point, from_pair
.
ToCodePoint
(
)
);
58
}
59
}
60
61
}
// namespace pdfium
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
pdfium::SurrogatePair::SurrogatePair
constexpr SurrogatePair(char32_t code_point)
Definition
utf16.h:71
pdfium::SurrogatePair::high
constexpr char16_t high() const
Definition
utf16.h:78
pdfium::SurrogatePair::ToCodePoint
constexpr char32_t ToCodePoint() const
Definition
utf16.h:82
pdfium::SurrogatePair::SurrogatePair
constexpr SurrogatePair(char16_t high, char16_t low)
Definition
utf16.h:64
pdfium::SurrogatePair::low
constexpr char16_t low() const
Definition
utf16.h:79
pdfium::IsSupplementary
constexpr bool IsSupplementary(char32_t code_point)
Definition
utf16.h:43
pdfium::kMaximumSupplementaryCodePoint
constexpr char32_t kMaximumSupplementaryCodePoint
Definition
utf16.h:22
pdfium::kMinimumSupplementaryCodePoint
constexpr char32_t kMinimumSupplementaryCodePoint
Definition
utf16.h:19
pdfium::TEST
TEST(SurrogatePairTest, RoundTrip)
Definition
utf16_unittest.cpp:48
pdfium::IsHighSurrogate
constexpr bool IsHighSurrogate(char32_t code_point)
Definition
utf16.h:49
pdfium::kMaximumHighSurrogateCodeUnit
constexpr char16_t kMaximumHighSurrogateCodeUnit
Definition
utf16.h:30
pdfium::kMaximumLowSurrogateCodeUnit
constexpr char16_t kMaximumLowSurrogateCodeUnit
Definition
utf16.h:38
pdfium::kSurrogateMask
constexpr char16_t kSurrogateMask
Definition
utf16.h:16
pdfium::IsLowSurrogate
constexpr bool IsLowSurrogate(char32_t code_point)
Definition
utf16.h:55
pdfium::kMinimumLowSurrogateCodeUnit
constexpr char16_t kMinimumLowSurrogateCodeUnit
Definition
utf16.h:34
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
utf16_unittest.cpp
Generated on
for Qt by
1.18.0