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 {
33 }
34
TearDownTestCase()35 void WindowSessionPropertyTest::TearDownTestCase()
36 {
37 }
38
39 namespace {
40 /**
41 * @tc.name: SetDragEnabled001
42 * @tc.desc: SetDragEnabled and GetDragEnabled to check the value
43 * @tc.type: FUNC
44 */
45 HWTEST_F(WindowSessionPropertyTest, SetDragEnabled001, Function | SmallTest | Level2)
46 {
47 WindowSessionProperty *property = new WindowSessionProperty();
48 ASSERT_EQ(property->GetDragEnabled(), true);
49 property->SetDragEnabled(false);
50 ASSERT_EQ(property->GetDragEnabled(), false);
51 }
52
53 /**
54 * @tc.name: SetRaiseEnabled001
55 * @tc.desc: SetRaiseEnabled and GetRaiseEnabled to check the value
56 * @tc.type: FUNC
57 */
58 HWTEST_F(WindowSessionPropertyTest, SetRaiseEnabled001, Function | SmallTest | Level2)
59 {
60 WindowSessionProperty *property = new WindowSessionProperty();
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, Function | SmallTest | Level2)
72 {
73 const sptr<WindowSessionProperty> property = new WindowSessionProperty();
74 ASSERT_EQ(property->GetDragEnabled(), true);
75 }
76
77 /**
78 * @tc.name: SetSessionInfo
79 * @tc.desc: SetSessionInfo
80 * @tc.type: FUNC
81 */
82 HWTEST_F(WindowSessionPropertyTest, SetSessionInfo, Function | SmallTest | Level2)
83 {
84 SessionInfo *info = new SessionInfo();
85 WindowSessionProperty *property = new WindowSessionProperty();
86 property->SetSessionInfo(*info);
87 ASSERT_EQ(property->GetRaiseEnabled(), true);
88 }
89 /**
90 * @tc.name: SetRequestedOrientation
91 * @tc.desc: SetRequestedOrientation test
92 * @tc.type: FUNC
93 */
94 HWTEST_F(WindowSessionPropertyTest, SetRequestedOrientation, Function | SmallTest | Level2)
95 {
96 Orientation orientation = Orientation::REVERSE_HORIZONTAL;
97 WindowSessionProperty *property = new WindowSessionProperty();
98 property->SetRequestedOrientation(orientation);
99 Orientation ret = property->GetRequestedOrientation();
100 ASSERT_EQ(ret, orientation);
101
102 property->SetRequestedOrientation(Orientation::AUTO_ROTATION_UNSPECIFIED);
103 Orientation ret1 = property->GetRequestedOrientation();
104 ASSERT_EQ(ret1, Orientation::AUTO_ROTATION_UNSPECIFIED);
105
106 property->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT);
107 Orientation ret2 = property->GetRequestedOrientation();
108 ASSERT_EQ(ret2, Orientation::USER_ROTATION_PORTRAIT);
109
110 property->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE);
111 Orientation ret3 = property->GetRequestedOrientation();
112 ASSERT_EQ(ret3, Orientation::USER_ROTATION_LANDSCAPE);
113
114 property->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT_INVERTED);
115 Orientation ret4 = property->GetRequestedOrientation();
116 ASSERT_EQ(ret4, Orientation::USER_ROTATION_PORTRAIT_INVERTED);
117
118 property->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
119 Orientation ret5 = property->GetRequestedOrientation();
120 ASSERT_EQ(ret5, Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
121
122 property->SetRequestedOrientation(Orientation::FOLLOW_DESKTOP);
123 Orientation ret6 = property->GetRequestedOrientation();
124 ASSERT_EQ(ret6, Orientation::FOLLOW_DESKTOP);
125 }
126
127 /**
128 * @tc.name: SetDefaultRequestedOrientation
129 * @tc.desc: SetDefaultRequestedOrientation test
130 * @tc.type: FUNC
131 */
132 HWTEST_F(WindowSessionPropertyTest, SetDefaultRequestedOrientation, Function | SmallTest | Level2)
133 {
134 Orientation orientation = Orientation::REVERSE_HORIZONTAL;
135 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
136 property->SetDefaultRequestedOrientation(orientation);
137 Orientation ret = property->GetDefaultRequestedOrientation();
138 ASSERT_EQ(ret, orientation);
139 }
140
141 /**
142 * @tc.name: SetPrivacyMode
143 * @tc.desc: SetPrivacyMode test
144 * @tc.type: FUNC
145 */
146 HWTEST_F(WindowSessionPropertyTest, SetPrivacyMode, Function | SmallTest | Level2)
147 {
148 WindowSessionProperty *property = new WindowSessionProperty();
149 ASSERT_EQ(property->GetPrivacyMode(), false);
150 property->SetPrivacyMode(false);
151 ASSERT_EQ(property->GetPrivacyMode(), false);
152 }
153
154 /**
155 * @tc.name: SetSystemPrivacyMode
156 * @tc.desc: SetSystemPrivacyMode test
157 * @tc.type: FUNC
158 */
159 HWTEST_F(WindowSessionPropertyTest, SetSystemPrivacyMode, Function | SmallTest | Level2)
160 {
161 WindowSessionProperty *property = new WindowSessionProperty();
162 ASSERT_EQ(property->GetSystemPrivacyMode(), false);
163 }
164
165 /**
166 * @tc.name: SetBrightness
167 * @tc.desc: SetBrightness test
168 * @tc.type: FUNC
169 */
170 HWTEST_F(WindowSessionPropertyTest, SetBrightness, Function | SmallTest | Level2)
171 {
172 float brightness = 0.02;
173 WindowSessionProperty windowSessionProperty;
174 windowSessionProperty.SetBrightness(brightness);
175 WindowSessionProperty *property = new WindowSessionProperty();
176 ASSERT_NE(property->GetBrightness(), 0);
177 }
178
179 /**
180 * @tc.name: SetTopmost
181 * @tc.desc: SetTopmost test
182 * @tc.type: FUNC
183 */
184 HWTEST_F(WindowSessionPropertyTest, SetTopmost, Function | SmallTest | Level2)
185 {
186 bool topmost = true;
187 WindowSessionProperty windowSessionProperty;
188 windowSessionProperty.SetTopmost(topmost);
189 ASSERT_TRUE(windowSessionProperty.IsTopmost());
190 }
191
192 /**
193 * @tc.name: SetMainWindowTopmost
194 * @tc.desc: SetMainWindowTopmost test
195 * @tc.type: FUNC
196 */
197 HWTEST_F(WindowSessionPropertyTest, SetMainWindowTopmost, Function | SmallTest | Level2)
198 {
199 bool isTopmost = true;
200 WindowSessionProperty windowSessionProperty;
201 windowSessionProperty.SetMainWindowTopmost(isTopmost);
202 ASSERT_TRUE(windowSessionProperty.IsMainWindowTopmost());
203 }
204
205 /**
206 * @tc.name: GetParentId
207 * @tc.desc: GetParentId test
208 * @tc.type: FUNC
209 */
210 HWTEST_F(WindowSessionPropertyTest, GetParentId, Function | SmallTest | Level2)
211 {
212 WindowSessionProperty windowSessionProperty;
213 int32_t result = windowSessionProperty.GetParentId();
214 ASSERT_EQ(0, result);
215 }
216
217 /**
218 * @tc.name: SetWindowFlags
219 * @tc.desc: SetWindowFlags test
220 * @tc.type: FUNC
221 */
222 HWTEST_F(WindowSessionPropertyTest, SetWindowFlags, Function | SmallTest | Level2)
223 {
224 WindowSessionProperty *property = new WindowSessionProperty();
225 ASSERT_EQ(property->GetWindowFlags(), 0);
226 }
227
228 /**
229 * @tc.name: SetAndGetPipTemplateInfo
230 * @tc.desc: SetAndGetPipTemplateInfo test
231 * @tc.type: FUNC
232 */
233 HWTEST_F(WindowSessionPropertyTest, SetAndGetPipTemplateInfo, Function | SmallTest | Level2)
234 {
235 WindowSessionProperty *property = new WindowSessionProperty();
236 PiPTemplateInfo pipTemplateInfo;
237 pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
238 property->SetPiPTemplateInfo(pipTemplateInfo);
239 ASSERT_EQ(property->GetPiPTemplateInfo().pipTemplateType,
240 static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL));
241 }
242
243 /**
244 * @tc.name: SetAndGetRealParentId
245 * @tc.desc: SetRealParentId and GetRealParentId test
246 * @tc.type: FUNC
247 */
248 HWTEST_F(WindowSessionPropertyTest, SetAndGetRealParentId, Function | SmallTest | Level2)
249 {
250 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
251 ASSERT_NE(property, nullptr);
252 property->SetRealParentId(1919);
253 EXPECT_EQ(1919, property->GetRealParentId());
254 property->SetRealParentId(810);
255 EXPECT_EQ(810, property->GetRealParentId());
256 }
257
258 /**
259 * @tc.name: SetAndGetUIExtensionUsage
260 * @tc.desc: SetUIExtensionUsage and GetUIExtensionUsage test
261 * @tc.type: FUNC
262 */
263 HWTEST_F(WindowSessionPropertyTest, SetAndGetUIExtensionUsage, Function | SmallTest | Level2)
264 {
265 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
266 ASSERT_NE(property, nullptr);
267 property->SetUIExtensionUsage(UIExtensionUsage::MODAL);
268 EXPECT_EQ(UIExtensionUsage::MODAL, property->GetUIExtensionUsage());
269 property->SetUIExtensionUsage(UIExtensionUsage::EMBEDDED);
270 EXPECT_EQ(UIExtensionUsage::EMBEDDED, property->GetUIExtensionUsage());
271 }
272
273 /**
274 * @tc.name: SetParentWindowType
275 * @tc.desc: SetParentWindowType and GetParentWindowType test
276 * @tc.type: FUNC
277 */
278 HWTEST_F(WindowSessionPropertyTest, SetParentWindowType, Function | SmallTest | Level2)
279 {
280 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
281 ASSERT_NE(property, nullptr);
282 property->SetParentWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
283 EXPECT_EQ(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, property->GetParentWindowType());
284 property->SetParentWindowType(WindowType::WINDOW_TYPE_TOAST);
285 EXPECT_EQ(WindowType::WINDOW_TYPE_TOAST, property->GetParentWindowType());
286 }
287
288 /**
289 * @tc.name: SetAndGetIsUIExtensionAbilityProcess
290 * @tc.desc: SetIsUIExtensionAbilityProcess and GetIsUIExtensionAbilityProcess test
291 * @tc.type: FUNC
292 */
293 HWTEST_F(WindowSessionPropertyTest, SetAndGetIsUIExtensionAbilityProcess, Function | SmallTest | Level2)
294 {
295 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
296 ASSERT_NE(property, nullptr);
297 property->SetIsUIExtensionAbilityProcess(true);
298 EXPECT_EQ(true, property->GetIsUIExtensionAbilityProcess());
299 property->SetIsUIExtensionAbilityProcess(false);
300 EXPECT_EQ(false, property->GetIsUIExtensionAbilityProcess());
301 }
302
303 /**
304 * @tc.name: AddWindowFlag
305 * @tc.desc: AddWindowFlag test
306 * @tc.type: FUNC
307 */
308 HWTEST_F(WindowSessionPropertyTest, AddWindowFlag, Function | SmallTest | Level2)
309 {
310 WindowFlag flags=WindowFlag();
311 WindowSessionProperty windowSessionProperty;
312 windowSessionProperty.AddWindowFlag(flags);
313 WindowSessionProperty *property = new WindowSessionProperty();
314 ASSERT_EQ(property->GetWindowFlags(), false);
315 }
316
317 /**
318 * @tc.name: IsTurnScreenOn
319 * @tc.desc: IsTurnScreenOn test
320 * @tc.type: FUNC
321 */
322 HWTEST_F(WindowSessionPropertyTest, IsTurnScreenOn, Function | SmallTest | Level2)
323 {
324 WindowSessionProperty windowSessionProperty;
325 bool result = windowSessionProperty.IsTurnScreenOn();
326 ASSERT_EQ(false, result);
327 }
328
329 /**
330 * @tc.name: IsKeepScreenOn
331 * @tc.desc: IsKeepScreenOn test
332 * @tc.type: FUNC
333 */
334 HWTEST_F(WindowSessionPropertyTest, IsKeepScreenOn, Function | SmallTest | Level2)
335 {
336 WindowSessionProperty windowSessionProperty;
337 bool result = windowSessionProperty.IsKeepScreenOn();
338 ASSERT_EQ(false, result);
339 }
340
341 /**
342 * @tc.name: GetAccessTokenId
343 * @tc.desc: GetAccessTokenId test
344 * @tc.type: FUNC
345 */
346 HWTEST_F(WindowSessionPropertyTest, GetAccessTokenId, Function | SmallTest | Level2)
347 {
348 WindowSessionProperty windowSessionProperty;
349 auto result = windowSessionProperty.GetAccessTokenId();
350 ASSERT_EQ(false, result);
351 }
352
353 /**
354 * @tc.name: SetTokenState
355 * @tc.desc: SetTokenState test
356 * @tc.type: FUNC
357 */
358 HWTEST_F(WindowSessionPropertyTest, SetTokenState, Function | SmallTest | Level2)
359 {
360 WindowSessionProperty *property = new WindowSessionProperty();
361 ASSERT_EQ(property->GetTokenState(), false);
362 }
363
364 /**
365 * @tc.name: SetMaximizeMode
366 * @tc.desc: SetMaximizeMode test
367 * @tc.type: FUNC
368 */
369 HWTEST_F(WindowSessionPropertyTest, SetMaximizeMode, Function | SmallTest | Level2)
370 {
371 WindowSessionProperty windowSessionProperty;
372 MaximizeMode mode = MaximizeMode::MODE_RECOVER;
373 windowSessionProperty.SetMaximizeMode(mode);
374 WindowSessionProperty *property = new WindowSessionProperty();
375 ASSERT_EQ(property->GetMaximizeMode(), mode);
376 }
377
378 /**
379 * @tc.name: SetSystemBarProperty
380 * @tc.desc: SetSystemBarProperty test
381 * @tc.type: FUNC
382 */
383 HWTEST_F(WindowSessionPropertyTest, SetSystemBarProperty, Function | SmallTest | Level2)
384 {
385 SystemBarProperty *systemBarProperty = new SystemBarProperty();
386 WindowType windowtype = WindowType::APP_WINDOW_BASE;
387 WindowSessionProperty windowSessionProperty;
388 windowSessionProperty.SetSystemBarProperty(windowtype, *systemBarProperty);
389 WindowSessionProperty *property = new WindowSessionProperty();
390 ASSERT_EQ(property->GetTokenState(), false);
391 }
392
393 /**
394 * @tc.name: IsDecorEnable
395 * @tc.desc: IsDecorEnable test
396 * @tc.type: FUNC
397 */
398 HWTEST_F(WindowSessionPropertyTest, IsDecorEnable, Function | SmallTest | Level2)
399 {
400 WindowSessionProperty windowSessionProperty;
401 auto result = windowSessionProperty.IsDecorEnable();
402 ASSERT_EQ(false, result);
403 }
404
405 /**
406 * @tc.name: SetWindowModeSupportType
407 * @tc.desc: SetWindowModeSupportType test
408 * @tc.type: FUNC
409 */
410 HWTEST_F(WindowSessionPropertyTest, SetWindowModeSupportType, Function | SmallTest | Level2)
411 {
412 uint32_t windowModeSupportType = 1234567890;
413 WindowSessionProperty windowSessionProperty;
414 windowSessionProperty.SetWindowModeSupportType(windowModeSupportType);
415 WindowSessionProperty *property = new WindowSessionProperty();
416 ASSERT_NE(property->GetWindowModeSupportType(), 0);
417 }
418 /**
419 * @tc.name: IsFloatingWindowAppType
420 * @tc.desc: IsFloatingWindowAppType test
421 * @tc.type: FUNC
422 */
423 HWTEST_F(WindowSessionPropertyTest, IsFloatingWindowAppType, Function | SmallTest | Level2)
424 {
425 WindowSessionProperty windowSessionProperty;
426 auto result = windowSessionProperty.IsFloatingWindowAppType();
427 ASSERT_EQ(false, result);
428 }
429
430 /**
431 * @tc.name: SetTouchHotAreas
432 * @tc.desc: SetTouchHotAreas test
433 * @tc.type: FUNC
434 */
435 HWTEST_F(WindowSessionPropertyTest, SetTouchHotAreas, Function | SmallTest | Level2)
436 {
437 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
438 Rect rect { 4, 4, 4, 4 };
439 std::vector<Rect> vRect { rect };
440 property->SetPersistentId(0);
441 property->SetSessionPropertyChangeCallback(nullptr);
442 EXPECT_EQ(nullptr, property->touchHotAreasChangeCallback_);
443 property->SetTouchHotAreas(vRect);
444
__anon3036937a0202() 445 auto func = []() {};
446 property->SetPersistentId(1);
447 property->SetSessionPropertyChangeCallback(func);
448 property->SetTouchHotAreas(vRect);
449 EXPECT_NE(nullptr, property->touchHotAreasChangeCallback_);
450
451 Rect rect1 { 5, 5, 5, 5 };
452 vRect.emplace_back(rect1);
453 property->SetTouchHotAreas(vRect);
454 }
455
456 /**
457 * @tc.name: SetKeyboardTouchHotAreas
458 * @tc.desc: SetKeyboardTouchHotAreas test
459 * @tc.type: FUNC
460 */
461 HWTEST_F(WindowSessionPropertyTest, SetKeyboardTouchHotAreas, Function | SmallTest | Level2)
462 {
463 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
464 KeyboardTouchHotAreas hotAreas;
465 Rect rect { 4, 4, 4, 4 };
466 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
467 hotAreas.landscapePanelHotAreas_.push_back(rect);
468 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
469 hotAreas.portraitPanelHotAreas_.push_back(rect);
470 property->SetPersistentId(0);
471 property->SetSessionPropertyChangeCallback(nullptr);
472 EXPECT_EQ(nullptr, property->touchHotAreasChangeCallback_);
473 property->SetKeyboardTouchHotAreas(hotAreas);
474
__anon3036937a0302() 475 auto func = []() {};
476 property->SetPersistentId(1);
477 property->SetSessionPropertyChangeCallback(func);
478 property->SetKeyboardTouchHotAreas(hotAreas);
479 EXPECT_NE(nullptr, property->touchHotAreasChangeCallback_);
480
481 Rect rect1 { 5, 5, 5, 5 };
482 hotAreas.landscapeKeyboardHotAreas_.push_back(rect1);
483 hotAreas.landscapePanelHotAreas_.push_back(rect1);
484 hotAreas.portraitKeyboardHotAreas_.push_back(rect1);
485 hotAreas.portraitPanelHotAreas_.push_back(rect1);
486 property->SetKeyboardTouchHotAreas(hotAreas);
487 }
488
489 /**
490 * @tc.name: UnmarshallingWindowLimits
491 * @tc.desc: UnmarshallingWindowLimits test
492 * @tc.type: FUNC
493 */
494 HWTEST_F(WindowSessionPropertyTest, UnmarshallingWindowLimits, Function | SmallTest | Level2)
495 {
496 Parcel parcel = Parcel();
497 WindowSessionProperty *property = new WindowSessionProperty();
498 WindowSessionProperty windowSessionProperty;
499 windowSessionProperty.UnmarshallingWindowLimits(parcel, property);
500 ASSERT_EQ(property->GetTokenState(), false);
501 }
502
503 /**
504 * @tc.name: UnMarshallingSystemBarMap
505 * @tc.desc: UnMarshallingSystemBarMap test
506 * @tc.type: FUNC
507 */
508 HWTEST_F(WindowSessionPropertyTest, UnMarshallingSystemBarMap, Function | SmallTest | Level2)
509 {
510 Parcel parcel = Parcel();
511 WindowSessionProperty *property = new WindowSessionProperty();
512 WindowSessionProperty windowSessionProperty;
513 windowSessionProperty.UnMarshallingSystemBarMap(parcel, property);
514 ASSERT_EQ(property->GetTokenState(), false);
515 }
516
517 /**
518 * @tc.name: UnmarshallingTouchHotAreas
519 * @tc.desc: UnmarshallingTouchHotAreas test
520 * @tc.type: FUNC
521 */
522 HWTEST_F(WindowSessionPropertyTest, UnmarshallingTouchHotAreas, Function | SmallTest | Level2)
523 {
524 Parcel parcel;
525 WindowSessionProperty *property = new WindowSessionProperty();
526 WindowSessionProperty windowSessionProperty;
527 windowSessionProperty.UnmarshallingTouchHotAreas(parcel, property);
528 ASSERT_EQ(property->GetTokenState(), false);
529 }
530
531 /**
532 * @tc.name: UnmarshallingKeyboardTouchHotAreas
533 * @tc.desc: UnmarshallingKeyboardTouchHotAreas test
534 * @tc.type: FUNC
535 */
536 HWTEST_F(WindowSessionPropertyTest, UnmarshallingKeyboardTouchHotAreas, Function | SmallTest | Level2)
537 {
538 Parcel parcel;
539 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
540 KeyboardTouchHotAreas hotAreas;
541 Rect rect { 4, 4, 4, 4 };
542 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
543 hotAreas.landscapePanelHotAreas_.push_back(rect);
544 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
545 hotAreas.portraitPanelHotAreas_.push_back(rect);
546 WindowSessionProperty windowSessionProperty;
547 windowSessionProperty.SetKeyboardTouchHotAreas(hotAreas);
548 windowSessionProperty.MarshallingKeyboardTouchHotAreas(parcel);
549 windowSessionProperty.UnmarshallingKeyboardTouchHotAreas(parcel, property);
550 ASSERT_NE(0, property->keyboardTouchHotAreas_.landscapeKeyboardHotAreas_.size());
551 }
552
553 /**
554 * @tc.name: UnmarshallingPiPTemplateInfo
555 * @tc.desc: UnmarshallingPiPTemplateInfo test
556 * @tc.type: FUNC
557 */
558 HWTEST_F(WindowSessionPropertyTest, UnmarshallingPiPTemplateInfo, Function | SmallTest | Level2)
559 {
560 Parcel parcel = Parcel();
561 WindowSessionProperty *property = new WindowSessionProperty();
562 EXPECT_NE(nullptr, property);
563 property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
564 EXPECT_EQ(WindowType::WINDOW_TYPE_PIP, property->GetWindowType());
565 property->UnmarshallingPiPTemplateInfo(parcel, property);
566 delete property;
567 }
568
569 /**
570 * @tc.name: CopyFrom
571 * @tc.desc: CopyFrom test
572 * @tc.type: FUNC
573 */
574 HWTEST_F(WindowSessionPropertyTest, CopyFrom, Function | SmallTest | Level2)
575 {
576 sptr<WindowSessionProperty> property = new WindowSessionProperty();
577 WindowSessionProperty windowSessionProperty;
578 windowSessionProperty.CopyFrom(property);
579 WindowSessionProperty *wproperty = new WindowSessionProperty();
580 ASSERT_EQ(wproperty->GetTokenState(), false);
581 }
582
583 /**
584 * @tc.name: SetFocusable
585 * @tc.desc: SetFocusable and GetFocusable to check the value
586 * @tc.type: FUNC
587 */
588 HWTEST_F(WindowSessionPropertyTest, SetFocusable, Function | SmallTest | Level2)
589 {
590 sptr<WindowSessionProperty> property = new WindowSessionProperty();
591 ASSERT_NE(nullptr, property);
592 ASSERT_EQ(property->GetFocusable(), true);
593 property->SetFocusable(false);
594 ASSERT_EQ(property->GetFocusable(), false);
595 }
596
597 /**
598 * @tc.name: SetTouchable
599 * @tc.desc: SetTouchable and GetTouchable to check the value
600 * @tc.type: FUNC
601 */
602 HWTEST_F(WindowSessionPropertyTest, SetTouchable, Function | SmallTest | Level2)
603 {
604 sptr<WindowSessionProperty> property = new WindowSessionProperty();
605 ASSERT_NE(nullptr, property);
606 ASSERT_EQ(property->GetTouchable(), true);
607 property->SetTouchable(false);
608 ASSERT_EQ(property->GetTouchable(), false);
609 }
610
611 /**
612 * @tc.name: SetForceHide
613 * @tc.desc: SetForceHide and GetForceHide to check the value
614 * @tc.type: FUNC
615 */
616 HWTEST_F(WindowSessionPropertyTest, SetForceHide, Function | SmallTest | Level2)
617 {
618 sptr<WindowSessionProperty> property = new WindowSessionProperty();
619 ASSERT_NE(nullptr, property);
620 ASSERT_EQ(property->GetForceHide(), false);
621 property->SetForceHide(true);
622 ASSERT_EQ(property->GetForceHide(), true);
623 }
624
625 /**
626 * @tc.name: SetSystemCalling
627 * @tc.desc: SetSystemCalling and GetSystemCalling to check the value
628 * @tc.type: FUNC
629 */
630 HWTEST_F(WindowSessionPropertyTest, SetSystemCalling, Function | SmallTest | Level2)
631 {
632 sptr<WindowSessionProperty> property = new WindowSessionProperty();
633 ASSERT_NE(nullptr, property);
634 ASSERT_EQ(property->GetSystemCalling(), false);
635 property->SetSystemCalling(true);
636 ASSERT_EQ(property->GetSystemCalling(), true);
637 }
638
639 /**
640 * @tc.name: SetIsNeedUpdateWindowMode
641 * @tc.desc: SetIsNeedUpdateWindowMode and GetIsNeedUpdateWindowMode to check the value
642 * @tc.type: FUNC
643 */
644 HWTEST_F(WindowSessionPropertyTest, SetIsNeedUpdateWindowMode, Function | SmallTest | Level2)
645 {
646 sptr<WindowSessionProperty> property = new WindowSessionProperty();
647 ASSERT_NE(nullptr, property);
648 ASSERT_EQ(property->GetIsNeedUpdateWindowMode(), false);
649 property->SetIsNeedUpdateWindowMode(true);
650 ASSERT_EQ(property->GetIsNeedUpdateWindowMode(), true);
651 }
652
653 /**
654 * @tc.name: SetIsShaped
655 * @tc.desc: SetIsShaped and GetIsShaped to check the value
656 * @tc.type: FUNC
657 */
658 HWTEST_F(WindowSessionPropertyTest, SetIsShaped, Function | SmallTest | Level2)
659 {
660 sptr<WindowSessionProperty> property = new WindowSessionProperty();
661 ASSERT_NE(nullptr, property);
662 ASSERT_EQ(property->GetIsShaped(), false);
663 property->SetIsShaped(true);
664 ASSERT_EQ(property->GetIsShaped(), true);
665 }
666
667 /**
668 * @tc.name: SetHideNonSystemFloatingWindows
669 * @tc.desc: SetHideNonSystemFloatingWindows and GetHideNonSystemFloatingWindows to check the value
670 * @tc.type: FUNC
671 */
672 HWTEST_F(WindowSessionPropertyTest, SetHideNonSystemFloatingWindows, Function | SmallTest | Level2)
673 {
674 sptr<WindowSessionProperty> property = new WindowSessionProperty();
675 ASSERT_NE(nullptr, property);
676 ASSERT_EQ(property->GetHideNonSystemFloatingWindows(), false);
677 property->SetHideNonSystemFloatingWindows(true);
678 ASSERT_EQ(property->GetHideNonSystemFloatingWindows(), true);
679 }
680
681 /**
682 * @tc.name: KeepKeyboardOnFocus
683 * @tc.desc: KeepKeyboardOnFocus and GetKeepKeyboardFlag to check the value
684 * @tc.type: FUNC
685 */
686 HWTEST_F(WindowSessionPropertyTest, KeepKeyboardOnFocus, Function | SmallTest | Level2)
687 {
688 sptr<WindowSessionProperty> property = new WindowSessionProperty();
689 ASSERT_NE(nullptr, property);
690 ASSERT_EQ(property->GetKeepKeyboardFlag(), false);
691 property->KeepKeyboardOnFocus(true);
692 ASSERT_EQ(property->GetKeepKeyboardFlag(), true);
693 }
694
695 /**
696 * @tc.name: SetTextFieldPositionY
697 * @tc.desc: SetTextFieldPositionY and GetTextFieldPositionY to check the value
698 * @tc.type: FUNC
699 */
700 HWTEST_F(WindowSessionPropertyTest, SetTextFieldPositionY, Function | SmallTest | Level2)
701 {
702 sptr<WindowSessionProperty> property = new WindowSessionProperty();
703 ASSERT_NE(nullptr, property);
704 property->SetTextFieldPositionY(5.5);
705 ASSERT_EQ(property->GetTextFieldPositionY(), 5.5);
706 }
707
708 /**
709 * @tc.name: SetTextFieldHeight
710 * @tc.desc: SetTextFieldHeight and GetTextFieldHeight to check the value
711 * @tc.type: FUNC
712 */
713 HWTEST_F(WindowSessionPropertyTest, SetTextFieldHeight, Function | SmallTest | Level2)
714 {
715 sptr<WindowSessionProperty> property = new WindowSessionProperty();
716 ASSERT_NE(nullptr, property);
717 property->SetTextFieldHeight(5.5);
718 ASSERT_EQ(property->GetTextFieldHeight(), 5.5);
719 }
720
721 /**
722 * @tc.name: SetIsLayoutFullScreen
723 * @tc.desc: SetIsLayoutFullScreen and IsLayoutFullScreen to check the value
724 * @tc.type: FUNC
725 */
726 HWTEST_F(WindowSessionPropertyTest, SetIsLayoutFullScreen, Function | SmallTest | Level2)
727 {
728 sptr<WindowSessionProperty> property = new WindowSessionProperty();
729 ASSERT_NE(nullptr, property);
730 ASSERT_EQ(property->IsLayoutFullScreen(), false);
731 property->SetIsLayoutFullScreen(true);
732 ASSERT_EQ(property->IsLayoutFullScreen(), true);
733 }
734
735 /**
736 * @tc.name: Read
737 * @tc.desc: Read test
738 * @tc.type: FUNC
739 */
740 HWTEST_F(WindowSessionPropertyTest, Read, Function | SmallTest | Level2)
741 {
742 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
743 if (property != nullptr) {
744 Parcel parcel = Parcel();
745 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MODE);
746 property->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST);
747 ASSERT_EQ(property->GetPersistentId(), INVALID_SESSION_ID);
748 delete property;
749 }
750 }
751
752 /**
753 * @tc.name: Write
754 * @tc.desc: Write and Read to check the value
755 * @tc.type: FUNC
756 */
757 HWTEST_F(WindowSessionPropertyTest, Write, Function | SmallTest | Level2)
758 {
759 WindowSessionProperty *oldProperty = new (std::nothrow) WindowSessionProperty();
760 WindowSessionProperty *newProperty = new (std::nothrow) WindowSessionProperty();
761 if ((oldProperty != nullptr) && (newProperty != nullptr)) {
762 int32_t persistentId = 2;
763 oldProperty->SetPersistentId(persistentId);
764 oldProperty->SetFocusable(true);
765 oldProperty->SetMainWindowTopmost(true);
766 Parcel parcel = Parcel();
767 oldProperty->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE);
768 oldProperty->Write(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST);
769
770 newProperty->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE);
771 newProperty->Read(parcel, WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST);
772 ASSERT_EQ(newProperty->GetPersistentId(), persistentId);
773 ASSERT_EQ(newProperty->GetFocusable(), true);
774 ASSERT_EQ(newProperty->IsMainWindowTopmost(), true);
775 delete oldProperty;
776 delete newProperty;
777 }
778 }
779
780 /**
781 * @tc.name: GetWindowName
782 * @tc.desc: GetWindowName
783 * @tc.type: FUNC
784 */
785 HWTEST_F(WindowSessionPropertyTest, GetWindowName, Function | SmallTest | Level2)
786 {
787 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
788 if (property == nullptr) {
789 return;
790 }
791 std::string name = "test";
792 property->SetWindowName(name);
793 auto result = property->GetWindowName();
794 ASSERT_EQ(result, name);
795 delete property;
796 }
797
798 /**
799 * @tc.name: GetSessionInfo
800 * @tc.desc: GetSessionInfo
801 * @tc.type: FUNC
802 */
803 HWTEST_F(WindowSessionPropertyTest, GetSessionInfo, Function | SmallTest | Level2)
804 {
805 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
806 if (property == nullptr) {
807 return;
808 }
809 SessionInfo *info = new SessionInfo();
810 if (info == nullptr) {
811 return;
812 }
813 property->SetSessionInfo(*info);
814 auto result = property->GetSessionInfo();
815 ASSERT_EQ(property->GetRaiseEnabled(), true);
816 delete property;
817 }
818
819 /**
820 * @tc.name: EditSessionInfo
821 * @tc.desc: EditSessionInfo
822 * @tc.type: FUNC
823 */
824 HWTEST_F(WindowSessionPropertyTest, EditSessionInfo, Function | SmallTest | Level2)
825 {
826 std::string abilityName = "1234";
827 std::string abilityNameNew = "12345";
828 SessionInfo info;
829 info.abilityName_ = abilityName;
830 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
831 property->SetSessionInfo(info);
832 property->EditSessionInfo().abilityName_ = abilityNameNew;
833 ASSERT_EQ(property->EditSessionInfo().abilityName_, abilityNameNew);
834 }
835
836 /**
837 * @tc.name: GetWindowRect
838 * @tc.desc: GetWindowRect
839 * @tc.type: FUNC
840 */
841 HWTEST_F(WindowSessionPropertyTest, GetWindowRect, Function | SmallTest | Level2)
842 {
843 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
844 if (property == nullptr) {
845 return;
846 }
847 Rect rect = {0, 0, 0, 0};
848 property->SetWindowRect(rect);
849 auto result = property->GetWindowRect();
850 ASSERT_EQ(result, rect);
851 delete property;
852 }
853
854 /**
855 * @tc.name: GetRequestRect
856 * @tc.desc: GetRequestRect
857 * @tc.type: FUNC
858 */
859 HWTEST_F(WindowSessionPropertyTest, GetRequestRect, Function | SmallTest | Level2)
860 {
861 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
862 if (property == nullptr) {
863 return;
864 }
865 Rect requestRect = {0, 0, 0, 0};
866 property->SetWindowRect(requestRect);
867 auto result = property->GetWindowRect();
868 ASSERT_EQ(result, requestRect);
869 delete property;
870 }
871
872 /**
873 * @tc.name: GetWindowType
874 * @tc.desc: GetWindowType
875 * @tc.type: FUNC
876 */
877 HWTEST_F(WindowSessionPropertyTest, GetWindowType, Function | SmallTest | Level2)
878 {
879 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
880 if (property == nullptr) {
881 return;
882 }
883 WindowType type = WindowType::APP_WINDOW_BASE;
884 property->SetWindowType(type);
885 auto result = property->GetWindowType();
886 ASSERT_EQ(result, type);
887 delete property;
888 }
889
890 /**
891 * @tc.name: GetDisplayId
892 * @tc.desc: GetDisplayId
893 * @tc.type: FUNC
894 */
895 HWTEST_F(WindowSessionPropertyTest, GetDisplayId, Function | SmallTest | Level2)
896 {
897 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
898 if (property == nullptr) {
899 return;
900 }
901 DisplayId displayId = 1;
902 property->SetDisplayId(displayId);
903 auto result = property->GetDisplayId();
904 ASSERT_EQ(result, displayId);
905 delete property;
906 }
907
908 /**
909 * @tc.name: GetPersistentId
910 * @tc.desc: GetPersistentId
911 * @tc.type: FUNC
912 */
913 HWTEST_F(WindowSessionPropertyTest, GetPersistentId, Function | SmallTest | Level2)
914 {
915 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
916 if (property == nullptr) {
917 return;
918 }
919 int32_t persistentId = 1;
920 property->SetPersistentId(persistentId);
921 auto result = property->GetPersistentId();
922 ASSERT_EQ(result, persistentId);
923 delete property;
924 }
925
926 /**
927 * @tc.name: GetParentPersistentId
928 * @tc.desc: GetParentPersistentId
929 * @tc.type: FUNC
930 */
931 HWTEST_F(WindowSessionPropertyTest, GetParentPersistentId, Function | SmallTest | Level2)
932 {
933 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
934 if (property == nullptr) {
935 return;
936 }
937 int32_t persistentId = 1;
938 property->SetParentPersistentId(persistentId);
939 auto result = property->GetParentPersistentId();
940 ASSERT_EQ(result, persistentId);
941 delete property;
942 }
943
944 /**
945 * @tc.name: SetTurnScreenOn
946 * @tc.desc: SetTurnScreenOn
947 * @tc.type: FUNC
948 */
949 HWTEST_F(WindowSessionPropertyTest, SetTurnScreenOn, Function | SmallTest | Level2)
950 {
951 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
952 if (property == nullptr) {
953 return;
954 }
955 bool turnScreenOn = false;
956 property->SetTurnScreenOn(turnScreenOn);
957 ASSERT_EQ(property->turnScreenOn_, turnScreenOn);
958 delete property;
959 }
960
961 /**
962 * @tc.name: SetKeepScreenOn
963 * @tc.desc: SetKeepScreenOn
964 * @tc.type: FUNC
965 */
966 HWTEST_F(WindowSessionPropertyTest, SetKeepScreenOn, Function | SmallTest | Level2)
967 {
968 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
969 if (property == nullptr) {
970 return;
971 }
972 bool keepScreenOn = false;
973 property->SetKeepScreenOn(keepScreenOn);
974 ASSERT_EQ(property->keepScreenOn_, keepScreenOn);
975 delete property;
976 }
977
978 /**
979 * @tc.name: MarshallingSessionInfo
980 * @tc.desc: MarshallingSessionInfo test
981 * @tc.type: FUNC
982 */
983 HWTEST_F(WindowSessionPropertyTest, MarshallingSessionInfo, Function | SmallTest | Level2)
984 {
985 Parcel parcel;
986 SessionInfo info = { "testBundleName", "testModuleName", "testAbilityName" };
987 info.want = std::make_shared<AAFwk::Want>();
988 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
989 bool result = property->MarshallingSessionInfo(parcel);
990 ASSERT_EQ(result, true);
991 }
992
993 /**
994 * @tc.name: UnMarshallingSessionInfo
995 * @tc.desc: UnMarshallingSessionInfo test
996 * @tc.type: FUNC
997 */
998 HWTEST_F(WindowSessionPropertyTest, UnMarshallingSessionInfo, Function | SmallTest | Level2)
999 {
1000 Parcel parcel;
1001 WindowSessionProperty windowSessionProperty;
1002 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1003 windowSessionProperty.UnmarshallingWindowLimits(parcel, property);
1004 ASSERT_EQ(property->GetTokenState(), false);
1005 }
1006
1007 /**
1008 * @tc.name: SetAccessTokenId
1009 * @tc.desc: SetAccessTokenId
1010 * @tc.type: FUNC
1011 */
1012 HWTEST_F(WindowSessionPropertyTest, SetAccessTokenId, Function | SmallTest | Level2)
1013 {
1014 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
1015 if (property == nullptr) {
1016 return;
1017 }
1018 uint32_t accessTokenId = 1;
1019 property->SetAccessTokenId(accessTokenId);
1020 ASSERT_EQ(property->accessTokenId_, accessTokenId);
1021 delete property;
1022 }
1023
1024 /**
1025 * @tc.name: GetWindowState
1026 * @tc.desc: GetWindowState
1027 * @tc.type: FUNC
1028 */
1029 HWTEST_F(WindowSessionPropertyTest, GetWindowState, Function | SmallTest | Level2)
1030 {
1031 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
1032 if (property == nullptr) {
1033 return;
1034 }
1035 WindowState state = WindowState::STATE_INITIAL;
1036 property->SetWindowState(state);
1037 auto result = property->GetWindowState();
1038 ASSERT_EQ(result, state);
1039 delete property;
1040 }
1041
1042 /**
1043 * @tc.name: SetSystemPrivacyMode02
1044 * @tc.desc: SetSystemPrivacyMode
1045 * @tc.type: FUNC
1046 */
1047 HWTEST_F(WindowSessionPropertyTest, SetSystemPrivacyMode02, Function | SmallTest | Level2)
1048 {
1049 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
1050 if (property == nullptr) {
1051 return;
1052 }
1053 bool isSystemPrivate = false;
1054 property->SetSystemPrivacyMode(isSystemPrivate);
1055 ASSERT_EQ(property->isSystemPrivacyMode_, isSystemPrivate);
1056 delete property;
1057 }
1058
1059 /**
1060 * @tc.name: SetTokenState02
1061 * @tc.desc: SetTokenState
1062 * @tc.type: FUNC
1063 */
1064 HWTEST_F(WindowSessionPropertyTest, SetTokenState02, Function | SmallTest | Level2)
1065 {
1066 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
1067 if (property == nullptr) {
1068 return;
1069 }
1070 bool hasToken = false;
1071 property->SetTokenState(hasToken);
1072 ASSERT_EQ(property->tokenState_, hasToken);
1073 delete property;
1074 }
1075
1076 /**
1077 * @tc.name: MarshallingTouchHotAreas
1078 * @tc.desc: MarshallingTouchHotAreas test
1079 * @tc.type: FUNC
1080 */
1081 HWTEST_F(WindowSessionPropertyTest, MarshallingTouchHotAreas, Function | SmallTest | Level2)
1082 {
1083 Parcel parcel;
1084 WindowSessionProperty *property = new WindowSessionProperty();
1085 if (property == nullptr) {
1086 return;
1087 }
1088 for (int i = 0; i < 55; i++) {
1089 struct Rect rect[i];
1090 property->touchHotAreas_.push_back(rect[i]);
1091 }
1092 bool result = property->MarshallingTouchHotAreas(parcel);
1093 ASSERT_EQ(result, false);
1094 delete property;
1095 }
1096
1097 /**
1098 * @tc.name: MarshallingKeyboardTouchHotAreas
1099 * @tc.desc: MarshallingKeyboardTouchHotAreas test
1100 * @tc.type: FUNC
1101 */
1102 HWTEST_F(WindowSessionPropertyTest, MarshallingKeyboardTouchHotAreas, Function | SmallTest | Level2)
1103 {
1104 Parcel parcel;
1105 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1106 KeyboardTouchHotAreas hotAreas;
1107 for (int i = 0; i < 55; i++) {
1108 Rect rect { i, i, i, i };
1109 hotAreas.landscapeKeyboardHotAreas_.push_back(rect);
1110 hotAreas.landscapePanelHotAreas_.push_back(rect);
1111 hotAreas.portraitKeyboardHotAreas_.push_back(rect);
1112 hotAreas.portraitPanelHotAreas_.push_back(rect);
1113 }
1114 property->SetKeyboardTouchHotAreas(hotAreas);
1115 bool result = property->MarshallingKeyboardTouchHotAreas(parcel);
1116 ASSERT_EQ(result, false);
1117 }
1118
1119 /**
1120 * @tc.name: UnmarshallingPiPTemplateInfo02
1121 * @tc.desc: UnmarshallingPiPTemplateInfo test
1122 * @tc.type: FUNC
1123 */
1124 HWTEST_F(WindowSessionPropertyTest, UnmarshallingPiPTemplateInfo02, Function | SmallTest | Level2)
1125 {
1126 Parcel parcel = Parcel();
1127 WindowSessionProperty *property = new WindowSessionProperty();
1128 if (property == nullptr) {
1129 return;
1130 }
1131 property->type_ = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW;
1132 WindowSessionProperty windowSessionProperty;
1133 windowSessionProperty.UnmarshallingPiPTemplateInfo(parcel, property);
1134 ASSERT_EQ(property->GetTokenState(), false);
1135 delete property;
1136 }
1137
1138 /**
1139 * @tc.name: MarshallingPiPTemplateInfo
1140 * @tc.desc: MarshallingPiPTemplateInfo test
1141 * @tc.type: FUNC
1142 */
1143 HWTEST_F(WindowSessionPropertyTest, MarshallingPiPTemplateInfo, Function | SmallTest | Level2)
1144 {
1145 Parcel parcel = Parcel();
1146 WindowSessionProperty *property = new WindowSessionProperty();
1147 if (property == nullptr) {
1148 return;
1149 }
1150 property->type_ = WindowType::WINDOW_TYPE_PIP;
1151 for (int i = 0; i < 10; i++) {
1152 property->pipTemplateInfo_.controlGroup.push_back(i);
1153 }
1154 bool result = property->MarshallingPiPTemplateInfo(parcel);
1155 ASSERT_EQ(result, false);
1156 delete property;
1157 }
1158
1159 /**
1160 * @tc.name: SetIsPcAppInPad/GetIsPcAppInPad
1161 * @tc.desc: SetIsPcAppInPad/GetIsPcAppInPad
1162 * @tc.type: FUNC
1163 */
1164 HWTEST_F(WindowSessionPropertyTest, SetIsPcAppInPad, Function | SmallTest | Level2)
1165 {
1166 WindowSessionProperty *property = new (std::nothrow) WindowSessionProperty();
1167 if (property == nullptr) {
1168 return;
1169 }
1170 bool isPcAppInPad = true;
1171 property->SetIsPcAppInPad(isPcAppInPad);
1172 auto result = property->GetIsPcAppInPad();
1173 ASSERT_EQ(result, isPcAppInPad);
1174 delete property;
1175 }
1176
1177 /**
1178 * @tc.name: SetSubWindowLevel
1179 * @tc.desc: SetSubWindowLevel Test
1180 * @tc.type: FUNC
1181 */
1182 HWTEST_F(WindowSessionPropertyTest, SetSubWindowLevel, Function | SmallTest | Level2)
1183 {
1184 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1185 EXPECT_NE(property, nullptr);
1186 uint32_t level = 4;
1187 property->SetSubWindowLevel(level);
1188 ASSERT_EQ(level, property->GetSubWindowLevel());
1189 }
1190
1191 /**
1192 * @tc.name: GetSubWindowLevel
1193 * @tc.desc: GetSubWindowLevel Test
1194 * @tc.type: FUNC
1195 */
1196 HWTEST_F(WindowSessionPropertyTest, GetSubWindowLevel, Function | SmallTest | Level2)
1197 {
1198 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1199 EXPECT_NE(property, nullptr);;
1200 ASSERT_EQ(1, property->GetSubWindowLevel());
1201 }
1202 } // namespace
1203 } // namespace Rosen
1204 } // namespace OHOS
1205