• 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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, Function | SmallTest | 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: DumpTentMode
727  * @tc.desc: test function : DumpTentMode
728  * @tc.type: FUNC
729  */
730 HWTEST_F(ScreenSessionDumperTest, DumpTentMode, 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->DumpTentMode();
736     ASSERT_EQ(dumper->fd_, 1);
737 }
738 
739 /**
740  * @tc.name: IsNumber01
741  * @tc.desc: test function : IsNumber
742  * @tc.type: FUNC
743  */
744 HWTEST_F(ScreenSessionDumperTest, IsNumber01, Function | SmallTest | Level1)
745 {
746     int fd = 1;
747     std::vector<std::u16string> args = {u"-h"};
748     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
749 
750     bool ret = dumper->IsNumber("");
751     ASSERT_EQ(ret, false);
752 }
753 
754 /**
755  * @tc.name: IsNumber02
756  * @tc.desc: test function : IsNumber
757  * @tc.type: FUNC
758  */
759 HWTEST_F(ScreenSessionDumperTest, IsNumber02, Function | SmallTest | Level1)
760 {
761     int fd = 1;
762     std::vector<std::u16string> args = {u"-h"};
763     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
764 
765     bool ret = dumper->IsNumber("123");
766     ASSERT_EQ(ret, true);
767 }
768 
769 /**
770  * @tc.name: IsNumber03
771  * @tc.desc: test function : IsNumber
772  * @tc.type: FUNC
773  */
774 HWTEST_F(ScreenSessionDumperTest, IsNumber03, Function | SmallTest | Level1)
775 {
776     int fd = 1;
777     std::vector<std::u16string> args = {u"-h"};
778     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
779 
780     bool ret = dumper->IsNumber("123aaa");
781     ASSERT_EQ(ret, false);
782 }
783 
784 /**
785  * @tc.name: ExecuteInjectCmd201
786  * @tc.desc: test function : ExecuteInjectCmd2
787  * @tc.type: FUNC
788  */
789 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd201, Function | SmallTest | Level1)
790 {
791     int fd = 1;
792     std::vector<std::u16string> args = {u"-ontent"};
793     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
794     dumper->ExecuteInjectCmd2();
795     ASSERT_EQ(dumper->fd_, 1);
796 }
797 
798 /**
799  * @tc.name: ExecuteInjectCmd202
800  * @tc.desc: test function : ExecuteInjectCmd2
801  * @tc.type: FUNC
802  */
803 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd202, Function | SmallTest | Level1)
804 {
805     int fd = 1;
806     std::vector<std::u16string> args = {u"-hoverstatus"};
807     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
808     dumper->ExecuteInjectCmd2();
809     ASSERT_EQ(dumper->fd_, 1);
810 }
811 
812 /**
813  * @tc.name: ExecuteInjectCmd203
814  * @tc.desc: test function : ExecuteInjectCmd2
815  * @tc.type: FUNC
816  */
817 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd203, Function | SmallTest | Level1)
818 {
819     int fd = 1;
820     std::vector<std::u16string> args = {u"-supertrans"};
821     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
822     dumper->ExecuteInjectCmd2();
823     ASSERT_EQ(dumper->fd_, 1);
824 }
825 
826 /**
827  * @tc.name: ExecuteInjectCmd204
828  * @tc.desc: test function : ExecuteInjectCmd2
829  * @tc.type: FUNC
830  */
831 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd204, Function | SmallTest | Level1)
832 {
833     int fd = 1;
834     std::vector<std::u16string> args = {u"-posture"};
835     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
836     dumper->ExecuteInjectCmd2();
837     ASSERT_EQ(dumper->fd_, 1);
838 }
839 
840 /**
841  * @tc.name: ExecuteInjectCmd205
842  * @tc.desc: test function : ExecuteInjectCmd2
843  * @tc.type: FUNC
844  */
845 HWTEST_F(ScreenSessionDumperTest, ExecuteInjectCmd205, Function | SmallTest | Level1)
846 {
847     int fd = 1;
848     std::vector<std::u16string> args = {u"-registerhall"};
849     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
850     dumper->ExecuteInjectCmd2();
851     ASSERT_EQ(dumper->fd_, 1);
852 }
853 
854 /**
855  * @tc.name: DumpMultiUserInfo
856  * @tc.desc: test function : DumpMultiUserInfo
857  * @tc.type: FUNC
858  */
859 HWTEST_F(ScreenSessionDumperTest, DumpMultiUserInfo, Function | SmallTest | Level1)
860 {
861     int fd = 1;
862     std::vector<std::u16string> args = {u"-h"};
863     std::vector<int32_t> oldScbPids = {1, 2, 3};
864     int32_t userId = 1;
865     int32_t scbPid = 1;
866     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
867     dumper->DumpMultiUserInfo(oldScbPids, userId, scbPid);
868     ASSERT_NE(dumper->dumpInfo_, std::string());
869 }
870 #ifdef FOLD_ABILITY_ENABLE
871 /**
872  * @tc.name: DumpFoldCreaseRegion
873  * @tc.desc: test function : DumpFoldCreaseRegion
874  * @tc.type: FUNC
875  */
876 HWTEST_F(ScreenSessionDumperTest, DumpFoldCreaseRegion, Function | SmallTest | Level1)
877 {
878     int fd = 1;
879     std::vector<std::u16string> args = {u"-h"};
880     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
881     dumper->DumpFoldCreaseRegion();
882     ASSERT_EQ(dumper->fd_, 1);
883 }
884 
885 /**
886  * @tc.name: SetHallAndPostureValue
887  * @tc.desc: test function : SetHallAndPostureValue
888  * @tc.type: FUNC
889  */
890 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureValue, Function | SmallTest | Level1)
891 {
892     int fd = 1;
893     std::vector<std::u16string> args = {u"-h"};
894     sptr<ScreenSessionDumper> dumper1 = new ScreenSessionDumper(fd, args);
895     dumper1->SetHallAndPostureValue("-hoverstatus,-1");
896     ASSERT_EQ(dumper1->fd_, 1);
897 
898     fd = 1;
899     args = {u"-posture"};
900     sptr<ScreenSessionDumper> dumper2 = new ScreenSessionDumper(fd, args);
901     dumper2->SetHallAndPostureValue("-hoverstatus,string1,string2");
902     ASSERT_EQ(dumper2->fd_, 1);
903 }
904 
905 /**
906  * @tc.name: SetHallAndPostureStatus01
907  * @tc.desc: test function : SetHallAndPostureStatus
908  * @tc.type: FUNC
909  */
910 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus01, Function | SmallTest | Level1)
911 {
912     int fd = 1;
913     std::vector<std::u16string> args = {u"-h"};
914     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
915     dumper->SetHallAndPostureStatus("");
916     ASSERT_EQ(dumper->fd_, 1);
917 }
918 
919 /**
920  * @tc.name: SetHallAndPostureStatus02
921  * @tc.desc: test function : SetHallAndPostureStatus
922  * @tc.type: FUNC
923  */
924 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus02, Function | SmallTest | Level1)
925 {
926     int fd = 1;
927     std::vector<std::u16string> args = {u"-h"};
928     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
929     dumper->SetHallAndPostureStatus("-registerhall,a,a");
930     ASSERT_EQ(dumper->fd_, 1);
931 }
932 
933 /**
934  * @tc.name: SetHallAndPostureStatus03
935  * @tc.desc: test function : SetHallAndPostureStatus
936  * @tc.type: FUNC
937  */
938 HWTEST_F(ScreenSessionDumperTest, SetHallAndPostureStatus03, Function | SmallTest | Level1)
939 {
940     int fd = 1;
941     std::vector<std::u16string> args = {u"-h"};
942     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
943     dumper->SetHallAndPostureStatus("-registerhall,1");
944     ASSERT_EQ(dumper->fd_, 1);
945 }
946 
947 /**
948  * @tc.name: SetSuperFoldStatusChange01
949  * @tc.desc: test function : SetSuperFoldStatusChange
950  * @tc.type: FUNC
951  */
952 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange01, Function | SmallTest | Level1)
953 {
954     int fd = 1;
955     std::vector<std::u16string> args = {u"-h"};
956     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
957     dumper->SetSuperFoldStatusChange("");
958     ASSERT_EQ(dumper->fd_, 1);
959 }
960 
961 /**
962  * @tc.name: SetSuperFoldStatusChange02
963  * @tc.desc: test function : SetSuperFoldStatusChange
964  * @tc.type: FUNC
965  */
966 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange02, Function | SmallTest | Level1)
967 {
968     int fd = 1;
969     std::vector<std::u16string> args = {u"-h"};
970     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
971     dumper->SetSuperFoldStatusChange("-supertrans,");
972     ASSERT_EQ(dumper->fd_, 1);
973 }
974 
975 /**
976  * @tc.name: SetSuperFoldStatusChange03
977  * @tc.desc: test function : SetSuperFoldStatusChange
978  * @tc.type: FUNC
979  */
980 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange03, Function | SmallTest | Level1)
981 {
982     int fd = 1;
983     std::vector<std::u16string> args = {u"-h"};
984     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
985     dumper->SetSuperFoldStatusChange("-supertrans,a");
986     ASSERT_EQ(dumper->fd_, 1);
987 }
988 
989 /**
990  * @tc.name: SetSuperFoldStatusChange04
991  * @tc.desc: test function : SetSuperFoldStatusChange
992  * @tc.type: FUNC
993  */
994 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange04, Function | SmallTest | Level1)
995 {
996     int fd = 1;
997     std::vector<std::u16string> args = {u"-h"};
998     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
999     dumper->SetSuperFoldStatusChange("-supertrans,ab");
1000     ASSERT_EQ(dumper->fd_, 1);
1001 }
1002 
1003 /**
1004  * @tc.name: SetSuperFoldStatusChange05
1005  * @tc.desc: test function : SetSuperFoldStatusChange
1006  * @tc.type: FUNC
1007  */
1008 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange05, Function | SmallTest | Level1)
1009 {
1010     int fd = 1;
1011     std::vector<std::u16string> args = {u"-h"};
1012     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1013     dumper->SetSuperFoldStatusChange("-supertrans,-1");
1014     ASSERT_EQ(dumper->fd_, 1);
1015 }
1016 
1017 /**
1018  * @tc.name: SetSuperFoldStatusChange06
1019  * @tc.desc: test function : SetSuperFoldStatusChange
1020  * @tc.type: FUNC
1021  */
1022 HWTEST_F(ScreenSessionDumperTest, SetSuperFoldStatusChange06, Function | SmallTest | Level1)
1023 {
1024     int fd = 1;
1025     std::vector<std::u16string> args = {u"-h"};
1026     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1027     dumper->SetSuperFoldStatusChange("-supertrans,1");
1028     ASSERT_EQ(dumper->fd_, 1);
1029 }
1030 
1031 /**
1032  * @tc.name: SetSecondaryStatusChange01
1033  * @tc.desc: test function : SetSecondaryStatusChange
1034  * @tc.type: FUNC
1035  */
1036 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange01, Function | SmallTest | Level1)
1037 {
1038     int fd = 1;
1039     std::vector<std::u16string> args = {u"-h"};
1040     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1041     dumper->SetSuperFoldStatusChange("-secondary,f");
1042     ASSERT_EQ(dumper->fd_, 1);
1043 }
1044 
1045 /**
1046  * @tc.name: SetSecondaryStatusChange02
1047  * @tc.desc: test function : SetSecondaryStatusChange
1048  * @tc.type: FUNC
1049  */
1050 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange02, Function | SmallTest | Level1)
1051 {
1052     int fd = 1;
1053     std::vector<std::u16string> args = {u"-h"};
1054     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1055     dumper->SetSecondaryStatusChange("-secondary,m");
1056     ASSERT_EQ(dumper->fd_, 1);
1057 }
1058 
1059 /**
1060  * @tc.name: SetSecondaryStatusChange03
1061  * @tc.desc: test function : SetSecondaryStatusChange
1062  * @tc.type: FUNC
1063  */
1064 HWTEST_F(ScreenSessionDumperTest, SetSecondaryStatusChange03, Function | SmallTest | Level1)
1065 {
1066     int fd = 1;
1067     std::vector<std::u16string> args = {u"-h"};
1068     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1069     dumper->SetSecondaryStatusChange("-secondary,g");
1070     ASSERT_EQ(dumper->fd_, 1);
1071 }
1072 
1073 /**
1074  * @tc.name: IsAllCharDigit01
1075  * @tc.desc: test function : IsAllCharDigit
1076  * @tc.type: FUNC
1077  */
1078 HWTEST_F(ScreenSessionDumperTest, IsAllCharDigit01, Function | SmallTest | Level1)
1079 {
1080     int fd = 1;
1081     std::vector<std::u16string> args = {u"-h"};
1082     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1083     bool res = dumper->IsAllCharDigit("-secondary,g");
1084     EXPECT_FALSE(res);
1085     res = dumper->IsAllCharDigit("111");
1086     EXPECT_TRUE(res);
1087 }
1088 
1089 /**
1090  * @tc.name: GetPostureAndHall01
1091  * @tc.desc: test function : GetPostureAndHall
1092  * @tc.type: FUNC
1093  */
1094 HWTEST_F(ScreenSessionDumperTest, GetPostureAndHall01, Function | SmallTest | Level1)
1095 {
1096     int fd = 1;
1097     std::vector<std::u16string> args = {u"-h"};
1098     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1099     std::vector<std::string> strVec { TEST_SECONDARY_SRNSOR_POSTURE, TEST_SECONDARY_SRNSOR_HALL };
1100     std::vector<float> postures;
1101     std::vector<uint16_t> halls;
1102     bool res = dumper->GetPostureAndHall(strVec, postures, halls);
1103     EXPECT_TRUE(res);
1104     EXPECT_EQ(postures.size(), SIZE_THREE);
1105     EXPECT_EQ(postures[0], POSTURE_FIRST);
1106     EXPECT_EQ(postures[1], POSTURE_SECOND);
1107     EXPECT_EQ(postures[SIZE_TWO], POSTURE_THIRD);
1108     EXPECT_EQ(halls.size(), SIZE_TWO);
1109     EXPECT_EQ(halls[0], HALL_TEST);
1110     EXPECT_EQ(halls[1], HALL_TEST);
1111 }
1112 
1113 /**
1114  * @tc.name: GetPostureAndHall02
1115  * @tc.desc: test function : GetPostureAndHall
1116  * @tc.type: FUNC
1117  */
1118 HWTEST_F(ScreenSessionDumperTest, GetPostureAndHall02, Function | SmallTest | Level1)
1119 {
1120     int fd = 1;
1121     std::vector<std::u16string> args = {u"-h"};
1122     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1123 
1124     std::vector<float> postures;
1125     std::vector<uint16_t> halls;
1126     std::vector<std::string> strVecFirst { "posture:93,180,2", "hall:1,1" };
1127     bool res = dumper->GetPostureAndHall(strVecFirst, postures, halls);
1128     EXPECT_FALSE(res);
1129 
1130     postures.clear();
1131     halls.clear();
1132     std::vector<std::string> strVecSecond { "posture:181,180,0", "hall:1,1" };
1133     res = dumper->GetPostureAndHall(strVecSecond, postures, halls);
1134     EXPECT_TRUE(res);
1135 
1136     postures.clear();
1137     halls.clear();
1138     std::vector<std::string> strVecFourth { "posture:90,170,0", "hall:a,1" };
1139     res = dumper->GetPostureAndHall(strVecFourth, postures, halls);
1140     EXPECT_FALSE(res);
1141 }
1142 
1143 /**
1144  * @tc.name: TriggerSecondarySensor01
1145  * @tc.desc: test function : TriggerSecondarySensor
1146  * @tc.type: FUNC
1147  */
1148 HWTEST_F(ScreenSessionDumperTest, TriggerSecondarySensor01, Function | SmallTest | Level1)
1149 {
1150     if (!FoldScreenStateInternel::IsSecondaryDisplayFoldDevice()) {
1151         return;
1152     }
1153     std::vector<std::u16string> args = {u"-h"};
1154     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(1, args);
1155     dumper->TriggerSecondarySensor("posture:178,180,0/hall:1,1");
1156     FoldStatus status = ScreenSessionManager::GetInstance().GetFoldStatus();
1157     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_EXPAND);
1158 
1159     dumper->TriggerSecondarySensor("posture:93,180,0/hall:1,1");
1160     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1161     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_EXPAND);
1162 
1163     dumper->TriggerSecondarySensor("posture:150,88,0/hall:1,1");
1164     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1165     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_HALF_FOLDED);
1166 
1167     dumper->TriggerSecondarySensor("posture:3,88,0/hall:1,1");
1168     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1169     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_HALF_FOLDED);
1170 
1171     dumper->TriggerSecondarySensor("posture:88,3,0/hall:1,0");
1172     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1173     EXPECT_EQ(status, FoldStatus::HALF_FOLD);
1174 }
1175 
1176 /**
1177  * @tc.name: TriggerSecondaryFoldStatus01
1178  * @tc.desc: test function : TriggerSecondaryFoldStatus
1179  * @tc.type: FUNC
1180  */
1181 HWTEST_F(ScreenSessionDumperTest, TriggerSecondaryFoldStatus01, Function | SmallTest | Level1)
1182 {
1183     if (!FoldScreenStateInternel::IsSecondaryDisplayFoldDevice()) {
1184         return;
1185     }
1186     std::vector<std::u16string> args = {u"-h"};
1187     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(1, args);
1188     dumper->TriggerSecondaryFoldStatus("z=1");
1189     FoldStatus status = ScreenSessionManager::GetInstance().GetFoldStatus();
1190     EXPECT_EQ(status, FoldStatus::EXPAND);
1191 
1192     dumper->TriggerSecondaryFoldStatus("z=2");
1193     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1194     EXPECT_EQ(status, FoldStatus::FOLDED);
1195 
1196     dumper->TriggerSecondaryFoldStatus("z=3");
1197     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1198     EXPECT_EQ(status, FoldStatus::HALF_FOLD);
1199 
1200     dumper->TriggerSecondaryFoldStatus("z=11");
1201     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1202     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_EXPAND);
1203 
1204     dumper->TriggerSecondaryFoldStatus("z=21");
1205     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1206     EXPECT_EQ(status, FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_HALF_FOLDED);
1207 
1208     dumper->TriggerSecondaryFoldStatus("z=12");
1209     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1210     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_EXPAND);
1211 
1212     dumper->TriggerSecondaryFoldStatus("z=22");
1213     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1214     EXPECT_EQ(status, FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_HALF_FOLDED);
1215 
1216     dumper->TriggerSecondaryFoldStatus("z=13");
1217     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1218     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_EXPAND);
1219 
1220     dumper->TriggerSecondaryFoldStatus("z=23");
1221     status = ScreenSessionManager::GetInstance().GetFoldStatus();
1222     EXPECT_EQ(status, FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_HALF_FOLDED);
1223 }
1224 
1225 /**
1226  * @tc.name: SetFoldStatusLocked
1227  * @tc.desc: test function : SetFoldStatusLocked
1228  * @tc.type: FUNC
1229  */
1230 HWTEST_F(ScreenSessionDumperTest, SetFoldStatusLocked, Function | SmallTest | Level1)
1231 {
1232     int fd = 1;
1233     std::vector<std::u16string> args = {u""};
1234     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1235     int ret = dumper->SetFoldStatusLocked();
1236     ASSERT_EQ(ret, -1);
1237 
1238     dumper->params_[0] = "-l";
1239     ret = dumper->SetFoldStatusLocked();
1240     ASSERT_EQ(ret, 0);
1241 
1242     dumper->params_[0] = "-u";
1243     ret = dumper->SetFoldStatusLocked();
1244     ASSERT_EQ(ret, 0);
1245 
1246     dumper->params_[0] = "-test";
1247     ret = dumper->SetFoldStatusLocked();
1248     ASSERT_EQ(ret, -1);
1249 }
1250 
1251 /**
1252  * @tc.name: SetFoldDisplayMode
1253  * @tc.desc: test function : SetFoldDisplayMode
1254  * @tc.type: FUNC
1255  */
1256 HWTEST_F(ScreenSessionDumperTest, SetFoldDisplayMode, Function | SmallTest | Level1)
1257 {
1258     int fd = 1;
1259     std::vector<std::u16string> args = {u""};
1260     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1261     int ret = dumper->SetFoldDisplayMode();
1262     ASSERT_EQ(ret, -1);
1263 
1264     dumper->params_[0] = "-sub";
1265     ret = dumper->SetFoldDisplayMode();
1266     ASSERT_EQ(ret, 0);
1267 
1268     dumper->params_[0] = "-coor";
1269     ret = dumper->SetFoldDisplayMode();
1270     ASSERT_EQ(ret, 0);
1271 
1272     dumper->params_[0] = "-m";
1273     ret = dumper->SetFoldDisplayMode();
1274     ASSERT_EQ(ret, 0);
1275 
1276     dumper->params_[0] = "-f";
1277     ret = dumper->SetFoldDisplayMode();
1278     ASSERT_EQ(ret, 0);
1279 
1280     dumper->params_[0] = "-test";
1281     ret = dumper->SetFoldDisplayMode();
1282     ASSERT_EQ(ret, -1);
1283 }
1284 
1285 /**
1286  * @tc.name: SetEnterOrExitTentMode
1287  * @tc.desc: test function : SetEnterOrExitTentMode
1288  * @tc.type: FUNC
1289  */
1290 HWTEST_F(ScreenSessionDumperTest, SetEnterOrExitTentMode, Function | SmallTest | Level1)
1291 {
1292     int fd = 1;
1293     std::vector<std::u16string> args = {u"-h"};
1294     sptr<ScreenSessionDumper> dumper = new ScreenSessionDumper(fd, args);
1295 
1296     dumper->SetEnterOrExitTentMode("-offtent");
1297     bool tentMode = ScreenSessionManager::GetInstance().GetTentMode();
1298     ASSERT_EQ(tentMode, false);
1299 }
1300 
1301 #endif // FOLD_ABILITY_ENABLE
1302 }
1303 }
1304 }