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
widetext_buffer_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2018 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/widetext_buffer.h"
6
7
#
include
<
utility
>
8
9
#
include
"testing/gtest/include/gtest/gtest.h"
10
11
namespace
fxcrt
{
12
13
TEST
(WideTextBuffer,
EmptyBuf
) {
14
WideTextBuffer wtb;
15
EXPECT_TRUE(wtb
.
GetWideSpan
().empty());
16
EXPECT_TRUE(wtb
.
AsStringView
().IsEmpty());
17
EXPECT_TRUE(wtb
.
MakeString
(
)
.
IsEmpty
(
)
);
18
}
19
20
TEST
(WideTextBuffer,
OperatorLtLt
) {
21
WideTextBuffer wtb;
22
wtb <<
"clams"
<< L"\u208c\u208e";
23
EXPECT_EQ(wtb
.
MakeString
(
)
, L"clams\u208c\u208e");
24
}
25
26
TEST
(WideTextBuffer,
Deletion
) {
27
WideTextBuffer wtb;
28
wtb << L"ABCDEFG";
29
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
"ABCDEFG"
));
30
31
wtb.Delete(1, 3);
32
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
"AEFG"
));
33
34
wtb.Delete(1, 0);
35
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
"AEFG"
));
36
37
wtb.Delete(0, 2);
38
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
"FG"
));
39
40
wtb.Delete(0, 2);
41
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
""
));
42
43
wtb.Delete(0, 0);
44
EXPECT_TRUE(wtb
.
AsStringView
().EqualsASCII(
""
));
45
}
46
47
TEST
(WideTextBuffer,
Move
) {
48
WideTextBuffer wtb;
49
wtb <<
"clams"
;
50
EXPECT_EQ(wtb
.
MakeString
(
)
, L"clams");
51
52
WideTextBuffer wtb2(
std
::move(wtb));
53
EXPECT_EQ(wtb
.
MakeString
(
)
, L"");
54
EXPECT_EQ(wtb2
.
MakeString
(
)
, L"clams");
55
56
WideTextBuffer wtb3;
57
wtb3 =
std
::move(wtb2);
58
EXPECT_EQ(wtb2
.
MakeString
(
)
, L"");
59
EXPECT_EQ(wtb3
.
MakeString
(
)
, L"clams");
60
}
61
62
}
// namespace fxcrt
fxcrt::WideString::IsEmpty
bool IsEmpty() const
Definition
widestring.h:118
fxcrt::WideTextBuffer::GetWideSpan
pdfium::span< wchar_t > GetWideSpan()
Definition
widetext_buffer.cpp:18
fxcrt::WideTextBuffer::MakeString
WideString MakeString() const
Definition
widetext_buffer.cpp:32
fxcrt::WideTextBuffer::AsStringView
WideStringView AsStringView() const
Definition
widetext_buffer.cpp:28
fxcrt
Definition
span_util.h:14
fxcrt::TEST
TEST(WideTextBuffer, EmptyBuf)
Definition
widetext_buffer_unittest.cpp:13
std
Definition
qfloat16.h:492
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
widetext_buffer_unittest.cpp
Generated on Sat Sep 21 2024 00:55:47 for Qt by
1.12.0