• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include <libxml/globals.h>
19 #include <libxml/xmlstring.h>
20 
21 #include "window_manager_hilog.h"
22 #include "xml_config_base.h"
23 #include "screen_scene_config.h"
24 #include "screen_session_manager.h"
25 #include "scene_board_judgement.h"
26 
27 using namespace testing;
28 using namespace testing::ext;
29 
30 namespace OHOS {
31 namespace Rosen {
32 namespace {
33     constexpr uint32_t SLEEP_TIME_IN_US = 100000; // 100ms
34 }
35 class ScreenSceneConfigTest : public testing::Test {
36 public:
37     static void SetUpTestCase();
38     static void TearDownTestCase();
39     void SetUp() override;
40     void TearDown() override;
41 };
42 
SetUpTestCase()43 void ScreenSceneConfigTest::SetUpTestCase()
44 {
45 }
46 
TearDownTestCase()47 void ScreenSceneConfigTest::TearDownTestCase()
48 {
49     usleep(SLEEP_TIME_IN_US);
50 }
51 
SetUp()52 void ScreenSceneConfigTest::SetUp()
53 {
54 }
55 
TearDown()56 void ScreenSceneConfigTest::TearDown()
57 {
58 }
59 
60 namespace {
61 /**
62  * @tc.name: IsNumber
63  * @tc.desc: test function : IsNumber
64  * @tc.type: FUNC
65  */
66 HWTEST_F(ScreenSceneConfigTest, IsNumber, Function | SmallTest | Level1)
67 {
68     bool result = ScreenSceneConfig::IsNumber("123");
69     ASSERT_EQ(true, result);
70     result = ScreenSceneConfig::IsNumber("a123");
71     ASSERT_EQ(false, result);
72     result = ScreenSceneConfig::IsNumber("");
73     ASSERT_EQ(false, result);
74     result = ScreenSceneConfig::IsNumber("-123");
75     ASSERT_EQ(false, result);
76     result = ScreenSceneConfig::IsNumber("123.456");
77     ASSERT_EQ(false, result);
78 }
79 
80 /**
81  * @tc.name: GetConfigPath1
82  * @tc.desc: test function : GetConfigPath
83  * @tc.type: FUNC
84  */
85 HWTEST_F(ScreenSceneConfigTest, GetConfigPath1, Function | SmallTest | Level1)
86 {
87     auto result = ScreenSceneConfig::GetConfigPath("");
88     ASSERT_STRNE("/system/", result.c_str());
89 }
90 
91 /**
92  * @tc.name: GetConfigPath2
93  * @tc.desc: test function : GetConfigPath
94  * @tc.type: FUNC
95  */
96 HWTEST_F(ScreenSceneConfigTest, GetConfigPath2, Function | SmallTest | Level1)
97 {
98     auto result = ScreenSceneConfig::GetConfigPath("a.xml");
99     ASSERT_STREQ("/system/a.xml", result.c_str());
100 }
101 
102 /**
103  * @tc.name: LoadConfigXml
104  * @tc.desc: test function : loadConfigXml
105  * @tc.type: FUNC
106  */
107 HWTEST_F(ScreenSceneConfigTest, LoadConfigXml, Function | SmallTest | Level1)
108 {
109     auto result = ScreenSceneConfig::LoadConfigXml();
110     ASSERT_EQ(true, result);
111 }
112 
113 /**
114  * @tc.name: IsValidNode1
115  * @tc.desc: test function : IsValidNode
116  * @tc.type: FUNC
117  */
118 HWTEST_F(ScreenSceneConfigTest, IsValidNode1, Function | SmallTest | Level1)
119 {
120     xmlNode node;
121     auto result = ScreenSceneConfig::IsValidNode(node);
122     ASSERT_EQ(false, result);
123 }
124 
125 /**
126  * @tc.name: IsValidNode2
127  * @tc.desc: test function : IsValidNode
128  * @tc.type: FUNC
129  */
130 HWTEST_F(ScreenSceneConfigTest, IsValidNode2, Function | SmallTest | Level1)
131 {
132     const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
133     xmlNode node;
134     node.name = xmlStringText;
135     node.type = XML_TEXT_NODE;
136     auto result = ScreenSceneConfig::IsValidNode(node);
137     ASSERT_EQ(true, result);
138 }
139 
140 /**
141  * @tc.name: IsValidNode3
142  * @tc.desc: test function : IsValidNode
143  * @tc.type: FUNC
144  */
145 HWTEST_F(ScreenSceneConfigTest, IsValidNode3, Function | SmallTest | Level1)
146 {
147     const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
148     xmlNode node;
149     node.name = xmlStringText;
150     node.type = XML_COMMENT_NODE;
151     auto result = ScreenSceneConfig::IsValidNode(node);
152     ASSERT_EQ(false, result);
153 }
154 
155 /**
156  * @tc.name: ReadIntNumbersConfigInfo
157  * @tc.desc: test function : ReadIntNumbersConfigInfo
158  * @tc.type: FUNC
159  */
160 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo, Function | SmallTest | Level1)
161 {
162     ScreenSceneConfig::enableConfig_.clear();
163 
164     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
165     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
166     if (docPtr == nullptr) {
167         return;
168     }
169 
170     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
171     if (rootPtr == nullptr || rootPtr->name == nullptr ||
172         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
173         xmlFreeDoc(docPtr);
174         return;
175     }
176     uint32_t readCount = 0;
177     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
178         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
179             continue;
180         }
181         auto nodeName = curNodePtr->name;
182         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi")) ||
183             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("defaultDeviceRotationOffset")) ||
184             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("cutoutArea")) ||
185             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("curvedScreenBoundary"))) {
186             ScreenSceneConfig::ReadIntNumbersConfigInfo(curNodePtr);
187             readCount++;
188             continue;
189         }
190     }
191     ASSERT_GE(ScreenSceneConfig::intNumbersConfig_.size(), readCount);
192     ScreenSceneConfig::DumpConfig();
193     xmlFreeDoc(docPtr);
194 }
195 
196 
197 /**
198  * @tc.name: ReadEnableConfigInfo
199  * @tc.desc: test function : ReadEnableConfigInfo
200  * @tc.type: FUNC
201  */
202 HWTEST_F(ScreenSceneConfigTest, ReadEnableConfigInfo, Function | SmallTest | Level1)
203 {
204     ScreenSceneConfig::enableConfig_.clear();
205 
206     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
207     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
208     if (docPtr == nullptr) {
209         return;
210     }
211 
212     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
213     if (rootPtr == nullptr || rootPtr->name == nullptr ||
214         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
215         xmlFreeDoc(docPtr);
216         return;
217     }
218     uint32_t readCount = 0;
219     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
220         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
221             continue;
222         }
223 
224         auto nodeName = curNodePtr->name;
225         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("isWaterfallDisplay"))) {
226             ScreenSceneConfig::ReadEnableConfigInfo(curNodePtr);
227             readCount++;
228             continue;
229         }
230 
231         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi"))) {
232             ScreenSceneConfig::ReadEnableConfigInfo(curNodePtr);
233             readCount++;
234             continue;
235         }
236     }
237 
238     ASSERT_LE(ScreenSceneConfig::enableConfig_.size(), readCount);
239 
240     ScreenSceneConfig::DumpConfig();
241     xmlFreeDoc(docPtr);
242 }
243 
244 /**
245  * @tc.name: ReadStringConfigInfo
246  * @tc.desc: test function : ReadStringConfigInfo
247  * @tc.type: FUNC
248  */
249 HWTEST_F(ScreenSceneConfigTest, ReadStringConfigInfo, Function | SmallTest | Level1)
250 {
251     ScreenSceneConfig::enableConfig_.clear();
252 
253     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
254     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
255     if (docPtr == nullptr) {
256         return;
257     }
258 
259     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
260     if (rootPtr == nullptr || rootPtr->name == nullptr ||
261         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
262         xmlFreeDoc(docPtr);
263         return;
264     }
265     uint32_t readCount = 0;
266     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
267         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
268             continue;
269         }
270 
271         auto nodeName = curNodePtr->name;
272         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("defaultDisplayCutoutPath"))) {
273             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
274             readCount++;
275             continue;
276         }
277         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("subDisplayCutoutPath"))) {
278             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
279             readCount++;
280             continue;
281         }
282         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi"))) {
283             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
284             readCount++;
285             continue;
286         }
287         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("externalScreenDefaultMode"))) {
288             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
289             readCount++;
290             continue;
291         }
292     }
293 
294     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
295         ASSERT_GT(ScreenSceneConfig::stringConfig_.size(), readCount);
296     } else {
297         ASSERT_EQ(ScreenSceneConfig::stringConfig_.size(), readCount);
298     }
299     ScreenSceneConfig::DumpConfig();
300     xmlFreeDoc(docPtr);
301 }
302 
303 /**
304  * @tc.name: GetEnableConfig1
305  * @tc.desc: test function : GetEnableConfig
306  * @tc.type: FUNC
307  */
308 HWTEST_F(ScreenSceneConfigTest, GetEnableConfig, Function | SmallTest | Level1)
309 {
310     auto result = ScreenSceneConfig::GetEnableConfig();
311     ASSERT_EQ(true, result.size() == 0);
312 }
313 
314 /**
315  * @tc.name: GetIntNumbersConfig
316  * @tc.desc: test function : GetIntNumbersConfig
317  * @tc.type: FUNC
318  */
319 HWTEST_F(ScreenSceneConfigTest, GetIntNumbersConfig, Function | SmallTest | Level1)
320 {
321     auto result = ScreenSceneConfig::GetIntNumbersConfig();
322     ASSERT_NE(true, result.size() == 0);
323 }
324 
325 /**
326  * @tc.name: GetStringConfig
327  * @tc.desc: test function : GetStringConfig
328  * @tc.type: FUNC
329  */
330 HWTEST_F(ScreenSceneConfigTest, GetStringConfig, Function | SmallTest | Level1)
331 {
332     auto result = ScreenSceneConfig::GetStringConfig();
333     ASSERT_NE(0, result.size());
334 }
335 
336 /**
337  * @tc.name: GetStringListConfig
338  * @tc.desc: test function : GetStringListConfig
339  * @tc.type: FUNC
340  */
341 HWTEST_F(ScreenSceneConfigTest, GetStringListConfig, Function | SmallTest | Level1)
342 {
343     auto result = ScreenSceneConfig::GetStringListConfig();
344     ASSERT_EQ(0, result.size());
345 }
346 
347 /**
348  * @tc.name: GetCurvedScreenBoundaryConfig
349  * @tc.desc: test function : GetCurvedScreenBoundaryConfig
350  * @tc.type: FUNC
351  */
352 HWTEST_F(ScreenSceneConfigTest, GetCurvedScreenBoundaryConfig, Function | SmallTest | Level1)
353 {
354     auto result = ScreenSceneConfig::GetCurvedScreenBoundaryConfig();
355     if ((ScreenSessionManager::GetInstance().GetCurvedCompressionArea() == 0) &&
356         SceneBoardJudgement::IsSceneBoardEnabled()) {
357         ASSERT_EQ(0, result.size());
358     } else {
359         ASSERT_NE(0, result.size());
360     }
361 }
362 
363 /**
364  * @tc.name: GetCutoutBoundaryRect
365  * @tc.desc: GetCutoutBoundaryRect func
366  * @tc.type: FUNC
367  */
368 HWTEST_F(ScreenSceneConfigTest, GetCutoutBoundaryRect, Function | SmallTest | Level3)
369 {
370     uint64_t displayId = -1;
371     auto result = ScreenSceneConfig::GetCutoutBoundaryRect(displayId);
372     ASSERT_FALSE(result.size() > 0);
373 }
374 
375 /**
376  * @tc.name: GetSubCutoutBoundaryRect
377  * @tc.desc: GetSubCutoutBoundaryRect func
378  * @tc.type: FUNC
379  */
380 HWTEST_F(ScreenSceneConfigTest, GetSubCutoutBoundaryRect, Function | SmallTest | Level3)
381 {
382     auto result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
383     if (ScreenSessionManager::GetInstance().IsFoldable()) {
384         ASSERT_TRUE(result.size() > 0);
385     } else {
386         ASSERT_TRUE(result.size() == 0);
387     }
388 }
389 
390 /**
391  * @tc.name: IsWaterfallDisplay
392  * @tc.desc: IsWaterfallDisplay func
393  * @tc.type: FUNC
394  */
395 HWTEST_F(ScreenSceneConfigTest, IsWaterfallDisplay, Function | SmallTest | Level3)
396 {
397     auto result = ScreenSceneConfig::IsWaterfallDisplay();
398     if (result) {
399         ASSERT_EQ(true, result);
400     }
401 }
402 
403 /**
404  * @tc.name: GetCurvedCompressionAreaInLandscape
405  * @tc.desc: GetCurvedCompressionAreaInLandscape func
406  * @tc.type: FUNC
407  */
408 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape, Function | SmallTest | Level3)
409 {
410     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
411     ASSERT_TRUE(result == 0);
412 }
413 
414 /**
415  * @tc.name: Split
416  * @tc.desc: Split func
417  * @tc.type: FUNC
418  */
419 HWTEST_F(ScreenSceneConfigTest, Split, Function | SmallTest | Level3)
420 {
421     auto result = ScreenSceneConfig::Split("oo", "+9");
422     ASSERT_NE(0, result.size());
423 }
424 
425 /**
426  * @tc.name: CalcCutoutBoundaryRect
427  * @tc.desc: CalcCutoutBoundaryRect func
428  * @tc.type: FUNC
429  */
430 HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect, Function | SmallTest | Level3)
431 {
432     DMRect emptyRect = {0, 0, 0, 0};
433     auto result = ScreenSceneConfig::CalcCutoutBoundaryRect("oo");
434     ASSERT_FALSE(result != emptyRect);
435 }
436 
437 /**
438  * @tc.name: SetCutoutSvgPath
439  * @tc.desc: SetCutoutSvgPath func
440  * @tc.type: FUNC
441  */
442 HWTEST_F(ScreenSceneConfigTest, SetCutoutSvgPath, Function | SmallTest | Level3)
443 {
444     uint64_t displayId = 0;
445     ScreenSceneConfig::SetCutoutSvgPath(displayId, "oo");
446     auto result = ScreenSceneConfig::GetCutoutBoundaryRect(displayId);
447     ASSERT_NE(0, result.size());
448 }
449 
450 /**
451  * @tc.name: SetSubCutoutSvgPath
452  * @tc.desc: SetSubCutoutSvgPath func
453  * @tc.type: FUNC
454  */
455 HWTEST_F(ScreenSceneConfigTest, SetSubCutoutSvgPath, Function | SmallTest | Level3)
456 {
457     ScreenSceneConfig::SetSubCutoutSvgPath("oo");
458     auto result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
459     ASSERT_NE(0, result.size());
460 }
461 
462 /**
463  * @tc.name: SetSubCutoutSvgPath01
464  * @tc.desc: SetSubCutoutSvgPath func
465  * @tc.type: FUNC
466  */
467 HWTEST_F(ScreenSceneConfigTest, SetSubCutoutSvgPath01, Function | SmallTest | Level3)
468 {
469     ScreenSceneConfig::SetSubCutoutSvgPath("M507 18 L573 18 v 66 h -66 Z");
470     std::vector<DMRect> result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
471     if (result.size() <= 0) {
472         ASSERT_EQ(0, result.size());
473     }
474     DMRect targetRect{507, 18, 66, 66}; // the rect size after svg parsing
475     EXPECT_EQ(result[0].posX_, targetRect.posX_);
476     EXPECT_EQ(result[0].posY_, targetRect.posY_);
477     EXPECT_EQ(result[0].width_, targetRect.width_);
478     EXPECT_EQ(result[0].height_, targetRect.height_);
479 }
480 
481 /**
482  * @tc.name: SetCurvedCompressionAreaInLandscape
483  * @tc.desc: SetCurvedCompressionAreaInLandscape func
484  * @tc.type: FUNC
485  */
486 HWTEST_F(ScreenSceneConfigTest, SetCurvedCompressionAreaInLandscape, Function | SmallTest | Level3)
487 {
488     int res = 0;
489     ScreenSceneConfig::SetCurvedCompressionAreaInLandscape();
490     ASSERT_EQ(0, res);
491 }
492 
493 /**
494  * @tc.name: IsSupportRotateWithSensor01
495  * @tc.desc: IsSupportRotateWithSensor
496  * @tc.type: FUNC
497  */
498 HWTEST_F(ScreenSceneConfigTest, IsSupportRotateWithSensor01, Function | SmallTest | Level3)
499 {
500     ScreenSceneConfig::enableConfig_["supportRotateWithSensor"] = true;
501     bool res = ScreenSceneConfig::IsSupportRotateWithSensor();
502     ASSERT_EQ(true, res);
503 }
504 
505 /**
506  * @tc.name: IsSupportRotateWithSensor01
507  * @tc.desc: IsSupportRotateWithSensor
508  * @tc.type: FUNC
509  */
510 HWTEST_F(ScreenSceneConfigTest, IsSupportRotateWithSensor02, Function | SmallTest | Level3)
511 {
512     ScreenSceneConfig::enableConfig_.erase("supportRotateWithSensor");
513     bool res = ScreenSceneConfig::IsSupportRotateWithSensor();
514     ASSERT_EQ(false, res);
515 }
516 
517 /**
518  * @tc.name: GetExternalScreenDefaultMode01
519  * @tc.desc: GetExternalScreenDefaultMode
520  * @tc.type: FUNC
521  */
522 HWTEST_F(ScreenSceneConfigTest, GetExternalScreenDefaultMode01, Function | SmallTest | Level3)
523 {
524     ScreenSceneConfig::stringConfig_["externalScreenDefaultMode"] = "mirror";
525     std::string res = ScreenSceneConfig::GetExternalScreenDefaultMode();
526     ASSERT_EQ("mirror", res);
527 }
528 
529 /**
530  * @tc.name: GetExternalScreenDefaultMode02
531  * @tc.desc: GetExternalScreenDefaultMode
532  * @tc.type: FUNC
533  */
534 HWTEST_F(ScreenSceneConfigTest, GetExternalScreenDefaultMode02, Function | SmallTest | Level3)
535 {
536     ScreenSceneConfig::stringConfig_.erase("externalScreenDefaultMode");
537     std::string res = ScreenSceneConfig::GetExternalScreenDefaultMode();
538     ASSERT_EQ("", res);
539 }
540 
541 /**
542  * @tc.name: GetCurvedCompressionAreaInLandscape01
543  * @tc.desc: GetCurvedCompressionAreaInLandscape
544  * @tc.type: FUNC
545  */
546 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape01, Function | SmallTest | Level3)
547 {
548     ScreenSceneConfig::isWaterfallDisplay_ = false;
549     ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false;
550     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
551     ASSERT_TRUE(result == 0);
552 }
553 
554 /**
555  * @tc.name: GetCurvedCompressionAreaInLandscape02
556  * @tc.desc: GetCurvedCompressionAreaInLandscape
557  * @tc.type: FUNC
558  */
559 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape02, Function | SmallTest | Level3)
560 {
561     ScreenSceneConfig::isWaterfallDisplay_ = true;
562     ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false;
563     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
564     ASSERT_TRUE(result == 0);
565 }
566 
567 /**
568  * @tc.name: ReadStringListConfigInfo01
569  * @tc.desc: ReadStringListConfigInfo
570  * @tc.type: FUNC
571  */
572 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo01, Function | SmallTest | Level3)
573 {
574     xmlNodePtr rootNode = nullptr;
575     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, "");
576     EXPECT_EQ(rootNode, nullptr);
577 }
578 
579 /**
580  * @tc.name: ReadStringListConfigInfo02
581  * @tc.desc: ReadStringListConfigInfo
582  * @tc.type: FUNC
583  */
584 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo02, Function | SmallTest | Level3)
585 {
586     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
587     ASSERT_NE(rootNode, nullptr);
588     rootNode->name = nullptr;
589     std::string name = "testName";
590     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
591     xmlFreeNode(rootNode);
592 }
593 
594 /**
595  * @tc.name: ReadStringListConfigInfo03
596  * @tc.desc: ReadStringListConfigInfo
597  * @tc.type: FUNC
598  */
599 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo03, Function | SmallTest | Level3)
600 {
601     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
602     ASSERT_NE(rootNode, nullptr);
603     std::string name = "testName";
604     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
605     xmlFreeNode(rootNode);
606 }
607 
608 /**
609  * @tc.name: ReadStringListConfigInfo04
610  * @tc.desc: ReadStringListConfigInfo
611  * @tc.type: FUNC
612  */
613 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo04, Function | SmallTest | Level3)
614 {
615     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
616     ASSERT_NE(rootNode, nullptr);
617     xmlNodePtr curNode = xmlNewNode(nullptr, BAD_CAST "invalidNode");
618     rootNode->children = curNode;
619     std::string name = "testName";
620     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
621     xmlFreeNode(rootNode);
622 }
623 
624 /**
625  * @tc.name: ReadStringListConfigInfo05
626  * @tc.desc: ReadStringListConfigInfo
627  * @tc.type: FUNC
628  */
629 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo05, Function | SmallTest | Level3)
630 {
631     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
632     ASSERT_NE(rootNode, nullptr);
633     xmlNodePtr curNode = xmlNewNode(nullptr, BAD_CAST "invalidNode");
634     xmlNodeSetContent(curNode, BAD_CAST "validContent");
635     rootNode->children = curNode;
636     std::string name = "testName";
637     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
638     xmlFreeNode(rootNode);
639 }
640 
641 /**
642  * @tc.name: ReadPhysicalDisplayConfigInfo01
643  * @tc.desc: ReadPhysicalDisplayConfigInfo
644  * @tc.type: FUNC
645  */
646 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo01, Function | SmallTest | Level3)
647 {
648     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*> ("displayMode"));
649     ASSERT_NE(currNode, nullptr);
650     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
651     xmlFreeNode(currNode);
652 }
653 
654 /**
655  * @tc.name: ReadPhysicalDisplayConfigInfo02
656  * @tc.desc: ReadPhysicalDisplayConfigInfo
657  * @tc.type: FUNC
658  */
659 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo02, Function | SmallTest | Level3)
660 {
661     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
662     ASSERT_NE(currNode, nullptr);
663     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
664     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>(" "));
665     xmlFreeNode(currNode);
666 }
667 
668 /**
669  * @tc.name: ReadPhysicalDisplayConfigInfo03
670  * @tc.desc: ReadPhysicalDisplayConfigInfo
671  * @tc.type: FUNC
672  */
673 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo03, Function | SmallTest | Level3)
674 {
675     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
676     ASSERT_NE(currNode, nullptr);
677     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
678     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("100:200"));
679     xmlFreeNode(currNode);
680 }
681 
682 /**
683  * @tc.name: ReadPhysicalDisplayConfigInfo04
684  * @tc.desc: ReadPhysicalDisplayConfigInfo
685  * @tc.type: FUNC
686  */
687 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo04, Function | SmallTest | Level3)
688 {
689     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
690     ASSERT_NE(currNode, nullptr);
691     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
692     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:100:200"));
693     xmlFreeNode(currNode);
694 }
695 
696 /**
697  * @tc.name: ReadPhysicalDisplayConfigInfo05
698  * @tc.desc: ReadPhysicalDisplayConfigInfo
699  * @tc.type: FUNC
700  */
701 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo05, Function | SmallTest | Level3)
702 {
703     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
704     ASSERT_NE(currNode, nullptr);
705     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
706     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_MAIN:100:200"));
707     xmlFreeNode(currNode);
708 }
709 
710 /**
711  * @tc.name: ReadPhysicalDisplayConfigInfo06
712  * @tc.desc: ReadPhysicalDisplayConfigInfo
713  * @tc.type: FUNC
714  */
715 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo0, Function | SmallTest | Level3)
716 {
717     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
718     ASSERT_NE(currNode, nullptr);
719     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
720     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_SUB:100:200"));
721     xmlFreeNode(currNode);
722 }
723 
724 /**
725  * @tc.name: ReadPhysicalDisplayConfigInfo07
726  * @tc.desc: ReadPhysicalDisplayConfigInfo
727  * @tc.type: FUNC
728  */
729 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo07, Function | SmallTest | Level3)
730 {
731     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
732     ASSERT_NE(currNode, nullptr);
733     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
734     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:100:200"));
735     xmlFreeNode(currNode);
736 }
737 
738 /**
739  * @tc.name: ReadPhysicalDisplayConfigInfo08
740  * @tc.desc: ReadPhysicalDisplayConfigInfo
741  * @tc.type: FUNC
742  */
743 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo08, Function | SmallTest | Level3)
744 {
745     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
746     ASSERT_NE(currNode, nullptr);
747     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
748     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:abc:def"));
749     xmlFreeNode(currNode);
750 }
751 
752 /**
753  * @tc.name: ReadScrollableParam01
754  * @tc.desc: ReadScrollableParam
755  * @tc.type: FUNC
756  */
757 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam01, Function | SmallTest | Level3)
758 {
759     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
760     ASSERT_NE(currNode, nullptr);
761     ScreenSceneConfig::ReadScrollableParam(currNode);
762     xmlFreeNode(currNode);
763 }
764 
765 /**
766  * @tc.name: ReadScrollableParam02
767  * @tc.desc: ReadScrollableParam
768  * @tc.type: FUNC
769  */
770 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam02, Function | SmallTest | Level3)
771 {
772     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
773     ASSERT_NE(currNode, nullptr);
774     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:1.5:0.5"));
775     ScreenSceneConfig::ReadScrollableParam(currNode);
776     xmlFreeNode(currNode);
777 }
778 
779 /**
780  * @tc.name: ReadScrollableParam03
781  * @tc.desc: ReadScrollableParam
782  * @tc.type: FUNC
783  */
784 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam03, Function | SmallTest | Level3)
785 {
786     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
787     ASSERT_NE(currNode, nullptr);
788     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_MAIN:1.5:0.5"));
789     ScreenSceneConfig::ReadScrollableParam(currNode);
790     xmlFreeNode(currNode);
791 }
792 
793 /**
794  * @tc.name: ReadScrollableParam04
795  * @tc.desc: ReadScrollableParam
796  * @tc.type: FUNC
797  */
798 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam04, Function | SmallTest | Level3)
799 {
800     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
801     ASSERT_NE(currNode, nullptr);
802     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_SUB:1.5:0.5"));
803     ScreenSceneConfig::ReadScrollableParam(currNode);
804     xmlFreeNode(currNode);
805 }
806 
807 /**
808  * @tc.name: ReadScrollableParam05
809  * @tc.desc: ReadScrollableParam
810  * @tc.type: FUNC
811  */
812 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam05, Function | SmallTest | Level3)
813 {
814     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
815     ASSERT_NE(currNode, nullptr);
816     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:1.5:0.5"));
817     ScreenSceneConfig::ReadScrollableParam(currNode);
818     xmlFreeNode(currNode);
819 }
820 
821 /**
822  * @tc.name: ReadScrollableParam06
823  * @tc.desc: ReadScrollableParam
824  * @tc.type: FUNC
825  */
826 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam06, Function | SmallTest | Level3)
827 {
828     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
829     ASSERT_NE(currNode, nullptr);
830         xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:1.5:"));
831     ScreenSceneConfig::ReadScrollableParam(currNode);
832     xmlFreeNode(currNode);
833 }
834 
835 /**
836  * @tc.name: ReadScrollableParam07
837  * @tc.desc: ReadScrollableParam
838  * @tc.type: FUNC
839  */
840 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam07, Function | SmallTest | Level3)
841 {
842     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
843     ASSERT_NE(currNode, nullptr);
844     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>(" "));
845     ScreenSceneConfig::ReadScrollableParam(currNode);
846     xmlFreeNode(currNode);
847 }
848 
849 /**
850  * @tc.name: ReadScrollableParam08
851  * @tc.desc: ReadScrollableParam
852  * @tc.type: FUNC
853  */
854 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam08, Function | SmallTest | Level3)
855 {
856     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
857     ASSERT_NE(currNode, nullptr);
858     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:!!:aa"));
859     ScreenSceneConfig::ReadScrollableParam(currNode);
860     xmlFreeNode(currNode);
861 }
862 
863 /**
864  * @tc.name: ReadScrollableParam09
865  * @tc.desc: ReadScrollableParam
866  * @tc.type: FUNC
867  */
868 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam09, Function | SmallTest | Level3)
869 {
870     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
871     ASSERT_NE(currNode, nullptr);
872     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_COORDINATION:1.5:0.5"));
873     ScreenSceneConfig::ReadScrollableParam(currNode);
874     xmlFreeNode(currNode);
875 }
876 }
877 } // namespace Rosen
878 } // namespace OHOS
879