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
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
12namespace {
13
14using ::pdfium::CodePointView;
15
16std::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
27 EXPECT_EQ(U"", Materialize(CodePointView(L"")));
28}
29
31 EXPECT_EQ(U"(\u0080\uffff)", Materialize(CodePointView(L"(\u0080\uffff)")));
32}
33
35 EXPECT_EQ(U"(🎨)", Materialize(CodePointView(L"(🎨)")));
36}
37
39 EXPECT_EQ(U"\xd800", Materialize(CodePointView(L"\xd800")));
40}
41
43 EXPECT_EQ(U"\xdc00", Materialize(CodePointView(L"\xdc00")));
44}
45
46#if defined(WCHAR_T_IS_16_BIT)
47TEST(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)
TEST(FXCRYPT, MD5GenerateEmtpyData)