1a3e0fd82Sopenharmony_ci/*
2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License.
5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at
6a3e0fd82Sopenharmony_ci *
7a3e0fd82Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8a3e0fd82Sopenharmony_ci *
9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and
13a3e0fd82Sopenharmony_ci * limitations under the License.
14a3e0fd82Sopenharmony_ci */
15a3e0fd82Sopenharmony_ci
16a3e0fd82Sopenharmony_ci#include <climits>
17a3e0fd82Sopenharmony_ci#include <codecvt>
18a3e0fd82Sopenharmony_ci#include <gtest/gtest.h>
19a3e0fd82Sopenharmony_ci#include <locale>
20a3e0fd82Sopenharmony_ci#include <string>
21a3e0fd82Sopenharmony_ci#include "common/text.h"
22a3e0fd82Sopenharmony_ci#include "common/spannable_string.h"
23a3e0fd82Sopenharmony_ci#if !(defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT)
24a3e0fd82Sopenharmony_ci#include "common/ui_text_language.h"
25a3e0fd82Sopenharmony_ci#endif
26a3e0fd82Sopenharmony_ci#include "gfx_utils/color.h"
27a3e0fd82Sopenharmony_ci#include "gfx_utils/list.h"
28a3e0fd82Sopenharmony_ci#include "gfx_utils/vector.h"
29a3e0fd82Sopenharmony_ci
30a3e0fd82Sopenharmony_ciusing namespace testing::ext;
31a3e0fd82Sopenharmony_cinamespace OHOS {
32a3e0fd82Sopenharmony_ciclass TextTest : public testing::Test {
33a3e0fd82Sopenharmony_cipublic:
34a3e0fd82Sopenharmony_ci    static void SetUpTestCase(void);
35a3e0fd82Sopenharmony_ci    static void TearDownTestCase(void);
36a3e0fd82Sopenharmony_ci    static Text* text_;
37a3e0fd82Sopenharmony_ci};
38a3e0fd82Sopenharmony_ci
39a3e0fd82Sopenharmony_ciText* TextTest::text_ = nullptr;
40a3e0fd82Sopenharmony_ci
41a3e0fd82Sopenharmony_civoid TextTest::SetUpTestCase(void)
42a3e0fd82Sopenharmony_ci{
43a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
44a3e0fd82Sopenharmony_ci        text_ = new Text();
45a3e0fd82Sopenharmony_ci    }
46a3e0fd82Sopenharmony_ci}
47a3e0fd82Sopenharmony_ci
48a3e0fd82Sopenharmony_civoid TextTest::TearDownTestCase(void)
49a3e0fd82Sopenharmony_ci{
50a3e0fd82Sopenharmony_ci    if (text_ != nullptr) {
51a3e0fd82Sopenharmony_ci        delete text_;
52a3e0fd82Sopenharmony_ci        text_ = nullptr;
53a3e0fd82Sopenharmony_ci    }
54a3e0fd82Sopenharmony_ci}
55a3e0fd82Sopenharmony_ci
56a3e0fd82Sopenharmony_ci/**
57a3e0fd82Sopenharmony_ci * @tc.name: TextSetText_001
58a3e0fd82Sopenharmony_ci * @tc.desc: Verify SetText function, equal.
59a3e0fd82Sopenharmony_ci * @tc.type: FUNC
60a3e0fd82Sopenharmony_ci * @tc.require: AR000DSMQ1
61a3e0fd82Sopenharmony_ci */
62a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_001, TestSize.Level0)
63a3e0fd82Sopenharmony_ci{
64a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
65a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
66a3e0fd82Sopenharmony_ci        return;
67a3e0fd82Sopenharmony_ci    }
68a3e0fd82Sopenharmony_ci    const char* text = "unit test text";
69a3e0fd82Sopenharmony_ci    text_->SetText(text);
70a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
71a3e0fd82Sopenharmony_ci}
72a3e0fd82Sopenharmony_ci
73a3e0fd82Sopenharmony_ci/**
74a3e0fd82Sopenharmony_ci * @tc.name: TextSetDirect_001
75a3e0fd82Sopenharmony_ci * @tc.desc: Verify SetDirect function, equal.
76a3e0fd82Sopenharmony_ci * @tc.type: FUNC
77a3e0fd82Sopenharmony_ci * @tc.require: AR000DSMQ1
78a3e0fd82Sopenharmony_ci */
79a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetDirect_001, TestSize.Level0)
80a3e0fd82Sopenharmony_ci{
81a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
82a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
83a3e0fd82Sopenharmony_ci        return;
84a3e0fd82Sopenharmony_ci    }
85a3e0fd82Sopenharmony_ci    UITextLanguageDirect direct = UITextLanguageDirect::TEXT_DIRECT_LTR;
86a3e0fd82Sopenharmony_ci    text_->SetDirect(direct);
87a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetDirect(), direct);
88a3e0fd82Sopenharmony_ci    direct = UITextLanguageDirect::TEXT_DIRECT_RTL;
89a3e0fd82Sopenharmony_ci    text_->SetDirect(direct);
90a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetDirect(), direct);
91a3e0fd82Sopenharmony_ci}
92a3e0fd82Sopenharmony_ci
93a3e0fd82Sopenharmony_ci/**
94a3e0fd82Sopenharmony_ci * @tc.name: TextSetAlign_001
95a3e0fd82Sopenharmony_ci * @tc.desc: Verify SetAlign function, equal.
96a3e0fd82Sopenharmony_ci * @tc.type: FUNC
97a3e0fd82Sopenharmony_ci * @tc.require: AR000DSMQ1
98a3e0fd82Sopenharmony_ci */
99a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetAlign_001, TestSize.Level1)
100a3e0fd82Sopenharmony_ci{
101a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
102a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
103a3e0fd82Sopenharmony_ci        return;
104a3e0fd82Sopenharmony_ci    }
105a3e0fd82Sopenharmony_ci    text_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_TOP);
106a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->IsNeedRefresh(), true);
107a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetHorAlign(), TEXT_ALIGNMENT_LEFT);
108a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetVerAlign(), TEXT_ALIGNMENT_TOP);
109a3e0fd82Sopenharmony_ci}
110a3e0fd82Sopenharmony_ci
111a3e0fd82Sopenharmony_ci/**
112a3e0fd82Sopenharmony_ci * @tc.name: TextSetExpand_001
113a3e0fd82Sopenharmony_ci * @tc.desc: Verify SetExpand function, equal.
114a3e0fd82Sopenharmony_ci * @tc.type: FUNC
115a3e0fd82Sopenharmony_ci * @tc.require: AR000DSMQ1
116a3e0fd82Sopenharmony_ci */
117a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetExpand_001, TestSize.Level1)
118a3e0fd82Sopenharmony_ci{
119a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
120a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
121a3e0fd82Sopenharmony_ci        return;
122a3e0fd82Sopenharmony_ci    }
123a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->IsExpandWidth(), false);
124a3e0fd82Sopenharmony_ci    text_->SetExpandWidth(true);
125a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->IsExpandWidth(), true);
126a3e0fd82Sopenharmony_ci
127a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->IsExpandHeight(), false);
128a3e0fd82Sopenharmony_ci    text_->SetExpandHeight(true);
129a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->IsExpandHeight(), true);
130a3e0fd82Sopenharmony_ci}
131a3e0fd82Sopenharmony_ci
132a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetBackgroundColorSpan_001, TestSize.Level1)
133a3e0fd82Sopenharmony_ci{
134a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
135a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
136a3e0fd82Sopenharmony_ci        return;
137a3e0fd82Sopenharmony_ci    }
138a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetBackgroundColorSpan().Size(), 0);
139a3e0fd82Sopenharmony_ci    text_->SetBackgroundColorSpan(Color::Red(), 0, 2);
140a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetBackgroundColorSpan().Size(), 1);
141a3e0fd82Sopenharmony_ci}
142a3e0fd82Sopenharmony_ci
143a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetForegroundColorSpan_001, TestSize.Level1)
144a3e0fd82Sopenharmony_ci{
145a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
146a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
147a3e0fd82Sopenharmony_ci        return;
148a3e0fd82Sopenharmony_ci    }
149a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetForegroundColorSpan().Size(), 0);
150a3e0fd82Sopenharmony_ci    text_->SetForegroundColorSpan(Color::Blue(), 1, 3);
151a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetForegroundColorSpan().Size(), 1);
152a3e0fd82Sopenharmony_ci}
153a3e0fd82Sopenharmony_ci
154a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetLineBackgroundSpan_001, TestSize.Level1)
155a3e0fd82Sopenharmony_ci{
156a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
157a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
158a3e0fd82Sopenharmony_ci        return;
159a3e0fd82Sopenharmony_ci    }
160a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetLineBackgroundSpan().Size(), 0);
161a3e0fd82Sopenharmony_ci    text_->SetLineBackgroundSpan(Color::Blue(), 1, 3);
162a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetLineBackgroundSpan().Size(), 1);
163a3e0fd82Sopenharmony_ci}
164a3e0fd82Sopenharmony_ci
165a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetAbsoluteSizeSpan_001, TestSize.Level1)
166a3e0fd82Sopenharmony_ci{
167a3e0fd82Sopenharmony_ci    Text* text = new Text();
168a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
169a3e0fd82Sopenharmony_ci#else
170a3e0fd82Sopenharmony_ci    text->SetFontId(16);
171a3e0fd82Sopenharmony_ci#endif
172a3e0fd82Sopenharmony_ci    text->SetAbsoluteSizeSpan(1, 2, 38);
173a3e0fd82Sopenharmony_ci    EXPECT_EQ(text->GetSizeSpan(), 0);
174a3e0fd82Sopenharmony_ci    delete text;
175a3e0fd82Sopenharmony_ci    text = nullptr;
176a3e0fd82Sopenharmony_ci}
177a3e0fd82Sopenharmony_ci
178a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetRelativeSpan_001, TestSize.Level1)
179a3e0fd82Sopenharmony_ci{
180a3e0fd82Sopenharmony_ci    Text* text = new Text();
181a3e0fd82Sopenharmony_ci    text->SetRelativeSizeSpan(1, 2, 1.9f);
182a3e0fd82Sopenharmony_ci    EXPECT_EQ(text->GetSizeSpan(), 0);
183a3e0fd82Sopenharmony_ci    delete text;
184a3e0fd82Sopenharmony_ci    text = nullptr;
185a3e0fd82Sopenharmony_ci}
186a3e0fd82Sopenharmony_ci
187a3e0fd82Sopenharmony_ci#if defined(ENABLE_TEXT_STYLE) && ENABLE_TEXT_STYLE
188a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetStyleSpan_001, TestSize.Level1)
189a3e0fd82Sopenharmony_ci{
190a3e0fd82Sopenharmony_ci    SpannableString spannableString("图形子系统测试正常粗体斜体粗斜体");
191a3e0fd82Sopenharmony_ci    spannableString.SetTextStyle(TEXT_STYLE_ITALIC, 11, 13);
192a3e0fd82Sopenharmony_ci    spannableString.SetTextStyle(TEXT_STYLE_BOLD, 9, 11);
193a3e0fd82Sopenharmony_ci    spannableString.SetTextStyle(TEXT_STYLE_BOLD_ITALIC, 13, 16);
194a3e0fd82Sopenharmony_ci    EXPECT_EQ(spannableString.styleList_.Size(), 3);
195a3e0fd82Sopenharmony_ci}
196a3e0fd82Sopenharmony_ci#endif
197a3e0fd82Sopenharmony_ci
198a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
199a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_002, TestSize.Level0)
200a3e0fd82Sopenharmony_ci{
201a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
202a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
203a3e0fd82Sopenharmony_ci        return;
204a3e0fd82Sopenharmony_ci    }
205a3e0fd82Sopenharmony_ci    const char* text = "abcd";
206a3e0fd82Sopenharmony_ci    text_->SetText(text);
207a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
208a3e0fd82Sopenharmony_ci}
209a3e0fd82Sopenharmony_ci#else
210a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_002, TestSize.Level0)
211a3e0fd82Sopenharmony_ci{
212a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
213a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
214a3e0fd82Sopenharmony_ci        return;
215a3e0fd82Sopenharmony_ci    }
216a3e0fd82Sopenharmony_ci
217a3e0fd82Sopenharmony_ci    const char* text = "\xEF\x80\x80\xEF\x80\x81\xEF\x80\x82";
218a3e0fd82Sopenharmony_ci    text_->SetText(text);
219a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
220a3e0fd82Sopenharmony_ci}
221a3e0fd82Sopenharmony_ci#endif
222a3e0fd82Sopenharmony_ci
223a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
224a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_003, TestSize.Level0)
225a3e0fd82Sopenharmony_ci{
226a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
227a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
228a3e0fd82Sopenharmony_ci        return;
229a3e0fd82Sopenharmony_ci    }
230a3e0fd82Sopenharmony_ci    const char* text = "鸿蒙操作系统";
231a3e0fd82Sopenharmony_ci    text_->SetText(text);
232a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
233a3e0fd82Sopenharmony_ci}
234a3e0fd82Sopenharmony_ci#else
235a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_003, TestSize.Level0)
236a3e0fd82Sopenharmony_ci{
237a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
238a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
239a3e0fd82Sopenharmony_ci        return;
240a3e0fd82Sopenharmony_ci    }
241a3e0fd82Sopenharmony_ci
242a3e0fd82Sopenharmony_ci    const char* text = "轻量图形子系统\xEF\x80\x80\xEF\x80\x81\xEF\x80\x82鸿蒙操作系統";
243a3e0fd82Sopenharmony_ci    text_->SetText(text);
244a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
245a3e0fd82Sopenharmony_ci}
246a3e0fd82Sopenharmony_ci#endif
247a3e0fd82Sopenharmony_ci
248a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
249a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_004, TestSize.Level1)
250a3e0fd82Sopenharmony_ci{
251a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
252a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
253a3e0fd82Sopenharmony_ci        return;
254a3e0fd82Sopenharmony_ci    }
255a3e0fd82Sopenharmony_ci    const char* text = "鸿蒙操作系统abcd";
256a3e0fd82Sopenharmony_ci    text_->SetText(text);
257a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
258a3e0fd82Sopenharmony_ci}
259a3e0fd82Sopenharmony_ci#else
260a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_004, TestSize.Level1)
261a3e0fd82Sopenharmony_ci{
262a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
263a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
264a3e0fd82Sopenharmony_ci        return;
265a3e0fd82Sopenharmony_ci    }
266a3e0fd82Sopenharmony_ci
267a3e0fd82Sopenharmony_ci    const char* text = "鸿蒙操作系統轻量图形子系统TDD测试用例\xEF\x80\x80\xEF\x80\x81\xEF\x80\x82";
268a3e0fd82Sopenharmony_ci    text_->SetText(text);
269a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
270a3e0fd82Sopenharmony_ci}
271a3e0fd82Sopenharmony_ci#endif
272a3e0fd82Sopenharmony_ci
273a3e0fd82Sopenharmony_ci
274a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
275a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_005, TestSize.Level1)
276a3e0fd82Sopenharmony_ci{
277a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
278a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
279a3e0fd82Sopenharmony_ci        return;
280a3e0fd82Sopenharmony_ci    }
281a3e0fd82Sopenharmony_ci    const char* text = "鸿蒙abcd操作系统";
282a3e0fd82Sopenharmony_ci    text_->SetText(text);
283a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
284a3e0fd82Sopenharmony_ci}
285a3e0fd82Sopenharmony_ci#else
286a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_005, TestSize.Level1)
287a3e0fd82Sopenharmony_ci{
288a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
289a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
290a3e0fd82Sopenharmony_ci        return;
291a3e0fd82Sopenharmony_ci    }
292a3e0fd82Sopenharmony_ci
293a3e0fd82Sopenharmony_ci    const char* text = "\xEF\x80\x80鸿蒙操作系統\xEF\x80\x81\xEF\x80\x82轻量图形子系统TDD测试用例";
294a3e0fd82Sopenharmony_ci    text_->SetText(text);
295a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
296a3e0fd82Sopenharmony_ci}
297a3e0fd82Sopenharmony_ci#endif
298a3e0fd82Sopenharmony_ci
299a3e0fd82Sopenharmony_ci#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
300a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_006, TestSize.Level1)
301a3e0fd82Sopenharmony_ci{
302a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
303a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
304a3e0fd82Sopenharmony_ci        return;
305a3e0fd82Sopenharmony_ci    }
306a3e0fd82Sopenharmony_ci    const char* text = "鸿蒙ab轻量图形子系统cd操作系统";
307a3e0fd82Sopenharmony_ci    text_->SetText(text);
308a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
309a3e0fd82Sopenharmony_ci}
310a3e0fd82Sopenharmony_ci#else
311a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextSetText_006, TestSize.Level1)
312a3e0fd82Sopenharmony_ci{
313a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
314a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
315a3e0fd82Sopenharmony_ci        return;
316a3e0fd82Sopenharmony_ci    }
317a3e0fd82Sopenharmony_ci
318a3e0fd82Sopenharmony_ci    const char* text = "轻量图形子系统TDD测试用例\xEF\x80\x80鸿蒙操作系統\xEF\x80\x81测试符号\xEF\x80\x82";
319a3e0fd82Sopenharmony_ci    text_->SetText(text);
320a3e0fd82Sopenharmony_ci    EXPECT_EQ(strcmp(text_->GetText(), text), 0);
321a3e0fd82Sopenharmony_ci}
322a3e0fd82Sopenharmony_ci#endif
323a3e0fd82Sopenharmony_ci
324a3e0fd82Sopenharmony_ci/**
325a3e0fd82Sopenharmony_ci * @tc.name: TextGetShapingFontId_001
326a3e0fd82Sopenharmony_ci * @tc.desc: Verify GetShapingFontId function, equal.
327a3e0fd82Sopenharmony_ci * @tc.type: FUNC
328a3e0fd82Sopenharmony_ci * @tc.require: AR000H8BB3
329a3e0fd82Sopenharmony_ci */
330a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextGetShapingFontId_001, TestSize.Level1)
331a3e0fd82Sopenharmony_ci{
332a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
333a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
334a3e0fd82Sopenharmony_ci        return;
335a3e0fd82Sopenharmony_ci    }
336a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetShapingFontId(), 0);
337a3e0fd82Sopenharmony_ci}
338a3e0fd82Sopenharmony_ci
339a3e0fd82Sopenharmony_ci/**
340a3e0fd82Sopenharmony_ci * @tc.name: TextGetCodePointNum_001
341a3e0fd82Sopenharmony_ci * @tc.desc: Verify GetCodePointNum function, equal.
342a3e0fd82Sopenharmony_ci * @tc.type: FUNC
343a3e0fd82Sopenharmony_ci * @tc.require: AR000H8BB3
344a3e0fd82Sopenharmony_ci */
345a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextGetCodePointNum_001, TestSize.Level1)
346a3e0fd82Sopenharmony_ci{
347a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
348a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
349a3e0fd82Sopenharmony_ci        return;
350a3e0fd82Sopenharmony_ci    }
351a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetCodePointNum(), 0);
352a3e0fd82Sopenharmony_ci}
353a3e0fd82Sopenharmony_ci
354a3e0fd82Sopenharmony_ci/**
355a3e0fd82Sopenharmony_ci * @tc.name: TextGetCodePoints_001
356a3e0fd82Sopenharmony_ci * @tc.desc: Verify GetCodePoints function, equal.
357a3e0fd82Sopenharmony_ci * @tc.type: FUNC
358a3e0fd82Sopenharmony_ci * @tc.require: AR000H8BB3
359a3e0fd82Sopenharmony_ci */
360a3e0fd82Sopenharmony_ciHWTEST_F(TextTest, TextGetCodePoints_001, TestSize.Level1)
361a3e0fd82Sopenharmony_ci{
362a3e0fd82Sopenharmony_ci    if (text_ == nullptr) {
363a3e0fd82Sopenharmony_ci        EXPECT_NE(0, 0);
364a3e0fd82Sopenharmony_ci        return;
365a3e0fd82Sopenharmony_ci    }
366a3e0fd82Sopenharmony_ci    EXPECT_EQ(text_->GetCodePoints(), nullptr);
367a3e0fd82Sopenharmony_ci}
368a3e0fd82Sopenharmony_ci} // namespace OHOS
369