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 #include "window_session_property.h"
18
19 using namespace testing;
20 using namespace testing::ext;
21
22 namespace OHOS {
23 namespace Rosen {
24
25 class WindowSessionPropertyTest : public testing::Test {
26 public:
27 static void SetUpTestCase();
28 static void TearDownTestCase();
29 };
30
SetUpTestCase()31 void WindowSessionPropertyTest::SetUpTestCase() {}
32
TearDownTestCase()33 void WindowSessionPropertyTest::TearDownTestCase() {}
34
35 namespace {
36 /**
37 * @tc.name: SetDragEnabled001
38 * @tc.desc: SetDragEnabled and GetDragEnabled to check the value
39 * @tc.type: FUNC
40 */
41 HWTEST_F(WindowSessionPropertyTest, SetDragEnabled001, TestSize.Level1)
42 {
43 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
44 ASSERT_NE(nullptr, property);
45 property->SetDragEnabled(true);
46 ASSERT_EQ(property->GetDragEnabled(), true);
47 property->SetDragEnabled(false);
48 ASSERT_EQ(property->GetDragEnabled(), false);
49 }
50
51 /**
52 * @tc.name: SetRaiseEnabled001
53 * @tc.desc: SetRaiseEnabled and GetRaiseEnabled to check the value
54 * @tc.type: FUNC
55 */
56 HWTEST_F(WindowSessionPropertyTest, SetRaiseEnabled001, TestSize.Level1)
57 {
58 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
59 ASSERT_NE(nullptr, property);
60 property->SetRaiseEnabled(true);
61 ASSERT_EQ(property->GetRaiseEnabled(), true);
62 property->SetRaiseEnabled(false);
63 ASSERT_EQ(property->GetRaiseEnabled(), false);
64 }
65
66 /**
67 * @tc.name: WindowSessionProperty
68 * @tc.desc: WindowSessionProperty
69 * @tc.type: FUNC
70 */
71 HWTEST_F(WindowSessionPropertyTest, WindowSessionProperty, TestSize.Level1)
72 {
73 const sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
74 ASSERT_NE(nullptr, property);
75 sptr<WindowSessionProperty> targetProperty = sptr<WindowSessionProperty>::MakeSptr(property);
76 ASSERT_NE(nullptr, targetProperty);
77 ASSERT_EQ(property->GetDragEnabled(), targetProperty->GetDragEnabled());
78 }
79
80 /**
81 * @tc.name: SetSessionInfo
82 * @tc.desc: SetSessionInfo
83 * @tc.type: FUNC
84 */
85 HWTEST_F(WindowSessionPropertyTest, SetSessionInfo, TestSize.Level1)
86 {
87 SessionInfo* info = new SessionInfo();
88 ASSERT_NE(nullptr, info);
89 info->bundleName_ = "test";
90 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
91 ASSERT_NE(nullptr, property);
92 property->SetSessionInfo(*info);
93 auto result = property->GetSessionInfo();
94 ASSERT_EQ(result.bundleName_, info->bundleName_);
95 delete info;
96 }
97
98 /**
99 * @tc.name: SetPrivacyMode
100 * @tc.desc: SetPrivacyMode as true and false
101 * @tc.type: FUNC
102 */
103 HWTEST_F(WindowSessionPropertyTest, SetPrivacyMode, TestSize.Level0)
104 {
105 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
106 ASSERT_NE(nullptr, property);
107 ASSERT_EQ(property->GetPrivacyMode(), false);
108 property->SetPrivacyMode(true);
109 ASSERT_EQ(property->GetPrivacyMode(), true);
110 property->SetPrivacyMode(false);
111 ASSERT_EQ(property->GetPrivacyMode(), false);
112 }
113
114 /**
115 * @tc.name: SetSystemPrivacyMode
116 * @tc.desc: SetSystemPrivacyMode test
117 * @tc.type: FUNC
118 */
119 HWTEST_F(WindowSessionPropertyTest, SetSystemPrivacyMode, TestSize.Level1)
120 {
121 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
122 ASSERT_NE(nullptr, property);
123 property->SetSystemPrivacyMode(false);
124 ASSERT_EQ(property->GetSystemPrivacyMode(), false);
125 property->SetSystemPrivacyMode(true);
126 ASSERT_EQ(property->GetSystemPrivacyMode(), true);
127 }
128
129 /**
130 * @tc.name: SetBrightness
131 * @tc.desc: SetBrightness test
132 * @tc.type: FUNC
133 */
134 HWTEST_F(WindowSessionPropertyTest, SetBrightness, TestSize.Level1)
135 {
136 float brightness = 0.02;
137 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
138 ASSERT_NE(nullptr, property);
139 property->SetBrightness(brightness);
140 ASSERT_EQ(brightness, property->GetBrightness());
141 }
142
143 /**
144 * @tc.name: SetTopmost
145 * @tc.desc: SetTopmost test
146 * @tc.type: FUNC
147 */
148 HWTEST_F(WindowSessionPropertyTest, SetTopmost, TestSize.Level1)
149 {
150 bool topmost = true;
151 WindowSessionProperty windowSessionProperty;
152 windowSessionProperty.SetTopmost(topmost);
153 ASSERT_TRUE(windowSessionProperty.IsTopmost());
154 }
155
156 /**
157 * @tc.name: SetMainWindowTopmost
158 * @tc.desc: SetMainWindowTopmost test
159 * @tc.type: FUNC
160 */
161 HWTEST_F(WindowSessionPropertyTest, SetMainWindowTopmost, TestSize.Level1)
162 {
163 bool isTopmost = true;
164 WindowSessionProperty windowSessionProperty;
165 windowSessionProperty.SetMainWindowTopmost(isTopmost);
166 ASSERT_TRUE(windowSessionProperty.IsMainWindowTopmost());
167 }
168
169 /**
170 * @tc.name: GetParentId
171 * @tc.desc: GetParentId test
172 * @tc.type: FUNC
173 */
174 HWTEST_F(WindowSessionPropertyTest, GetParentId, TestSize.Level1)
175 {
176 WindowSessionProperty windowSessionProperty;
177 windowSessionProperty.SetParentId(0);
178 int32_t result = windowSessionProperty.GetParentId();
179 ASSERT_EQ(0, result);
180 }
181
182 /**
183 * @tc.name: SetWindowFlags
184 * @tc.desc: SetWindowFlags test
185 * @tc.type: FUNC
186 */
187 HWTEST_F(WindowSessionPropertyTest, SetWindowFlags, TestSize.Level1)
188 {
189 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
190 ASSERT_NE(nullptr, property);
191 property->SetWindowFlags(0);
192 ASSERT_EQ(property->GetWindowFlags(), 0);
193 }
194
195 /**
196 * @tc.name: SetAndGetPipTemplateInfo
197 * @tc.desc: SetAndGetPipTemplateInfo test
198 * @tc.type: FUNC
199 */
200 HWTEST_F(WindowSessionPropertyTest, SetAndGetPipTemplateInfo, TestSize.Level1)
201 {
202 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
203 ASSERT_NE(nullptr, property);
204 PiPTemplateInfo pipTemplateInfo;
205 pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
206 property->SetPiPTemplateInfo(pipTemplateInfo);
207 ASSERT_EQ(property->GetPiPTemplateInfo().pipTemplateType, static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL));
208 }
209
210 /**
211 * @tc.name: SetAndGetRealParentId
212 * @tc.desc: SetRealParentId and GetRealParentId test
213 * @tc.type: FUNC
214 */
215 HWTEST_F(WindowSessionPropertyTest, SetAndGetRealParentId, TestSize.Level1)
216 {
217 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
218 ASSERT_NE(property, nullptr);
219 property->SetRealParentId(1919);
220 EXPECT_EQ(1919, property->GetRealParentId());
221 property->SetRealParentId(810);
222 EXPECT_EQ(810, property->GetRealParentId());
223 }
224
225 /**
226 * @tc.name: SetAndGetUIExtensionUsage
227 * @tc.desc: SetUIExtensionUsage and GetUIExtensionUsage test
228 * @tc.type: FUNC
229 */
230 HWTEST_F(WindowSessionPropertyTest, SetAndGetUIExtensionUsage, TestSize.Level1)
231 {
232 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
233 ASSERT_NE(property, nullptr);
234 property->SetUIExtensionUsage(UIExtensionUsage::MODAL);
235 EXPECT_EQ(UIExtensionUsage::MODAL, property->GetUIExtensionUsage());
236 property->SetUIExtensionUsage(UIExtensionUsage::EMBEDDED);
237 EXPECT_EQ(UIExtensionUsage::EMBEDDED, property->GetUIExtensionUsage());
238 }
239
240 /**
241 * @tc.name: SetParentWindowType
242 * @tc.desc: SetParentWindowType and GetParentWindowType test
243 * @tc.type: FUNC
244 */
245 HWTEST_F(WindowSessionPropertyTest, SetParentWindowType, TestSize.Level1)
246 {
247 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
248 ASSERT_NE(property, nullptr);
249 property->SetParentWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
250 EXPECT_EQ(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, property->GetParentWindowType());
251 property->SetParentWindowType(WindowType::WINDOW_TYPE_TOAST);
252 EXPECT_EQ(WindowType::WINDOW_TYPE_TOAST, property->GetParentWindowType());
253 }
254
255 /**
256 * @tc.name: SetAndGetIsUIExtensionAbilityProcess
257 * @tc.desc: SetIsUIExtensionAbilityProcess and GetIsUIExtensionAbilityProcess test
258 * @tc.type: FUNC
259 */
260 HWTEST_F(WindowSessionPropertyTest, SetAndGetIsUIExtensionAbilityProcess, TestSize.Level1)
261 {
262 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
263 ASSERT_NE(property, nullptr);
264 property->SetIsUIExtensionAbilityProcess(true);
265 EXPECT_EQ(true, property->GetIsUIExtensionAbilityProcess());
266 property->SetIsUIExtensionAbilityProcess(false);
267 EXPECT_EQ(false, property->GetIsUIExtensionAbilityProcess());
268 }
269
270 /**
271 * @tc.name: AddWindowFlag
272 * @tc.desc: AddWindowFlag test
273 * @tc.type: FUNC
274 */
275 HWTEST_F(WindowSessionPropertyTest, AddWindowFlag, TestSize.Level1)
276 {
277 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
278 ASSERT_NE(nullptr, property);
279 property->AddWindowFlag(WindowFlag::WINDOW_FLAG_NEED_AVOID);
280 uint32_t windowFlags = static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID);
281 ASSERT_EQ(property->GetWindowFlags(), windowFlags);
282 property->AddWindowFlag(WindowFlag::WINDOW_FLAG_PARENT_LIMIT);
283 windowFlags |= static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_PARENT_LIMIT);
284 ASSERT_EQ(property->GetWindowFlags(), windowFlags);
285 }
286
287 /**
288 * @tc.name: IsTurnScreenOn
289 * @tc.desc: IsTurnScreenOn test
290 * @tc.type: FUNC
291 */
292 HWTEST_F(WindowSessionPropertyTest, IsTurnScreenOn, TestSize.Level1)
293 {
294 WindowSessionProperty windowSessionProperty;
295 windowSessionProperty.SetTurnScreenOn(false);
296 bool result = windowSessionProperty.IsTurnScreenOn();
297 ASSERT_EQ(false, result);
298 }
299
300 /**
301 * @tc.name: IsKeepScreenOn
302 * @tc.desc: IsKeepScreenOn test
303 * @tc.type: FUNC
304 */
305 HWTEST_F(WindowSessionPropertyTest, IsKeepScreenOn, TestSize.Level1)
306 {
307 WindowSessionProperty windowSessionProperty;
308 windowSessionProperty.SetKeepScreenOn(false);
309 bool result = windowSessionProperty.IsKeepScreenOn();
310 ASSERT_EQ(false, result);
311 }
312
313 /**
314 * @tc.name: GetAccessTokenId
315 * @tc.desc: GetAccessTokenId test
316 * @tc.type: FUNC
317 */
318 HWTEST_F(WindowSessionPropertyTest, GetAccessTokenId, TestSize.Level1)
319 {
320 WindowSessionProperty windowSessionProperty;
321 windowSessionProperty.SetAccessTokenId(false);
322 auto result = windowSessionProperty.GetAccessTokenId();
323 ASSERT_EQ(false, result);
324 }
325
326 /**
327 * @tc.name: SetTokenState
328 * @tc.desc: SetTokenState test
329 * @tc.type: FUNC
330 */
331 HWTEST_F(WindowSessionPropertyTest, SetTokenState, TestSize.Level1)
332 {
333 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
334 ASSERT_NE(nullptr, property);
335 property->SetTokenState(false);
336 ASSERT_EQ(property->GetTokenState(), false);
337 property->SetTokenState(true);
338 ASSERT_EQ(property->GetTokenState(), true);
339 }
340
341 /**
342 * @tc.name: SetMaximizeMode
343 * @tc.desc: SetMaximizeMode test
344 * @tc.type: FUNC
345 */
346 HWTEST_F(WindowSessionPropertyTest, SetMaximizeMode, TestSize.Level1)
347 {
348 WindowSessionProperty windowSessionProperty;
349 MaximizeMode mode = MaximizeMode::MODE_RECOVER;
350 windowSessionProperty.SetMaximizeMode(mode);
351 ASSERT_EQ(windowSessionProperty.GetMaximizeMode(), mode);
352 }
353
354 /**
355 * @tc.name: SetSystemBarProperty
356 * @tc.desc: SetSystemBarProperty test
357 * @tc.type: FUNC
358 */
359 HWTEST_F(WindowSessionPropertyTest, SetSystemBarProperty, TestSize.Level1)
360 {
361 SystemBarProperty* systemBarProperty = new SystemBarProperty();
362 ASSERT_NE(nullptr, systemBarProperty);
363 WindowType windowType = WindowType::WINDOW_TYPE_STATUS_BAR;
364 WindowSessionProperty windowSessionProperty;
365 windowSessionProperty.SetSystemBarProperty(windowType, *systemBarProperty);
366 auto sysBarPropMap = windowSessionProperty.GetSystemBarProperty();
367 auto sysBarProperty = sysBarPropMap[windowType];
368 ASSERT_EQ(sysBarProperty, *systemBarProperty);
369 delete systemBarProperty;
370 }
371
372 /**
373 * @tc.name: IsDecorEnable
374 * @tc.desc: IsDecorEnable test
375 * @tc.type: FUNC
376 */
377 HWTEST_F(WindowSessionPropertyTest, IsDecorEnable, TestSize.Level1)
378 {
379 WindowSessionProperty windowSessionProperty;
380 windowSessionProperty.SetDecorEnable(false);
381 auto result = windowSessionProperty.IsDecorEnable();
382 ASSERT_EQ(false, result);
383 }
384
385 /**
386 * @tc.name: SetWindowModeSupportType
387 * @tc.desc: SetWindowModeSupportType test
388 * @tc.type: FUNC
389 */
390 HWTEST_F(WindowSessionPropertyTest, SetWindowModeSupportType, TestSize.Level1)
391 {
392 uint32_t windowModeSupportType = static_cast<uint32_t>(WindowModeSupport::WINDOW_MODE_SUPPORT_ALL);
393 WindowSessionProperty windowSessionProperty;
394 windowSessionProperty.SetWindowModeSupportType(windowModeSupportType);
395 ASSERT_EQ(windowSessionProperty.GetWindowModeSupportType(), windowModeSupportType);
396 }
397
398 /**
399 * @tc.name: IsFloatingWindowAppType
400 * @tc.desc: IsFloatingWindowAppType test
401 * @tc.type: FUNC
402 */
403 HWTEST_F(WindowSessionPropertyTest, IsFloatingWindowAppType, TestSize.Level1)
404 {
405 WindowSessionProperty windowSessionProperty;
406 windowSessionProperty.SetFloatingWindowAppType(false);
407 auto result = windowSessionProperty.IsFloatingWindowAppType();
408 ASSERT_EQ(false, result);
409 }
410
411 /**
412 * @tc.name: SetTouchHotAreas
413 * @tc.desc: SetTouchHotAreas test
414 * @tc.type: FUNC
415 */
416 HWTEST_F(WindowSessionPropertyTest, SetTouchHotAreas, TestSize.Level0)
417 {
418 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
419 Rect rect{ 4, 4, 4, 4 };
420 std::vector<Rect> vRect{ rect };
421 property->SetPersistentId(0);
422 property->SetSessionPropertyChangeCallback(nullptr);
423 EXPECT_EQ(nullptr, property->touchHotAreasChangeCallback_);
424 property->SetTouchHotAreas(vRect);
425
__anon238d2e5a0202() 426 auto func = []() {};
427 property->SetPersistentId(1);
428 property->SetSessionPropertyChangeCallback(func);
429 property->SetTouchHotAreas(vRect);
430 EXPECT_NE(nullptr, property->touchHotAreasChangeCallback_);
431
432 Rect rect1{ 5, 5, 5, 5 };
433 vRect.emplace_back(rect1);
434 property->SetTouchHotAreas(vRect);
435 }
436
437 /**
438 * @tc.name: SetKeyboardTouchHotAreas
439 * @tc.desc: SetKeyboardTouchHotAreas test
440 * @tc.type: FUNC
441 */
442 HWTEST_F(WindowSessionPropertyTest, SetKeyboardTouchHotAreas, TestSize.Level1)
443 {
444 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
445 KeyboardTouchHotAreas hotAreas;
446 Rect rect{ 4, 4, 4, 4 };
447 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
448 hotAreas.landscapePanelHotAreas_.push_back(rect);
449 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
450 hotAreas.portraitPanelHotAreas_.push_back(rect);
451 property->SetPersistentId(0);
452 property->SetSessionPropertyChangeCallback(nullptr);
453 EXPECT_EQ(nullptr, property->touchHotAreasChangeCallback_);
454 property->SetKeyboardTouchHotAreas(hotAreas);
455
__anon238d2e5a0302() 456 auto func = []() {};
457 property->SetPersistentId(1);
458 property->SetSessionPropertyChangeCallback(func);
459 property->SetKeyboardTouchHotAreas(hotAreas);
460 EXPECT_NE(nullptr, property->touchHotAreasChangeCallback_);
461
462 Rect rect1{ 5, 5, 5, 5 };
463 hotAreas.landscapeKeyboardHotAreas_.push_back(rect1);
464 hotAreas.landscapePanelHotAreas_.push_back(rect1);
465 hotAreas.portraitKeyboardHotAreas_.push_back(rect1);
466 hotAreas.portraitPanelHotAreas_.push_back(rect1);
467 property->SetKeyboardTouchHotAreas(hotAreas);
468 }
469
470 /**
471 * @tc.name: UnmarshallingWindowLimits
472 * @tc.desc: UnmarshallingWindowLimits test
473 * @tc.type: FUNC
474 */
475 HWTEST_F(WindowSessionPropertyTest, UnmarshallingWindowLimits, TestSize.Level1)
476 {
477 Parcel parcel = Parcel();
478 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
479 ASSERT_NE(nullptr, property);
480 WindowSessionProperty windowSessionProperty;
481 windowSessionProperty.UnmarshallingWindowLimits(parcel, property);
482 }
483
484 /**
485 * @tc.name: Unmarshalling
486 * @tc.desc: test whether unmarshalling property is ok
487 * @tc.type: FUNC
488 */
489 HWTEST_F(WindowSessionPropertyTest, Unmarshalling, TestSize.Level1)
490 {
491 std::string winName = "test";
492 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
493 property->SetWindowName(winName);
494 Parcel parcel = Parcel();
495 property->Marshalling(parcel);
496 sptr<WindowSessionProperty> property2 = property->Unmarshalling(parcel);
497 ASSERT_NE(property2, nullptr);
498 EXPECT_EQ(property2->GetWindowName(), winName);
499 }
500
501 /**
502 * @tc.name: UnMarshallingSystemBarMap
503 * @tc.desc: UnMarshallingSystemBarMap test
504 * @tc.type: FUNC
505 */
506 HWTEST_F(WindowSessionPropertyTest, UnMarshallingSystemBarMap, TestSize.Level1)
507 {
508 Parcel parcel = Parcel();
509 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
510 ASSERT_NE(nullptr, property);
511 WindowSessionProperty windowSessionProperty;
512 windowSessionProperty.MarshallingSystemBarMap(parcel);
513 windowSessionProperty.UnMarshallingSystemBarMap(parcel, property);
514 }
515
516 /**
517 * @tc.name: UnmarshallingTouchHotAreas
518 * @tc.desc: UnmarshallingTouchHotAreas test
519 * @tc.type: FUNC
520 */
521 HWTEST_F(WindowSessionPropertyTest, UnmarshallingTouchHotAreas, TestSize.Level1)
522 {
523 Parcel parcel;
524 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
525 Rect rect{ 4, 4, 4, 4 };
526 std::vector<Rect> vRect{ rect };
527 WindowSessionProperty windowSessionProperty;
528 windowSessionProperty.SetTouchHotAreas(vRect);
529 windowSessionProperty.MarshallingTouchHotAreas(parcel);
530 windowSessionProperty.UnmarshallingTouchHotAreas(parcel, property);
531 ASSERT_NE(0, property->touchHotAreas_.size());
532 }
533
534 /**
535 * @tc.name: UnmarshallingKeyboardTouchHotAreas
536 * @tc.desc: UnmarshallingKeyboardTouchHotAreas test
537 * @tc.type: FUNC
538 */
539 HWTEST_F(WindowSessionPropertyTest, UnmarshallingKeyboardTouchHotAreas, TestSize.Level1)
540 {
541 Parcel parcel;
542 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
543 KeyboardTouchHotAreas hotAreas;
544 Rect rect{ 4, 4, 4, 4 };
545 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
546 hotAreas.landscapePanelHotAreas_.push_back(rect);
547 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
548 hotAreas.portraitPanelHotAreas_.push_back(rect);
549 WindowSessionProperty windowSessionProperty;
550 windowSessionProperty.SetKeyboardTouchHotAreas(hotAreas);
551 windowSessionProperty.MarshallingKeyboardTouchHotAreas(parcel);
552 windowSessionProperty.UnmarshallingKeyboardTouchHotAreas(parcel, property);
553 ASSERT_NE(0, property->keyboardTouchHotAreas_.landscapeKeyboardHotAreas_.size());
554 }
555
556 /**
557 * @tc.name: UnmarshallingPiPTemplateInfo
558 * @tc.desc: UnmarshallingPiPTemplateInfo test
559 * @tc.type: FUNC
560 */
561 HWTEST_F(WindowSessionPropertyTest, UnmarshallingPiPTemplateInfo, TestSize.Level1)
562 {
563 Parcel parcel = Parcel();
564 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
565 EXPECT_NE(nullptr, property);
566 property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
567 EXPECT_EQ(WindowType::WINDOW_TYPE_PIP, property->GetWindowType());
568 PiPTemplateInfo pipTemplateInfo;
569 pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
570 property->SetPiPTemplateInfo(pipTemplateInfo);
571 property->MarshallingPiPTemplateInfo(parcel);
572 property->UnmarshallingPiPTemplateInfo(parcel, property);
573 }
574
575 /**
576 * @tc.name: CopyFrom
577 * @tc.desc: CopyFrom test
578 * @tc.type: FUNC
579 */
580 HWTEST_F(WindowSessionPropertyTest, CopyFrom, TestSize.Level1)
581 {
582 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
583 EXPECT_NE(nullptr, property);
584 std::string name = "test";
585 property->SetWindowName(name);
586 WindowSessionProperty windowSessionProperty;
587 windowSessionProperty.CopyFrom(property);
588 ASSERT_EQ(windowSessionProperty.GetWindowName(), name);
589 }
590
591 /**
592 * @tc.name: SetFocusable
593 * @tc.desc: SetFocusable and GetFocusable to check the value
594 * @tc.type: FUNC
595 */
596 HWTEST_F(WindowSessionPropertyTest, SetFocusable, TestSize.Level1)
597 {
598 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
599 ASSERT_NE(nullptr, property);
600 property->SetFocusable(true);
601 ASSERT_EQ(property->GetFocusable(), true);
602 property->SetFocusable(false);
603 ASSERT_EQ(property->GetFocusable(), false);
604 }
605
606 /**
607 * @tc.name: SetTouchable
608 * @tc.desc: SetTouchable and GetTouchable to check the value
609 * @tc.type: FUNC
610 */
611 HWTEST_F(WindowSessionPropertyTest, SetTouchable, TestSize.Level1)
612 {
613 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
614 ASSERT_NE(nullptr, property);
615 property->SetTouchable(true);
616 ASSERT_EQ(property->GetTouchable(), true);
617 property->SetTouchable(false);
618 ASSERT_EQ(property->GetTouchable(), false);
619 }
620
621 /**
622 * @tc.name: SetForceHide
623 * @tc.desc: SetForceHide and GetForceHide to check the value
624 * @tc.type: FUNC
625 */
626 HWTEST_F(WindowSessionPropertyTest, SetForceHide, TestSize.Level1)
627 {
628 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
629 ASSERT_NE(nullptr, property);
630 property->SetForceHide(false);
631 ASSERT_EQ(property->GetForceHide(), false);
632 property->SetForceHide(true);
633 ASSERT_EQ(property->GetForceHide(), true);
634 }
635
636 /**
637 * @tc.name: SetSystemCalling
638 * @tc.desc: SetSystemCalling and GetSystemCalling to check the value
639 * @tc.type: FUNC
640 */
641 HWTEST_F(WindowSessionPropertyTest, SetSystemCalling, TestSize.Level1)
642 {
643 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
644 ASSERT_NE(nullptr, property);
645 property->SetSystemCalling(false);
646 ASSERT_EQ(property->GetSystemCalling(), false);
647 property->SetSystemCalling(true);
648 ASSERT_EQ(property->GetSystemCalling(), true);
649 }
650
651 /**
652 * @tc.name: SetIsNeedUpdateWindowMode
653 * @tc.desc: SetIsNeedUpdateWindowMode and GetIsNeedUpdateWindowMode to check the value
654 * @tc.type: FUNC
655 */
656 HWTEST_F(WindowSessionPropertyTest, SetIsNeedUpdateWindowMode, TestSize.Level1)
657 {
658 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
659 ASSERT_NE(nullptr, property);
660 property->SetIsNeedUpdateWindowMode(false);
661 ASSERT_EQ(property->GetIsNeedUpdateWindowMode(), false);
662 property->SetIsNeedUpdateWindowMode(true);
663 ASSERT_EQ(property->GetIsNeedUpdateWindowMode(), true);
664 }
665
666 /**
667 * @tc.name: SetIsShaped
668 * @tc.desc: SetIsShaped and GetIsShaped to check the value
669 * @tc.type: FUNC
670 */
671 HWTEST_F(WindowSessionPropertyTest, SetIsShaped, TestSize.Level1)
672 {
673 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
674 ASSERT_NE(nullptr, property);
675 property->SetIsShaped(false);
676 ASSERT_EQ(property->GetIsShaped(), false);
677 property->SetIsShaped(true);
678 ASSERT_EQ(property->GetIsShaped(), true);
679 }
680
681 /**
682 * @tc.name: SetCollaboratorType
683 * @tc.desc: SetCollaboratorType and GetCollaboratorType to check the value
684 * @tc.type: FUNC
685 */
686 HWTEST_F(WindowSessionPropertyTest, SetCollaboratorType, TestSize.Level1)
687 {
688 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
689 ASSERT_NE(nullptr, property);
690 int32_t typeValue = static_cast<int32_t>(CollaboratorType::DEFAULT_TYPE);
691 property->SetCollaboratorType(typeValue);
692 ASSERT_EQ(property->GetCollaboratorType(), typeValue);
693 typeValue = static_cast<int32_t>(CollaboratorType::RESERVE_TYPE);
694 property->SetCollaboratorType(typeValue);
695 ASSERT_EQ(property->GetCollaboratorType(), typeValue);
696 typeValue = static_cast<int32_t>(CollaboratorType::OTHERS_TYPE);
697 property->SetCollaboratorType(typeValue);
698 ASSERT_EQ(property->GetCollaboratorType(), typeValue);
699 }
700
701 /**
702 * @tc.name: SetUserWindowLimits
703 * @tc.desc: SetUserWindowLimits and GetUserWindowLimits to check the value
704 * @tc.type: FUNC
705 */
706 HWTEST_F(WindowSessionPropertyTest, SetUserWindowLimits, TestSize.Level1)
707 {
708 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
709 ASSERT_NE(nullptr, property);
710 WindowLimits limits;
711 limits.minWidth_ = 10;
712 property->SetUserWindowLimits(limits);
713 WindowLimits result = property->GetUserWindowLimits();
714 ASSERT_EQ(result.minWidth_, limits.minWidth_);
715 }
716
717 /**
718 * @tc.name: SetConfigWindowLimitsVP
719 * @tc.desc: SetConfigWindowLimitsVP and GetConfigWindowLimitsVP to check the value
720 * @tc.type: FUNC
721 */
722 HWTEST_F(WindowSessionPropertyTest, SetConfigWindowLimitsVP, TestSize.Level1)
723 {
724 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
725 ASSERT_NE(nullptr, property);
726 WindowLimits limits;
727 limits.minWidth_ = 10;
728 property->SetConfigWindowLimitsVP(limits);
729 WindowLimits result = property->GetConfigWindowLimitsVP();
730 ASSERT_EQ(result.minWidth_, limits.minWidth_);
731 }
732
733 /**
734 * @tc.name: SetLastLimitsVpr
735 * @tc.desc: SetLastLimitsVpr and GetLastLimitsVpr to check the value
736 * @tc.type: FUNC
737 */
738 HWTEST_F(WindowSessionPropertyTest, SetLastLimitsVpr, TestSize.Level1)
739 {
740 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
741 ASSERT_NE(nullptr, property);
742 float vpr = 1.0f;
743 property->SetLastLimitsVpr(vpr);
744 auto result = property->GetLastLimitsVpr();
745 ASSERT_EQ(result, vpr);
746 }
747
748 /**
749 * @tc.name: SetFullScreenStart
750 * @tc.desc: SetFullScreenStart and GetFullScreenStart to check the value
751 * @tc.type: FUNC
752 */
753 HWTEST_F(WindowSessionPropertyTest, SetFullScreenStart, TestSize.Level1)
754 {
755 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
756 ASSERT_NE(nullptr, property);
757 property->SetFullScreenStart(true);
758 ASSERT_EQ(property->GetFullScreenStart(), true);
759 property->SetFullScreenStart(false);
760 ASSERT_EQ(property->GetFullScreenStart(), false);
761 }
762
763 /**
764 * @tc.name: SetHideNonSystemFloatingWindows
765 * @tc.desc: SetHideNonSystemFloatingWindows and GetHideNonSystemFloatingWindows to check the value
766 * @tc.type: FUNC
767 */
768 HWTEST_F(WindowSessionPropertyTest, SetHideNonSystemFloatingWindows, TestSize.Level1)
769 {
770 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
771 ASSERT_NE(nullptr, property);
772 property->SetHideNonSystemFloatingWindows(false);
773 ASSERT_EQ(property->GetHideNonSystemFloatingWindows(), false);
774 property->SetHideNonSystemFloatingWindows(true);
775 ASSERT_EQ(property->GetHideNonSystemFloatingWindows(), true);
776 }
777
778 /**
779 * @tc.name: KeepKeyboardOnFocus
780 * @tc.desc: KeepKeyboardOnFocus and GetKeepKeyboardFlag to check the value
781 * @tc.type: FUNC
782 */
783 HWTEST_F(WindowSessionPropertyTest, KeepKeyboardOnFocus, TestSize.Level1)
784 {
785 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
786 ASSERT_NE(nullptr, property);
787 property->KeepKeyboardOnFocus(false);
788 ASSERT_EQ(property->GetKeepKeyboardFlag(), false);
789 property->KeepKeyboardOnFocus(true);
790 ASSERT_EQ(property->GetKeepKeyboardFlag(), true);
791 }
792
793 /**
794 * @tc.name: SetTextFieldPositionY
795 * @tc.desc: SetTextFieldPositionY and GetTextFieldPositionY to check the value
796 * @tc.type: FUNC
797 */
798 HWTEST_F(WindowSessionPropertyTest, SetTextFieldPositionY, TestSize.Level1)
799 {
800 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
801 ASSERT_NE(nullptr, property);
802 property->SetTextFieldPositionY(5.5);
803 ASSERT_EQ(property->GetTextFieldPositionY(), 5.5);
804 }
805
806 /**
807 * @tc.name: SetTextFieldHeight
808 * @tc.desc: SetTextFieldHeight and GetTextFieldHeight to check the value
809 * @tc.type: FUNC
810 */
811 HWTEST_F(WindowSessionPropertyTest, SetTextFieldHeight, TestSize.Level1)
812 {
813 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
814 ASSERT_NE(nullptr, property);
815 property->SetTextFieldHeight(5.5);
816 ASSERT_EQ(property->GetTextFieldHeight(), 5.5);
817 }
818
819 /**
820 * @tc.name: SetIsLayoutFullScreen
821 * @tc.desc: SetIsLayoutFullScreen and IsLayoutFullScreen to check the value
822 * @tc.type: FUNC
823 */
824 HWTEST_F(WindowSessionPropertyTest, SetIsLayoutFullScreen, TestSize.Level1)
825 {
826 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
827 ASSERT_NE(nullptr, property);
828 property->SetIsLayoutFullScreen(false);
829 ASSERT_EQ(property->IsLayoutFullScreen(), false);
830 property->SetIsLayoutFullScreen(true);
831 ASSERT_EQ(property->IsLayoutFullScreen(), true);
832 }
833
834 /**
835 * @tc.name: Read
836 * @tc.desc: Read test
837 * @tc.type: FUNC
838 */
839 HWTEST_F(WindowSessionPropertyTest, Read, TestSize.Level1)
840 {
841 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
842 ASSERT_NE(property, nullptr);
843 Parcel parcel = Parcel();
844 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_RECT);
845 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON);
846 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON);
847 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE);
848 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE);
849 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS);
850 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION);
851 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE);
852 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE);
853 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP);
854 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE);
855 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS);
856 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS);
857 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS);
858 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS);
859 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_FLAGS);
860 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MODE);
861 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG);
862 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA);
863 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE);
864 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS);
865 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED);
866 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED);
867 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS);
868 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO);
869 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK);
870 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOPMOST);
871 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL);
872 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO);
873 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST);
874 ASSERT_EQ(property->GetPersistentId(), INVALID_SESSION_ID);
875 }
876
877 /**
878 * @tc.name: Write
879 * @tc.desc: Write and Read to check the value
880 * @tc.type: FUNC
881 */
882 HWTEST_F(WindowSessionPropertyTest, Write, TestSize.Level1)
883 {
884 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
885 ASSERT_NE(property, nullptr);
886 Parcel parcel = Parcel();
887 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_RECT);
888 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON);
889 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON);
890 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE);
891 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE);
892 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS);
893 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION);
894 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE);
895 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE);
896 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP);
897 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE);
898 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS);
899 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS);
900 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS);
901 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS);
902 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_FLAGS);
903 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_MODE);
904 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG);
905 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA);
906 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE);
907 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS);
908 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED);
909 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED);
910 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS);
911 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO);
912 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK);
913 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_TOPMOST);
914 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL);
915 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO);
916 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST);
917 property->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_AVOID_AREA_OPTION);
918 ASSERT_EQ(property->GetPersistentId(), INVALID_SESSION_ID);
919 }
920
921 /**
922 * @tc.name: GetWindowName
923 * @tc.desc: GetWindowName
924 * @tc.type: FUNC
925 */
926 HWTEST_F(WindowSessionPropertyTest, GetWindowName, TestSize.Level1)
927 {
928 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
929 ASSERT_NE(nullptr, property);
930 std::string name = "test";
931 property->SetWindowName(name);
932 auto result = property->GetWindowName();
933 ASSERT_EQ(result, name);
934 }
935
936 /**
937 * @tc.name: GetSessionInfo
938 * @tc.desc: GetSessionInfo
939 * @tc.type: FUNC
940 */
941 HWTEST_F(WindowSessionPropertyTest, GetSessionInfo, TestSize.Level1)
942 {
943 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
944 ASSERT_NE(nullptr, property);
945 SessionInfo* info = new SessionInfo();
946 ASSERT_NE(nullptr, info);
947 info->bundleName_ = "test";
948 property->SetSessionInfo(*info);
949 auto result = property->GetSessionInfo();
950 ASSERT_EQ(result.bundleName_, info->bundleName_);
951 delete info;
952 }
953
954 /**
955 * @tc.name: EditSessionInfo
956 * @tc.desc: EditSessionInfo
957 * @tc.type: FUNC
958 */
959 HWTEST_F(WindowSessionPropertyTest, EditSessionInfo, TestSize.Level1)
960 {
961 std::string abilityName = "1234";
962 std::string abilityNameNew = "12345";
963 SessionInfo info;
964 info.abilityName_ = abilityName;
965 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
966 ASSERT_NE(nullptr, property);
967 property->SetSessionInfo(info);
968 property->EditSessionInfo().abilityName_ = abilityNameNew;
969 ASSERT_EQ(property->EditSessionInfo().abilityName_, abilityNameNew);
970 }
971
972 /**
973 * @tc.name: SetGlobalDisplayRect
974 * @tc.desc: test whether get the value that set before
975 * @tc.type: FUNC
976 */
977 HWTEST_F(WindowSessionPropertyTest, SetGlobalDisplayRect, TestSize.Level1)
978 {
979 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
980 ASSERT_NE(property, nullptr);
981 Rect rect = { 10, 10, 20, 20 };
982 property->SetGlobalDisplayRect(rect);
983 auto result = property->GetGlobalDisplayRect();
984 EXPECT_EQ(result, rect);
985 }
986
987 /**
988 * @tc.name: GetWindowRect
989 * @tc.desc: GetWindowRect
990 * @tc.type: FUNC
991 */
992 HWTEST_F(WindowSessionPropertyTest, GetWindowRect, TestSize.Level1)
993 {
994 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
995 ASSERT_NE(nullptr, property);
996 Rect rect = { 0, 0, 0, 0 };
997 property->SetWindowRect(rect);
998 auto result = property->GetWindowRect();
999 ASSERT_EQ(result, rect);
1000 }
1001
1002 /**
1003 * @tc.name: GetWindowSizeLimits
1004 * @tc.desc: GetWindowSizeLimits
1005 * @tc.type: FUNC
1006 */
1007 HWTEST_F(WindowSessionPropertyTest, GetWindowSizeLimits, TestSize.Level1)
1008 {
1009 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1010 WindowSizeLimits windowSizeLimits = { 0, 0, 0, 0 };
1011 property->SetWindowSizeLimits(windowSizeLimits);
1012 auto result = property->GetWindowSizeLimits();
1013 ASSERT_EQ(result, windowSizeLimits);
1014 }
1015
1016 /**
1017 * @tc.name: GetRequestRect
1018 * @tc.desc: GetRequestRect
1019 * @tc.type: FUNC
1020 */
1021 HWTEST_F(WindowSessionPropertyTest, GetRequestRect, TestSize.Level1)
1022 {
1023 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1024 ASSERT_NE(nullptr, property);
1025 Rect requestRect = { 0, 0, 0, 0 };
1026 property->SetRequestRect(requestRect);
1027 auto result = property->GetRequestRect();
1028 ASSERT_EQ(result, requestRect);
1029 }
1030
1031 /**
1032 * @tc.name: GetWindowType
1033 * @tc.desc: GetWindowType
1034 * @tc.type: FUNC
1035 */
1036 HWTEST_F(WindowSessionPropertyTest, GetWindowType, TestSize.Level1)
1037 {
1038 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1039 ASSERT_NE(nullptr, property);
1040 WindowType type = WindowType::APP_WINDOW_BASE;
1041 property->SetWindowType(type);
1042 auto result = property->GetWindowType();
1043 ASSERT_EQ(result, type);
1044 }
1045
1046 /**
1047 * @tc.name: GetDisplayId
1048 * @tc.desc: GetDisplayId
1049 * @tc.type: FUNC
1050 */
1051 HWTEST_F(WindowSessionPropertyTest, GetDisplayId, TestSize.Level1)
1052 {
1053 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1054 ASSERT_NE(nullptr, property);
1055 DisplayId displayId = 1;
1056 property->SetDisplayId(displayId);
1057 auto result = property->GetDisplayId();
1058 ASSERT_EQ(result, displayId);
1059 }
1060
1061 /**
1062 * @tc.name: GetPersistentId
1063 * @tc.desc: GetPersistentId
1064 * @tc.type: FUNC
1065 */
1066 HWTEST_F(WindowSessionPropertyTest, GetPersistentId, TestSize.Level1)
1067 {
1068 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1069 ASSERT_NE(nullptr, property);
1070 int32_t persistentId = 1;
1071 property->SetPersistentId(persistentId);
1072 auto result = property->GetPersistentId();
1073 ASSERT_EQ(result, persistentId);
1074 }
1075
1076 /**
1077 * @tc.name: GetParentPersistentId
1078 * @tc.desc: GetParentPersistentId
1079 * @tc.type: FUNC
1080 */
1081 HWTEST_F(WindowSessionPropertyTest, GetParentPersistentId, TestSize.Level1)
1082 {
1083 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1084 ASSERT_NE(nullptr, property);
1085 int32_t persistentId = 1;
1086 property->SetParentPersistentId(persistentId);
1087 auto result = property->GetParentPersistentId();
1088 ASSERT_EQ(result, persistentId);
1089 }
1090
1091 /**
1092 * @tc.name: SetTurnScreenOn
1093 * @tc.desc: SetTurnScreenOn
1094 * @tc.type: FUNC
1095 */
1096 HWTEST_F(WindowSessionPropertyTest, SetTurnScreenOn, TestSize.Level1)
1097 {
1098 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1099 ASSERT_NE(nullptr, property);
1100 bool turnScreenOn = false;
1101 property->SetTurnScreenOn(turnScreenOn);
1102 ASSERT_EQ(property->IsTurnScreenOn(), turnScreenOn);
1103 }
1104
1105 /**
1106 * @tc.name: SetKeepScreenOn
1107 * @tc.desc: SetKeepScreenOn
1108 * @tc.type: FUNC
1109 */
1110 HWTEST_F(WindowSessionPropertyTest, SetKeepScreenOn, TestSize.Level1)
1111 {
1112 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1113 ASSERT_NE(nullptr, property);
1114 bool keepScreenOn = true;
1115 property->SetKeepScreenOn(keepScreenOn);
1116 ASSERT_EQ(keepScreenOn, property->IsKeepScreenOn());
1117 keepScreenOn = false;
1118 property->SetKeepScreenOn(keepScreenOn);
1119 ASSERT_EQ(keepScreenOn, property->IsKeepScreenOn());
1120 }
1121
1122 /**
1123 * @tc.name: SetViewKeepScreenOn
1124 * @tc.desc: SetViewKeepScreenOn And IsViewKeepScreenOn
1125 * @tc.type: FUNC
1126 */
1127 HWTEST_F(WindowSessionPropertyTest, SetViewKeepScreenOn, TestSize.Level1)
1128 {
1129 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1130 ASSERT_NE(nullptr, property);
1131 bool keepScreenOn = true;
1132 property->SetViewKeepScreenOn(keepScreenOn);
1133 ASSERT_EQ(keepScreenOn, property->IsViewKeepScreenOn());
1134 keepScreenOn = false;
1135 property->SetViewKeepScreenOn(keepScreenOn);
1136 ASSERT_EQ(keepScreenOn, property->IsViewKeepScreenOn());
1137 }
1138
1139 /**
1140 * @tc.name: SetWindowShadowEnabled
1141 * @tc.desc: SetWindowShadowEnabled And GetWindowShadowEnabled
1142 * @tc.type: FUNC
1143 */
1144 HWTEST_F(WindowSessionPropertyTest, SetWindowShadowEnabled, TestSize.Level1)
1145 {
1146 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1147 ASSERT_NE(nullptr, property);
1148 bool isEnabled = true;
1149 property->SetWindowShadowEnabled(isEnabled);
1150 EXPECT_NE(isEnabled, property->GetWindowShadowEnabled());
1151 isEnabled = false;
1152 property->SetWindowShadowEnabled(isEnabled);
1153 EXPECT_NE(isEnabled, property->GetWindowShadowEnabled());
1154 }
1155
1156 /**
1157 * @tc.name: MarshallingSessionInfo
1158 * @tc.desc: MarshallingSessionInfo test
1159 * @tc.type: FUNC
1160 */
1161 HWTEST_F(WindowSessionPropertyTest, MarshallingSessionInfo, TestSize.Level1)
1162 {
1163 Parcel parcel;
1164 SessionInfo info = { "testBundleName", "testModuleName", "testAbilityName" };
1165 info.want = std::make_shared<AAFwk::Want>();
1166 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1167 ASSERT_NE(nullptr, property);
1168 bool result = property->MarshallingSessionInfo(parcel);
1169 ASSERT_EQ(result, true);
1170 }
1171
1172 /**
1173 * @tc.name: UnMarshallingSessionInfo
1174 * @tc.desc: UnMarshallingSessionInfo test
1175 * @tc.type: FUNC
1176 */
1177 HWTEST_F(WindowSessionPropertyTest, UnMarshallingSessionInfo, TestSize.Level1)
1178 {
1179 Parcel parcel;
1180 WindowSessionProperty windowSessionProperty;
1181 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1182 ASSERT_NE(nullptr, property);
1183 SessionInfo info = { "testBundleName", "testModuleName", "testAbilityName" };
1184 info.want = std::make_shared<AAFwk::Want>();
1185 bool result = property->MarshallingSessionInfo(parcel);
1186 ASSERT_EQ(result, true);
1187 result = property->UnmarshallingSessionInfo(parcel, &windowSessionProperty);
1188 ASSERT_EQ(result, true);
1189 }
1190
1191 /**
1192 * @tc.name: MarshallingTransitionAnimationMap
1193 * @tc.desc: MarshallingTransitionAnimationMap test
1194 * @tc.type: FUNC
1195 */
1196 HWTEST_F(WindowSessionPropertyTest, MarshallingTransitionAnimationMap, TestSize.Level1)
1197 {
1198 Parcel parcel;
1199 TransitionAnimation animation;
1200 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1201 ASSERT_NE(nullptr, property);
1202 bool result = property->MarshallingTransitionAnimationMap(parcel);
1203 ASSERT_EQ(result, true);
1204 property->transitionAnimationConfig_[WindowTransitionType::DESTROY] =
1205 std::make_shared<TransitionAnimation>(animation);
1206 result = property->MarshallingTransitionAnimationMap(parcel);
1207 ASSERT_EQ(result, true);
1208 property->transitionAnimationConfig_[WindowTransitionType::DESTROY] = nullptr;
1209 result = property->MarshallingTransitionAnimationMap(parcel);
1210 ASSERT_EQ(result, false);
1211 }
1212
1213 /**
1214 * @tc.name: UnmarshallingTransitionAnimationMap
1215 * @tc.desc: UnmarshallingTransitionAnimationMap test
1216 * @tc.type: FUNC
1217 */
1218 HWTEST_F(WindowSessionPropertyTest, UnmarshallingTransitionAnimationMap, TestSize.Level1)
1219 {
1220 Parcel parcel;
1221 TransitionAnimation animation;
1222 WindowSessionProperty windowSessionProperty;
1223 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1224 ASSERT_NE(nullptr, property);
1225 property->transitionAnimationConfig_[WindowTransitionType::DESTROY] =
1226 std::make_shared<TransitionAnimation>(animation);
1227 bool result = property->MarshallingTransitionAnimationMap(parcel);
1228 ASSERT_EQ(result, true);
1229 result = property->UnmarshallingTransitionAnimationMap(parcel, &windowSessionProperty);
1230 ASSERT_EQ(result, true);
1231 }
1232
1233 /**
1234 * @tc.name: SetAccessTokenId
1235 * @tc.desc: SetAccessTokenId
1236 * @tc.type: FUNC
1237 */
1238 HWTEST_F(WindowSessionPropertyTest, SetAccessTokenId, TestSize.Level1)
1239 {
1240 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1241 ASSERT_NE(nullptr, property);
1242 uint32_t accessTokenId = 1;
1243 property->SetAccessTokenId(accessTokenId);
1244 ASSERT_EQ(property->accessTokenId_, accessTokenId);
1245 }
1246
1247 /**
1248 * @tc.name: GetWindowState
1249 * @tc.desc: GetWindowState
1250 * @tc.type: FUNC
1251 */
1252 HWTEST_F(WindowSessionPropertyTest, GetWindowState, TestSize.Level1)
1253 {
1254 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1255 ASSERT_NE(nullptr, property);
1256 WindowState state = WindowState::STATE_INITIAL;
1257 property->SetWindowState(state);
1258 auto result = property->GetWindowState();
1259 ASSERT_EQ(result, state);
1260 }
1261
1262 /**
1263 * @tc.name: SetSystemPrivacyMode02
1264 * @tc.desc: SetSystemPrivacyMode
1265 * @tc.type: FUNC
1266 */
1267 HWTEST_F(WindowSessionPropertyTest, SetSystemPrivacyMode02, TestSize.Level1)
1268 {
1269 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1270 ASSERT_NE(nullptr, property);
1271 bool isSystemPrivate = false;
1272 property->SetSystemPrivacyMode(isSystemPrivate);
1273 ASSERT_EQ(property->GetSystemPrivacyMode(), isSystemPrivate);
1274 }
1275
1276 /**
1277 * @tc.name: SetTokenState02
1278 * @tc.desc: SetTokenState
1279 * @tc.type: FUNC
1280 */
1281 HWTEST_F(WindowSessionPropertyTest, SetTokenState02, TestSize.Level1)
1282 {
1283 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1284 ASSERT_NE(nullptr, property);
1285 bool hasToken = false;
1286 property->SetTokenState(hasToken);
1287 ASSERT_EQ(property->GetTokenState(), hasToken);
1288 }
1289
1290 /**
1291 * @tc.name: MarshallingTouchHotAreas
1292 * @tc.desc: MarshallingTouchHotAreas test
1293 * @tc.type: FUNC
1294 */
1295 HWTEST_F(WindowSessionPropertyTest, MarshallingTouchHotAreas, TestSize.Level1)
1296 {
1297 Parcel parcel;
1298 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1299 std::vector<Rect> rects;
1300 for (int i = 0; i < 55; i++) {
1301 Rect rect{ i, i, i, i };
1302 rects.push_back(rect);
1303 }
1304 property->SetTouchHotAreas(rects);
1305 bool result = property->MarshallingTouchHotAreas(parcel);
1306 ASSERT_EQ(result, false);
1307 }
1308
1309 /**
1310 * @tc.name: MarshallingKeyboardTouchHotAreas
1311 * @tc.desc: MarshallingKeyboardTouchHotAreas test
1312 * @tc.type: FUNC
1313 */
1314 HWTEST_F(WindowSessionPropertyTest, MarshallingKeyboardTouchHotAreas, TestSize.Level1)
1315 {
1316 Parcel parcel;
1317 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1318 KeyboardTouchHotAreas hotAreas;
1319 for (int i = 0; i < 55; i++) {
1320 Rect rect{ i, i, i, i };
1321 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
1322 hotAreas.landscapePanelHotAreas_.push_back(rect);
1323 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
1324 hotAreas.portraitPanelHotAreas_.push_back(rect);
1325 }
1326 property->SetKeyboardTouchHotAreas(hotAreas);
1327 bool result = property->MarshallingKeyboardTouchHotAreas(parcel);
1328 ASSERT_EQ(result, false);
1329 }
1330
1331 /**
1332 * @tc.name: UnmarshallingPiPTemplateInfo02
1333 * @tc.desc: UnmarshallingPiPTemplateInfo test
1334 * @tc.type: FUNC
1335 */
1336 HWTEST_F(WindowSessionPropertyTest, UnmarshallingPiPTemplateInfo02, TestSize.Level1)
1337 {
1338 Parcel parcel = Parcel();
1339 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1340 ASSERT_NE(nullptr, property);
1341 property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1342 WindowSessionProperty windowSessionProperty;
1343 windowSessionProperty.UnmarshallingPiPTemplateInfo(parcel, property);
1344 }
1345
1346 /**
1347 * @tc.name: MarshallingPiPTemplateInfo
1348 * @tc.desc: MarshallingPiPTemplateInfo test
1349 * @tc.type: FUNC
1350 */
1351 HWTEST_F(WindowSessionPropertyTest, MarshallingPiPTemplateInfo, TestSize.Level1)
1352 {
1353 Parcel parcel = Parcel();
1354 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1355 ASSERT_NE(nullptr, property);
1356 property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
1357 auto info = property->GetPiPTemplateInfo();
1358 for (int i = 0; i < 10; i++) {
1359 info.controlGroup.push_back(i);
1360 }
1361 property->SetPiPTemplateInfo(info);
1362 bool result = property->MarshallingPiPTemplateInfo(parcel);
1363 ASSERT_EQ(result, false);
1364 }
1365
1366 /**
1367 * @tc.name: SetIsPcAppInPad/GetIsPcAppInPad
1368 * @tc.desc: SetIsPcAppInPad/GetIsPcAppInPad
1369 * @tc.type: FUNC
1370 */
1371 HWTEST_F(WindowSessionPropertyTest, SetIsPcAppInPad, TestSize.Level1)
1372 {
1373 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1374 ASSERT_NE(nullptr, property);
1375 bool isPcAppInLargeScreenDevice = true;
1376 property->SetIsPcAppInPad(isPcAppInLargeScreenDevice);
1377 auto result = property->GetIsPcAppInPad();
1378 ASSERT_EQ(result, isPcAppInLargeScreenDevice);
1379 }
1380
1381 /**
1382 * @tc.name: SetSubWindowLevel
1383 * @tc.desc: SetSubWindowLevel Test
1384 * @tc.type: FUNC
1385 */
1386 HWTEST_F(WindowSessionPropertyTest, SetSubWindowLevel, TestSize.Level1)
1387 {
1388 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1389 EXPECT_NE(property, nullptr);
1390 uint32_t level = 4;
1391 property->SetSubWindowLevel(level);
1392 ASSERT_EQ(level, property->GetSubWindowLevel());
1393 }
1394
1395 /**
1396 * @tc.name: GetSubWindowLevel
1397 * @tc.desc: GetSubWindowLevel Test
1398 * @tc.type: FUNC
1399 */
1400 HWTEST_F(WindowSessionPropertyTest, GetSubWindowLevel, TestSize.Level1)
1401 {
1402 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1403 EXPECT_NE(property, nullptr);
1404 property->SetSubWindowLevel(1);
1405 ASSERT_EQ(1, property->GetSubWindowLevel());
1406 }
1407
1408 /**
1409 * @tc.name: GetSubWindowZLevel
1410 * @tc.desc: GetSubWindowZLevel Test
1411 * @tc.type: FUNC
1412 */
1413 HWTEST_F(WindowSessionPropertyTest, GetSubWindowZLevel, TestSize.Level1)
1414 {
1415 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1416 int32_t zLevel = 1;
1417 property->zLevel_ = zLevel;
1418 ASSERT_EQ(zLevel, property->GetSubWindowZLevel());
1419 }
1420
1421 /**
1422 * @tc.name: SetSubWindowZLevel
1423 * @tc.desc: SetSubWindowZLevel Test
1424 * @tc.type: FUNC
1425 */
1426 HWTEST_F(WindowSessionPropertyTest, SetSubWindowZLevel, TestSize.Level1)
1427 {
1428 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1429 int32_t zLevel = 1;
1430 property->SetSubWindowZLevel(zLevel);
1431 ASSERT_EQ(zLevel, property->zLevel_);
1432 }
1433
1434 /**
1435 * @tc.name: GetWindowAnchorInfo
1436 * @tc.desc: GetWindowAnchorInfo Test
1437 * @tc.type: FUNC
1438 */
1439 HWTEST_F(WindowSessionPropertyTest, GetWindowAnchorInfo, TestSize.Level1)
1440 {
1441 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1442 ASSERT_NE(nullptr, property);
1443 WindowAnchorInfo anchorInfo = { true, WindowAnchor::TOP_START, 0, 0 };
1444 property->windowAnchorInfo_ = anchorInfo;
1445 EXPECT_EQ(anchorInfo, property->GetWindowAnchorInfo());
1446 }
1447
1448 /**
1449 * @tc.name: SetWindowAnchorInfo
1450 * @tc.desc: SetWindowAnchorInfo Test
1451 * @tc.type: FUNC
1452 */
1453 HWTEST_F(WindowSessionPropertyTest, SetWindowAnchorInfo, TestSize.Level1)
1454 {
1455 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1456 ASSERT_NE(nullptr, property);
1457 WindowAnchorInfo anchorInfo = { true, WindowAnchor::TOP_START, 0, 0 };
1458 property->SetWindowAnchorInfo(anchorInfo);
1459 EXPECT_EQ(anchorInfo, property->windowAnchorInfo_);
1460 }
1461
1462 /**
1463 * @tc.name: UnmarshallingWindowAnchorInfo
1464 * @tc.desc: UnmarshallingWindowAnchorInfo Test
1465 * @tc.type: FUNC
1466 */
1467 HWTEST_F(WindowSessionPropertyTest, UnmarshallingWindowAnchorInfo, TestSize.Level1)
1468 {
1469 Parcel parcel = Parcel();
1470 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1471 ASSERT_NE(nullptr, property);
1472 WindowSessionProperty windowSessionProperty;
1473 windowSessionProperty.UnmarshallingWindowAnchorInfo(parcel, property);
1474 EXPECT_EQ(property->GetTokenState(), false);
1475 }
1476
1477 /**
1478 * @tc.name: GetZIndex
1479 * @tc.desc: GetZIndex Test
1480 * @tc.type: FUNC
1481 */
1482 HWTEST_F(WindowSessionPropertyTest, GetZIndex, Function | SmallTest | Level2)
1483 {
1484 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1485 int32_t zIndex = 1;
1486 property->zIndex_ = zIndex;
1487 ASSERT_EQ(zIndex, property->GetZIndex());
1488 }
1489
1490 /**
1491 * @tc.name: SetZIndex
1492 * @tc.desc: SetZIndex Test
1493 * @tc.type: FUNC
1494 */
1495 HWTEST_F(WindowSessionPropertyTest, SetZIndex, Function | SmallTest | Level2)
1496 {
1497 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1498 int32_t zIndex = 1;
1499 property->SetZIndex(zIndex);
1500 ASSERT_EQ(zIndex, property->zIndex_);
1501 }
1502 /**
1503 * @tc.name: SetAndIsSystemKeyboard
1504 * @tc.desc: SetIsSystemKeyboard and IsSystemKeyboard Test
1505 * @tc.type: FUNC
1506 */
1507 HWTEST_F(WindowSessionPropertyTest, SetAndIsSystemKeyboard, TestSize.Level1)
1508 {
1509 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1510 ASSERT_EQ(false, property->IsSystemKeyboard());
1511 property->SetIsSystemKeyboard(true);
1512 ASSERT_EQ(true, property->IsSystemKeyboard());
1513 }
1514
1515 /**
1516 * @tc.name: SetAvoidAreaOption
1517 * @tc.desc: SetAvoidAreaOption Test
1518 * @tc.type: FUNC
1519 */
1520 HWTEST_F(WindowSessionPropertyTest, SetAvoidAreaOption, TestSize.Level1)
1521 {
1522 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1523 uint32_t avoidAreaOption = 0;
1524 property->SetAvoidAreaOption(avoidAreaOption);
1525 ASSERT_EQ(avoidAreaOption, property->GetAvoidAreaOption());
1526 avoidAreaOption = 2;
1527 property->SetAvoidAreaOption(avoidAreaOption);
1528 ASSERT_EQ(avoidAreaOption, property->GetAvoidAreaOption());
1529 }
1530
1531 /**
1532 * @tc.name: GetAvoidAreaOption
1533 * @tc.desc: GetAvoidAreaOption Test
1534 * @tc.type: FUNC
1535 */
1536 HWTEST_F(WindowSessionPropertyTest, GetAvoidAreaOption, TestSize.Level1)
1537 {
1538 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1539 uint32_t avoidAreaOption = 2;
1540 property->SetAvoidAreaOption(avoidAreaOption);
1541 ASSERT_EQ(2, property->GetAvoidAreaOption());
1542 }
1543
1544 /**
1545 * @tc.name: SetBackgroundAlpha
1546 * @tc.desc: SetBackgroundAlpha Test
1547 * @tc.type: FUNC
1548 */
1549 HWTEST_F(WindowSessionPropertyTest, SetBackgroundAlpha, TestSize.Level1)
1550 {
1551 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1552 uint8_t backgroundAlpha = 0;
1553 property->SetBackgroundAlpha(backgroundAlpha);
1554 ASSERT_EQ(backgroundAlpha, property->GetBackgroundAlpha());
1555 backgroundAlpha = 2;
1556 property->SetBackgroundAlpha(backgroundAlpha);
1557 ASSERT_EQ(backgroundAlpha, property->GetBackgroundAlpha());
1558 }
1559
1560 /**
1561 * @tc.name: GetBackgroundAlpha
1562 * @tc.desc: GetBackgroundAlpha Test
1563 * @tc.type: FUNC
1564 */
1565 HWTEST_F(WindowSessionPropertyTest, GetBackgroundAlpha, TestSize.Level1)
1566 {
1567 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1568 uint8_t backgroundAlpha = 2;
1569 property->SetBackgroundAlpha(backgroundAlpha);
1570 ASSERT_EQ(2, property->GetBackgroundAlpha());
1571 }
1572
1573 /**
1574 * @tc.name: GetIsAtomicService
1575 * @tc.desc: GetIsAtomicService
1576 * @tc.type: FUNC
1577 */
1578 HWTEST_F(WindowSessionPropertyTest, GetIsAtomicService, TestSize.Level1)
1579 {
1580 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1581 bool isAtomicService = true;
1582 property->SetIsAtomicService(isAtomicService);
1583 auto result = property->GetIsAtomicService();
1584 ASSERT_EQ(result, isAtomicService);
1585 }
1586
1587 /**
1588 * @tc.name: SetPcAppInpadCompatibleMode
1589 * @tc.desc: SetPcAppInpadCompatibleMode
1590 * @tc.type: FUNC
1591 */
1592 HWTEST_F(WindowSessionPropertyTest, SetPcAppInpadCompatibleMode, TestSize.Level1)
1593 {
1594 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1595 bool enabled = true;
1596 property->SetPcAppInpadCompatibleMode(enabled);
1597 auto result = property->GetPcAppInpadCompatibleMode();
1598 ASSERT_EQ(result, enabled);
1599 }
1600
1601 /**
1602 * @tc.name: SetPcAppInpadSpecificSystemBarInvisible
1603 * @tc.desc: SetPcAppInpadSpecificSystemBarInvisible
1604 * @tc.type: FUNC
1605 */
1606 HWTEST_F(WindowSessionPropertyTest, SetPcAppInpadSpecificSystemBarInvisible, TestSize.Level1)
1607 {
1608 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1609 bool isPcAppInpadSpecificSystemBarInvisible = true;
1610 property->SetPcAppInpadSpecificSystemBarInvisible(isPcAppInpadSpecificSystemBarInvisible);
1611 auto result = property->GetPcAppInpadSpecificSystemBarInvisible();
1612 ASSERT_EQ(result, isPcAppInpadSpecificSystemBarInvisible);
1613 }
1614
1615 /**
1616 * @tc.name: SetPcAppInpadOrientationLandscape
1617 * @tc.desc: SetPcAppInpadOrientationLandscape
1618 * @tc.type: FUNC
1619 */
1620 HWTEST_F(WindowSessionPropertyTest, SetPcAppInpadOrientationLandscape, TestSize.Level1)
1621 {
1622 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1623 bool isPcAppInpadOrientationLandscape = true;
1624 property->SetPcAppInpadOrientationLandscape(isPcAppInpadOrientationLandscape);
1625 auto result = property->GetPcAppInpadOrientationLandscape();
1626 ASSERT_EQ(result, isPcAppInpadOrientationLandscape);
1627 }
1628
1629 /**
1630 * @tc.name: UnmarshallingFbTemplateInfoTest
1631 * @tc.desc: UnmarshallingFbTemplateInfoTest
1632 * @tc.type: FUNC
1633 */
1634 HWTEST_F(WindowSessionPropertyTest, UnmarshallingFbTemplateInfoTest, TestSize.Level1)
1635 {
1636 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1637 property->SetWindowType(WindowType::WINDOW_TYPE_FB);
1638
1639 Parcel parcel;
1640 std::shared_ptr<Media::PixelMap> icon;
1641 FloatingBallTemplateInfo fbTemplateInfo {{1, "fb", "fb_content", "red"}, icon};
1642 property->UnmarshallingFbTemplateInfo(parcel, property);
1643 ASSERT_NE(property->GetFbTemplateInfo().template_, fbTemplateInfo.template_);
1644 ASSERT_NE(property->GetFbTemplateInfo().title_, fbTemplateInfo.title_);
1645 ASSERT_NE(property->GetFbTemplateInfo().content_, fbTemplateInfo.content_);
1646 ASSERT_NE(property->GetFbTemplateInfo().backgroundColor_, fbTemplateInfo.backgroundColor_);
1647 ASSERT_EQ(property->GetFbTemplateInfo().icon_, fbTemplateInfo.icon_);
1648
1649 parcel.WriteParcelable(&fbTemplateInfo);
1650 property->UnmarshallingFbTemplateInfo(parcel, property);
1651 ASSERT_EQ(property->GetFbTemplateInfo().template_, fbTemplateInfo.template_);
1652 ASSERT_EQ(property->GetFbTemplateInfo().title_, fbTemplateInfo.title_);
1653 ASSERT_EQ(property->GetFbTemplateInfo().content_, fbTemplateInfo.content_);
1654 ASSERT_EQ(property->GetFbTemplateInfo().backgroundColor_, fbTemplateInfo.backgroundColor_);
1655 ASSERT_EQ(property->GetFbTemplateInfo().icon_, fbTemplateInfo.icon_);
1656 }
1657 } // namespace
1658 } // namespace Rosen
1659 } // namespace OHOS
1660