• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include "display_manager.h"
19 #include "input_event.h"
20 #include "key_event.h"
21 #include "mock/mock_session_stage.h"
22 #include "pointer_event.h"
23 
24 #include "session/host/include/main_session.h"
25 #include "session/host/include/scene_session.h"
26 #include "session/host/include/sub_session.h"
27 #include "session/host/include/system_session.h"
28 #include "screen_session_manager_client/include/screen_session_manager_client.h"
29 #include "window_helper.h"
30 #include "wm_common.h"
31 #include "ui/rs_surface_node.h"
32 
33 
34 using namespace testing;
35 using namespace testing::ext;
36 namespace OHOS {
37 namespace Rosen {
38 class SceneSessionTest4 : public testing::Test {
39 public:
40     static void SetUpTestCase();
41     static void TearDownTestCase();
42     void SetUp() override;
43     void TearDown() override;
44     sptr<SceneSession> sceneSession;
45     sptr<WindowSessionProperty> property;
46     SessionInfo info;
47     WSPropertyChangeAction action;
48 };
49 
SetUpTestCase()50 void SceneSessionTest4::SetUpTestCase()
51 {
52 }
53 
TearDownTestCase()54 void SceneSessionTest4::TearDownTestCase()
55 {
56 }
57 
SetUp()58 void SceneSessionTest4::SetUp()
59 {
60     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
61     property = sptr<WindowSessionProperty>::MakeSptr();
62     action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
63 }
64 
TearDown()65 void SceneSessionTest4::TearDown()
66 {
67 }
68 
69 namespace {
70 /**
71  * @tc.name: HandleActionUpdateFlags
72  * @tc.desc: normal function
73  * @tc.type: FUNC
74  */
75 HWTEST_F(SceneSessionTest4, HandleActionUpdateFlags, Function | SmallTest | Level2)
76 {
77     SessionInfo info;
78     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
79     ASSERT_NE(nullptr, sceneSession);
80     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
81     ASSERT_NE(nullptr, property);
82     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
83     WMError ret = sceneSession->HandleActionUpdateStatusProps(property, action);
84     ASSERT_EQ(WMError::WM_OK, ret);
85     ret = sceneSession->HandleActionUpdateNavigationProps(property, action);
86     ASSERT_EQ(WMError::WM_OK, ret);
87     ret = sceneSession->HandleActionUpdateNavigationIndicatorProps(property, action);
88     ASSERT_EQ(WMError::WM_OK, ret);
89     ret = sceneSession->HandleActionUpdateFlags(property, action);
90     ASSERT_EQ(WMError::WM_OK, ret);
91 }
92 
93 /**
94  * @tc.name: HandleActionUpdateTouchHotArea
95  * @tc.desc: normal function
96  * @tc.type: FUNC
97  */
98 HWTEST_F(SceneSessionTest4, HandleActionUpdateTouchHotArea, Function | SmallTest | Level2)
99 {
100     SessionInfo info;
101     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
102     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
103     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
104     WMError ret = sceneSession->HandleActionUpdateTouchHotArea(property, action);
105     ASSERT_EQ(WMError::WM_OK, ret);
106 }
107 
108 /**
109  * @tc.name: HandleActionUpdateKeyboardTouchHotArea01
110  * @tc.desc: normal function
111  * @tc.type: FUNC
112  */
113 HWTEST_F(SceneSessionTest4, HandleActionUpdateKeyboardTouchHotArea01, Function | SmallTest | Level2)
114 {
115     SessionInfo info;
116     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
117     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
118     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
119     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
120     WMError ret = sceneSession->HandleActionUpdateKeyboardTouchHotArea(property, action);
121     ASSERT_EQ(WMError::WM_OK, ret);
122 }
123 
124 /**
125  * @tc.name: HandleActionUpdateKeyboardTouchHotArea02
126  * @tc.desc: normal function
127  * @tc.type: FUNC
128  */
129 HWTEST_F(SceneSessionTest4, HandleActionUpdateKeyboardTouchHotArea02, Function | SmallTest | Level2)
130 {
131     SessionInfo info;
132     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
133     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
134     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
135     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
136     WMError ret = sceneSession->HandleActionUpdateKeyboardTouchHotArea(property, action);
137     ASSERT_EQ(WMError::WM_ERROR_INVALID_TYPE, ret);
138 }
139 
140 /**
141  * @tc.name: HandleActionUpdateDecorEnable
142  * @tc.desc: normal function
143  * @tc.type: FUNC
144  */
145 HWTEST_F(SceneSessionTest4, HandleActionUpdateDecorEnable, Function | SmallTest | Level2)
146 {
147     SessionInfo info;
148     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
149     ASSERT_NE(nullptr, sceneSession);
150     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
151 
152     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
153     ASSERT_NE(nullptr, property);
154     OHOS::Rosen::Session session(info);
155     session.property_ = nullptr;
156     sceneSession->HandleActionUpdateDecorEnable(property, action);
157     session.property_ = sptr<WindowSessionProperty>::MakeSptr();
158     sceneSession->HandleActionUpdateDecorEnable(property, action);
159 
160     OHOS::Rosen::WindowSessionProperty windowSessionProperty;
161     auto ret = sceneSession->HandleActionUpdateDecorEnable(property, action);
162     ASSERT_EQ(WMError::WM_ERROR_NOT_SYSTEM_APP, ret);
163 }
164 
165 /**
166  * @tc.name: HandleActionUpdateDragenabled
167  * @tc.desc: normal function
168  * @tc.type: FUNC
169  */
170 HWTEST_F(SceneSessionTest4, HandleActionUpdateDragenabled, Function | SmallTest | Level2)
171 {
172     SessionInfo info;
173     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
174     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ASPECT_RATIO;
175     OHOS::Rosen::Session session(info);
176     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
177     session.property_ = property;
178 
179     WMError res = sceneSession->HandleActionUpdateDragenabled(property, action);
180     ASSERT_EQ(WMError::WM_OK, res);
181 }
182 
183 /**
184  * @tc.name: HandleActionUpdateRaiseenabled
185  * @tc.desc: normal function
186  * @tc.type: FUNC
187  */
188 HWTEST_F(SceneSessionTest4, HandleActionUpdateRaiseenabled, Function | SmallTest | Level2)
189 {
190     ASSERT_NE(nullptr, sceneSession);
191     ASSERT_NE(nullptr, property);
192     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG;
193     sceneSession->HandleActionUpdateRaiseenabled(property, action);
194 
195     OHOS::Rosen::WindowSessionProperty windowSessionProperty;
196     windowSessionProperty.isSystemCalling_ = {true};
197     sceneSession->HandleActionUpdateRaiseenabled(property, action);
198 
199     windowSessionProperty.isSystemCalling_ = {true};
200     OHOS::Rosen::Session session(info);
201     session.property_ = sptr<WindowSessionProperty>::MakeSptr();
202     sceneSession->HandleActionUpdateRaiseenabled(property, action);
203 
204     sceneSession->HandleActionUpdateHideNonSystemFloatingWindows(property, action);
205 }
206 
207 /**
208  * @tc.name: HandleActionUpdateTextfieldAvoidInfo
209  * @tc.desc: normal function
210  * @tc.type: FUNC
211  */
212 HWTEST_F(SceneSessionTest4, HandleActionUpdateTextfieldAvoidInfo, Function | SmallTest | Level2)
213 {
214     ASSERT_NE(nullptr, sceneSession);
215     ASSERT_NE(nullptr, property);
216     sceneSession->HandleActionUpdateTextfieldAvoidInfo(property, action);
217     sceneSession->HandleActionUpdateWindowMask(property, action);
218 
219     OHOS::Rosen::Session session(info);
220     session.property_ = sptr<WindowSessionProperty>::MakeSptr();
221     sceneSession->HandleActionUpdateTextfieldAvoidInfo(property, action);
222     sceneSession->HandleActionUpdateWindowMask(property, action);
223     sceneSession->HandleActionUpdateTopmost(property, action);
224 
225     SessionInfo info;
226     sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(info, nullptr);
227     ASSERT_NE(nullptr, sceneSession1);
228     sceneSession1->HandleActionUpdateTextfieldAvoidInfo(property, action);
229     sceneSession1->HandleActionUpdateWindowMask(property, action);
230 }
231 
232 /**
233  * @tc.name: SetWindowFlags
234  * @tc.desc: normal function
235  * @tc.type: FUNC
236  */
237 HWTEST_F(SceneSessionTest4, SetWindowFlags, Function | SmallTest | Level2)
238 {
239     ASSERT_NE(nullptr, sceneSession);
240     ASSERT_NE(nullptr, property);
241     sceneSession->SetWindowFlags(property);
242 
243     OHOS::Rosen::Session session(info);
244     session.property_ = sptr<WindowSessionProperty>::MakeSptr();
245     sceneSession->SetWindowFlags(property);
246     sceneSession->NotifySessionChangeByActionNotifyManager(property, action);
247 
248     session.property_ = nullptr;
249     sceneSession->SetWindowFlags(property);
250     sceneSession->sessionChangeByActionNotifyManagerFunc_ = [](
251         const sptr<SceneSession>& sceneSession,
252         const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action
__anon691d35de0202( const sptr<SceneSession>& sceneSession, const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action )253     ){};
254     sceneSession->NotifySessionChangeByActionNotifyManager(property, action);
255 }
256 
257 /**
258  * @tc.name: SetSkipDraw
259  * @tc.desc: SetSkipDraw function
260  * @tc.type: FUNC
261  */
262 HWTEST_F(SceneSessionTest4, SetSkipDraw, Function | SmallTest | Level2)
263 {
264     SessionInfo info;
265     info.abilityName_ = "SetSkipDraw";
266     info.bundleName_ = "SetSkipDraw";
267     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
268     EXPECT_NE(nullptr, session);
269     struct RSSurfaceNodeConfig config;
270     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
271     session->surfaceNode_ = surfaceNode;
272     session->SetLeashWinSurfaceNode(nullptr);
273     session->SetSkipDraw(true);
274     session->SetLeashWinSurfaceNode(surfaceNode);
275     EXPECT_EQ(surfaceNode, session->GetLeashWinSurfaceNode());
276     session->SetSkipDraw(true);
277 }
278 
279 /**
280  * @tc.name: SetScale
281  * @tc.desc: SetScale function
282  * @tc.type: FUNC
283  */
284 HWTEST_F(SceneSessionTest4, SetScale, Function | SmallTest | Level2)
285 {
286     SessionInfo info;
287     info.abilityName_ = "SetScale";
288     info.bundleName_ = "SetScale";
289     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
290     EXPECT_NE(nullptr, session);
291     session->Session::SetScale(1.0f, 2.0f, 3.0f, 4.0f);
292     session->sessionStage_ = nullptr;
293     session->SetScale(5.0f, 2.0f, 3.0f, 4.0f);
294     sptr<SceneSession::SpecificSessionCallback> specificCallback =
295         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
__anon691d35de0302(int32_t persistentId, WindowUpdateType type) 296     NotifyWindowInfoUpdateCallback func = [](int32_t persistentId, WindowUpdateType type) {
297         return;
298     };
299     specificCallback->onWindowInfoUpdate_ = func;
300     session->specificCallback_ = specificCallback;
301     session->SetScale(5.0f, 5.0f, 3.0f, 4.0f);
302     session->SetScale(5.0f, 5.0f, 5.0f, 4.0f);
303     session->SetScale(5.0f, 5.0f, 5.0f, 5.0f);
304     session->SetScale(5.0f, 5.0f, 5.0f, 5.0f);
305     EXPECT_EQ(5.0f, session->GetScaleX());
306     EXPECT_EQ(5.0f, session->GetScaleY());
307     EXPECT_EQ(5.0f, session->GetPivotX());
308     EXPECT_EQ(5.0f, session->GetPivotY());
309 
310     session->sessionStage_ = sptr<SessionStageMocker>::MakeSptr();
311     EXPECT_NE(nullptr, session->sessionStage_);
312     session->SetScale(5.0f, 5.0f, 5.0f, 5.0f);
313     EXPECT_EQ(5.0f, session->GetPivotY());
314 }
315 
316 /**
317  * @tc.name: RequestSessionBack
318  * @tc.desc: RequestSessionBack function
319  * @tc.type: FUNC
320  */
321 HWTEST_F(SceneSessionTest4, RequestSessionBack, Function | SmallTest | Level2)
322 {
323     SessionInfo info;
324     info.abilityName_ = "RequestSessionBack";
325     info.bundleName_ = "RequestSessionBack";
326     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
327     EXPECT_NE(nullptr, session);
__anon691d35de0402(const bool needMoveToBackground) 328     NotifyBackPressedFunc func = [](const bool needMoveToBackground) {
329         return;
330     };
331     session->backPressedFunc_ = func;
332     EXPECT_EQ(WSError::WS_OK, session->RequestSessionBack(true));
333 }
334 
335 /**
336  * @tc.name: SetSurfaceBounds
337  * @tc.desc: SetSurfaceBounds function
338  * @tc.type: FUNC
339  */
340 HWTEST_F(SceneSessionTest4, SetSurfaceBounds, Function | SmallTest | Level2)
341 {
342     SessionInfo info;
343     info.abilityName_ = "SetSurfaceBounds";
344     info.bundleName_ = "SetSurfaceBounds";
345     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
346     EXPECT_NE(nullptr, session);
347     WSRect rect;
348     struct RSSurfaceNodeConfig config;
349     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
350     session->surfaceNode_ = surfaceNode;
351     session->SetSurfaceBounds(rect, false);
352     session->SetLeashWinSurfaceNode(surfaceNode);
353     session->SetSurfaceBounds(rect, false);
354     EXPECT_NE(nullptr, session->GetLeashWinSurfaceNode());
355 }
356 
357 /**
358  * @tc.name: SetFloatingScale
359  * @tc.desc: SetFloatingScale function
360  * @tc.type: FUNC
361  */
362 HWTEST_F(SceneSessionTest4, SetFloatingScale, Function | SmallTest | Level2)
363 {
364     SessionInfo info;
365     info.abilityName_ = "SetFloatingScale";
366     info.bundleName_ = "SetFloatingScale";
367     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
368     EXPECT_NE(nullptr, session);
369     session->floatingScale_ = 3.14f;
370     session->SetFloatingScale(2.176f);
371     session->SetFloatingScale(3.14f);
372     EXPECT_EQ(nullptr, session->specificCallback_);
373 }
374 
375 /**
376  * @tc.name: SetRequestedOrientation
377  * @tc.desc: SetRequestedOrientation function
378  * @tc.type: FUNC
379  */
380 HWTEST_F(SceneSessionTest4, SetRequestedOrientation, Function | SmallTest | Level2)
381 {
382     SessionInfo info;
383     info.abilityName_ = "SetRequestedOrientation";
384     info.bundleName_ = "SetRequestedOrientation";
385     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
386     Orientation orientation { Orientation::BEGIN };
387     session->SetRequestedOrientation(orientation);
388     session->onRequestedOrientationChange_ = nullptr;
389     session->SetRequestedOrientation(orientation);
__anon691d35de0502(uint32_t orientation) 390     NotifyReqOrientationChangeFunc func = [](uint32_t orientation) {
391         return;
392     };
393     session->onRequestedOrientationChange_ = func;
394     session->SetRequestedOrientation(orientation);
395     EXPECT_NE(nullptr, session->onRequestedOrientationChange_);
396 }
397 
398 /**
399  * @tc.name: UpdateSessionPropertyByAction
400  * @tc.desc: UpdateSessionPropertyByAction function
401  * @tc.type: FUNC
402  */
403 HWTEST_F(SceneSessionTest4, UpdateSessionPropertyByAction, Function | SmallTest | Level2)
404 {
405     SessionInfo info;
406     info.abilityName_ = "UpdateSessionPropertyByAction";
407     info.bundleName_ = "UpdateSessionPropertyByAction";
408     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
409     ASSERT_NE(nullptr, sceneSession);
410     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
411     ASSERT_NE(nullptr, property);
412     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE;
413     EXPECT_EQ(WMError::WM_ERROR_NULLPTR, sceneSession->UpdateSessionPropertyByAction(nullptr, action));
414 
415     sceneSession->SetSessionProperty(property);
416     EXPECT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, sceneSession->UpdateSessionPropertyByAction(property, action));
417 
418     action = WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON;
419     EXPECT_EQ(WMError::WM_OK, sceneSession->UpdateSessionPropertyByAction(property, action));
420 }
421 
422 /**
423  * @tc.name: ProcessUpdatePropertyByAction1
424  * @tc.desc: ProcessUpdatePropertyByAction1 function
425  * @tc.type: FUNC
426  */
427 HWTEST_F(SceneSessionTest4, ProcessUpdatePropertyByAction1, Function | SmallTest | Level2)
428 {
429     SessionInfo info;
430     info.abilityName_ = "ProcessUpdatePropertyByAction1";
431     info.bundleName_ = "ProcessUpdatePropertyByAction1";
432     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
433     ASSERT_NE(nullptr, sceneSession);
434     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
435     ASSERT_NE(nullptr, property);
436 
437     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
438         WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON));
439 
440     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
441         WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON));
442 
443     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
444         WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE));
445 
446     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
447         WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE));
448 
449     sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
450     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
451         WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS));
452 
453     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
454     sceneSession->state_ = SessionState::STATE_END;
455     EXPECT_EQ(WMError::WM_ERROR_INVALID_SESSION, sceneSession->ProcessUpdatePropertyByAction(property,
456         WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS));
457 
458     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
459     sceneSession->state_ = SessionState::STATE_ACTIVE;
460     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
461         WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS));
462 
463     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
464         WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION));
465 
466     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
467         WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE));
468 
469     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
470         WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE));
471 
472     struct RSSurfaceNodeConfig config;
473     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
474     sceneSession->surfaceNode_ = surfaceNode;
475     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
476         WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP));
477 }
478 
479 /**
480  * @tc.name: ProcessUpdatePropertyByAction2
481  * @tc.desc: ProcessUpdatePropertyByAction2 function
482  * @tc.type: FUNC
483  */
484 HWTEST_F(SceneSessionTest4, ProcessUpdatePropertyByAction2, Function | SmallTest | Level2)
485 {
486     SessionInfo info;
487     info.abilityName_ = "ProcessUpdatePropertyByAction2";
488     info.bundleName_ = "ProcessUpdatePropertyByAction2";
489     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
490     ASSERT_NE(nullptr, sceneSession);
491     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
492     ASSERT_NE(nullptr, property);
493 
494     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
495         WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE));
496 
497     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
498         WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS));
499 
500     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
501         WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS));
502 
503     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
504         WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS));
505 
506     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
507         WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS));
508 
509     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
510         WSPropertyChangeAction::ACTION_UPDATE_FLAGS));
511 
512     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
513         WSPropertyChangeAction::ACTION_UPDATE_MODE));
514 
515     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
516         WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG));
517 
518     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
519         WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA));
520 
521     property->SetSystemCalling(false);
522     EXPECT_EQ(WMError::WM_ERROR_NOT_SYSTEM_APP, sceneSession->ProcessUpdatePropertyByAction(property,
523         WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE));
524 
525     property->SetSystemCalling(true);
526     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
527         WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE));
528 }
529 
530 /**
531  * @tc.name: ProcessUpdatePropertyByAction3
532  * @tc.desc: ProcessUpdatePropertyByAction3 function
533  * @tc.type: FUNC
534  */
535 HWTEST_F(SceneSessionTest4, ProcessUpdatePropertyByAction3, Function | SmallTest | Level2)
536 {
537     SessionInfo info;
538     info.abilityName_ = "ProcessUpdatePropertyByAction3";
539     info.bundleName_ = "ProcessUpdatePropertyByAction3";
540     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
541     ASSERT_NE(nullptr, sceneSession);
542     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
543     ASSERT_NE(nullptr, property);
544 
545     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
546         WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS));
547 
548     property->SetSystemCalling(false);
549     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
550         WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED));
551 
552     property->SetSystemCalling(true);
553     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
554         WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED));
555 
556     sceneSession->property_ = property;
557     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
558         WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED));
559 
560     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
561         WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED));
562 
563     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
564         WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS));
565 
566     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
567         WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO));
568 
569     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
570         WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK));
571 
572     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
573         WSPropertyChangeAction::ACTION_UPDATE_TOPMOST));
574 
575     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
576         WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL));
577 
578     property->SetSystemCalling(false);
579     EXPECT_EQ(WMError::WM_ERROR_NOT_SYSTEM_APP, sceneSession->ProcessUpdatePropertyByAction(property,
580         WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO));
581 
582     property->SetSystemCalling(true);
583     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
584         WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO));
585 
586     EXPECT_EQ(WMError::WM_DO_NOTHING, sceneSession->ProcessUpdatePropertyByAction(property,
587         WSPropertyChangeAction::ACTION_UPDATE_RECT));
588 
589     property->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_FLOAT);
590     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
591         WSPropertyChangeAction::ACTION_UPDATE_AVOID_AREA_OPTION));
592 }
593 
594 /**
595  * @tc.name: ProcessUpdatePropertyByAction4
596  * @tc.desc: ProcessUpdatePropertyByAction4 function
597  * @tc.type: FUNC
598  */
599 HWTEST_F(SceneSessionTest4, ProcessUpdatePropertyByAction4, Function | SmallTest | Level2)
600 {
601     SessionInfo info;
602     info.abilityName_ = "ProcessUpdatePropertyByAction4";
603     info.bundleName_ = "ProcessUpdatePropertyByAction4";
604     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
605     ASSERT_NE(nullptr, sceneSession);
606     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
607     ASSERT_NE(nullptr, property);
608     property->SetSystemCalling(true);
609     sceneSession->property_ = property;
610     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
611         WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS));
612 
613     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
614         WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE));
615 
616     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
617         WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS));
618 
619     sceneSession->property_ = nullptr;
620     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
621         WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED));
622 
623     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
624         WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED));
625 
626     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
627         WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS));
628 
629     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
630         WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE));
631 
632     EXPECT_EQ(WMError::WM_OK, sceneSession->ProcessUpdatePropertyByAction(property,
633         WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS));
634 }
635 
636 /**
637  * @tc.name: HandleSpecificSystemBarProperty
638  * @tc.desc: HandleSpecificSystemBarProperty
639  * @tc.type: FUNC
640  */
641 HWTEST_F(SceneSessionTest4, HandleSpecificSystemBarProperty, Function | SmallTest | Level2)
642 {
643     SessionInfo info;
644     info.abilityName_ = "HandleSpecificSystemBarProperty";
645     info.bundleName_ = "HandleSpecificSystemBarProperty";
646     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
647     ASSERT_NE(nullptr, sceneSession);
648     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
649     ASSERT_NE(nullptr, property);
650     WindowType type = WindowType::WINDOW_TYPE_STATUS_BAR;
651     sceneSession->HandleSpecificSystemBarProperty(type, property);
652 
653     sceneSession->isDisplayStatusBarTemporarily_.store(true);
654     sceneSession->HandleSpecificSystemBarProperty(type, property);
655 
656     sceneSession->specificCallback_ = nullptr;
657     sceneSession->HandleSpecificSystemBarProperty(type, property);
658 
659     sptr<SceneSession::SpecificSessionCallback> specificCallback =
660         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
661     ASSERT_NE(nullptr, specificCallback);
662     sceneSession->specificCallback_ = specificCallback;
663     sceneSession->HandleSpecificSystemBarProperty(type, property);
664 
665     sceneSession->specificCallback_->onUpdateAvoidArea_ = nullptr;
666     sceneSession->HandleSpecificSystemBarProperty(type, property);
667 
668     UpdateAvoidAreaCallback onUpdateAvoidArea;
669     sceneSession->specificCallback_->onUpdateAvoidArea_ = onUpdateAvoidArea;
670     sceneSession->HandleSpecificSystemBarProperty(type, property);
671 }
672 
673 /**
674  * @tc.name: SetWindowFlags1
675  * @tc.desc: SetWindowFlags1
676  * @tc.type: FUNC
677  */
678 HWTEST_F(SceneSessionTest4, SetWindowFlags1, Function | SmallTest | Level2)
679 {
680     SessionInfo info;
681     info.abilityName_ = "SetWindowFlags1";
682     info.bundleName_ = "SetWindowFlags1";
683     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
684     ASSERT_NE(nullptr, sceneSession);
685     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
686     ASSERT_NE(nullptr, property);
687     sptr<WindowSessionProperty> sessionProperty = sptr<WindowSessionProperty>::MakeSptr();
688     ASSERT_NE(nullptr, sessionProperty);
689     sceneSession->SetWindowFlags(property);
690     sceneSession->property_ = sessionProperty;
691     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_PARENT_LIMIT));
692     sceneSession->property_->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
693     sceneSession->SetWindowFlags(property);
694     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_FORBID_SPLIT_MOVE));
695     sceneSession->property_->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_WATER_MARK));
696     sceneSession->SetWindowFlags(property);
697 }
698 
699 /**
700  * @tc.name: SetGestureBackEnabled
701  * @tc.desc: SetGestureBackEnabled
702  * @tc.type: FUNC
703  */
704 HWTEST_F(SceneSessionTest4, SetGestureBackEnabled, Function | SmallTest | Level2)
705 {
706     SessionInfo info;
707     info.abilityName_ = "SetGestureBackEnabled";
708     info.bundleName_ = "SetGestureBackEnabled";
709     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
710     ASSERT_NE(nullptr, sceneSession);
711     sceneSession->isEnableGestureBack_ = false;
712     EXPECT_EQ(WMError::WM_OK, sceneSession->SetGestureBackEnabled(false));
713     sceneSession->specificCallback_ = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
714     EXPECT_NE(nullptr, sceneSession->specificCallback_);
__anon691d35de0602(int32_t persistentId) 715     auto func = [sceneSession](int32_t persistentId) {
716         return;
717     };
718     sceneSession->specificCallback_->onUpdateGestureBackEnabled_ = func;
719     EXPECT_EQ(WMError::WM_OK, sceneSession->SetGestureBackEnabled(true));
720     EXPECT_EQ(true, sceneSession->GetGestureBackEnabled());
721 }
722 
723 /**
724  * @tc.name: GetCustomDecorHeight02
725  * @tc.desc: GetCustomDecorHeight
726  * @tc.type: FUNC
727  */
728 HWTEST_F(SceneSessionTest4, GetCustomDecorHeight02, Function | SmallTest | Level3)
729 {
730     SessionInfo info;
731     info.abilityName_ = "GetCustomDecorHeight";
732     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
733     sceneSession->SetCustomDecorHeight(50);
734     sceneSession->SetCustomDecorHeight(20);
735     ASSERT_EQ(50, sceneSession->customDecorHeight_);
736 
737     sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(info, nullptr);
738     sceneSession2->SetCustomDecorHeight(50);
739     sceneSession2->SetCustomDecorHeight(150);
740     ASSERT_EQ(50, sceneSession2->customDecorHeight_);
741 }
742 
743 /**
744  * @tc.name: SetDefaultDisplayIdIfNeed03
745  * @tc.desc: SetDefaultDisplayIdIfNeed
746  * @tc.type: FUNC
747  */
748 HWTEST_F(SceneSessionTest4, SetDefaultDisplayIdIfNeed03, Function | SmallTest | Level2)
749 {
750     SessionInfo info;
751     info.abilityName_ = "SetDefaultDisplayIdIfNeed03";
752     info.bundleName_ = "SetDefaultDisplayIdIfNeed03";
753     info.screenId_ = 20;
754     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
755     sceneSession->SetDefaultDisplayIdIfNeed();
756     ASSERT_EQ(20, sceneSession->GetSessionInfo().screenId_);
757 }
758 
759 /**
760  * @tc.name: NotifyServerToUpdateRect01
761  * @tc.desc: NotifyServerToUpdateRect
762  * @tc.type: FUNC
763  */
764 HWTEST_F(SceneSessionTest4, NotifyServerToUpdateRect01, Function | SmallTest | Level2)
765 {
766     SessionInfo info;
767     info.abilityName_ = "NotifyServerToUpdateRect";
768     info.bundleName_ = "NotifyServerToUpdateRect";
769     info.screenId_ = 20;
770     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
771     SessionUIParam uiParam;
772     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
773     sceneSession->SetForegroundInteractiveStatus(false);
774     sceneSession->NotifyServerToUpdateRect(uiParam, reason);
775     ASSERT_EQ(false, sceneSession->NotifyServerToUpdateRect(uiParam, reason));
776 
777     sceneSession->SetForegroundInteractiveStatus(true);
778     ASSERT_EQ(false, sceneSession->NotifyServerToUpdateRect(uiParam, reason));
779 
780     uiParam.needSync_ = false;
781     ASSERT_EQ(false, sceneSession->NotifyServerToUpdateRect(uiParam, reason));
782 
783     uiParam.needSync_ = true;
784     uiParam.rect_ = {0, 0, 1, 1};
785 
786     sceneSession->winRect_ = {0, 0, 1, 1};
787     sceneSession->clientRect_ = {0, 0, 1, 1};
788     ASSERT_FALSE(sceneSession->NotifyServerToUpdateRect(uiParam, reason));
789 
790     sceneSession->winRect_ = {1, 1, 1, 1};
791     ASSERT_TRUE(sceneSession->NotifyServerToUpdateRect(uiParam, reason));
792 
793     sceneSession->winRect_ = {0, 0, 1, 1};
794     sceneSession->clientRect_ = {1, 1, 1, 1};
795     ASSERT_FALSE(sceneSession->NotifyServerToUpdateRect(uiParam, reason));
796 
797     sceneSession->sessionStage_ = sptr<SessionStageMocker>::MakeSptr();
798     ASSERT_TRUE(sceneSession->NotifyServerToUpdateRect(uiParam, reason));
799 
800     sceneSession->winRect_ = {1, 1, 1, 1};
801     sceneSession->clientRect_ = {1, 1, 1, 1};
802     ASSERT_TRUE(sceneSession->NotifyServerToUpdateRect(uiParam, reason));
803 
804     uiParam.rect_ = {0, 0, 1, 0};
805     ASSERT_EQ(false, sceneSession->NotifyServerToUpdateRect(uiParam, reason));
806 }
807 
808 /**
809  * @tc.name: UpdateVisibilityInner
810  * @tc.desc: UpdateVisibilityInner
811  * @tc.type: FUNC
812  */
813 HWTEST_F(SceneSessionTest4, UpdateVisibilityInner01, Function | SmallTest | Level2)
814 {
815     SessionInfo info;
816     info.abilityName_ = "UpdateVisibilityInner01";
817     info.bundleName_ = "UpdateVisibilityInner01";
818     info.screenId_ = 20;
819     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
820     sceneSession->isVisible_ = false;
821     ASSERT_EQ(false, sceneSession->UpdateVisibilityInner(false));
822 
823     ASSERT_EQ(true, sceneSession->UpdateVisibilityInner(true));
824 }
825 
826 /**
827  * @tc.name: UnregisterSessionChangeListeners
828  * @tc.desc: UnregisterSessionChangeListeners
829  * @tc.type: FUNC
830  */
831 HWTEST_F(SceneSessionTest4, UnregisterSessionChangeListeners01, Function | SmallTest | Level2)
832 {
833     SessionInfo info;
834     info.abilityName_ = "UnregisterSessionChangeListeners01";
835     info.bundleName_ = "UnregisterSessionChangeListeners01";
836     info.screenId_ = 20;
837     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
838     sceneSession->UnregisterSessionChangeListeners();
839 
840     sceneSession->UnregisterSessionChangeListeners();
841     NotifyPendingSessionToBackgroundForDelegatorFunc func =[sceneSession](const SessionInfo& info,
__anon691d35de0702(const SessionInfo& info, bool shouldBackToCaller) 842         bool shouldBackToCaller) { return; };
843     sceneSession->pendingSessionToBackgroundForDelegatorFunc_ = func;
844     ASSERT_EQ(WSError::WS_OK, sceneSession->PendingSessionToBackgroundForDelegator(true));
845 }
846 
847 /**
848  * @tc.name: IsPcOrPadEnableActivation01
849  * @tc.desc: IsPcOrPadEnableActivation
850  * @tc.type: FUNC
851  */
852 HWTEST_F(SceneSessionTest4, IsPcOrPadEnableActivation01, Function | SmallTest | Level2)
853 {
854     SessionInfo info;
855     info.abilityName_ = "IsPcOrPadEnableActivation01";
856     info.bundleName_ = "IsPcOrPadEnableActivation01";
857     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
858 
859     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
860     sceneSession->SetSessionProperty(property);
861     sceneSession->SetIsPcAppInPad(true);
862     ASSERT_EQ(true, sceneSession->IsPcOrPadEnableActivation());
863 }
864 
865 /**
866  * @tc.name: SetSystemWindowEnableDrag01
867  * @tc.desc: SetSystemWindowEnableDrag function01
868  * @tc.type: FUNC
869  */
870 HWTEST_F(SceneSessionTest4, SetSystemWindowEnableDrag01, Function | SmallTest | Level2)
871 {
872     SessionInfo info;
873     info.abilityName_ = "SetSystemWindowEnableDrag01";
874     info.bundleName_ = "SetSystemWindowEnableDrag01";
875     info.windowType_ = static_cast<uint32_t>(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
876     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
877     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
878     auto ret = session->SetSystemWindowEnableDrag(true);
879     ASSERT_EQ(WMError::WM_ERROR_INVALID_CALLING, ret);
880 }
881 
882 /**
883  * @tc.name: OnTitleAndDockHoverShowChange01
884  * @tc.desc: normal function
885  * @tc.type: FUNC
886  */
887 HWTEST_F(SceneSessionTest4, OnTitleAndDockHoverShowChange01, Function | SmallTest | Level2)
888 {
889     SessionInfo info;
890     info.abilityName_ = "OnTitleAndDockHoverShowChange01";
891     info.bundleName_ = "OnTitleAndDockHoverShowChange01";
892     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
893 
894     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
895     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
896     sceneSession->SetSessionProperty(property);
897     auto result = sceneSession->OnTitleAndDockHoverShowChange(true, true);
898     ASSERT_EQ(result, WSError::WS_OK);
899 }
900 
901 /**
902  * @tc.name: SetAutoStartPiP01
903  * @tc.desc: SetAutoStartPiP
904  * @tc.type: FUNC
905  */
906 HWTEST_F(SceneSessionTest4, SetAutoStartPiP01, Function | SmallTest | Level2)
907 {
908     SessionInfo info;
909     info.abilityName_ = "SetAutoStartPiP01";
910     info.bundleName_ = "SetAutoStartPiP01";
911     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
912 
913     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
914     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
915     sceneSession->SetSessionProperty(property);
916     sceneSession->isTerminating_ = false;
917     auto result = sceneSession->SetAutoStartPiP(true, 0, 1, 1);
918     ASSERT_EQ(result, WSError::WS_OK);
919 }
920 
921 /**
922  * @tc.name: SetAutoStartPiP02
923  * @tc.desc: SetAutoStartPiP
924  * @tc.type: FUNC
925  */
926 HWTEST_F(SceneSessionTest4, SetAutoStartPiP02, Function | SmallTest | Level2)
927 {
928     SessionInfo info;
929     info.abilityName_ = "SetAutoStartPiP02";
930     info.bundleName_ = "SetAutoStartPiP02";
931     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
932 
933     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
934     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
935     sceneSession->SetSessionProperty(property);
936     sceneSession->isTerminating_ = true;
__anon691d35de0802(bool flag, uint32_t status, uint32_t width, uint32_t height) 937     NotifyAutoStartPiPStatusChangeFunc func = [](bool flag, uint32_t status, uint32_t width, uint32_t height) {
938         return;
939     };
940     sceneSession->autoStartPiPStatusChangeFunc_ = func;
941     auto result = sceneSession->SetAutoStartPiP(true, 1, 1, 1);
942     ASSERT_EQ(result, WSError::WS_OK);
943 }
944 
945 /**
946  * @tc.name: SetAutoStartPiP03
947  * @tc.desc: SetAutoStartPiP
948  * @tc.type: FUNC
949  */
950 HWTEST_F(SceneSessionTest4, SetAutoStartPiP03, Function | SmallTest | Level2)
951 {
952     SessionInfo info;
953     info.abilityName_ = "SetAutoStartPiP03";
954     info.bundleName_ = "SetAutoStartPiP03";
955     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
956 
957     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
958     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
959     sceneSession->SetSessionProperty(property);
960     sceneSession->isTerminating_ = true;
961     auto result = sceneSession->SetAutoStartPiP(true, 0, 1, 1);
962     ASSERT_EQ(result, WSError::WS_OK);
963 }
964 
965 /**
966  * @tc.name: UpdatePiPControlStatus
967  * @tc.desc: UpdatePiPControlStatus
968  * @tc.type: FUNC
969  */
970 HWTEST_F(SceneSessionTest4, UpdatePiPControlStatus, Function | SmallTest | Level2)
971 {
972     SessionInfo info;
973     info.abilityName_ = "UpdatePiPControlStatus";
974     info.bundleName_ = "UpdatePiPControlStatus";
975     auto sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
976     ASSERT_NE(sceneSession, nullptr);
977     sceneSession->isActive_ = true;
978 
979     auto property = sptr<WindowSessionProperty>::MakeSptr();
980     ASSERT_NE(property, nullptr);
981     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
982     sceneSession->SetSessionProperty(property);
983 
984     auto controlType = WsPiPControlType::VIDEO_PLAY_PAUSE;
985     auto status = WsPiPControlStatus::PLAY;
986     sceneSession->isTerminating_ = false;
987     WSError result = sceneSession->UpdatePiPControlStatus(controlType, status);
988     ASSERT_EQ(result, WSError::WS_OK);
989 
990     sceneSession->isTerminating_ = true;
991     result = sceneSession->UpdatePiPControlStatus(controlType, status);
992     ASSERT_EQ(result, WSError::WS_OK);
993 }
994 
995 /**
996  * @tc.name: SetSplitButtonVisible01
997  * @tc.desc: SetSplitButtonVisible
998  * @tc.type: FUNC
999  */
1000 HWTEST_F(SceneSessionTest4, SetSplitButtonVisible01, Function | SmallTest | Level2)
1001 {
1002     SessionInfo info;
1003     info.abilityName_ = "SetSplitButtonVisible01";
1004     info.bundleName_ = "SetSplitButtonVisible01";
1005     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
1006 
1007     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1008     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
1009     sceneSession->SetSessionProperty(property);
1010     sceneSession->sessionStage_ = nullptr;
1011     auto result = sceneSession->SetSplitButtonVisible(true);
1012     EXPECT_EQ(result, WSError::WS_ERROR_NULLPTR);
1013 }
1014 
1015 /**
1016  * @tc.name: SetSplitButtonVisible02
1017  * @tc.desc: SetSplitButtonVisible
1018  * @tc.type: FUNC
1019  */
1020 HWTEST_F(SceneSessionTest4, SetSplitButtonVisible02, Function | SmallTest | Level2)
1021 {
1022     SessionInfo info;
1023     info.abilityName_ = "SetSplitButtonVisible02";
1024     info.bundleName_ = "SetSplitButtonVisible02";
1025     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
1026 
1027     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1028     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
1029     sceneSession->SetSessionProperty(property);
1030     sptr<SessionStageMocker> mockSessionStage = sptr<SessionStageMocker>::MakeSptr();
1031     sceneSession->sessionStage_ = mockSessionStage;
1032     auto result = sceneSession->SetSplitButtonVisible(true);
1033     EXPECT_EQ(result, WSError::WS_OK);
1034 }
1035 
1036 /**
1037  * @tc.name: SetMovable01
1038  * @tc.desc: SetMovable
1039  * @tc.type: FUNC
1040  */
1041 HWTEST_F(SceneSessionTest4, SetMovable01, Function | SmallTest | Level2)
1042 {
1043     SessionInfo info;
1044     info.abilityName_ = "SetMovable01";
1045     info.bundleName_ = "SetMovable01";
1046 
1047     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1048 
1049     sceneSession->SetMovable(true);
1050     sceneSession->leashWinSurfaceNode_ = nullptr;
1051     SessionEvent event = SessionEvent::EVENT_START_MOVE;
1052     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(1, WindowType::WINDOW_TYPE_FLOAT);
1053     sceneSession->SetMovable(true);
1054     sceneSession->OnSessionEvent(event);
1055     sceneSession->moveDragController_->isStartDrag_ = true;
1056     auto result = sceneSession->OnSessionEvent(event);
1057     ASSERT_EQ(result, WSError::WS_OK);
1058 }
1059 
1060 /**
1061  * @tc.name: SetWindowFlags01
1062  * @tc.desc: SetWindowFlags
1063  * @tc.type: FUNC
1064  */
1065 HWTEST_F(SceneSessionTest4, SetWindowFlags01, Function | SmallTest | Level2)
1066 {
1067     SessionInfo info;
1068     info.abilityName_ = "SetWindowFlags01";
1069     info.bundleName_ = "SetWindowFlags01";
1070 
1071     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1072     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1073     sceneSession->SetWindowFlags(property);
1074     ASSERT_EQ(0, property->GetWindowFlags());
1075 }
1076 
1077 /**
1078  * @tc.name: SetWindowFlags02
1079  * @tc.desc: SetWindowFlags
1080  * @tc.type: FUNC
1081  */
1082 HWTEST_F(SceneSessionTest4, SetWindowFlags02, Function | SmallTest | Level2)
1083 {
1084     SessionInfo info;
1085     info.abilityName_ = "SetWindowFlags02";
1086     info.bundleName_ = "SetWindowFlags02";
1087 
1088     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1089     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1090     property->SetWindowFlags(2);
1091     sceneSession->SetSessionProperty(property);
1092 
1093     sptr<WindowSessionProperty> property2 = sptr<WindowSessionProperty>::MakeSptr();
1094     property2->SetWindowFlags(2);
1095     property2->SetSystemCalling(false);
1096 
1097     sceneSession->SetWindowFlags(property2);
1098     ASSERT_EQ(2, sceneSession->GetSessionProperty()->GetWindowFlags());
1099 }
1100 
1101 /**
1102  * @tc.name: SetWindowFlags03
1103  * @tc.desc: SetWindowFlags
1104  * @tc.type: FUNC
1105  */
1106 HWTEST_F(SceneSessionTest4, SetWindowFlags03, Function | SmallTest | Level2)
1107 {
1108     SessionInfo info;
1109     info.abilityName_ = "SetWindowFlags03";
1110     info.bundleName_ = "SetWindowFlags03";
1111 
1112     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1113     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1114     property->SetWindowFlags(2);
1115     sceneSession->SetSessionProperty(property);
1116 
1117     sptr<WindowSessionProperty> property2 = sptr<WindowSessionProperty>::MakeSptr();
1118     property2->SetWindowFlags(2);
1119     property2->SetSystemCalling(true);
1120 
1121     sceneSession->SetWindowFlags(property2);
1122     ASSERT_EQ(2, sceneSession->GetSessionProperty()->GetWindowFlags());
1123 }
1124 
1125 /**
1126  * @tc.name: UpdateSessionPropertyByAction02
1127  * @tc.desc: UpdateSessionPropertyByAction function
1128  * @tc.type: FUNC
1129  */
1130 HWTEST_F(SceneSessionTest4, UpdateSessionPropertyByAction02, Function | SmallTest | Level2)
1131 {
1132     SessionInfo info;
1133     info.abilityName_ = "UpdateSessionPropertyByAction02";
1134     info.bundleName_ = "UpdateSessionPropertyByAction02";
1135     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1136 
1137     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1138     sceneSession->SetSessionProperty(property);
1139     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST;
1140     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, sceneSession->UpdateSessionPropertyByAction(property, action));
1141 }
1142 
1143 /**
1144  * @tc.name: IsMovable01
1145  * @tc.desc: IsMovable
1146  * @tc.type: FUNC
1147  */
1148 HWTEST_F(SceneSessionTest4, isMovable01, Function | SmallTest | Level2)
1149 {
1150     SessionInfo info;
1151     info.abilityName_ = "isMovable01";
1152     info.bundleName_ = "isMovable01";
1153     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1154     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1155     sceneSession->SetSessionProperty(property);
1156     ASSERT_EQ(false, sceneSession->IsMovable());
1157 }
1158 
1159 /**
1160  * @tc.name: IsMovable02
1161  * @tc.desc: IsMovable
1162  * @tc.type: FUNC
1163  */
1164 HWTEST_F(SceneSessionTest4, IsMovable02, Function | SmallTest | Level2)
1165 {
1166     SessionInfo info;
1167     info.abilityName_ = "IsMovable02";
1168     info.bundleName_ = "IsMovable02";
1169     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1170     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1171     sceneSession->SetSessionProperty(property);
1172     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, WindowType::WINDOW_TYPE_FLOAT);
1173     ASSERT_EQ(WSError::WS_DO_NOTHING, sceneSession->UpdateFocus(false));
1174     ASSERT_EQ(false, sceneSession->IsMovable());
1175     ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateFocus(true));
1176 }
1177 
1178 /**
1179  * @tc.name: IsMovable03
1180  * @tc.desc: IsMovable
1181  * @tc.type: FUNC
1182  */
1183 HWTEST_F(SceneSessionTest4, IsMovable03, Function | SmallTest | Level2)
1184 {
1185     SessionInfo info;
1186     info.abilityName_ = "IsMovable03";
1187     info.bundleName_ = "IsMovable03";
1188     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1189     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1190     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, WindowType::WINDOW_TYPE_FLOAT);
1191     ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateFocus(true));
1192     ASSERT_EQ(false, sceneSession->IsMovable());
1193 }
1194 
1195 /**
1196  * @tc.name: SetFrameGravity
1197  * @tc.desc: SetFrameGravity Test
1198  * @tc.type: FUNC
1199  */
1200 HWTEST_F(SceneSessionTest4, SetFrameGravity, Function | SmallTest | Level2)
1201 {
1202     SessionInfo info;
1203     info.abilityName_ = "SetFrameGravity";
1204     info.bundleName_ = "SetFrameGravity";
1205     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1206     EXPECT_NE(session, nullptr);
1207 
1208     struct RSSurfaceNodeConfig config;
1209     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
1210     session->surfaceNode_ = surfaceNode;
1211     ASSERT_EQ(true, session->SetFrameGravity(Gravity::RESIZE));
1212     session->surfaceNode_ = nullptr;
1213     ASSERT_EQ(false, session->SetFrameGravity(Gravity::TOP_LEFT));
1214 }
1215 
1216 /**
1217  * @tc.name: SetIsLayoutFullScreen
1218  * @tc.desc: SetIsLayoutFullScreen Test
1219  * @tc.type: FUNC
1220  */
1221 HWTEST_F(SceneSessionTest4, SetIsLayoutFullScreen, Function | SmallTest | Level2)
1222 {
1223     SessionInfo info;
1224     info.abilityName_ = "SetIsLayoutFullScreen";
1225     info.bundleName_ = "SetIsLayoutFullScreen";
1226     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1227     ASSERT_NE(session, nullptr);
1228     session->SetIsLayoutFullScreen(true);
1229     EXPECT_EQ(session->IsLayoutFullScreen(), true);
1230 }
1231 
1232 /**
1233  * @tc.name: IsLayoutFullScreen
1234  * @tc.desc: IsLayoutFullScreen Test
1235  * @tc.type: FUNC
1236  */
1237 HWTEST_F(SceneSessionTest4, IsLayoutFullScreen, Function | SmallTest | Level2)
1238 {
1239     SessionInfo info;
1240     info.abilityName_ = "IsLayoutFullScreen";
1241     info.bundleName_ = "IsLayoutFullScreen";
1242     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1243     ASSERT_NE(session, nullptr);
1244     EXPECT_EQ(session->IsLayoutFullScreen(), false);
1245 }
1246 
1247 /**
1248  * @tc.name: UpdateAllModalUIExtensions
1249  * @tc.desc: UpdateAllModalUIExtensions Test
1250  * @tc.type: FUNC
1251  */
1252 HWTEST_F(SceneSessionTest4, UpdateAllModalUIExtensions, Function | SmallTest | Level2)
1253 {
1254     SessionInfo info;
1255     info.abilityName_ = "UpdateAllModalUIExtensions";
1256     info.bundleName_ = "UpdateAllModalUIExtensions";
1257     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1258     EXPECT_NE(session, nullptr);
1259 
1260     struct RSSurfaceNodeConfig config;
1261     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
1262     session->surfaceNode_ = surfaceNode;
1263     WSRect globalRect = { 100, 100, 100, 100 };
1264     session->SetSessionGlobalRect(globalRect);
1265 
1266     Rect windowRect = { 100, 100, 100, 100 };
1267     Rect uiExtRect = { 0, 0, 100, 100 };
1268     ExtensionWindowEventInfo extensionInfo { 1, 1, windowRect, uiExtRect, false };
1269     ExtensionWindowEventInfo extensionInfo2 { 2, 2, windowRect, uiExtRect, true };
1270     session->modalUIExtensionInfoList_.push_back(extensionInfo);
1271     session->modalUIExtensionInfoList_.push_back(extensionInfo2);
1272 
1273     WSRect newGlobalRect = { 150, 150, 100, 100 };
1274     session->UpdateAllModalUIExtensions(newGlobalRect);
1275 }
1276 
1277 /**
1278  * @tc.name: HandleActionUpdateSubWindowZLevel
1279  * @tc.desc: HandleActionUpdateSubWindowZLevel Test
1280  * @tc.type: FUNC
1281  */
1282 HWTEST_F(SceneSessionTest4, HandleActionUpdateSubWindowZLevel, Function | SmallTest | Level2)
1283 {
1284     SessionInfo info;
1285     info.abilityName_ = "HandleActionUpdateSubWindowZLevel";
1286     info.bundleName_ = "HandleActionUpdateSubWindowZLevel";
1287     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1288     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1289     sptr<WindowSessionProperty> sessionProperty = sptr<WindowSessionProperty>::MakeSptr();
1290     sessionProperty->zLevel_ = 0;
1291     sceneSession->property_ = sessionProperty;
1292     ASSERT_EQ(0, sceneSession->GetSubWindowZLevel());
1293     property->zLevel_ = 1;
1294     WMError ret = sceneSession->HandleActionUpdateSubWindowZLevel(property,
1295         WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL);
1296     sceneSession->SetSubWindowZLevel(1);
1297     ASSERT_EQ(WMError::WM_OK, ret);
1298 }
1299 
1300 /**
1301  * @tc.name: HandleActionUpdateAvoidAreaOption
1302  * @tc.desc: normal function
1303  * @tc.type: FUNC
1304  */
1305 HWTEST_F(SceneSessionTest4, HandleActionUpdateAvoidAreaOption, Function | SmallTest | Level2)
1306 {
1307     SessionInfo info;
1308     info.abilityName_ = "HandleActionUpdateAvoidAreaOption";
1309     info.bundleName_ = "HandleActionUpdateAvoidAreaOption";
1310     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1311     sptr<WindowSessionProperty> sessionProperty = session->GetSessionProperty();
1312 
1313     sessionProperty->SetAvoidAreaOption(1);
1314     sessionProperty->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_FLOAT);
1315     WMError ret = session->HandleActionUpdateAvoidAreaOption(sessionProperty, action);
1316     ASSERT_EQ(WMError::WM_OK, ret);
1317 
1318     sessionProperty->SetAvoidAreaOption(2);
1319     sessionProperty->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
1320     ret = session->HandleActionUpdateAvoidAreaOption(sessionProperty, action);
1321     ASSERT_EQ(WMError::WM_OK, ret);
1322 
1323     sessionProperty->SetAvoidAreaOption(3);
1324     sessionProperty->SetWindowType(WindowType::WINDOW_TYPE_UI_EXTENSION);
1325     ret = session->HandleActionUpdateAvoidAreaOption(sessionProperty, action);
1326     ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
1327 }
1328 
1329 /**
1330  * @tc.name: GetSystemAvoidArea
1331  * @tc.desc: normal function
1332  * @tc.type: FUNC
1333  */
1334 HWTEST_F(SceneSessionTest4, GetSystemAvoidArea, Function | SmallTest | Level2)
1335 {
1336     SessionInfo info;
1337     info.abilityName_ = "GetSystemAvoidArea";
1338     info.bundleName_ = "GetSystemAvoidArea";
1339     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1340     auto specificCallback = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1341     sceneSession->isActive_ = true;
1342     SystemSessionConfig systemConfig;
1343     systemConfig.windowUIType_ = WindowUIType::PHONE_WINDOW;
1344     sceneSession->SetSystemConfig(systemConfig);
1345     ScreenSessionManagerClient::GetInstance().screenSessionMap_.clear();
1346     sceneSession->GetSessionProperty()->SetDisplayId(2024);
1347     sptr<ScreenSession> screenSession = sptr<ScreenSession>::MakeSptr();
1348     ScreenSessionManagerClient::GetInstance().screenSessionMap_.insert(std::make_pair(2024, screenSession));
1349     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1350     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1351     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
1352     sceneSession->SetSessionProperty(property);
1353 
1354     WSRect rect1({0, 0, 10, 10});
1355     AvoidArea avoidArea;
1356     sceneSession->GetSystemAvoidArea(rect1, avoidArea);
1357     WSRect rect2({0, 0, 10, 10});
1358     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1359     sceneSession->SetSessionProperty(property);
1360     sceneSession->GetSystemAvoidArea(rect2, avoidArea);
1361     ASSERT_EQ(avoidArea.topRect_.posX_, 0);
1362 
1363     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1364     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
1365     sceneSession->SetSessionProperty(property);
1366     ASSERT_EQ(avoidArea.topRect_.posX_, 0);
1367 }
1368 
1369 /**
1370  * @tc.name: CheckGetAvoidAreaAvailable
1371  * @tc.desc: normal function
1372  * @tc.type: FUNC
1373  */
1374 HWTEST_F(SceneSessionTest4, CheckGetAvoidAreaAvailable, Function | SmallTest | Level2)
1375 {
1376     SessionInfo info;
1377     info.abilityName_ = "CheckGetAvoidAreaAvailable";
1378     info.bundleName_ = "CheckGetAvoidAreaAvailable";
1379     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
1380     sptr<WindowSessionProperty> property = session->GetSessionProperty();
1381     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1382     SystemSessionConfig systemConfig;
1383     systemConfig.windowUIType_ = WindowUIType::PHONE_WINDOW;
1384     session->SetSystemConfig(systemConfig);
1385 
1386     bool ret;
1387     property->SetAvoidAreaOption(0);
1388     property->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_FLOAT);
1389     session->SetSessionProperty(property);
1390     ret = session->CheckGetAvoidAreaAvailable(AvoidAreaType::TYPE_SYSTEM);
1391     ASSERT_EQ(false, ret);
1392 
1393     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
1394     session->SetSessionProperty(property);
1395     ret = session->CheckGetAvoidAreaAvailable(AvoidAreaType::TYPE_SYSTEM);
1396     ASSERT_EQ(false, ret);
1397 }
1398 
1399 /**
1400  * @tc.name: GetAvoidAreaBytype
1401  * @tc.desc: normal function
1402  * @tc.type: FUNC
1403  */
1404 HWTEST_F(SceneSessionTest4, GetAvoidAreaBytype, Function | SmallTest | Level2)
1405 {
1406     SessionInfo info;
1407     info.abilityName_ = "GetAvoidAreaBytype";
1408     info.bundleName_ = "GetAvoidAreaBytype";
1409     WSRect rect({0, 0, 10, 10});
1410     AvoidArea avoidArea;
1411     std::vector<sptr<SceneSession>> sessionVector;
1412     for (int i = 0; i < 1000; i++) {
1413         sessionVector.push_back(sptr<SceneSession>::MakeSptr(info, nullptr));
1414         sessionVector[i]->GetSessionProperty()->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_FLOAT);
1415         sessionVector[i]->GetSessionProperty()->SetAvoidAreaOption(
1416             static_cast<uint32_t>(AvoidAreaOption::ENABLE_SYSTEM_WINDOW));
1417     }
1418     for (int i = 0; i < 1000; i++) {
1419         avoidArea = sessionVector[i]->GetAvoidAreaByType(AvoidAreaType::TYPE_SYSTEM, rect);
1420         ASSERT_EQ(avoidArea.topRect_.posX_, 0);
1421     }
1422 }
1423 }
1424 }
1425 }