• 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 #include "fold_screen_state_internel.h"
27 
28 using namespace testing;
29 using namespace testing::ext;
30 
31 namespace OHOS {
32 namespace Rosen {
33 namespace {
34 constexpr uint32_t SLEEP_TIME_IN_US = 100000; // 100ms
35 }
36 class ScreenSceneConfigTest : public testing::Test {
37 public:
38     static void SetUpTestCase();
39     static void TearDownTestCase();
40     void SetUp() override;
41     void TearDown() override;
42 };
43 
SetUpTestCase()44 void ScreenSceneConfigTest::SetUpTestCase()
45 {
46 }
47 
TearDownTestCase()48 void ScreenSceneConfigTest::TearDownTestCase()
49 {
50     usleep(SLEEP_TIME_IN_US);
51 }
52 
SetUp()53 void ScreenSceneConfigTest::SetUp()
54 {
55 }
56 
TearDown()57 void ScreenSceneConfigTest::TearDown()
58 {
59 }
60 
61 namespace {
62 /**
63  * @tc.name: IsNumber
64  * @tc.desc: test function : IsNumber
65  * @tc.type: FUNC
66  */
67 HWTEST_F(ScreenSceneConfigTest, IsNumber, TestSize.Level1)
68 {
69     bool result = ScreenSceneConfig::IsNumber("123");
70     ASSERT_EQ(true, result);
71     result = ScreenSceneConfig::IsNumber("a123");
72     ASSERT_EQ(false, result);
73     result = ScreenSceneConfig::IsNumber("");
74     ASSERT_EQ(false, result);
75     result = ScreenSceneConfig::IsNumber("-123");
76     ASSERT_EQ(false, result);
77     result = ScreenSceneConfig::IsNumber("123.456");
78     ASSERT_EQ(false, result);
79 }
80 
81 /**
82  * @tc.name: GetConfigPath1
83  * @tc.desc: test function : GetConfigPath
84  * @tc.type: FUNC
85  */
86 HWTEST_F(ScreenSceneConfigTest, GetConfigPath1, TestSize.Level1)
87 {
88     auto result = ScreenSceneConfig::GetConfigPath("");
89     ASSERT_STRNE("/system/", result.c_str());
90 }
91 
92 /**
93  * @tc.name: GetConfigPath2
94  * @tc.desc: test function : GetConfigPath
95  * @tc.type: FUNC
96  */
97 HWTEST_F(ScreenSceneConfigTest, GetConfigPath2, TestSize.Level1)
98 {
99     auto result = ScreenSceneConfig::GetConfigPath("a.xml");
100     ASSERT_STREQ("/system/a.xml", result.c_str());
101 }
102 
103 /**
104  * @tc.name: LoadConfigXml
105  * @tc.desc: test function : loadConfigXml
106  * @tc.type: FUNC
107  */
108 HWTEST_F(ScreenSceneConfigTest, LoadConfigXml, TestSize.Level1)
109 {
110     auto result = ScreenSceneConfig::LoadConfigXml();
111     ASSERT_EQ(true, result);
112 }
113 
114 /**
115  * @tc.name: IsValidNode1
116  * @tc.desc: test function : IsValidNode
117  * @tc.type: FUNC
118  */
119 HWTEST_F(ScreenSceneConfigTest, IsValidNode1, TestSize.Level1)
120 {
121     xmlNode node;
122     auto result = ScreenSceneConfig::IsValidNode(node);
123     ASSERT_EQ(false, result);
124 }
125 
126 /**
127  * @tc.name: IsValidNode2
128  * @tc.desc: test function : IsValidNode
129  * @tc.type: FUNC
130  */
131 HWTEST_F(ScreenSceneConfigTest, IsValidNode2, TestSize.Level1)
132 {
133     const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
134     xmlNode node;
135     node.name = xmlStringText;
136     node.type = XML_TEXT_NODE;
137     auto result = ScreenSceneConfig::IsValidNode(node);
138     ASSERT_EQ(true, result);
139 }
140 
141 /**
142  * @tc.name: IsValidNode3
143  * @tc.desc: test function : IsValidNode
144  * @tc.type: FUNC
145  */
146 HWTEST_F(ScreenSceneConfigTest, IsValidNode3, TestSize.Level1)
147 {
148     const xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
149     xmlNode node;
150     node.name = xmlStringText;
151     node.type = XML_COMMENT_NODE;
152     auto result = ScreenSceneConfig::IsValidNode(node);
153     ASSERT_EQ(false, result);
154 }
155 
156 /**
157  * @tc.name: ReadIntNumbersConfigInfo
158  * @tc.desc: test function : ReadIntNumbersConfigInfo
159  * @tc.type: FUNC
160  */
161 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo, TestSize.Level1)
162 {
163     ScreenSceneConfig::enableConfig_.clear();
164 
165     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
166     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
167     if (docPtr == nullptr) {
168         return;
169     }
170 
171     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
172     if (rootPtr == nullptr || rootPtr->name == nullptr ||
173         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
174         xmlFreeDoc(docPtr);
175         return;
176     }
177     uint32_t readCount = 0;
178     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
179         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
180             continue;
181         }
182         auto nodeName = curNodePtr->name;
183         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi")) ||
184             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("defaultDeviceRotationOffset")) ||
185             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("cutoutArea")) ||
186             !xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("curvedScreenBoundary"))) {
187             ScreenSceneConfig::ReadIntNumbersConfigInfo(curNodePtr);
188             readCount++;
189             continue;
190         }
191     }
192     ASSERT_GE(ScreenSceneConfig::intNumbersConfig_.size(), readCount);
193     ScreenSceneConfig::DumpConfig();
194     xmlFreeDoc(docPtr);
195 }
196 
197 /**
198  * @tc.name: ReadIntNumbersConfigInfo02
199  * @tc.desc: Test ReadIntNumbersConfigInfo method when node content is nullptr.
200  * @tc.type: FUNC
201  */
202 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo02, TestSize.Level1)
203 {
204     xmlNodePtr currNode = xmlNewNode(nullptr, BAD_CAST "testNode");
205     ASSERT_NE(currNode, nullptr);
206     ScreenSceneConfig::ReadIntNumbersConfigInfo(currNode);
207     xmlFree(currNode);
208 }
209 
210 /**
211  * @tc.name: ReadIntNumbersConfigInfo03
212  * @tc.desc: Test ReadIntNumbersConfigInfo method when node content is empty.
213  * @tc.type: FUNC
214  */
215 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo03, TestSize.Level1)
216 {
217     xmlNodePtr currNode = xmlNewNode(nullptr, BAD_CAST "testNode");
218     ASSERT_NE(currNode, nullptr);
219     xmlNodeSetContent(currNode, BAD_CAST "");
220     ScreenSceneConfig::ReadIntNumbersConfigInfo(currNode);
221     xmlFree(currNode);
222 }
223 
224 /**
225  * @tc.name: ReadIntNumbersConfigInfo04
226  * @tc.desc: Test ReadIntNumbersConfigInfo method when node content contains non-number.
227  * @tc.type: FUNC
228  */
229 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo04, TestSize.Level1)
230 {
231     xmlNodePtr currNode = xmlNewNode(nullptr, BAD_CAST "testNode");
232     ASSERT_NE(currNode, nullptr);
233     xmlNodeSetContent(currNode, BAD_CAST "123 abc");
234     ScreenSceneConfig::ReadIntNumbersConfigInfo(currNode);
235     xmlFree(currNode);
236 }
237 
238 /**
239  * @tc.name: ReadIntNumbersConfigInfo05
240  * @tc.desc: Test ReadIntNumbersConfigInfo method when node content is valid.
241  * @tc.type: FUNC
242  */
243 HWTEST_F(ScreenSceneConfigTest, ReadIntNumbersConfigInfo05, TestSize.Level1)
244 {
245     xmlNodePtr currNode = xmlNewNode(nullptr, BAD_CAST "testNode");
246     ASSERT_NE(currNode, nullptr);
247     xmlNodeSetContent(currNode, BAD_CAST "123 456 789");
248     ScreenSceneConfig::ReadIntNumbersConfigInfo(currNode);
249     xmlFree(currNode);
250 }
251 
252 /**
253  * @tc.name: ReadEnableConfigInfo
254  * @tc.desc: test function : ReadEnableConfigInfo
255  * @tc.type: FUNC
256  */
257 HWTEST_F(ScreenSceneConfigTest, ReadEnableConfigInfo, TestSize.Level1)
258 {
259     ScreenSceneConfig::enableConfig_.clear();
260 
261     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
262     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
263     if (docPtr == nullptr) {
264         return;
265     }
266 
267     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
268     if (rootPtr == nullptr || rootPtr->name == nullptr ||
269         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
270         xmlFreeDoc(docPtr);
271         return;
272     }
273     uint32_t readCount = 0;
274     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
275         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
276             continue;
277         }
278 
279         auto nodeName = curNodePtr->name;
280         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("isWaterfallDisplay"))) {
281             ScreenSceneConfig::ReadEnableConfigInfo(curNodePtr);
282             readCount++;
283             continue;
284         }
285 
286         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi"))) {
287             ScreenSceneConfig::ReadEnableConfigInfo(curNodePtr);
288             readCount++;
289             continue;
290         }
291     }
292 
293     ASSERT_LE(ScreenSceneConfig::enableConfig_.size(), readCount);
294 
295     ScreenSceneConfig::DumpConfig();
296     xmlFreeDoc(docPtr);
297 }
298 
299 /**
300  * @tc.name: ReadStringConfigInfo
301  * @tc.desc: test function : ReadStringConfigInfo
302  * @tc.type: FUNC
303  */
304 HWTEST_F(ScreenSceneConfigTest, ReadStringConfigInfo, TestSize.Level1)
305 {
306     ScreenSceneConfig::enableConfig_.clear();
307 
308     auto configFilePath = ScreenSceneConfig::GetConfigPath("etc/window/resources/display_manager_config.xml");
309     xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
310     if (docPtr == nullptr) {
311         return;
312     }
313 
314     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
315     if (rootPtr == nullptr || rootPtr->name == nullptr ||
316         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
317         xmlFreeDoc(docPtr);
318         return;
319     }
320     uint32_t readCount = 0;
321     for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
322         if (!ScreenSceneConfig::IsValidNode(*curNodePtr)) {
323             continue;
324         }
325 
326         auto nodeName = curNodePtr->name;
327         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("defaultDisplayCutoutPath"))) {
328             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
329             readCount++;
330             continue;
331         }
332         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("subDisplayCutoutPath"))) {
333             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
334             readCount++;
335             continue;
336         }
337         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("dpi"))) {
338             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
339             readCount++;
340             continue;
341         }
342         if (!xmlStrcmp(nodeName, reinterpret_cast<const xmlChar*>("externalScreenDefaultMode"))) {
343             ScreenSceneConfig::ReadStringConfigInfo(curNodePtr);
344             readCount++;
345             continue;
346         }
347     }
348 
349     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
350         ASSERT_GT(ScreenSceneConfig::stringConfig_.size(), readCount);
351     } else {
352         ASSERT_EQ(ScreenSceneConfig::stringConfig_.size(), readCount);
353     }
354     ScreenSceneConfig::DumpConfig();
355     xmlFreeDoc(docPtr);
356 }
357 
358 /**
359  * @tc.name: GetEnableConfig1
360  * @tc.desc: test function : GetEnableConfig
361  * @tc.type: FUNC
362  */
363 HWTEST_F(ScreenSceneConfigTest, GetEnableConfig, TestSize.Level1)
364 {
365     auto result = ScreenSceneConfig::GetEnableConfig();
366     ASSERT_EQ(true, result.size() == 0);
367 }
368 
369 /**
370  * @tc.name: GetIntNumbersConfig
371  * @tc.desc: test function : GetIntNumbersConfig
372  * @tc.type: FUNC
373  */
374 HWTEST_F(ScreenSceneConfigTest, GetIntNumbersConfig, TestSize.Level1)
375 {
376     auto result = ScreenSceneConfig::GetIntNumbersConfig();
377     ASSERT_NE(true, result.size() == 0);
378 }
379 
380 /**
381  * @tc.name: GetStringConfig
382  * @tc.desc: test function : GetStringConfig
383  * @tc.type: FUNC
384  */
385 HWTEST_F(ScreenSceneConfigTest, GetStringConfig, TestSize.Level1)
386 {
387     auto result = ScreenSceneConfig::GetStringConfig();
388     ASSERT_NE(0, result.size());
389 }
390 
391 /**
392  * @tc.name: GetStringListConfig
393  * @tc.desc: test function : GetStringListConfig
394  * @tc.type: FUNC
395  */
396 HWTEST_F(ScreenSceneConfigTest, GetStringListConfig, TestSize.Level1)
397 {
398     auto result = ScreenSceneConfig::GetStringListConfig();
399     ASSERT_EQ(0, result.size());
400 }
401 
402 /**
403  * @tc.name: GetCurvedScreenBoundaryConfig
404  * @tc.desc: test function : GetCurvedScreenBoundaryConfig
405  * @tc.type: FUNC
406  */
407 HWTEST_F(ScreenSceneConfigTest, GetCurvedScreenBoundaryConfig, TestSize.Level1)
408 {
409     auto result = ScreenSceneConfig::GetCurvedScreenBoundaryConfig();
410     if ((ScreenSessionManager::GetInstance().GetCurvedCompressionArea() == 0) &&
411         SceneBoardJudgement::IsSceneBoardEnabled()) {
412         ASSERT_EQ(0, result.size());
413     } else {
414         ASSERT_NE(0, result.size());
415     }
416 }
417 
418 /**
419  * @tc.name: GetCutoutBoundaryRect
420  * @tc.desc: GetCutoutBoundaryRect func
421  * @tc.type: FUNC
422  */
423 HWTEST_F(ScreenSceneConfigTest, GetCutoutBoundaryRect, TestSize.Level1)
424 {
425     uint64_t displayId = -1;
426     auto result = ScreenSceneConfig::GetCutoutBoundaryRect(displayId);
427     ASSERT_FALSE(result.size() > 0);
428 }
429 
430 /**
431  * @tc.name: GetSubCutoutBoundaryRect
432  * @tc.desc: GetSubCutoutBoundaryRect func
433  * @tc.type: FUNC
434  */
435 HWTEST_F(ScreenSceneConfigTest, GetSubCutoutBoundaryRect, TestSize.Level1)
436 {
437     if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
438         return;
439     }
440     auto result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
441     if (ScreenSessionManager::GetInstance().IsFoldable() && !FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
442         ASSERT_TRUE(result.size() > 0);
443     } else {
444         ASSERT_TRUE(result.size() == 0);
445     }
446 }
447 
448 /**
449  * @tc.name: IsWaterfallDisplay
450  * @tc.desc: IsWaterfallDisplay func
451  * @tc.type: FUNC
452  */
453 HWTEST_F(ScreenSceneConfigTest, IsWaterfallDisplay, TestSize.Level1)
454 {
455     auto result = ScreenSceneConfig::IsWaterfallDisplay();
456     if (result) {
457         ASSERT_EQ(true, result);
458     }
459 }
460 
461 /**
462  * @tc.name: GetCurvedCompressionAreaInLandscape
463  * @tc.desc: GetCurvedCompressionAreaInLandscape func
464  * @tc.type: FUNC
465  */
466 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape, TestSize.Level1)
467 {
468     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
469     ASSERT_TRUE(result == 0);
470 }
471 
472 /**
473  * @tc.name: Split01
474  * @tc.desc: Split01 func
475  * @tc.type: FUNC
476  */
477 HWTEST_F(ScreenSceneConfigTest, Split01, TestSize.Level1)
478 {
479     auto result = ScreenSceneConfig::Split("oo", "+9");
480     ASSERT_NE(0, result.size());
481 }
482 
483 /**
484  * @tc.name: Split02
485  * @tc.desc: Test Split function when no pattern is found in the string
486  * @tc.type: FUNC
487  */
488 HWTEST_F(ScreenSceneConfigTest, Split02, TestSize.Level1)
489 {
490     std::string str = "HelloWorld";
491     std::string pattern = "::";
492     std::vector<std::string> result = ScreenSceneConfig::Split(str, pattern);
493     EXPECT_EQ(result.size(), 1);
494     EXPECT_EQ(result[0], str);
495 }
496 
497 /**
498  * @tc.name: Split03
499  * @tc.desc: Test Split function when one pattern is found in the string
500  * @tc.type: FUNC
501  */
502 HWTEST_F(ScreenSceneConfigTest, Split03, TestSize.Level1)
503 {
504     std::string str = "Hello::World";
505     std::string pattern = "::";
506     std::vector<std::string> result = ScreenSceneConfig::Split(str, pattern);
507     EXPECT_EQ(result.size(), 2);
508     EXPECT_EQ(result[0], "Hello");
509     EXPECT_EQ(result[1], "World");
510 }
511 
512 /**
513  * @tc.name: Split04
514  * @tc.desc: Test Split function when multiple patterns are found in the string
515  * @tc.type: FUNC
516  */
517 HWTEST_F(ScreenSceneConfigTest, Split04, TestSize.Level1)
518 {
519     std::string str = "Hello::World::This::Is::A::Test";
520     std::string pattern = "::";
521     std::vector<std::string> result = ScreenSceneConfig::Split(str, pattern);
522     EXPECT_EQ(result.size(), 6);
523     EXPECT_EQ(result[0], "Hello");
524     EXPECT_EQ(result[1], "World");
525     EXPECT_EQ(result[2], "This");
526     EXPECT_EQ(result[3], "Is");
527     EXPECT_EQ(result[4], "A");
528     EXPECT_EQ(result[5], "Test");
529 }
530 
531 /**
532  * @tc.name: Split05
533  * @tc.desc: Test Split function when the string ends with the pattern.
534  * @tc.type: FUNC
535  */
536 HWTEST_F(ScreenSceneConfigTest, Split05, TestSize.Level1)
537 {
538     std::string str = "Hello::World::";
539     std::string pattern = "::";
540     std::vector<std::string> result = ScreenSceneConfig::Split(str, pattern);
541     EXPECT_EQ(result.size(), 3);
542     EXPECT_EQ(result[0], "Hello");
543     EXPECT_EQ(result[1], "World");
544     EXPECT_EQ(result[2], "");
545 }
546 
547 /**
548  * @tc.name: Split06
549  * @tc.desc: Test Split function when the input string is the same as the pattern.
550  * @tc.type: FUNC
551  */
552 HWTEST_F(ScreenSceneConfigTest, Split06, TestSize.Level1)
553 {
554     std::string str = "::";
555     std::string pattern = "::";
556     std::vector<std::string> result = ScreenSceneConfig::Split(str, pattern);
557     EXPECT_EQ(result.size(), 2);
558     EXPECT_EQ(result[0], "");
559     EXPECT_EQ(result[1], "");
560 }
561 
562 /**
563  * @tc.name: GetAllDisplayPhysicalConfig01
564  * @tc.desc: GetAllDisplayPhysicalConfig01 func
565  * @tc.type: FUNC
566  */
567 HWTEST_F(ScreenSceneConfigTest, GetAllDisplayPhysicalConfig01, TestSize.Level1)
568 {
569     ScreenSceneConfig::displayPhysicalResolution_.clear();
570     std::vector<DisplayPhysicalResolution> actual = ScreenSceneConfig::GetAllDisplayPhysicalConfig();
571     EXPECT_TRUE(actual.empty());
572 }
573 
574 /**
575  * @tc.name: CalcCutoutBoundaryRect
576  * @tc.desc: CalcCutoutBoundaryRect func
577  * @tc.type: FUNC
578  */
579 HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect, TestSize.Level1)
580 {
581     DMRect emptyRect = {0, 0, 0, 0};
582     auto result = ScreenSceneConfig::CalcCutoutBoundaryRect("oo");
583     ASSERT_FALSE(result != emptyRect);
584 }
585 
586 /**
587  * @tc.name: CalcCutoutBoundaryRect02
588  * @tc.desc: Test scenario where svg parsing fails and an empty rectangle is expected.
589  * @tc.type: FUNC
590  */
591 HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect02, TestSize.Level1)
592 {
593     std::string invalidSvgPath = "invalid_svg_path";
594     DMRect result = ScreenSceneConfig::CalcCutoutBoundaryRect(invalidSvgPath);
595     EXPECT_EQ(result.posX_, 0);
596     EXPECT_EQ(result.posY_, 0);
597     EXPECT_EQ(result.width_, 0);
598     EXPECT_EQ(result.height_, 0);
599 }
600 
601 /**
602  * @tc.name: CalcCutoutBoundaryRect03
603  * @tc.desc: Test scenario where SkRect is empty and an empty rectangle is expected.
604  * @tc.type: FUNC
605  */
606 HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect03, TestSize.Level1)
607 {
608     std::string emptySvgPath = "M0 0";
609     DMRect result = ScreenSceneConfig::CalcCutoutBoundaryRect(emptySvgPath);
610     EXPECT_EQ(result.posX_, 0);
611     EXPECT_EQ(result.posY_, 0);
612     EXPECT_EQ(result.width_, 0);
613     EXPECT_EQ(result.height_, 0);
614 }
615 
616 /**
617  * @tc.name: CalcCutoutBoundaryRect04
618  * @tc.desc: Test scenario where svg is valid and a valid rectangle is expected.
619  * @tc.type: FUNC
620  */
621 HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect04, TestSize.Level1)
622 {
623     std::string validSvgPath = "M10 10 L20 20";
624     DMRect result = ScreenSceneConfig::CalcCutoutBoundaryRect(validSvgPath);
625     EXPECT_EQ(result.posX_, 10);
626     EXPECT_EQ(result.posY_, 10);
627     EXPECT_EQ(result.width_, 10);
628     EXPECT_EQ(result.height_, 10);
629 }
630 
631 /**
632  * @tc.name: GetFoldDisplayMode
633  * @tc.desc: GetFoldDisplayMode func
634  * @tc.type: FUNC
635 */
636 HWTEST_F(ScreenSceneConfigTest, GetFoldDisplayMode, TestSize.Level1)
637 {
638     DisplayPhysicalResolution physicalSize1{ FoldDisplayMode::MAIN, 100, 200 };
639     ScreenSceneConfig::displayPhysicalResolution_.emplace_back(physicalSize1);
640 
641     DisplayPhysicalResolution physicalSize2{ FoldDisplayMode::FULL, 300, 600 };
642     ScreenSceneConfig::displayPhysicalResolution_.emplace_back(physicalSize2);
643 
644     FoldDisplayMode result = ScreenSceneConfig::GetFoldDisplayMode(200, 100);
645     EXPECT_EQ(FoldDisplayMode::MAIN, result);
646     result = ScreenSceneConfig::GetFoldDisplayMode(100, 200);
647     EXPECT_EQ(FoldDisplayMode::MAIN, result);
648 
649     result = ScreenSceneConfig::GetFoldDisplayMode(300, 600);
650     EXPECT_EQ(FoldDisplayMode::FULL, result);
651     result = ScreenSceneConfig::GetFoldDisplayMode(600, 300);
652     EXPECT_EQ(FoldDisplayMode::FULL, result);
653 
654     ScreenSceneConfig::displayPhysicalResolution_.clear();
655 }
656 
657 /**
658  * @tc.name: SetCutoutSvgPath
659  * @tc.desc: SetCutoutSvgPath func
660  * @tc.type: FUNC
661  */
662 HWTEST_F(ScreenSceneConfigTest, SetCutoutSvgPath, TestSize.Level1)
663 {
664     uint64_t displayId = 0;
665     ScreenSceneConfig::SetCutoutSvgPath(displayId, "");
666     ScreenSceneConfig::SetCutoutSvgPath(displayId, "oo");
667     auto result_ = ScreenSceneConfig::GetCutoutBoundaryRect(displayId);
668     ASSERT_NE(0, result_.size());
669 }
670 
671 /**
672  * @tc.name: SetSubCutoutSvgPath
673  * @tc.desc: SetSubCutoutSvgPath func
674  * @tc.type: FUNC
675  */
676 HWTEST_F(ScreenSceneConfigTest, SetSubCutoutSvgPath, TestSize.Level1)
677 {
678     ScreenSceneConfig::SetSubCutoutSvgPath("");
679     ScreenSceneConfig::SetSubCutoutSvgPath("oo");
680     auto result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
681     ASSERT_NE(0, result.size());
682 }
683 
684 /**
685  * @tc.name: SetSubCutoutSvgPath01
686  * @tc.desc: SetSubCutoutSvgPath func
687  * @tc.type: FUNC
688  */
689 HWTEST_F(ScreenSceneConfigTest, SetSubCutoutSvgPath01, TestSize.Level1)
690 {
691     ScreenSceneConfig::SetSubCutoutSvgPath("M507 18 L573 18 v 66 h -66 Z");
692     std::vector<DMRect> result = ScreenSceneConfig::GetSubCutoutBoundaryRect();
693     if (result.size() <= 0) {
694         ASSERT_EQ(0, result.size());
695     }
696     DMRect targetRect{507, 18, 66, 66}; // the rect size after svg parsing
697     EXPECT_EQ(result[0].posX_, targetRect.posX_);
698     EXPECT_EQ(result[0].posY_, targetRect.posY_);
699     EXPECT_EQ(result[0].width_, targetRect.width_);
700     EXPECT_EQ(result[0].height_, targetRect.height_);
701 }
702 
703 /**
704  * @tc.name: SetCurvedCompressionAreaInLandscape
705  * @tc.desc: SetCurvedCompressionAreaInLandscape func
706  * @tc.type: FUNC
707  */
708 HWTEST_F(ScreenSceneConfigTest, SetCurvedCompressionAreaInLandscape, TestSize.Level1)
709 {
710     int res = 0;
711     ScreenSceneConfig::SetCurvedCompressionAreaInLandscape();
712     ASSERT_EQ(0, res);
713 }
714 
715 /**
716  * @tc.name: IsSupportRotateWithSensor01
717  * @tc.desc: IsSupportRotateWithSensor
718  * @tc.type: FUNC
719  */
720 HWTEST_F(ScreenSceneConfigTest, IsSupportRotateWithSensor01, TestSize.Level1)
721 {
722     ScreenSceneConfig::enableConfig_["supportRotateWithSensor"] = true;
723     bool res = ScreenSceneConfig::IsSupportRotateWithSensor();
724     ASSERT_EQ(true, res);
725 }
726 
727 /**
728  * @tc.name: IsSupportRotateWithSensor01
729  * @tc.desc: IsSupportRotateWithSensor
730  * @tc.type: FUNC
731  */
732 HWTEST_F(ScreenSceneConfigTest, IsSupportRotateWithSensor02, TestSize.Level1)
733 {
734     ScreenSceneConfig::enableConfig_.erase("supportRotateWithSensor");
735     bool res = ScreenSceneConfig::IsSupportRotateWithSensor();
736     ASSERT_EQ(false, res);
737 }
738 
739 /**
740  * @tc.name: GetExternalScreenDefaultMode01
741  * @tc.desc: GetExternalScreenDefaultMode
742  * @tc.type: FUNC
743  */
744 HWTEST_F(ScreenSceneConfigTest, GetExternalScreenDefaultMode01, TestSize.Level1)
745 {
746     ScreenSceneConfig::stringConfig_["externalScreenDefaultMode"] = "mirror";
747     std::string res = ScreenSceneConfig::GetExternalScreenDefaultMode();
748     ASSERT_EQ("mirror", res);
749 }
750 
751 /**
752  * @tc.name: GetExternalScreenDefaultMode02
753  * @tc.desc: GetExternalScreenDefaultMode
754  * @tc.type: FUNC
755  */
756 HWTEST_F(ScreenSceneConfigTest, GetExternalScreenDefaultMode02, TestSize.Level1)
757 {
758     ScreenSceneConfig::stringConfig_.erase("externalScreenDefaultMode");
759     std::string res = ScreenSceneConfig::GetExternalScreenDefaultMode();
760     ASSERT_EQ("", res);
761 }
762 
763 /**
764  * @tc.name: GetCurvedCompressionAreaInLandscape01
765  * @tc.desc: GetCurvedCompressionAreaInLandscape
766  * @tc.type: FUNC
767  */
768 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape01, TestSize.Level1)
769 {
770     ScreenSceneConfig::isWaterfallDisplay_ = false;
771     ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false;
772     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
773     ASSERT_TRUE(result == 0);
774 }
775 
776 /**
777  * @tc.name: GetCurvedCompressionAreaInLandscape02
778  * @tc.desc: GetCurvedCompressionAreaInLandscape
779  * @tc.type: FUNC
780  */
781 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape02, TestSize.Level1)
782 {
783     ScreenSceneConfig::isWaterfallDisplay_ = true;
784     ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false;
785     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
786     ASSERT_TRUE(result == 0);
787 }
788 
789 /**
790  * @tc.name: GetCurvedCompressionAreaInLandscape03
791  * @tc.desc: Test GetCurvedCompressionAreaInLandscape method
792  * @tc.type: FUNC
793  */
794 HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape03, TestSize.Level1)
795 {
796     ScreenSceneConfig::isWaterfallDisplay_ = true;
797     ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = true;
798     auto result = ScreenSceneConfig::GetCurvedCompressionAreaInLandscape();
799     ASSERT_TRUE(result == 0);
800 }
801 
802 /**
803  * @tc.name: ReadStringListConfigInfo01
804  * @tc.desc: ReadStringListConfigInfo
805  * @tc.type: FUNC
806  */
807 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo01, TestSize.Level1)
808 {
809     xmlNodePtr rootNode = nullptr;
810     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, "");
811     EXPECT_EQ(rootNode, nullptr);
812 }
813 
814 /**
815  * @tc.name: ReadStringListConfigInfo02
816  * @tc.desc: ReadStringListConfigInfo
817  * @tc.type: FUNC
818  */
819 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo02, TestSize.Level1)
820 {
821     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
822     ASSERT_NE(rootNode, nullptr);
823     rootNode->name = nullptr;
824     std::string name = "testName";
825     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
826     xmlFreeNode(rootNode);
827 }
828 
829 /**
830  * @tc.name: ReadStringListConfigInfo03
831  * @tc.desc: ReadStringListConfigInfo
832  * @tc.type: FUNC
833  */
834 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo03, TestSize.Level1)
835 {
836     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
837     ASSERT_NE(rootNode, nullptr);
838     std::string name = "testName";
839     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
840     xmlFreeNode(rootNode);
841 }
842 
843 /**
844  * @tc.name: ReadStringListConfigInfo04
845  * @tc.desc: ReadStringListConfigInfo
846  * @tc.type: FUNC
847  */
848 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo04, TestSize.Level1)
849 {
850     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
851     ASSERT_NE(rootNode, nullptr);
852     xmlNodePtr curNode = xmlNewNode(nullptr, BAD_CAST "invalidNode");
853     rootNode->children = curNode;
854     curNode->parent = rootNode;
855     curNode->next = nullptr;
856     std::string name = "testName";
857     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
858     xmlFreeNode(rootNode);
859 }
860 
861 /**
862  * @tc.name: ReadStringListConfigInfo05
863  * @tc.desc: ReadStringListConfigInfo
864  * @tc.type: FUNC
865  */
866 HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo05, TestSize.Level1)
867 {
868     xmlNodePtr rootNode = xmlNewNode(nullptr, BAD_CAST "testNode");
869     ASSERT_NE(rootNode, nullptr);
870     xmlNodePtr curNode = xmlNewNode(nullptr, BAD_CAST "invalidNode");
871     xmlNodeSetContent(curNode, BAD_CAST "validContent");
872     rootNode->children = curNode;
873     curNode->parent = rootNode;
874     curNode->next = nullptr;
875     std::string name = "testName";
876     ScreenSceneConfig::ReadStringListConfigInfo(rootNode, name);
877     xmlFreeNode(rootNode);
878 }
879 
880 /**
881  * @tc.name: ReadPhysicalDisplayConfigInfo01
882  * @tc.desc: ReadPhysicalDisplayConfigInfo
883  * @tc.type: FUNC
884  */
885 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo01, TestSize.Level1)
886 {
887     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*> ("displayMode"));
888     ASSERT_NE(currNode, nullptr);
889     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
890     xmlFreeNode(currNode);
891 }
892 
893 /**
894  * @tc.name: ReadPhysicalDisplayConfigInfo02
895  * @tc.desc: ReadPhysicalDisplayConfigInfo
896  * @tc.type: FUNC
897  */
898 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo02, TestSize.Level1)
899 {
900     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
901     ASSERT_NE(currNode, nullptr);
902     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
903     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>(" "));
904     xmlFreeNode(currNode);
905 }
906 
907 /**
908  * @tc.name: ReadPhysicalDisplayConfigInfo03
909  * @tc.desc: ReadPhysicalDisplayConfigInfo
910  * @tc.type: FUNC
911  */
912 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo03, TestSize.Level1)
913 {
914     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
915     ASSERT_NE(currNode, nullptr);
916     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
917     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("100:200"));
918     xmlFreeNode(currNode);
919 }
920 
921 /**
922  * @tc.name: ReadPhysicalDisplayConfigInfo04
923  * @tc.desc: ReadPhysicalDisplayConfigInfo
924  * @tc.type: FUNC
925  */
926 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo04, TestSize.Level1)
927 {
928     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
929     ASSERT_NE(currNode, nullptr);
930     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
931     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:100:200"));
932     xmlFreeNode(currNode);
933 }
934 
935 /**
936  * @tc.name: ReadPhysicalDisplayConfigInfo05
937  * @tc.desc: ReadPhysicalDisplayConfigInfo
938  * @tc.type: FUNC
939  */
940 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo05, TestSize.Level1)
941 {
942     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
943     ASSERT_NE(currNode, nullptr);
944     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
945     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_MAIN:100:200"));
946     xmlFreeNode(currNode);
947 }
948 
949 /**
950  * @tc.name: ReadPhysicalDisplayConfigInfo06
951  * @tc.desc: ReadPhysicalDisplayConfigInfo
952  * @tc.type: FUNC
953  */
954 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo0, TestSize.Level1)
955 {
956     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
957     ASSERT_NE(currNode, nullptr);
958     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
959     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_SUB:100:200"));
960     xmlFreeNode(currNode);
961 }
962 
963 /**
964  * @tc.name: ReadPhysicalDisplayConfigInfo07
965  * @tc.desc: ReadPhysicalDisplayConfigInfo
966  * @tc.type: FUNC
967  */
968 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo07, TestSize.Level1)
969 {
970     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
971     ASSERT_NE(currNode, nullptr);
972     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
973     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:100:200"));
974     xmlFreeNode(currNode);
975 }
976 
977 /**
978  * @tc.name: ReadPhysicalDisplayConfigInfo08
979  * @tc.desc: ReadPhysicalDisplayConfigInfo
980  * @tc.type: FUNC
981  */
982 HWTEST_F(ScreenSceneConfigTest, ReadPhysicalDisplayConfigInfo08, TestSize.Level1)
983 {
984     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
985     ASSERT_NE(currNode, nullptr);
986     ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(currNode);
987     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:abc:def"));
988     xmlFreeNode(currNode);
989 }
990 
991 /**
992  * @tc.name: ReadScrollableParam01
993  * @tc.desc: ReadScrollableParam
994  * @tc.type: FUNC
995  */
996 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam01, TestSize.Level1)
997 {
998     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
999     ASSERT_NE(currNode, nullptr);
1000     ScreenSceneConfig::ReadScrollableParam(currNode);
1001     xmlFreeNode(currNode);
1002 }
1003 
1004 /**
1005  * @tc.name: ReadScrollableParam02
1006  * @tc.desc: ReadScrollableParam
1007  * @tc.type: FUNC
1008  */
1009 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam02, TestSize.Level1)
1010 {
1011     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1012     ASSERT_NE(currNode, nullptr);
1013     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:1.5:0.5"));
1014     ScreenSceneConfig::ReadScrollableParam(currNode);
1015     xmlFreeNode(currNode);
1016 }
1017 
1018 /**
1019  * @tc.name: ReadScrollableParam03
1020  * @tc.desc: ReadScrollableParam
1021  * @tc.type: FUNC
1022  */
1023 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam03, TestSize.Level1)
1024 {
1025     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1026     ASSERT_NE(currNode, nullptr);
1027     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_MAIN:1.5:0.5"));
1028     ScreenSceneConfig::ReadScrollableParam(currNode);
1029     xmlFreeNode(currNode);
1030 }
1031 
1032 /**
1033  * @tc.name: ReadScrollableParam04
1034  * @tc.desc: ReadScrollableParam
1035  * @tc.type: FUNC
1036  */
1037 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam04, TestSize.Level1)
1038 {
1039     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1040     ASSERT_NE(currNode, nullptr);
1041     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_SUB:1.5:0.5"));
1042     ScreenSceneConfig::ReadScrollableParam(currNode);
1043     xmlFreeNode(currNode);
1044 }
1045 
1046 /**
1047  * @tc.name: ReadScrollableParam05
1048  * @tc.desc: ReadScrollableParam
1049  * @tc.type: FUNC
1050  */
1051 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam05, TestSize.Level1)
1052 {
1053     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1054     ASSERT_NE(currNode, nullptr);
1055     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:1.5:0.5"));
1056     ScreenSceneConfig::ReadScrollableParam(currNode);
1057     xmlFreeNode(currNode);
1058 }
1059 
1060 /**
1061  * @tc.name: ReadScrollableParam06
1062  * @tc.desc: ReadScrollableParam
1063  * @tc.type: FUNC
1064  */
1065 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam06, TestSize.Level1)
1066 {
1067     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1068     ASSERT_NE(currNode, nullptr);
1069         xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL:1.5:"));
1070     ScreenSceneConfig::ReadScrollableParam(currNode);
1071     xmlFreeNode(currNode);
1072 }
1073 
1074 /**
1075  * @tc.name: ReadScrollableParam07
1076  * @tc.desc: ReadScrollableParam
1077  * @tc.type: FUNC
1078  */
1079 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam07, TestSize.Level1)
1080 {
1081     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1082     ASSERT_NE(currNode, nullptr);
1083     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>(" "));
1084     ScreenSceneConfig::ReadScrollableParam(currNode);
1085     xmlFreeNode(currNode);
1086 }
1087 
1088 /**
1089  * @tc.name: ReadScrollableParam08
1090  * @tc.desc: ReadScrollableParam
1091  * @tc.type: FUNC
1092  */
1093 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam08, TestSize.Level1)
1094 {
1095     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1096     ASSERT_NE(currNode, nullptr);
1097     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("UNKNOWN:!!:aa"));
1098     ScreenSceneConfig::ReadScrollableParam(currNode);
1099     xmlFreeNode(currNode);
1100 }
1101 
1102 /**
1103  * @tc.name: ReadScrollableParam09
1104  * @tc.desc: ReadScrollableParam
1105  * @tc.type: FUNC
1106  */
1107 HWTEST_F(ScreenSceneConfigTest, ReadScrollableParam09, TestSize.Level1)
1108 {
1109     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("displayMode"));
1110     ASSERT_NE(currNode, nullptr);
1111     xmlNodeSetContent(currNode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_COORDINATION:1.5:0.5"));
1112     ScreenSceneConfig::ReadScrollableParam(currNode);
1113     xmlFreeNode(currNode);
1114 }
1115 
1116 /**
1117  * @tc.name: ParseNodeConfig01
1118  * @tc.desc: Test if ParseNodeConfig correctly calls ReadEnableConfigInfo when node name matches.
1119  * @tc.type: FUNC
1120  */
1121 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig01, TestSize.Level1)
1122 {
1123     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("IS_WATERFALL_DISPLAY"));
1124     ASSERT_NE(currNode, nullptr);
1125     ScreenSceneConfig::ParseNodeConfig(currNode);
1126     xmlFreeNode(currNode);
1127 }
1128 
1129 /**
1130  * @tc.name: ParseNodeConfig02
1131  * @tc.desc: Test if ParseNodeConfig correctly calls ReadIntNumbersConfigInfo when node name matches.
1132  * @tc.type: FUNC
1133  */
1134 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig02, TestSize.Level1)
1135 {
1136     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("DPI"));
1137     ASSERT_NE(currNode, nullptr);
1138     ScreenSceneConfig::ParseNodeConfig(currNode);
1139     xmlFreeNode(currNode);
1140 }
1141 
1142 /**
1143  * @tc.name: ParseNodeConfig03
1144  * @tc.desc: Test if ParseNodeConfig correctly calls ReadStringConfigInfo when node name matches.
1145  * @tc.type: FUNC
1146  */
1147 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig03, TestSize.Level1)
1148 {
1149     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("DEFAULT_DISPLAY_CUTOUT_PATH"));
1150     ASSERT_NE(currNode, nullptr);
1151     ScreenSceneConfig::ParseNodeConfig(currNode);
1152     xmlFreeNode(currNode);
1153 }
1154 
1155 /**
1156  * @tc.name: ParseNodeConfig04
1157  * @tc.desc: Test if ParseNodeConfig correctly calls ReadStringListConfigInfo when node name matches.
1158  * @tc.type: FUNC
1159  */
1160 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig04, TestSize.Level1)
1161 {
1162     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("HALL_SWITCH_APP"));
1163     ASSERT_NE(currNode, nullptr);
1164     ScreenSceneConfig::ParseNodeConfig(currNode);
1165     xmlFreeNode(currNode);
1166 }
1167 
1168 /**
1169  * @tc.name: ParseNodeConfig05
1170  * @tc.desc: Test if ParseNodeConfig correctly calls ReadPhysicalDisplayConfigInfo when node name matches.
1171  * @tc.type: FUNC
1172  */
1173 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig05, TestSize.Level1)
1174 {
1175     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("PHYSICAL_DISPLAY_RESOLUTION"));
1176     ASSERT_NE(currNode, nullptr);
1177     ScreenSceneConfig::ParseNodeConfig(currNode);
1178     xmlFreeNode(currNode);
1179 }
1180 
1181 /**
1182  * @tc.name: ParseNodeConfig06
1183  * @tc.desc: Test if ParseNodeConfig correctly calls ReadScrollableParam when node name matches.
1184  * @tc.type: FUNC
1185  */
1186 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig06, TestSize.Level1)
1187 {
1188     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("SCROLLABLE_PARAM"));
1189     ASSERT_NE(currNode, nullptr);
1190     ScreenSceneConfig::ParseNodeConfig(currNode);
1191     xmlFreeNode(currNode);
1192 }
1193 
1194 /**
1195  * @tc.name: ParseNodeConfig07
1196  * @tc.desc: Test if ParseNodeConfig logs a warning when node name does not match any known node.
1197  * @tc.type: FUNC
1198  */
1199 HWTEST_F(ScreenSceneConfigTest, ParseNodeConfig07, TestSize.Level1)
1200 {
1201     xmlNodePtr currNode = xmlNewNode(nullptr, reinterpret_cast<const xmlChar*>("UNKNOWN_NODE"));
1202     ASSERT_NE(currNode, nullptr);
1203     ScreenSceneConfig::ParseNodeConfig(currNode);
1204     xmlFreeNode(currNode);
1205 }
1206 
1207 /**
1208  * @tc.name: GetOffScreenPPIThreshold01
1209  * @tc.desc: Test GetOffScreenPPIThreshold when the array is not empty.
1210  * @tc.type: FUNC
1211  */
1212 HWTEST_F(ScreenSceneConfigTest, GetOffScreenPPIThreshold01, TestSize.Level1)
1213 {
1214     uint32_t result = ScreenSceneConfig::GetOffScreenPPIThreshold();
1215     EXPECT_EQ(result, 0);
1216 }
1217 
1218 /**
1219  * @tc.name: GetOffScreenPPIThreshold02
1220  * @tc.desc: Test GetOffScreenPPIThreshold when the array is empty.
1221  * @tc.type: FUNC
1222  */
1223 HWTEST_F(ScreenSceneConfigTest, GetOffScreenPPIThreshold02, TestSize.Level1)
1224 {
1225     ScreenSceneConfig::xmlNodeMap_.clear();
1226     uint32_t result = ScreenSceneConfig::GetOffScreenPPIThreshold();
1227     EXPECT_EQ(result, ScreenSceneConfig::offScreenPPIThreshold_);
1228 }
1229 
1230 /**
1231  * @tc.name: IsSupportOffScreenRendering01
1232  * @tc.desc: IsSupportOffScreenRendering01
1233  * @tc.type: FUNC
1234  */
1235 HWTEST_F(ScreenSceneConfigTest, IsSupportOffScreenRendering01, TestSize.Level1)
1236 {
1237     ScreenSceneConfig::enableConfig_["isSupportOffScreenRendering"] = true;
1238     bool res = ScreenSceneConfig::IsSupportOffScreenRendering();
1239     EXPECT_EQ(true, res);
1240 }
1241 
1242 /**
1243  * @tc.name: IsSupportOffScreenRendering02
1244  * @tc.desc: IsSupportOffScreenRendering02
1245  * @tc.type: FUNC
1246  */
1247 HWTEST_F(ScreenSceneConfigTest, IsSupportOffScreenRendering02, TestSize.Level1)
1248 {
1249     ScreenSceneConfig::enableConfig_.erase("isSupportOffScreenRendering");
1250     bool res = ScreenSceneConfig::IsSupportOffScreenRendering();
1251     EXPECT_EQ(false, res);
1252 }
1253 
1254 /**
1255  * @tc.name: IsSupportDuringCall01
1256  * @tc.desc: IsSupportDuringCall01
1257  * @tc.type: FUNC
1258  */
1259 HWTEST_F(ScreenSceneConfigTest, IsSupportDuringCall01, TestSize.Level1)
1260 {
1261     ScreenSceneConfig::enableConfig_["supportDuringCall"] = true;
1262     bool res = ScreenSceneConfig::IsSupportDuringCall();
1263     EXPECT_TRUE(res);
1264 }
1265 
1266 /**
1267  * @tc.name: IsSupportDuringCall02
1268  * @tc.desc: IsSupportDuringCall02
1269  * @tc.type: FUNC
1270  */
1271 HWTEST_F(ScreenSceneConfigTest, IsSupportDuringCall02, TestSize.Level1)
1272 {
1273     ScreenSceneConfig::enableConfig_.erase("supportDuringCall");
1274     bool res = ScreenSceneConfig::IsSupportDuringCall();
1275     EXPECT_FALSE(res);
1276 }
1277 }
1278 } // namespace Rosen
1279 } // namespace OHOS
1280