• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 "screen_session_dumper.h"
19 #include "screen_session_manager.h"
20 #include "fold_screen_state_internel.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace Rosen {
27 namespace {
28 constexpr uint32_t SLEEP_TIME_US = 100000;
29 #ifdef FOLD_ABILITY_ENABLE
30 constexpr uint32_t SIZE_TWO = 2;
31 constexpr uint32_t SIZE_THREE = 3;
32 constexpr float POSTURE_FIRST = 93;
33 constexpr float POSTURE_SECOND = 180;
34 constexpr float POSTURE_THIRD = 0;
35 constexpr uint16_t HALL_TEST = 1;
36 const std::string TEST_SECONDARY_SRNSOR_POSTURE = "posture:93,180,0";
37 const std::string TEST_SECONDARY_SRNSOR_HALL = "hall:1,1";
38 #endif
39 }
40 class ScreenSessionDumperTest : public testing::Test {
41 public:
42     static void SetUpTestCase();
43     static void TearDownTestCase();
44     void SetUp() override;
45     void TearDown() override;
46 };
47 
SetUpTestCase()48 void ScreenSessionDumperTest::SetUpTestCase()
49 {
50 }
51 
TearDownTestCase()52 void ScreenSessionDumperTest::TearDownTestCase()
53 {
54     usleep(SLEEP_TIME_US);
55 }
56 
SetUp()57 void ScreenSessionDumperTest::SetUp()
58 {
59 }
60 
TearDown()61 void ScreenSessionDumperTest::TearDown()
62 {
63     usleep(SLEEP_TIME_US);
64 }
65 
66 namespace {
67 /**
68  * @tc.name: Dump01
69  * @tc.desc: Dump
70  * @tc.type: FUNC
71  */
72 HWTEST_F(ScreenSessionDumperTest, Dump01, TestSize.Level1)
73 {
74     int fd = 1;
75     std::vector<std::u16string> args;
76     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
77     ASSERT_NE(nullptr, dumper);
78 }
79 
80 /**
81  * @tc.name: Dump02
82  * @tc.desc: Dump input for -h
83  * @tc.type: FUNC
84  */
85 HWTEST_F(ScreenSessionDumperTest, Dump02, TestSize.Level1)
86 {
87     int fd = 1;
88     std::vector<std::u16string> args = {u"-h"};
89     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
90     dumper->ExecuteDumpCmd();
91     ASSERT_TRUE(true);
92 }
93 
94 /**
95  * @tc.name: Dump03
96  * @tc.desc: Dump input for -a
97  * @tc.type: FUNC
98  */
99 HWTEST_F(ScreenSessionDumperTest, Dump03, TestSize.Level1)
100 {
101     int fd = 1;
102     std::vector<std::u16string> args = {u"-a"};
103     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
104     dumper->ExecuteDumpCmd();
105     ASSERT_TRUE(true);
106 }
107 
108 /**
109  * @tc.name: Dump04
110  * @tc.desc: Dump input for abnormal
111  * @tc.type: FUNC
112  */
113 HWTEST_F(ScreenSessionDumperTest, Dump04, TestSize.Level1)
114 {
115     int fd = 1;
116     std::vector<std::u16string> args = {u"-abnormal"};
117     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
118     dumper->ExecuteDumpCmd();
119     ASSERT_TRUE(true);
120 }
121 
122 /**
123  * @tc.name: Dump05
124  * @tc.desc: Dump fd less 0
125  * @tc.type: FUNC
126  */
127 HWTEST_F(ScreenSessionDumperTest, Dump05, TestSize.Level1)
128 {
129     int fd = -1;
130     std::vector<std::u16string> args = {u"-h"};
131     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
132     dumper->ExecuteDumpCmd();
133     ASSERT_TRUE(true);
134 }
135 
136 /**
137  * @tc.name: OutputDumpInfo
138  * @tc.desc: test function : OutputDumpInfo
139  * @tc.type: FUNC
140  */
141 HWTEST_F(ScreenSessionDumperTest, OutputDumpInfo, TestSize.Level1)
142 {
143     int fd = -1;
144     std::vector<std::u16string> args = {u"-h"};
145     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
146     dumper->OutputDumpInfo();
147     ASSERT_EQ(dumper->fd_, -1);
148 }
149 
150 /**
151  * @tc.name: ExecuteDumpCmd
152  * @tc.desc: test function : ExecuteDumpCmd
153  * @tc.type: FUNC
154  */
155 HWTEST_F(ScreenSessionDumperTest, ExecuteDumpCmd, TestSize.Level1)
156 {
157     int fd = 1;
158     std::vector<std::u16string> args;
159     sptr<ScreenSessionDumper> dumper1 = new ScreenSessionDumper(fd, args);
160     dumper1->ExecuteDumpCmd();
161     ASSERT_EQ(dumper1->fd_, 1);
162 
163     fd = 1;
164     args = {u"-h"};
165     sptr<ScreenSessionDumper> dumper2 = new ScreenSessionDumper(fd, args);
166     dumper2->ExecuteDumpCmd();
167     ASSERT_EQ(dumper2->fd_, 1);
168 
169     fd = 1;
170     args = {u"-a"};
171     sptr<ScreenSessionDumper> dumper3 = new ScreenSessionDumper(fd, args);
172     dumper3->ExecuteDumpCmd();
173     ASSERT_EQ(dumper3->fd_, 1);
174 
175     fd = 1;
176     args = {u"-f"};
177     sptr<ScreenSessionDumper> dumper4 = new ScreenSessionDumper(fd, args);
178     dumper4->ExecuteDumpCmd();
179     ASSERT_EQ(dumper4->fd_, 1);
180 
181     fd = 1;
182     args = {u"-z"};
183     sptr<ScreenSessionDumper> dumper5 = new ScreenSessionDumper(fd, args);
184     dumper5->ExecuteDumpCmd();
185     ASSERT_EQ(dumper5->fd_, 1);
186 
187     fd = 1;
188     args = {u"-y"};
189     sptr<ScreenSessionDumper> dumper6 = new ScreenSessionDumper(fd, args);
190     dumper6->ExecuteDumpCmd();
191     ASSERT_EQ(dumper6->fd_, 1);
192 
193     fd = 1;
194     args = {u"-p"};
195     sptr<ScreenSessionDumper> dumper7 = new ScreenSessionDumper(fd, args);
196     dumper7->ExecuteDumpCmd();
197     ASSERT_EQ(dumper7->fd_, 1);
198 
199     fd = 1;
200     args = {u"-g"};
201     sptr<ScreenSessionDumper> dumper8 = new ScreenSessionDumper(fd, args);
202     dumper8->ExecuteDumpCmd();
203     ASSERT_EQ(dumper8->fd_, 1);
204 }
205 
206 /**
207  * @tc.name: DumpEventTracker
208  * @tc.desc: test function : DumpEventTracker
209  * @tc.type: FUNC
210  */
211 HWTEST_F(ScreenSessionDumperTest, DumpEventTracker, TestSize.Level1)
212 {
213     int fd = 1;
214     std::vector<std::u16string> args = {u"-h"};
215     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
216     EventTracker tracker;
217     dumper->DumpEventTracker(tracker);
218     ASSERT_EQ(dumper->fd_, 1);
219 }
220 
221 /**
222  * @tc.name: DumpFreezedPidList
223  * @tc.desc: test function : DumpFreezedPidList
224  * @tc.type: FUNC
225  */
226 HWTEST_F(ScreenSessionDumperTest, DumpFreezedPidList, TestSize.Level1)
227 {
228     int fd = 1;
229     std::vector<std::u16string> args = {u"-h"};
230     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
231     std::set<int32_t> pidList = {1, 2, 3};
232     dumper->DumpFreezedPidList(pidList);
233     ASSERT_EQ(dumper->fd_, 1);
234 }
235 
236 /**
237  * @tc.name: ShowHelpInfo
238  * @tc.desc: test function : ShowHelpInfo
239  * @tc.type: FUNC
240  */
241 HWTEST_F(ScreenSessionDumperTest, ShowHelpInfo, TestSize.Level1)
242 {
243     int fd = 1;
244     std::vector<std::u16string> args = {u"-h"};
245     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
246     dumper->ShowHelpInfo();
247     ASSERT_EQ(dumper->fd_, 1);
248 }
249 
250 /**
251  * @tc.name: ShowAllScreenInfo
252  * @tc.desc: test function : ShowAllScreenInfo
253  * @tc.type: FUNC
254  */
255 HWTEST_F(ScreenSessionDumperTest, ShowAllScreenInfo, TestSize.Level1)
256 {
257     int fd = 1;
258     std::vector<std::u16string> args = {u"-h"};
259     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
260     dumper->ShowAllScreenInfo();
261     ASSERT_EQ(dumper->fd_, 1);
262 }
263 
264 /**
265  * @tc.name: DumpFoldStatus
266  * @tc.desc: test function : DumpFoldStatus
267  * @tc.type: FUNC
268  */
269 HWTEST_F(ScreenSessionDumperTest, DumpFoldStatus, TestSize.Level1)
270 {
271     int fd = 1;
272     std::vector<std::u16string> args = {u"-h"};
273     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
274     dumper->DumpFoldStatus();
275     ASSERT_EQ(dumper->fd_, 1);
276 }
277 
278 /**
279  * @tc.name: DumpScreenSessionById
280  * @tc.desc: test function : DumpScreenSessionById
281  * @tc.type: FUNC
282  */
283 HWTEST_F(ScreenSessionDumperTest, DumpScreenSessionById, TestSize.Level1)
284 {
285     int fd = 1;
286     std::vector<std::u16string> args = {u"-h"};
287     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
288     ScreenId id = 0;
289     dumper->DumpScreenSessionById(id);
290     ASSERT_EQ(dumper->fd_, 1);
291 
292     id = 5;
293     dumper->DumpScreenSessionById(id);
294     ASSERT_EQ(dumper->fd_, 1);
295 }
296 
297 /**
298  * @tc.name: DumpRsInfoById
299  * @tc.desc: test function : DumpRsInfoById
300  * @tc.type: FUNC
301  */
302 HWTEST_F(ScreenSessionDumperTest, DumpRsInfoById, TestSize.Level1)
303 {
304     int fd = 1;
305     std::vector<std::u16string> args = {u"-h"};
306     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
307     ScreenId id = 0;
308     dumper->DumpRsInfoById(id);
309     ASSERT_EQ(dumper->fd_, 1);
310 
311     id = 5;
312     dumper->DumpRsInfoById(id);
313     ASSERT_EQ(dumper->fd_, 1);
314 }
315 
316 /**
317  * @tc.name: DumpCutoutInfoById
318  * @tc.desc: test function : DumpCutoutInfoById
319  * @tc.type: FUNC
320  */
321 HWTEST_F(ScreenSessionDumperTest, DumpCutoutInfoById, TestSize.Level1)
322 {
323     int fd = 1;
324     std::vector<std::u16string> args = {u"-h"};
325     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
326     ScreenId id = 0;
327     dumper->DumpCutoutInfoById(id);
328     ASSERT_EQ(dumper->fd_, 1);
329 
330     id = 5;
331     dumper->DumpCutoutInfoById(id);
332     ASSERT_EQ(dumper->fd_, 1);
333 }
334 
335 /**
336  * @tc.name: DumpScreenInfoById
337  * @tc.desc: test function : DumpScreenInfoById
338  * @tc.type: FUNC
339  */
340 HWTEST_F(ScreenSessionDumperTest, DumpScreenInfoById, TestSize.Level1)
341 {
342     int fd = 1;
343     std::vector<std::u16string> args = {u"-h"};
344     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
345     ScreenId id = 0;
346     dumper->DumpScreenInfoById(id);
347     ASSERT_EQ(dumper->fd_, 1);
348 
349     id = 5;
350     dumper->DumpScreenInfoById(id);
351     ASSERT_EQ(dumper->fd_, 1);
352 }
353 
354 /**
355  * @tc.name: DumpScreenPropertyById
356  * @tc.desc: test function : DumpScreenPropertyById
357  * @tc.type: FUNC
358  */
359 HWTEST_F(ScreenSessionDumperTest, DumpScreenPropertyById, TestSize.Level1)
360 {
361     int fd = 1;
362     std::vector<std::u16string> args = {u"-h"};
363     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
364     ScreenId id = 0;
365     dumper->DumpScreenPropertyById(id);
366     ASSERT_EQ(dumper->fd_, 1);
367 
368     id = 5;
369     dumper->DumpScreenPropertyById(id);
370     ASSERT_EQ(dumper->fd_, 1);
371 }
372 
373 /**
374  * @tc.name: ShowNotifyFoldStatusChangedInfo
375  * @tc.desc: test function : ShowNotifyFoldStatusChangedInfo
376  * @tc.type: FUNC
377  */
378 HWTEST_F(ScreenSessionDumperTest, ShowNotifyFoldStatusChangedInfo, TestSize.Level1)
379 {
380     int fd = 1;
381     std::vector<std::u16string> args = {u"-h"};
382     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
383     dumper->params_[0] = "0";
384     dumper->ShowNotifyFoldStatusChangedInfo();
385     ASSERT_EQ(dumper->fd_, 1);
386 
387     dumper->params_[0] = "1";
388     dumper->ShowNotifyFoldStatusChangedInfo();
389     ASSERT_EQ(dumper->fd_, 1);
390 
391     dumper->params_[0] = "5";
392     dumper->ShowNotifyFoldStatusChangedInfo();
393     ASSERT_EQ(dumper->fd_, 1);
394 }
395 
396 /**
397  * @tc.name: ShowIllegalArgsInfo
398  * @tc.desc: test function : ShowIllegalArgsInfo
399  * @tc.type: FUNC
400  */
401 HWTEST_F(ScreenSessionDumperTest, ShowIllegalArgsInfo, TestSize.Level1)
402 {
403     int fd = 1;
404     std::vector<std::u16string> args = {u"-h"};
405     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
406     dumper->params_[0] = "0";
407     dumper->ShowIllegalArgsInfo();
408     ASSERT_EQ(dumper->fd_, 1);
409 }
410 
411 /**
412  * @tc.name: SetMotionSensorValue
413  * @tc.desc: test function : SetMotionSensorValue
414  * @tc.type: FUNC
415  */
416 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue01, TestSize.Level1)
417 {
418     int fd = 1;
419     std::vector<std::u16string> args = {u"-h"};
420     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
421     dumper ->SetMotionSensorValue("-motion,1");
422     ASSERT_EQ(true, true);
423 }
424 
425 /**
426  * @tc.name: SetMotionSensorValue
427  * @tc.desc: test function : SetMotionSensorValue
428  * @tc.type: FUNC
429  */
430 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue02, TestSize.Level1)
431 {
432     int fd = 1;
433     std::vector<std::u16string> args = {u"-h"};
434     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
435     dumper ->SetMotionSensorValue("-motion,2");
436     ASSERT_EQ(true, true);
437 }
438 
439 /**
440  * @tc.name: SetMotionSensorValue
441  * @tc.desc: test function : SetMotionSensorValue
442  * @tc.type: FUNC
443  */
444 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue03, TestSize.Level1)
445 {
446     int fd = 1;
447     std::vector<std::u16string> args = {u"-h"};
448     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
449     dumper ->SetMotionSensorValue("-motion,3");
450     ASSERT_EQ(true, true);
451 }
452 
453 /**
454  * @tc.name: SetMotionSensorValue
455  * @tc.desc: test function : SetMotionSensorValue
456  * @tc.type: FUNC
457  */
458 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue04, TestSize.Level1)
459 {
460     int fd = 1;
461     std::vector<std::u16string> args = {u"-h"};
462     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
463     dumper ->SetMotionSensorValue("-motion,4");
464     ASSERT_EQ(true, true);
465 }
466 
467 /**
468  * @tc.name: SetMotionSensorValue
469  * @tc.desc: test function : SetMotionSensorValue
470  * @tc.type: FUNC
471  */
472 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue05, TestSize.Level1)
473 {
474     int fd = 1;
475     std::vector<std::u16string> args = {u"-h"};
476     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
477     dumper ->SetMotionSensorValue("-motion,5");
478     ASSERT_EQ(true, true);
479 }
480 
481 /**
482  * @tc.name: SetMotionSensorValue
483  * @tc.desc: test function : SetMotionSensorValue
484  * @tc.type: FUNC
485  */
486 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue06, TestSize.Level1)
487 {
488     int fd = 1;
489     std::vector<std::u16string> args = {u"-h"};
490     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
491     dumper ->SetMotionSensorValue("-motion,9999");
492     ASSERT_EQ(true, true);
493 }
494 
495 /**
496  * @tc.name: SetMotionSensorValue
497  * @tc.desc: test function : SetMotionSensorValue
498  * @tc.type: FUNC
499  */
500 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue07, TestSize.Level1)
501 {
502     int fd = 1;
503     std::vector<std::u16string> args = {u"-h"};
504     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
505     dumper ->SetMotionSensorValue("-motion,xxxxx");
506     ASSERT_EQ(true, true);
507 }
508 
509 /**
510  * @tc.name: SetMotionSensorValue
511  * @tc.desc: test function : SetMotionSensorValue
512  * @tc.type: FUNC
513  */
514 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue07, TestSize.Level1)
515 {
516     int fd = 1;
517     std::vector<std::u16string> args = {u"-h"};
518     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
519     dumper ->SetMotionSensorValue("-motion,,,,,,");
520     ASSERT_EQ(true, true);
521 }
522 
523 /**
524  * @tc.name: SetRotationLockedValue
525  * @tc.desc: test function : SetRotationLockedValue
526  * @tc.type: FUNC
527  */
528 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue01, TestSize.Level1)
529 {
530     int fd = 1;
531     std::vector<std::u16string> args = {u"-h"};
532     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
533     dumper ->SetRotationLockedValue("-rotationlock,0");
534     ASSERT_EQ(true, true);
535 }
536 
537 /**
538  * @tc.name: SetRotationLockedValue
539  * @tc.desc: test function : SetRotationLockedValue
540  * @tc.type: FUNC
541  */
542 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue02, TestSize.Level1)
543 {
544     int fd = 1;
545     std::vector<std::u16string> args = {u"-h"};
546     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
547     dumper ->SetRotationLockedValue("-rotationlock,1");
548     ASSERT_EQ(true, true);
549 }
550 
551 /**
552  * @tc.name: SetRotationLockedValue
553  * @tc.desc: test function : SetRotationLockedValue
554  * @tc.type: FUNC
555  */
556 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue03, TestSize.Level1)
557 {
558     int fd = 1;
559     std::vector<std::u16string> args = {u"-h"};
560     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
561     dumper ->SetRotationLockedValue("-rotationlock,,,,,");
562     ASSERT_EQ(true, true);
563 }
564 
565 /**
566  * @tc.name: SetRotationLockedValue
567  * @tc.desc: test function : SetRotationLockedValue
568  * @tc.type: FUNC
569  */
570 HWTEST_F(ScreenSessionDumperTest, SetMotionSensorValue04, TestSize.Level1)
571 {
572     int fd = 1;
573     std::vector<std::u16string> args = {u"-h"};
574     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
575     dumper ->SetRotationLockedValue("-rotationlock,1-");
576     ASSERT_EQ(true, true);
577 }
578 
579 /**
580  * @tc.name: MockSendCastPublishEvent
581  * @tc.desc: test function : MockSendCastPublishEvent
582  * @tc.type: FUNC
583  */
584 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent01, TestSize.Level1)
585 {
586     int fd = 1;
587     std::vector<std::u16string> args = {u"-h"};
588     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
589     dumper ->MockSendCastPublishEvent("-publishcastevent,0");
590     ASSERT_EQ(true, true);
591 }
592 
593 /**
594  * @tc.name: MockSendCastPublishEvent
595  * @tc.desc: test function : MockSendCastPublishEvent
596  * @tc.type: FUNC
597  */
598 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent02, TestSize.Level1)
599 {
600     int fd = 1;
601     std::vector<std::u16string> args = {u"-h"};
602     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
603     dumper ->MockSendCastPublishEvent("-publishcastevent,1");
604     ASSERT_EQ(true, true);
605 }
606 
607 /**
608  * @tc.name: MockSendCastPublishEvent
609  * @tc.desc: test function : MockSendCastPublishEvent
610  * @tc.type: FUNC
611  */
612 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent03, TestSize.Level1)
613 {
614     int fd = 1;
615     std::vector<std::u16string> args = {u"-h"};
616     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
617     dumper ->MockSendCastPublishEvent("-publishcastevent,,,,,");
618     ASSERT_EQ(true, true);
619 }
620 
621 /**
622  * @tc.name: MockSendCastPublishEvent
623  * @tc.desc: test function : MockSendCastPublishEvent
624  * @tc.type: FUNC
625  */
626 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent04, TestSize.Level1)
627 {
628     int fd = 1;
629     std::vector<std::u16string> args = {u"-h"};
630     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
631     dumper ->MockSendCastPublishEvent("-publishcastevent,1-");
632     ASSERT_EQ(true, true);
633 }
634 
635 /**
636  * @tc.name: MockSendCastPublishEvent
637  * @tc.desc: test function : MockSendCastPublishEvent
638  * @tc.type: FUNC
639  */
640 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent05, TestSize.Level1)
641 {
642     int fd = 1;
643     std::vector<std::u16string> args = {u"-h"};
644     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
645     dumper ->MockSendCastPublishEvent("-publishcastevent,a");
646     ASSERT_EQ(true, true);
647 }
648 
649 /**
650  * @tc.name: MockSendCastPublishEvent
651  * @tc.desc: test function : MockSendCastPublishEvent
652  * @tc.type: FUNC
653  */
654 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent06, TestSize.Level1)
655 {
656     int fd = 1;
657     std::vector<std::u16string> args = {u"-h"};
658     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
659     dumper ->MockSendCastPublishEvent("-publishcastevent=1");
660     ASSERT_EQ(true, true);
661 }
662 
663 /**
664  * @tc.name: MockSendCastPublishEvent
665  * @tc.desc: test function : MockSendCastPublishEvent
666  * @tc.type: FUNC
667  */
668 HWTEST_F(ScreenSessionDumperTest, MockSendCastPublishEvent07, TestSize.Level1)
669 {
670     int fd = 1;
671     std::vector<std::u16string> args = {u"-h"};
672     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
673     dumper ->MockSendCastPublishEvent("-publishcastevent,7");
674     ASSERT_EQ(true, true);
675 }
676 
677 /**
678  * @tc.name: SetHoverStatusChange
679  * @tc.desc: test function : SetHoverStatusChange
680  * @tc.type: FUNC
681  */
682 HWTEST_F(ScreenSessionDumperTest, SetHoverStatusChange, TestSize.Level1)
683 {
684     int fd = 1;
685     std::vector<std::u16string> args = {u"-h"};
686     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
687     dumper ->SetHoverStatusChange("-hoverStatus,-1");
688     dumper ->SetHoverStatusChange("-hoverStatus,-0");
689     dumper ->SetHoverStatusChange("-hoverStatus,1");
690     dumper ->SetHoverStatusChange("-hoverStatus,4");
691     ASSERT_EQ(true, true);
692 }
693 
694 /**
695  * @tc.name: IsValidDisplayModeCommand
696  * @tc.desc: test function : IsValidDisplayModeCommand
697  * @tc.type: FUNC
698  */
699 HWTEST_F(ScreenSessionDumperTest, IsValidDisplayModeCommand, TestSize.Level1)
700 {
701     int fd = 1;
702     std::vector<std::u16string> args = {u"-f"};
703     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
704     std::string command = "-f";
705     bool ret = dumper->IsValidDisplayModeCommand(command);
706     ASSERT_EQ(ret, true);
707 
708     command = "-m";
709     ret = dumper->IsValidDisplayModeCommand(command);
710     ASSERT_EQ(ret, true);
711 
712     command = "-sub";
713     ret = dumper->IsValidDisplayModeCommand(command);
714     ASSERT_EQ(ret, true);
715 
716     command = "-coor";
717     ret = dumper->IsValidDisplayModeCommand(command);
718     ASSERT_EQ(ret, true);
719 
720     command = "-test";
721     ret = dumper->IsValidDisplayModeCommand(command);
722     ASSERT_EQ(ret, false);
723 }
724 
725 /**
726  * @tc.name: SetLandscapeLock
727  * @tc.desc: test function : SetLandscapeLock
728  * @tc.type: FUNC
729  */
730 HWTEST_F(ScreenSessionDumperTest, SetLandscapeLock, Function | SmallTest | Level1)
731 {
732     int fd = 1;
733     std::vector<std::u16string> args = {u"-h"};
734     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
735     dumper->SetLandscapeLock("-landscapelock,");
736     ASSERT_EQ(ScreenSessionManager::GetInstance().extendScreenConnectStatus_, ExtendScreenConnectStatus::UNKNOWN);
737     dumper->SetLandscapeLock("-landscapelock,a");
738     ASSERT_EQ(ScreenSessionManager::GetInstance().extendScreenConnectStatus_, ExtendScreenConnectStatus::UNKNOWN);
739 }
740 
741 /**
742  * @tc.name: DumpTentMode
743  * @tc.desc: test function : DumpTentMode
744  * @tc.type: FUNC
745  */
746 HWTEST_F(ScreenSessionDumperTest, DumpTentMode, Function | SmallTest | Level1)
747 {
748     int fd = 1;
749     std::vector<std::u16string> args = {u"-h"};
750     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
751     dumper->DumpTentMode();
752     ASSERT_EQ(dumper->fd_, 1);
753 }
754 
755 /**
756  * @tc.name: IsNumber01
757  * @tc.desc: test function : IsNumber
758  * @tc.type: FUNC
759  */
760 HWTEST_F(ScreenSessionDumperTest, IsNumber01, TestSize.Level1)
761 {
762     int fd = 1;
763     std::vector<std::u16string> args = {u"-h"};
764     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
765 
766     bool ret = dumper->IsNumber("");
767     ASSERT_EQ(ret, false);
768 }
769 
770 /**
771  * @tc.name: IsNumber02
772  * @tc.desc: test function : IsNumber
773  * @tc.type: FUNC
774  */
775 HWTEST_F(ScreenSessionDumperTest, IsNumber02, TestSize.Level1)
776 {
777     int fd = 1;
778     std::vector<std::u16string> args = {u"-h"};
779     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
780 
781     bool ret = dumper->IsNumber("123");
782     ASSERT_EQ(ret, true);
783 }
784 
785 /**
786  * @tc.name: IsNumber03
787  * @tc.desc: test function : IsNumber
788  * @tc.type: FUNC
789  */
790 HWTEST_F(ScreenSessionDumperTest, IsNumber03, TestSize.Level1)
791 {
792     int fd = 1;
793     std::vector<std::u16string> args = {u"-h"};
794     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
795 
796     bool ret = dumper->IsNumber("123aaa");
797     ASSERT_EQ(ret, false);
798 }
799 
800 /**
801  * @tc.name: ExecuteInjectCmd201
802  * @tc.desc: test function : ExecuteInjectCmd2
803  * @tc.type: FUNC
804  */
805 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd201, TestSize.Level1)
806 {
807     int fd = 1;
808     std::vector<std::u16string> args = {u"-ontent"};
809     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
810     dumper->ExecuteInjectCmd2();
811     ASSERT_EQ(dumper->fd_, 1);
812 }
813 
814 /**
815  * @tc.name: ExecuteInjectCmd202
816  * @tc.desc: test function : ExecuteInjectCmd2
817  * @tc.type: FUNC
818  */
819 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd202, TestSize.Level1)
820 {
821     int fd = 1;
822     std::vector<std::u16string> args = {u"-hoverstatus"};
823     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
824     dumper->ExecuteInjectCmd2();
825     ASSERT_EQ(dumper->fd_, 1);
826 }
827 
828 /**
829  * @tc.name: ExecuteInjectCmd203
830  * @tc.desc: test function : ExecuteInjectCmd2
831  * @tc.type: FUNC
832  */
833 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd203, TestSize.Level1)
834 {
835     int fd = 1;
836     std::vector<std::u16string> args = {u"-supertrans"};
837     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
838     dumper->ExecuteInjectCmd2();
839     ASSERT_EQ(dumper->fd_, 1);
840 }
841 
842 /**
843  * @tc.name: ExecuteInjectCmd204
844  * @tc.desc: test function : ExecuteInjectCmd2
845  * @tc.type: FUNC
846  */
847 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd204, TestSize.Level1)
848 {
849     int fd = 1;
850     std::vector<std::u16string> args = {u"-posture"};
851     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
852     dumper->ExecuteInjectCmd2();
853     ASSERT_EQ(dumper->fd_, 1);
854 }
855 
856 /**
857  * @tc.name: ExecuteInjectCmd205
858  * @tc.desc: test function : ExecuteInjectCmd2
859  * @tc.type: FUNC
860  */
861 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd205, TestSize.Level1)
862 {
863     int fd = 1;
864     std::vector<std::u16string> args = {u"-registerhall"};
865     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
866     dumper->ExecuteInjectCmd2();
867     ASSERT_EQ(dumper->fd_, 1);
868 }
869 
870 /**
871  * @tc.name: ExecuteInjectCmd206
872  * @tc.desc: test function : ExecuteInjectCmd2
873  * @tc.type: FUNC
874  */
875 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd206, Function | SmallTest | Level1)
876 {
877     int fd = 1;
878     std::vector<std::u16string> args = {u"-landscapelock,1"};
879     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
880     dumper->ExecuteInjectCmd2();
881     ASSERT_EQ(ScreenSessionManager::GetInstance().extendScreenConnectStatus_, ExtendScreenConnectStatus::CONNECT);
882 }
883 
884 /**
885  * @tc.name: ExecuteInjectCmd207
886  * @tc.desc: test function : ExecuteInjectCmd2
887  * @tc.type: FUNC
888  */
889 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd207, Function | SmallTest | Level1)
890 {
891     int fd = 1;
892     std::vector<std::u16string> args = {u"-landscapelock,0"};
893     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
894     dumper->ExecuteInjectCmd2();
895     ASSERT_EQ(ScreenSessionManager::GetInstance().extendScreenConnectStatus_, ExtendScreenConnectStatus::DISCONNECT);
896 }
897 
898 /**
899  * @tc.name: DumpMultiUserInfo
900  * @tc.desc: test function : DumpMultiUserInfo
901  * @tc.type: FUNC
902  */
903 HWTEST_F(ScreenSessionDumperTest, DumpMultiUserInfo, TestSize.Level1)
904 {
905     int fd = 1;
906     std::vector<std::u16string> args = {u"-h"};
907     std::vector<int32_t> oldScbPids = {1, 2, 3};
908     int32_t userId = 1;
909     int32_t scbPid = 1;
910     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
911     dumper->DumpMultiUserInfo(oldScbPids, userId, scbPid);
912     ASSERT_NE(dumper->dumpInfo_, std::string());
913 }
914 #ifdef FOLD_ABILITY_ENABLE
915 /**
916  * @tc.name: DumpFoldCreaseRegion
917  * @tc.desc: test function : DumpFoldCreaseRegion
918  * @tc.type: FUNC
919  */
920 HWTEST_F(ScreenSessionDumperTest, DumpFoldCreaseRegion, TestSize.Level1)
921 {
922     int fd = 1;
923     std::vector<std::u16string> args = {u"-h"};
924     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
925     dumper->DumpFoldCreaseRegion();
926     ASSERT_EQ(dumper->fd_, 1);
927 }
928 
929 /**
930  * @tc.name: SetHallAndPostureValue
931  * @tc.desc: test function : SetHallAndPostureValue
932  * @tc.type: FUNC
933  */
934 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureValue, TestSize.Level1)
935 {
936     int fd = 1;
937     std::vector<std::u16string> args = {u"-h"};
938     sptr<ScreenSessionDumper> dumper1 = new ScreenSessionDumper(fd, args);
939     dumper1->SetHallAndPostureValue("-hoverstatus,-1");
940     ASSERT_EQ(dumper1->fd_, 1);
941 
942     fd = 1;
943     args = {u"-posture"};
944     sptr<ScreenSessionDumper> dumper2 = new ScreenSessionDumper(fd, args);
945     dumper2->SetHallAndPostureValue("-hoverstatus,string1,string2");
946     ASSERT_EQ(dumper2->fd_, 1);
947 }
948 
949 /**
950  * @tc.name: SetHallAndPostureStatus01
951  * @tc.desc: test function : SetHallAndPostureStatus
952  * @tc.type: FUNC
953  */
954 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus01, TestSize.Level1)
955 {
956     int fd = 1;
957     std::vector<std::u16string> args = {u"-h"};
958     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
959     dumper->SetHallAndPostureStatus("");
960     ASSERT_EQ(dumper->fd_, 1);
961 }
962 
963 /**
964  * @tc.name: SetHallAndPostureStatus02
965  * @tc.desc: test function : SetHallAndPostureStatus
966  * @tc.type: FUNC
967  */
968 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus02, TestSize.Level1)
969 {
970     int fd = 1;
971     std::vector<std::u16string> args = {u"-h"};
972     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
973     dumper->SetHallAndPostureStatus("-registerhall,a,a");
974     ASSERT_EQ(dumper->fd_, 1);
975 }
976 
977 /**
978  * @tc.name: SetHallAndPostureStatus03
979  * @tc.desc: test function : SetHallAndPostureStatus
980  * @tc.type: FUNC
981  */
982 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus03, TestSize.Level1)
983 {
984     int fd = 1;
985     std::vector<std::u16string> args = {u"-h"};
986     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
987     dumper->SetHallAndPostureStatus("-registerhall,1");
988     ASSERT_EQ(dumper->fd_, 1);
989 }
990 
991 /**
992  * @tc.name: SetSuperFoldStatusChange01
993  * @tc.desc: test function : SetSuperFoldStatusChange
994  * @tc.type: FUNC
995  */
996 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange01, TestSize.Level1)
997 {
998     int fd = 1;
999     std::vector<std::u16string> args = {u"-h"};
1000     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1001     dumper->SetSuperFoldStatusChange("");
1002     ASSERT_EQ(dumper->fd_, 1);
1003 }
1004 
1005 /**
1006  * @tc.name: SetSuperFoldStatusChange02
1007  * @tc.desc: test function : SetSuperFoldStatusChange
1008  * @tc.type: FUNC
1009  */
1010 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange02, TestSize.Level1)
1011 {
1012     int fd = 1;
1013     std::vector<std::u16string> args = {u"-h"};
1014     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1015     dumper->SetSuperFoldStatusChange("-supertrans,");
1016     ASSERT_EQ(dumper->fd_, 1);
1017 }
1018 
1019 /**
1020  * @tc.name: SetSuperFoldStatusChange03
1021  * @tc.desc: test function : SetSuperFoldStatusChange
1022  * @tc.type: FUNC
1023  */
1024 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange03, TestSize.Level1)
1025 {
1026     int fd = 1;
1027     std::vector<std::u16string> args = {u"-h"};
1028     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1029     dumper->SetSuperFoldStatusChange("-supertrans,a");
1030     ASSERT_EQ(dumper->fd_, 1);
1031 }
1032 
1033 /**
1034  * @tc.name: SetSuperFoldStatusChange04
1035  * @tc.desc: test function : SetSuperFoldStatusChange
1036  * @tc.type: FUNC
1037  */
1038 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange04, TestSize.Level1)
1039 {
1040     int fd = 1;
1041     std::vector<std::u16string> args = {u"-h"};
1042     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1043     dumper->SetSuperFoldStatusChange("-supertrans,ab");
1044     ASSERT_EQ(dumper->fd_, 1);
1045 }
1046 
1047 /**
1048  * @tc.name: SetSuperFoldStatusChange05
1049  * @tc.desc: test function : SetSuperFoldStatusChange
1050  * @tc.type: FUNC
1051  */
1052 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange05, TestSize.Level1)
1053 {
1054     int fd = 1;
1055     std::vector<std::u16string> args = {u"-h"};
1056     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1057     dumper->SetSuperFoldStatusChange("-supertrans,-1");
1058     ASSERT_EQ(dumper->fd_, 1);
1059 }
1060 
1061 /**
1062  * @tc.name: SetSuperFoldStatusChange06
1063  * @tc.desc: test function : SetSuperFoldStatusChange
1064  * @tc.type: FUNC
1065  */
1066 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange06, TestSize.Level1)
1067 {
1068     int fd = 1;
1069     std::vector<std::u16string> args = {u"-h"};
1070     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1071     dumper->SetSuperFoldStatusChange("-supertrans,1");
1072     ASSERT_EQ(dumper->fd_, 1);
1073 }
1074 
1075 /**
1076  * @tc.name: SetSecondaryStatusChange01
1077  * @tc.desc: test function : SetSecondaryStatusChange
1078  * @tc.type: FUNC
1079  */
1080 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange01, TestSize.Level1)
1081 {
1082     int fd = 1;
1083     std::vector<std::u16string> args = {u"-h"};
1084     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1085     dumper->SetSuperFoldStatusChange("-secondary,f");
1086     ASSERT_EQ(dumper->fd_, 1);
1087 }
1088 
1089 /**
1090  * @tc.name: SetSecondaryStatusChange02
1091  * @tc.desc: test function : SetSecondaryStatusChange
1092  * @tc.type: FUNC
1093  */
1094 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange02, TestSize.Level1)
1095 {
1096     int fd = 1;
1097     std::vector<std::u16string> args = {u"-h"};
1098     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1099     dumper->SetSecondaryStatusChange("-secondary,m");
1100     ASSERT_EQ(dumper->fd_, 1);
1101 }
1102 
1103 /**
1104  * @tc.name: SetSecondaryStatusChange03
1105  * @tc.desc: test function : SetSecondaryStatusChange
1106  * @tc.type: FUNC
1107  */
1108 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange03, TestSize.Level1)
1109 {
1110     int fd = 1;
1111     std::vector<std::u16string> args = {u"-h"};
1112     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1113     dumper->SetSecondaryStatusChange("-secondary,g");
1114     ASSERT_EQ(dumper->fd_, 1);
1115 }
1116 
1117 /**
1118  * @tc.name: IsAllCharDigit01
1119  * @tc.desc: test function : IsAllCharDigit
1120  * @tc.type: FUNC
1121  */
1122 HWTEST_F(ScreenSessionDumperTest, IsAllCharDigit01, TestSize.Level1)
1123 {
1124     int fd = 1;
1125     std::vector<std::u16string> args = {u"-h"};
1126     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1127     bool res = dumper->IsAllCharDigit("-secondary,g");
1128     EXPECT_FALSE(res);
1129     res = dumper->IsAllCharDigit("111");
1130     EXPECT_TRUE(res);
1131 }
1132 
1133 /**
1134  * @tc.name: GetPostureAndHall01
1135  * @tc.desc: test function : GetPostureAndHall
1136  * @tc.type: FUNC
1137  */
1138 HWTEST_F(ScreenSessionDumperTest, GetPostureAndHall01, TestSize.Level1)
1139 {
1140     int fd = 1;
1141     std::vector<std::u16string> args = {u"-h"};
1142     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1143     std::vector<std::string> strVec { TEST_SECONDARY_SRNSOR_POSTURE, TEST_SECONDARY_SRNSOR_HALL };
1144     std::vector<float> postures;
1145     std::vector<uint16_t> halls;
1146     bool res = dumper->GetPostureAndHall(strVec, postures, halls);
1147     EXPECT_TRUE(res);
1148     EXPECT_EQ(postures.size(), SIZE_THREE);
1149     EXPECT_EQ(postures[0], POSTURE_FIRST);
1150     EXPECT_EQ(postures[1], POSTURE_SECOND);
1151     EXPECT_EQ(postures[SIZE_TWO], POSTURE_THIRD);
1152     EXPECT_EQ(halls.size(), SIZE_TWO);
1153     EXPECT_EQ(halls[0], HALL_TEST);
1154     EXPECT_EQ(halls[1], HALL_TEST);
1155 }
1156 
1157 /**
1158  * @tc.name: GetPostureAndHall02
1159  * @tc.desc: test function : GetPostureAndHall
1160  * @tc.type: FUNC
1161  */
1162 HWTEST_F(ScreenSessionDumperTest, GetPostureAndHall02, TestSize.Level1)
1163 {
1164     int fd = 1;
1165     std::vector<std::u16string> args = {u"-h"};
1166     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1167 
1168     std::vector<float> postures;
1169     std::vector<uint16_t> halls;
1170     std::vector<std::string> strVecFirst { "posture:93,180,2", "hall:1,1" };
1171     bool res = dumper->GetPostureAndHall(strVecFirst, postures, halls);
1172     EXPECT_FALSE(res);
1173 
1174     postures.clear();
1175     halls.clear();
1176     std::vector<std::string> strVecSecond { "posture:181,180,0", "hall:1,1" };
1177     res = dumper->GetPostureAndHall(strVecSecond, postures, halls);
1178     EXPECT_TRUE(res);
1179 
1180     postures.clear();
1181     halls.clear();
1182     std::vector<std::string> strVecFourth { "posture:90,170,0", "hall:a,1" };
1183     res = dumper->GetPostureAndHall(strVecFourth, postures, halls);
1184     EXPECT_FALSE(res);
1185 }
1186 
1187 /**
1188  * @tc.name: TriggerSecondarySensor01
1189  * @tc.desc: test function : TriggerSecondarySensor
1190  * @tc.type: FUNC
1191  */
1192 HWTEST_F(ScreenSessionDumperTest, TriggerSecondarySensor01, TestSize.Level1)
1193 {
1194     if (!FoldScreenStateInternel::IsSecondaryDisplayFoldDevice()) {
1195         return;
1196     }
1197     std::vector<std::u16string> args = {u"-h"};
1198     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(1, args);
1199     dumper->TriggerSecondarySensor("posture:178,180,0/hall:1,1");
1200     FoldStatus status = ScreenSessionManager::GetInstance().GetFoldStatus();
1201     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_EXPAND);
1202 
1203     dumper->TriggerSecondarySensor("posture:93,180,0/hall:1,1");
1204     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1205     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_EXPAND);
1206 
1207     dumper->TriggerSecondarySensor("posture:150,88,0/hall:1,1");
1208     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1209     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_HALF_FOLDED);
1210 
1211     dumper->TriggerSecondarySensor("posture:3,88,0/hall:1,1");
1212     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1213     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_HALF_FOLDED);
1214 
1215     dumper->TriggerSecondarySensor("posture:88,3,0/hall:1,0");
1216     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1217     EXPECT_EQ(status, FoldStatus::HALF_FOLD);
1218 }
1219 
1220 /**
1221  * @tc.name: TriggerSecondaryFoldStatus01
1222  * @tc.desc: test function : TriggerSecondaryFoldStatus
1223  * @tc.type: FUNC
1224  */
1225 HWTEST_F(ScreenSessionDumperTest, TriggerSecondaryFoldStatus01, TestSize.Level1)
1226 {
1227     if (!FoldScreenStateInternel::IsSecondaryDisplayFoldDevice()) {
1228         return;
1229     }
1230     std::vector<std::u16string> args = {u"-h"};
1231     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(1, args);
1232     dumper->TriggerSecondaryFoldStatus("z=1");
1233     FoldStatus status = ScreenSessionManager::GetInstance().GetFoldStatus();
1234     EXPECT_EQ(status, FoldStatus::EXPAND);
1235 
1236     dumper->TriggerSecondaryFoldStatus("z=2");
1237     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1238     EXPECT_EQ(status, FoldStatus::FOLDED);
1239 
1240     dumper->TriggerSecondaryFoldStatus("z=3");
1241     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1242     EXPECT_EQ(status, FoldStatus::HALF_FOLD);
1243 
1244     dumper->TriggerSecondaryFoldStatus("z=11");
1245     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1246     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_EXPAND);
1247 
1248     dumper->TriggerSecondaryFoldStatus("z=21");
1249     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1250     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_HALF_FOLDED);
1251 
1252     dumper->TriggerSecondaryFoldStatus("z=12");
1253     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1254     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_EXPAND);
1255 
1256     dumper->TriggerSecondaryFoldStatus("z=22");
1257     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1258     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_HALF_FOLDED);
1259 
1260     dumper->TriggerSecondaryFoldStatus("z=13");
1261     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1262     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_EXPAND);
1263 
1264     dumper->TriggerSecondaryFoldStatus("z=23");
1265     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1266     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_HALF_FOLDED);
1267 }
1268 
1269 /**
1270  * @tc.name: SetFoldStatusLocked
1271  * @tc.desc: test function : SetFoldStatusLocked
1272  * @tc.type: FUNC
1273  */
1274 HWTEST_F(ScreenSessionDumperTest, SetFoldStatusLocked, TestSize.Level1)
1275 {
1276     int fd = 1;
1277     std::vector<std::u16string> args = {u""};
1278     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1279     int ret = dumper->SetFoldStatusLocked();
1280     ASSERT_EQ(ret, -1);
1281 
1282     dumper->params_[0] = "-l";
1283     ret = dumper->SetFoldStatusLocked();
1284     ASSERT_EQ(ret, 0);
1285 
1286     dumper->params_[0] = "-u";
1287     ret = dumper->SetFoldStatusLocked();
1288     ASSERT_EQ(ret, 0);
1289 
1290     dumper->params_[0] = "-test";
1291     ret = dumper->SetFoldStatusLocked();
1292     ASSERT_EQ(ret, -1);
1293 }
1294 
1295 /**
1296  * @tc.name: SetFoldDisplayMode
1297  * @tc.desc: test function : SetFoldDisplayMode
1298  * @tc.type: FUNC
1299  */
1300 HWTEST_F(ScreenSessionDumperTest, SetFoldDisplayMode, TestSize.Level1)
1301 {
1302     int fd = 1;
1303     std::vector<std::u16string> args = {u""};
1304     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1305     int ret = dumper->SetFoldDisplayMode();
1306     ASSERT_EQ(ret, -1);
1307 
1308     dumper->params_[0] = "-sub";
1309     ret = dumper->SetFoldDisplayMode();
1310     ASSERT_EQ(ret, 0);
1311 
1312     dumper->params_[0] = "-coor";
1313     ret = dumper->SetFoldDisplayMode();
1314     ASSERT_EQ(ret, 0);
1315 
1316     dumper->params_[0] = "-m";
1317     ret = dumper->SetFoldDisplayMode();
1318     ASSERT_EQ(ret, 0);
1319 
1320     dumper->params_[0] = "-f";
1321     ret = dumper->SetFoldDisplayMode();
1322     ASSERT_EQ(ret, 0);
1323 
1324     dumper->params_[0] = "-test";
1325     ret = dumper->SetFoldDisplayMode();
1326     ASSERT_EQ(ret, -1);
1327 }
1328 
1329 /**
1330  * @tc.name: SetEnterOrExitTentMode
1331  * @tc.desc: test function : SetEnterOrExitTentMode
1332  * @tc.type: FUNC
1333  */
1334 HWTEST_F(ScreenSessionDumperTest, SetEnterOrExitTentMode, TestSize.Level1)
1335 {
1336     int fd = 1;
1337     std::vector<std::u16string> args = {u"-h"};
1338     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1339 
1340     dumper->SetEnterOrExitTentMode("-offtent");
1341     bool tentMode = ScreenSessionManager::GetInstance().GetTentMode();
1342     ASSERT_EQ(tentMode, false);
1343 }
1344 
1345 /**
1346  * @tc.name: SetDuringCallState
1347  * @tc.desc: test function : SetDuringCallState
1348  * @tc.type: FUNC
1349  */
1350 HWTEST_F(ScreenSessionDumperTest, SetDuringCallState, TestSize.Level1)
1351 {
1352     int fd = 1;
1353     std::vector<std::u16string> args = {u"-h"};
1354     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1355 
1356     dumper->SetDuringCallState("-duringcallstate, 1");
1357     ASSERT_TRUE(ScreenSessionManager::GetInstance().duringCallState_);
1358 
1359     dumper->SetDuringCallState("-duringcallstate, 0");
1360     ASSERT_FALSE(ScreenSessionManager::GetInstance().duringCallState_);
1361 }
1362 
1363 #endif // FOLD_ABILITY_ENABLE
1364 }
1365 }
1366 }