• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "window_helper.h"
17 #include "display_manager.h"
18 #include "pointer_event.h"
19 
20 #include <gtest/gtest.h>
21 #include "key_event.h"
22 #include "session/host/include/scene_session.h"
23 #include "session/host/include/sub_session.h"
24 #include "session/host/include/system_session.h"
25 #include "session/host/include/main_session.h"
26 #include "wm_common.h"
27 #include "mock/mock_session_stage.h"
28 #include "mock/mock_accesstoken_kit.h"
29 #include "input_event.h"
30 #include <pointer_event.h>
31 #include <ui/rs_surface_node.h>
32 
33 using namespace testing;
34 using namespace testing::ext;
35 namespace OHOS {
36 namespace Rosen {
37 namespace {
38 std::string logMsg;
SceneSessionLogCallback(const LogType type,const LogLevel level,const unsigned int domain,const char * tag,const char * msg)39 void SceneSessionLogCallback(const LogType type,
40                              const LogLevel level,
41                              const unsigned int domain,
42                              const char* tag,
43                              const char* msg)
44 {
45     logMsg = msg;
46 }
47 } // namespace
48 constexpr int WAIT_ASYNC_US = 1000000;
49 class SceneSessionTest : public testing::Test {
50 public:
51     static void SetUpTestCase();
52     static void TearDownTestCase();
53     void SetUp() override;
54     void TearDown() override;
55 };
56 
SetUpTestCase()57 void SceneSessionTest::SetUpTestCase() {}
58 
TearDownTestCase()59 void SceneSessionTest::TearDownTestCase() {}
60 
SetUp()61 void SceneSessionTest::SetUp() {}
62 
TearDown()63 void SceneSessionTest::TearDown() {}
64 
65 namespace {
66 
67 /**
68  * @tc.name: SetGlobalMaximizeMode01
69  * @tc.desc: SetGlobalMaximizeMode
70  * @tc.type: FUNC
71  */
72 HWTEST_F(SceneSessionTest, SetGlobalMaximizeMode01, TestSize.Level1)
73 {
74     SessionInfo info;
75     info.abilityName_ = "SetGlobalMaximizeMode01";
76     info.bundleName_ = "SetGlobalMaximizeMode01";
77     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
78     EXPECT_NE(sceneSession, nullptr);
79     sceneSession->isActive_ = true;
80     auto result = sceneSession->SetGlobalMaximizeMode(MaximizeMode::MODE_AVOID_SYSTEM_BAR);
81     ASSERT_EQ(result, WSError::WS_OK);
82 }
83 
84 /**
85  * @tc.name: GetGlobalMaximizeMode01
86  * @tc.desc: GetGlobalMaximizeMode
87  * @tc.type: FUNC
88  */
89 HWTEST_F(SceneSessionTest, GetGlobalMaximizeMode01, TestSize.Level1)
90 {
91     SessionInfo info;
92     info.abilityName_ = "GetGlobalMaximizeMode01";
93     info.bundleName_ = "GetGlobalMaximizeMode01";
94     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
95     EXPECT_NE(sceneSession, nullptr);
96     sceneSession->isActive_ = true;
97     MaximizeMode mode;
98     auto result = sceneSession->GetGlobalMaximizeMode(mode);
99     ASSERT_EQ(result, WSError::WS_OK);
100 }
101 
102 /**
103  * @tc.name: GlobalMaximizeMode01
104  * @tc.desc: GlobalMaximizeMode MODE_AVOID_SYSTEM_BAR
105  * @tc.type: FUNC
106  */
107 HWTEST_F(SceneSessionTest, GlobalMaximizeMode01, TestSize.Level1)
108 {
109     SessionInfo info;
110     info.abilityName_ = "GlobalMaximizeMode01";
111     info.bundleName_ = "GlobalMaximizeMode01";
112     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
113     EXPECT_NE(sceneSession, nullptr);
114     sceneSession->isActive_ = true;
115     auto result = sceneSession->SetGlobalMaximizeMode(MaximizeMode::MODE_AVOID_SYSTEM_BAR);
116     ASSERT_EQ(result, WSError::WS_OK);
117 
118     MaximizeMode mode;
119     result = sceneSession->GetGlobalMaximizeMode(mode);
120     ASSERT_EQ(result, WSError::WS_OK);
121     ASSERT_EQ(mode, MaximizeMode::MODE_AVOID_SYSTEM_BAR);
122 }
123 
124 /**
125  * @tc.name: GlobalMaximizeMode02
126  * @tc.desc: GlobalMaximizeMode MODE_FULL_FILL
127  * @tc.type: FUNC
128  */
129 HWTEST_F(SceneSessionTest, GlobalMaximizeMode02, TestSize.Level1)
130 {
131     SessionInfo info;
132     info.abilityName_ = "GlobalMaximizeMode02";
133     info.bundleName_ = "GlobalMaximizeMode02";
134     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
135     EXPECT_NE(sceneSession, nullptr);
136     sceneSession->isActive_ = true;
137     auto result = sceneSession->SetGlobalMaximizeMode(MaximizeMode::MODE_FULL_FILL);
138     ASSERT_EQ(result, WSError::WS_OK);
139     MaximizeMode mode;
140     result = sceneSession->GetGlobalMaximizeMode(mode);
141     ASSERT_EQ(result, WSError::WS_OK);
142     ASSERT_EQ(mode, MaximizeMode::MODE_FULL_FILL);
143 }
144 
145 /**
146  * @tc.name: SetAndGetPipTemplateInfo
147  * @tc.desc: SetAndGetPipTemplateInfo Test
148  * @tc.type: FUNC
149  */
150 HWTEST_F(SceneSessionTest, SetAndGetPipTemplateInfo, TestSize.Level1)
151 {
152     SessionInfo info;
153     info.abilityName_ = "Background01";
154     info.bundleName_ = "Background01";
155     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
156     EXPECT_NE(sceneSession, nullptr);
157     sceneSession->isActive_ = true;
158     PiPTemplateInfo pipTemplateInfo;
159     pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
160     sceneSession->SetPiPTemplateInfo(pipTemplateInfo);
161     ASSERT_EQ(sceneSession->GetPiPTemplateInfo().pipTemplateType, static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL));
162 
163     pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_MEETING);
164     sceneSession->SetPiPTemplateInfo(pipTemplateInfo);
165     ASSERT_EQ(sceneSession->GetPiPTemplateInfo().pipTemplateType,
166               static_cast<uint32_t>(PiPTemplateType::VIDEO_MEETING));
167 }
168 
169 /**
170  * @tc.name: UpdateWindowSceneAfterCustomAnimation01
171  * @tc.desc: UpdateWindowSceneAfterCustomAnimation
172  * @tc.type: FUNC
173  */
174 HWTEST_F(SceneSessionTest, UpdateWindowSceneAfterCustomAnimation01, TestSize.Level1)
175 {
176     SessionInfo info;
177     info.abilityName_ = "Background01";
178     info.bundleName_ = "Background01";
179     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
180     EXPECT_NE(sceneSession, nullptr);
181     sceneSession->isActive_ = true;
182     auto result = sceneSession->UpdateWindowSceneAfterCustomAnimation(false);
183     ASSERT_EQ(result, WSError::WS_OK);
184     result = sceneSession->UpdateWindowSceneAfterCustomAnimation(true);
185     ASSERT_EQ(result, WSError::WS_OK);
186 }
187 
188 /**
189  * @tc.name: SetZOrder01
190  * @tc.desc: SetZOrder
191  * @tc.type: FUNC
192  */
193 HWTEST_F(SceneSessionTest, SetZOrder01, TestSize.Level1)
194 {
195     SessionInfo info;
196     info.abilityName_ = "SetZOrder01";
197     info.bundleName_ = "SetZOrder01";
198     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
199     EXPECT_NE(sceneSession, nullptr);
200     uint32_t zOrder = 2;
201     sceneSession->SetZOrder(zOrder);
202     usleep(WAIT_ASYNC_US);
203     ASSERT_EQ(zOrder, sceneSession->zOrder_);
204     sceneSession->SetZOrder(zOrder);
205     usleep(WAIT_ASYNC_US);
206     ASSERT_EQ(zOrder, sceneSession->zOrder_);
207 }
208 
209 /**
210  * @tc.name: GetTouchHotAreas01
211  * @tc.desc: GetTouchHotAreas
212  * @tc.type: FUNC
213  */
214 HWTEST_F(SceneSessionTest, GetTouchHotAreas01, TestSize.Level1)
215 {
216     SessionInfo info;
217     info.abilityName_ = "Background01";
218     info.bundleName_ = "GetTouchHotAreas01";
219     sptr<Rosen::ISession> session_;
220     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
221         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
222     EXPECT_NE(specificCallback_, nullptr);
223     sptr<SceneSession> sceneSession;
224     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
225     EXPECT_NE(sceneSession, nullptr);
226     Rect windowRect = { 1, 1, 1, 1 };
227     std::vector<Rect> rects;
228     uint32_t hotAreasNum = 10;
229     uint32_t hotAreaWidth = windowRect.width_ / hotAreasNum;
230     uint32_t hotAreaHeight = windowRect.height_ / hotAreasNum;
231     for (uint32_t i = 0; i < hotAreasNum; ++i) {
232         rects.emplace_back(Rect{ hotAreaWidth * i, hotAreaHeight * i, hotAreaWidth, hotAreaHeight });
233     }
234     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
235 
236     ASSERT_NE(nullptr, property);
237     property->SetTouchHotAreas(rects);
238     ASSERT_NE(rects, sceneSession->GetTouchHotAreas());
239 }
240 
241 /**
242  * @tc.name: SetTurnScreenOn01
243  * @tc.desc: SetTurnScreenOn
244  * @tc.type: FUNC
245  */
246 HWTEST_F(SceneSessionTest, SetTurnScreenOn01, TestSize.Level1)
247 {
248     SessionInfo info;
249     info.abilityName_ = "SetTurnScreenOn01";
250     info.bundleName_ = "SetTurnScreenOn01";
251     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
252     EXPECT_NE(sceneSession, nullptr);
253     ASSERT_EQ(WSError::WS_OK, sceneSession->SetTurnScreenOn(true));
254     ASSERT_EQ(true, sceneSession->IsTurnScreenOn());
255 }
256 
257 /**
258  * @tc.name: SetTurnScreenOn02
259  * @tc.desc: SetTurnScreenOn
260  * @tc.type: FUNC
261  */
262 HWTEST_F(SceneSessionTest, SetTurnScreenOn02, TestSize.Level1)
263 {
264     SessionInfo info;
265     info.abilityName_ = "SetTurnScreenOn02";
266     info.bundleName_ = "SetTurnScreenOn02";
267     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
268     EXPECT_NE(sceneSession, nullptr);
269     ASSERT_EQ(WSError::WS_OK, sceneSession->SetTurnScreenOn(false));
270     ASSERT_EQ(false, sceneSession->IsTurnScreenOn());
271 }
272 
273 /**
274  * @tc.name: UpdateWindowAnimationFlag01
275  * @tc.desc: UpdateWindowAnimationFlag true
276  * @tc.type: FUNC
277  */
278 HWTEST_F(SceneSessionTest, UpdateWindowAnimationFlag01, TestSize.Level1)
279 {
280     SessionInfo info;
281     info.abilityName_ = "UpdateWindowAnimationFlag01";
282     info.bundleName_ = "UpdateWindowAnimationFlag01";
283     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
284     EXPECT_NE(sceneSession, nullptr);
285     ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateWindowAnimationFlag(true));
286 }
287 
288 /**
289  * @tc.name: UpdateWindowAnimationFlag02
290  * @tc.desc: UpdateWindowAnimationFlag false
291  * @tc.type: FUNC
292  */
293 HWTEST_F(SceneSessionTest, UpdateWindowAnimationFlag02, TestSize.Level1)
294 {
295     SessionInfo info;
296     info.abilityName_ = "UpdateWindowAnimationFlag02";
297     info.bundleName_ = "UpdateWindowAnimationFlag02";
298     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
299     EXPECT_NE(sceneSession, nullptr);
300     ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateWindowAnimationFlag(false));
301 }
302 
303 /**
304  * @tc.name: SetRequestedOrientation
305  * @tc.desc: SetRequestedOrientation
306  * @tc.type: FUNC
307  */
308 HWTEST_F(SceneSessionTest, SetRequestedOrientation01, TestSize.Level1)
309 {
310     SessionInfo info;
311     info.abilityName_ = "SetRequestedOrientation01";
312     info.bundleName_ = "SetRequestedOrientation01";
313     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
314     EXPECT_NE(sceneSession, nullptr);
315     Orientation ori = Orientation::UNSPECIFIED;
316     sceneSession->SetRequestedOrientation(ori);
317     Orientation ret = sceneSession->GetRequestedOrientation();
318     ASSERT_EQ(ori, ret);
319 
320     sceneSession->SetRequestedOrientation(Orientation::AUTO_ROTATION_UNSPECIFIED);
321     Orientation ret1 = sceneSession->GetRequestedOrientation();
322     ASSERT_EQ(ret1, Orientation::AUTO_ROTATION_UNSPECIFIED);
323 
324     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT);
325     Orientation ret2 = sceneSession->GetRequestedOrientation();
326     ASSERT_EQ(ret2, Orientation::USER_ROTATION_PORTRAIT);
327 
328     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE);
329     Orientation ret3 = sceneSession->GetRequestedOrientation();
330     ASSERT_EQ(ret3, Orientation::USER_ROTATION_LANDSCAPE);
331 
332     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT_INVERTED);
333     Orientation ret4 = sceneSession->GetRequestedOrientation();
334     ASSERT_EQ(ret4, Orientation::USER_ROTATION_PORTRAIT_INVERTED);
335 
336     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
337     Orientation ret5 = sceneSession->GetRequestedOrientation();
338     ASSERT_EQ(ret5, Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
339 
340     sceneSession->SetRequestedOrientation(Orientation::FOLLOW_DESKTOP);
341     Orientation ret6 = sceneSession->GetRequestedOrientation();
342     ASSERT_EQ(ret6, Orientation::FOLLOW_DESKTOP);
343 }
344 
345 /**
346  * @tc.name: GetRequestedOrientation
347  * @tc.desc: GetRequestedOrientation
348  * @tc.type: FUNC
349  */
350 HWTEST_F(SceneSessionTest, GetRequestedOrientation, TestSize.Level1)
351 {
352     SessionInfo info;
353     info.abilityName_ = "GetRequestedOrientation";
354     info.bundleName_ = "GetRequestedOrientation";
355     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
356     Orientation ori = Orientation::HORIZONTAL;
357     sceneSession->SetRequestedOrientation(ori);
358     Orientation ret = sceneSession->GetRequestedOrientation();
359     ASSERT_EQ(ori, ret);
360 
361     sceneSession->SetRequestedOrientation(Orientation::AUTO_ROTATION_UNSPECIFIED);
362     Orientation ret1 = sceneSession->GetRequestedOrientation();
363     ASSERT_EQ(ret1, Orientation::AUTO_ROTATION_UNSPECIFIED);
364 
365     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT);
366     Orientation ret2 = sceneSession->GetRequestedOrientation();
367     ASSERT_EQ(ret2, Orientation::USER_ROTATION_PORTRAIT);
368 
369     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE);
370     Orientation ret3 = sceneSession->GetRequestedOrientation();
371     ASSERT_EQ(ret3, Orientation::USER_ROTATION_LANDSCAPE);
372 
373     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT_INVERTED);
374     Orientation ret4 = sceneSession->GetRequestedOrientation();
375     ASSERT_EQ(ret4, Orientation::USER_ROTATION_PORTRAIT_INVERTED);
376 
377     sceneSession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
378     Orientation ret5 = sceneSession->GetRequestedOrientation();
379     ASSERT_EQ(ret5, Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
380 
381     sceneSession->SetRequestedOrientation(Orientation::FOLLOW_DESKTOP);
382     Orientation ret6 = sceneSession->GetRequestedOrientation();
383     ASSERT_EQ(ret6, Orientation::FOLLOW_DESKTOP);
384 }
385 
386 /**
387  * @tc.name: IsKeepScreenOn01
388  * @tc.desc: IsKeepScreenOn true
389  * @tc.type: FUNC
390  */
391 HWTEST_F(SceneSessionTest, IsKeepScreenOn01, TestSize.Level1)
392 {
393     SessionInfo info;
394     info.abilityName_ = "IsKeepScreenOn01";
395     info.bundleName_ = "IsKeepScreenOn01";
396     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
397     ASSERT_NE(sceneSession, nullptr);
398     ASSERT_EQ(WSError::WS_OK, sceneSession->SetKeepScreenOn(true));
399     ASSERT_EQ(true, sceneSession->IsKeepScreenOn());
400 }
401 
402 /**
403  * @tc.name: IsKeepScreenOn02
404  * @tc.desc: IsKeepScreenOn false
405  * @tc.type: FUNC
406  */
407 HWTEST_F(SceneSessionTest, IsKeepScreenOn02, TestSize.Level1)
408 {
409     SessionInfo info;
410     info.abilityName_ = "IsKeepScreenOn02";
411     info.bundleName_ = "IsKeepScreenOn02";
412     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
413     ASSERT_NE(sceneSession, nullptr);
414     ASSERT_EQ(WSError::WS_OK, sceneSession->SetKeepScreenOn(false));
415     ASSERT_EQ(false, sceneSession->IsKeepScreenOn());
416 }
417 
418 /**
419  * @tc.name: IsViewKeepScreenOn01
420  * @tc.desc: IsViewKeepScreenOn true
421  * @tc.type: FUNC
422  */
423 HWTEST_F(SceneSessionTest, IsViewKeepScreenOn01, TestSize.Level1)
424 {
425     SessionInfo info;
426     info.abilityName_ = "IsViewKeepScreenOn01";
427     info.bundleName_ = "IsViewKeepScreenOn01";
428     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
429     ASSERT_NE(sceneSession, nullptr);
430     ASSERT_EQ(WSError::WS_OK, sceneSession->SetViewKeepScreenOn(true));
431     ASSERT_EQ(true, sceneSession->IsViewKeepScreenOn());
432 }
433 
434 /**
435  * @tc.name: IsViewKeepScreenOn02
436  * @tc.desc: IsViewKeepScreenOn false
437  * @tc.type: FUNC
438  */
439 HWTEST_F(SceneSessionTest, IsViewKeepScreenOn02, TestSize.Level1)
440 {
441     SessionInfo info;
442     info.abilityName_ = "IsViewKeepScreenOn02";
443     info.bundleName_ = "IsViewKeepScreenOn02";
444     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
445     ASSERT_NE(sceneSession, nullptr);
446     ASSERT_EQ(WSError::WS_OK, sceneSession->SetViewKeepScreenOn(false));
447     ASSERT_EQ(false, sceneSession->IsViewKeepScreenOn());
448 }
449 
450 /**
451  * @tc.name: HandleActionUpdateWindowShadowEnabled01
452  * @tc.desc: HandleActionUpdateWindowShadowEnabled
453  * @tc.type: FUNC
454  */
455 HWTEST_F(SceneSessionTest, HandleActionUpdateWindowShadowEnabled01, TestSize.Level1)
456 {
457     WSPropertyChangeAction action = WSPropertyChangeAction::ACTION_UPDATE_WINDOW_SHADOW_ENABLED;
458     SessionInfo info;
459     info.abilityName_ = "HandleActionUpdateWindowShadowEnabled";
460     info.bundleName_ = "HandleActionUpdateWindowShadowEnabled";
461     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
462     ASSERT_NE(sceneSession, nullptr);
463     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
464     sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
465     MockAccesstokenKit::MockAccessTokenKitRet(-1);
466     sceneSession->containerColorList_.insert("abc");
467     auto ret = sceneSession->HandleActionUpdateWindowShadowEnabled(property, action);
468     EXPECT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, ret);
469 
470     sceneSession->containerColorList_.insert("HandleActionUpdateWindowShadowEnabled");
471     ret = sceneSession->HandleActionUpdateWindowShadowEnabled(property, action);
472     EXPECT_EQ(WMError::WM_ERROR_INVALID_CALLING, ret);
473 
474     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
475     ret = sceneSession->HandleActionUpdateWindowShadowEnabled(property, action);
476     EXPECT_EQ(WMError::WM_OK, ret);
477 }
478 
479 /**
480  * @tc.name: SetWindowShadowEnabled01
481  * @tc.desc: SetWindowShadowEnabled
482  * @tc.type: FUNC
483  */
484 HWTEST_F(SceneSessionTest, SetWindowShadowEnabled01, TestSize.Level1)
485 {
486     SessionInfo info;
487     info.abilityName_ = "SetWindowShadowEnabled";
488     info.bundleName_ = "SetWindowShadowEnabled";
489     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
490     ASSERT_NE(sceneSession, nullptr);
491     bool isEnabled = true;
492     EXPECT_EQ(WSError::WS_OK, sceneSession->SetWindowShadowEnabled(isEnabled));
493     EXPECT_EQ(isEnabled, sceneSession->GetWindowShadowEnabled());
494     isEnabled = false;
495     EXPECT_EQ(WSError::WS_OK, sceneSession->SetWindowShadowEnabled(isEnabled));
496     EXPECT_EQ(isEnabled, sceneSession->GetWindowShadowEnabled());
497 }
498 
499 /**
500  * @tc.name: GetWindowName
501  * @tc.desc: GetWindowName
502  * @tc.type: FUNC
503  */
504 HWTEST_F(SceneSessionTest, GetWindowName, TestSize.Level1)
505 {
506     SessionInfo info;
507     info.abilityName_ = "Background01";
508     info.bundleName_ = "GetWindowName";
509     sptr<Rosen::ISession> session_;
510     sptr<SceneSession> sceneSession;
511     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
512     EXPECT_NE(sceneSession, nullptr);
513     ASSERT_NE("ww", sceneSession->GetWindowName());
514 }
515 
516 /**
517  * @tc.name: IsDecorEnable
518  * @tc.desc: IsDecorEnable
519  * @tc.type: FUNC
520  */
521 HWTEST_F(SceneSessionTest, IsDecorEnable, TestSize.Level1)
522 {
523     SessionInfo info;
524     info.abilityName_ = "IsDecorEnable";
525     info.bundleName_ = "IsDecorEnable";
526     info.windowType_ = 1;
527     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
528     EXPECT_NE(sceneSession, nullptr);
529     ASSERT_EQ(true, sceneSession->IsDecorEnable());
530     SessionInfo info_;
531     info_.abilityName_ = "Background01";
532     info_.bundleName_ = "IsDecorEnable";
533     info_.windowType_ = 1000;
534     sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(info_, nullptr);
535     EXPECT_NE(sceneSession1, nullptr);
536     ASSERT_EQ(false, sceneSession1->IsDecorEnable());
537 }
538 
539 /**
540  * @tc.name: IsDecorEnable01
541  * @tc.desc: IsDecorEnable
542  * @tc.type: FUNC
543  */
544 HWTEST_F(SceneSessionTest, IsDecorEnable01, TestSize.Level1)
545 {
546     SessionInfo info;
547     info.abilityName_ = "Background01";
548     info.bundleName_ = "IsDecorEnable01";
549     info.windowType_ = 1;
550     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
551     EXPECT_NE(sceneSession, nullptr);
552     EXPECT_NE(sceneSession->property_, nullptr);
553     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
554     sceneSession->property_->SetDecorEnable(true);
555     sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
556     ASSERT_EQ(true, sceneSession->IsDecorEnable());
557 }
558 
559 /**
560  * @tc.name: UpdateNativeVisibility
561  * @tc.desc: UpdateNativeVisibility
562  * @tc.type: FUNC
563  */
564 HWTEST_F(SceneSessionTest, UpdateNativeVisibility, TestSize.Level1)
565 {
566     SessionInfo info;
567     info.abilityName_ = "Background01";
568     info.bundleName_ = "UpdateNativeVisibility";
569     info.windowType_ = 1;
570     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
571     EXPECT_NE(sceneSession, nullptr);
572     sceneSession->UpdateNativeVisibility(false);
573     ASSERT_EQ(false, sceneSession->IsVisible());
574     sceneSession->NotifyWindowVisibility();
575 
576     sptr<SessionStageMocker> mockSessionStage = sptr<SessionStageMocker>::MakeSptr();
577     ASSERT_NE(mockSessionStage, nullptr);
578     sceneSession->sessionStage_ = mockSessionStage;
579     sceneSession->NotifyWindowVisibility();
580 }
581 
582 /**
583  * @tc.name: SetPrivacyMode01
584  * @tc.desc: Set PrivacyMode as false
585  * @tc.type: FUNC
586  */
587 HWTEST_F(SceneSessionTest, SetPrivacyMode01, TestSize.Level0)
588 {
589     SessionInfo info;
590     info.abilityName_ = "SetPrivacyMode01";
591     info.bundleName_ = "SetPrivacyMode01";
592     info.windowType_ = 1;
593     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
594     EXPECT_NE(sceneSession, nullptr);
595     struct RSSurfaceNodeConfig config;
596     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
597     sceneSession->surfaceNode_ = surfaceNode;
598     sceneSession->SetPrivacyMode(false);
599     ASSERT_EQ(false, sceneSession->property_->GetPrivacyMode());
600     ASSERT_EQ(false, sceneSession->property_->GetSystemPrivacyMode());
601 }
602 
603 /**
604  * @tc.name: SetPrivacyMode02
605  * @tc.desc: Set PrivacyMode as true
606  * @tc.type: FUNC
607  */
608 HWTEST_F(SceneSessionTest, SetPrivacyMode02, TestSize.Level0)
609 {
610     SessionInfo info;
611     info.abilityName_ = "SetPrivacyMode02";
612     info.bundleName_ = "SetPrivacyMode";
613     info.windowType_ = 1;
614     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
615     EXPECT_NE(sceneSession, nullptr);
616     struct RSSurfaceNodeConfig config;
617     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
618     sceneSession->surfaceNode_ = surfaceNode;
619     sceneSession->SetPrivacyMode(true);
620     ASSERT_EQ(true, sceneSession->property_->GetPrivacyMode());
621     ASSERT_EQ(true, sceneSession->property_->GetSystemPrivacyMode());
622 }
623 
624 /**
625  * @tc.name: SetPrivacyMode03
626  * @tc.desc: Set PrivacyMode as true
627  * @tc.type: FUNC
628  */
629 HWTEST_F(SceneSessionTest, SetPrivacyMode03, TestSize.Level0)
630 {
631     SessionInfo info;
632     info.abilityName_ = "TestAbility";
633     info.bundleName_ = "TestBundle";
634     info.windowType_ = static_cast<uint32_t>(WindowType::APP_SUB_WINDOW_BASE);
635     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
636     EXPECT_NE(sceneSession, nullptr);
637     auto runner = AppExecFwk::EventRunner::Create("SceneSessionTest");
638     auto handler = std::make_shared<AppExecFwk::EventHandler>(runner);
639     sceneSession->SetEventHandler(handler, handler);
640     struct RSSurfaceNodeConfig config;
641     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
642     sceneSession->surfaceNode_ = surfaceNode;
643     sceneSession->SetPrivacyMode(true);
644     EXPECT_EQ(sceneSession->appUseControlMap_.size(), 0);
645 }
646 
647 /**
648  * @tc.name: UpdatePrivacyModeControlInfo01
649  * @tc.desc: UpdatePrivacyModeControlInfo01
650  * @tc.type: FUNC
651  */
652 HWTEST_F(SceneSessionTest, UpdatePrivacyModeControlInfo01, Function | SmallTest | Level3)
653 {
654     SessionInfo info;
655     info.bundleName_ = "testBundleName";
656     info.abilityName_ = "testAbilityName";
657     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
658     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
659     property->SetPrivacyMode(true);
660     sceneSession->property_ = property;
661     sceneSession->UpdatePrivacyModeControlInfo();
662     EXPECT_EQ(sceneSession->appUseControlMap_.size(), 1);
663     EXPECT_EQ(sceneSession->appUseControlMap_[ControlAppType::PRIVACY_WINDOW].isNeedControl, true);
664 }
665 
666 /**
667  * @tc.name: UpdatePrivacyModeControlInfo02
668  * @tc.desc: UpdatePrivacyModeControlInfo02
669  * @tc.type: FUNC
670  */
671 HWTEST_F(SceneSessionTest, UpdatePrivacyModeControlInfo02, Function | SmallTest | Level3)
672 {
673     SessionInfo info;
674     info.bundleName_ = "testBundleName";
675     info.abilityName_ = "testAbilityName";
676     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
677     sceneSession->property_ = nullptr;
678     sptr<SceneSession::SpecificSessionCallback> specificSessionCb =
679         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
680     sptr<SceneSession> subSession = sptr<SceneSession>::MakeSptr(info, specificSessionCb);
681     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
682     property->SetPrivacyMode(true);
683     subSession->property_ = property;
684     sceneSession->AddSubSession(subSession);
685     sceneSession->UpdatePrivacyModeControlInfo();
686     EXPECT_EQ(sceneSession->appUseControlMap_.size(), 1);
687     EXPECT_EQ(sceneSession->appUseControlMap_[ControlAppType::PRIVACY_WINDOW].isNeedControl, true);
688 }
689 
690 /**
691  * @tc.name: HasSubSessionInPrivacyMode
692  * @tc.desc: HasSubSessionInPrivacyMode
693  * @tc.type: FUNC
694  */
695 HWTEST_F(SceneSessionTest, HasSubSessionInPrivacyMode, Function | SmallTest | Level3)
696 {
697     SessionInfo info;
698     info.bundleName_ = "testBundleName";
699     info.abilityName_ = "testAbilityName";
700     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
701     sceneSession->property_ = nullptr;
702     sptr<SceneSession::SpecificSessionCallback> specificSessionCb =
703         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
704     sptr<SceneSession> subSession = sptr<SceneSession>::MakeSptr(info, specificSessionCb);
705     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
706     property->SetPrivacyMode(false);
707     subSession->property_ = property;
708 
709     subSession->subSession_.push_back(nullptr);
710     subSession->AddSubSession(sptr<SceneSession>::MakeSptr(info, specificSessionCb));
711     sptr<SceneSession::SpecificSessionCallback> specificSessionCb2 =
712         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
713     sptr<SceneSession> subSession2 = sptr<SceneSession>::MakeSptr(info, specificSessionCb2);
714     sptr<WindowSessionProperty> property2 = sptr<WindowSessionProperty>::MakeSptr();
715     property2->SetPrivacyMode(true);
716     subSession2->property_ = property2;
717     subSession->AddSubSession(subSession2);
718 
719     sceneSession->AddSubSession(subSession);
720     EXPECT_EQ(sceneSession->HasSubSessionInPrivacyMode(), true);
721 }
722 
723 /**
724  * @tc.name: UpdateScreenshotAppEventRegistered
725  * @tc.desc: UpdateScreenshotAppEventRegistered01
726  * @tc.type: FUNC
727  */
728 HWTEST_F(SceneSessionTest, UpdateScreenshotAppEventRegistered01, TestSize.Level0)
729 {
730     SessionInfo info;
731     info.abilityName_ = "test";
732     info.bundleName_ = "test";
733     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
734     EXPECT_NE(sceneSession, nullptr);
735     auto ret = sceneSession->UpdateScreenshotAppEventRegistered(0, true);
736     EXPECT_NE(ret, WMError::WM_OK);
737 }
738 
739 /**
740  * @tc.name: SetNotifyScreenshotAppEventRegisteredFunc
741  * @tc.desc: SetNotifyScreenshotAppEventRegisteredFunc01
742  * @tc.type: FUNC
743  */
744 HWTEST_F(SceneSessionTest, SetNotifyScreenshotAppEventRegisteredFunc01, TestSize.Level0)
745 {
746     SessionInfo info;
747     info.abilityName_ = "test";
748     info.bundleName_ = "test";
749     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
750     EXPECT_NE(sceneSession, nullptr);
__anoncf6e0dec0302(int32_t persistentId, bool isRegister) 751     sceneSession->SetNotifyScreenshotAppEventRegisteredFunc([](int32_t persistentId, bool isRegister) {});
752     EXPECT_NE(sceneSession->updateScreenshotAppEventRegisteredFunc_, nullptr);
753 }
754 
755 /**
756  * @tc.name: UpdateAcrossDisplaysChangeRegistered
757  * @tc.desc: UpdateAcrossDisplaysChangeRegistered01
758  * @tc.type: FUNC
759  */
760 HWTEST_F(SceneSessionTest, UpdateAcrossDisplaysChangeRegistered01, TestSize.Level0)
761 {
762     SessionInfo info;
763     info.abilityName_ = "test";
764     info.bundleName_ = "test";
765     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
766     ASSERT_NE(sceneSession, nullptr);
767     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_PANEL);
768     auto ret = sceneSession->UpdateAcrossDisplaysChangeRegistered(true);
769     EXPECT_NE(ret, WMError::WM_ERROR_INVALID_CALLING);
770 
771     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
772     ret = sceneSession->UpdateAcrossDisplaysChangeRegistered(true);
773     EXPECT_NE(ret, WMError::WM_OK);
774 }
775 
776 /**
777  * @tc.name: IsMainWindowFullScreenAcrossDisplays
778  * @tc.desc: IsMainWindowFullScreenAcrossDisplays01
779  * @tc.type: FUNC
780  */
781 HWTEST_F(SceneSessionTest, IsMainWindowFullScreenAcrossDisplays01, TestSize.Level0)
782 {
783     bool isAcrossDisplays = false;
784     SessionInfo info;
785     info.abilityName_ = "test";
786     info.bundleName_ = "test";
787     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
788     ASSERT_NE(sceneSession, nullptr);
789     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_PANEL);
790     auto ret = sceneSession->IsMainWindowFullScreenAcrossDisplays(isAcrossDisplays);
791     EXPECT_NE(ret, WMError::WM_ERROR_INVALID_CALLING);
792 
793     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
794     ret = sceneSession->IsMainWindowFullScreenAcrossDisplays(isAcrossDisplays);
795     EXPECT_NE(ret, WMError::WM_OK);
796 
797     sptr<SceneSession> parentSession = sptr<SceneSession>::MakeSptr(info, nullptr);
798     parentSession->property_->SetPersistentId(12);
799     sceneSession->SetParentSession(parentSession);
800     ret = sceneSession->IsMainWindowFullScreenAcrossDisplays(isAcrossDisplays);
801     EXPECT_NE(ret, WMError::WM_ERROR_NULLPTR);
802 
803     sptr<SceneSession::SpecificSessionCallback> callBack = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
804     ASSERT_NE(nullptr, callBack);
805     sceneSession->specificCallback_ = callBack;
__anoncf6e0dec0402(int32_t persistentId) 806     auto task = [&parentSession](int32_t persistentId) { return parentSession; };
807     callBack->onGetSceneSessionByIdCallback_ = task;
808 
809     ret = sceneSession->IsMainWindowFullScreenAcrossDisplays(isAcrossDisplays);
810     EXPECT_NE(ret, WMError::WM_ERROR_NULLPTR);
811 }
812 
813 /**
814  * @tc.name: SetFullScreenWaterfallMode
815  * @tc.desc: SetFullScreenWaterfallMode true
816  * @tc.type: FUNC
817  */
818 HWTEST_F(SceneSessionTest, SetFullScreenWaterfallMode, TestSize.Level1)
819 {
820     SessionInfo info;
821     info.abilityName_ = "test";
822     info.bundleName_ = "test";
823     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
824     sceneSession->pcFoldScreenController_ =
825         sptr<PcFoldScreenController>::MakeSptr(wptr(sceneSession), sceneSession->GetPersistentId());
826     sceneSession->SetFullScreenWaterfallMode(true);
827     EXPECT_EQ(true, sceneSession->IsFullScreenWaterfallMode());
828 
829     sceneSession->pcFoldScreenController_ = nullptr;
830     sceneSession->SetFullScreenWaterfallMode(true);
831     EXPECT_EQ(false, sceneSession->IsFullScreenWaterfallMode());
832 }
833 
834 /**
835  * @tc.name: NotifySubSessionAcrossDisplaysChange
836  * @tc.desc: NotifySubSessionAcrossDisplaysChange01
837  * @tc.type: FUNC
838  */
839 HWTEST_F(SceneSessionTest, NotifySubSessionAcrossDisplaysChange01, TestSize.Level0)
840 {
841     SessionInfo info;
842     info.abilityName_ = "test";
843     info.bundleName_ = "test";
844     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
845     ASSERT_NE(sceneSession, nullptr);
846 
847     sptr<SceneSession> subSession1 = sptr<SceneSession>::MakeSptr(info, nullptr);
848     subSession1->isRegisterAcrossDisplaysChanged_ = false;
849     sptr<SceneSession> subSession2 = sptr<SceneSession>::MakeSptr(info, nullptr);
850     subSession2->isRegisterAcrossDisplaysChanged_ = true;
851     subSession2->sessionStage_ = nullptr;
852     sptr<SceneSession> subSession3 = sptr<SceneSession>::MakeSptr(info, nullptr);
853     subSession3->isRegisterAcrossDisplaysChanged_ = true;
854     sptr<SessionStageMocker> mockSessionStage = sptr<SessionStageMocker>::MakeSptr();
855     ASSERT_NE(mockSessionStage, nullptr);
856     subSession3->sessionStage_ = mockSessionStage;
857     sptr<SceneSession> subSession4 = nullptr;
858     sceneSession->subSession_.push_back(subSession1);
859     sceneSession->subSession_.push_back(subSession2);
860     sceneSession->subSession_.push_back(subSession3);
861     sceneSession->subSession_.push_back(subSession4);
862     auto ret = sceneSession->NotifySubSessionAcrossDisplaysChange(true);
863     EXPECT_NE(WMError::WM_OK, ret);
864 }
865 
866 /**
867  * @tc.name: NotifyFollowedParentWindowAcrossDisplaysChange
868  * @tc.desc: NotifyFollowedParentWindowAcrossDisplaysChange01
869  * @tc.type: FUNC
870  */
871 HWTEST_F(SceneSessionTest, NotifyFollowedParentWindowAcrossDisplaysChange01, TestSize.Level0)
872 {
873     SessionInfo info;
874     info.abilityName_ = "test";
875     info.bundleName_ = "test";
876     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
877 
878     sptr<SceneSession> subSession1 = sptr<SceneSession>::MakeSptr(info, nullptr);
879     subSession1->property_->SetPersistentId(1);
880     subSession1->isFollowParentLayout_ = false;
881     sptr<SceneSession> subSession2 = sptr<SceneSession>::MakeSptr(info, nullptr);
882     subSession2->property_->SetPersistentId(2);
883     subSession2->isFollowParentLayout_ = true;
884     subSession2->sessionStage_ = nullptr;
885     sptr<SceneSession> subSession3 = sptr<SceneSession>::MakeSptr(info, nullptr);
886     subSession3->property_->SetPersistentId(3);
887     subSession3->isFollowParentLayout_ = true;
888     sptr<SessionStageMocker> mockSessionStage = sptr<SessionStageMocker>::MakeSptr();
889     ASSERT_NE(mockSessionStage, nullptr);
890     subSession3->sessionStage_ = mockSessionStage;
891     sptr<SceneSession> subSession4 = nullptr;
892 
893     sceneSession->notifySurfaceBoundsChangeFuncMap_[1] = nullptr;
894     sceneSession->notifySurfaceBoundsChangeFuncMap_[2] = nullptr;
895     sceneSession->notifySurfaceBoundsChangeFuncMap_[3] = nullptr;
896     sceneSession->notifySurfaceBoundsChangeFuncMap_[4] = nullptr;
897 
898     sptr<SceneSession::SpecificSessionCallback> callBack = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
899     ASSERT_NE(nullptr, callBack);
900     sceneSession->specificCallback_ = callBack;
901 
__anoncf6e0dec0502(int32_t persistentId) 902     auto task = [&subSession1, &subSession2, &subSession3, &subSession4](int32_t persistentId) {
903         if (persistentId == 1) {
904             return subSession1;
905         } else if (persistentId == 2) {
906             return subSession2;
907         } else if (persistentId == 3) {
908             return subSession3;
909         }
910         return subSession4;
911     };
912     callBack->onGetSceneSessionByIdCallback_ = task;
913     auto ret = sceneSession->NotifyFollowedParentWindowAcrossDisplaysChange(true);
914     EXPECT_NE(WMError::WM_OK, ret);
915 }
916 
917 /**
918  * @tc.name: IsFloatingWindowAppType01
919  * @tc.desc: IsFloatingWindowAppType true
920  * @tc.type: FUNC
921  */
922 HWTEST_F(SceneSessionTest, IsFloatingWindowAppType01, TestSize.Level1)
923 {
924     SessionInfo info;
925     info.abilityName_ = "IsFloatingWindowAppType01";
926     info.bundleName_ = "IsFloatingWindowAppType01";
927     info.windowType_ = 1;
928     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
929     EXPECT_NE(sceneSession, nullptr);
930     EXPECT_NE(sceneSession->property_, nullptr);
931     sceneSession->property_->SetFloatingWindowAppType(true);
932     ASSERT_EQ(true, sceneSession->IsFloatingWindowAppType());
933 }
934 
935 /**
936  * @tc.name: IsFloatingWindowAppType02
937  * @tc.desc: IsFloatingWindowAppType false
938  * @tc.type: FUNC
939  */
940 HWTEST_F(SceneSessionTest, IsFloatingWindowAppType02, TestSize.Level1)
941 {
942     SessionInfo info;
943     info.abilityName_ = "IsFloatingWindowAppType02";
944     info.bundleName_ = "IsFloatingWindowAppType02";
945     info.windowType_ = 1;
946     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
947     EXPECT_NE(sceneSession, nullptr);
948     EXPECT_NE(sceneSession->property_, nullptr);
949     ASSERT_EQ(false, sceneSession->IsFloatingWindowAppType());
950 }
951 
952 /**
953  * @tc.name: NotifyIsCustomAnimationPlaying
954  * @tc.desc: NotifyIsCustomAnimationPlaying
955  * @tc.type: FUNC
956  */
957 HWTEST_F(SceneSessionTest, NotifyIsCustomAnimationPlaying, TestSize.Level1)
958 {
959     SessionInfo info;
960     info.abilityName_ = "Background01";
961     info.bundleName_ = "IsFloatingWindowAppType";
962     info.windowType_ = 1;
963     sptr<Rosen::ISession> session_;
964     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
965         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
966     EXPECT_NE(specificCallback_, nullptr);
967     sptr<SceneSession> sceneSession;
968     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
969     EXPECT_NE(sceneSession, nullptr);
970     sceneSession->NotifyIsCustomAnimationPlaying(false);
971 
__anoncf6e0dec0602(bool status) 972     sceneSession->onIsCustomAnimationPlaying_ = [](bool status) {};
973     sceneSession->NotifyIsCustomAnimationPlaying(false);
974 }
975 
976 /**
977  * @tc.name: ModalUIExtension
978  * @tc.desc: ModalUIExtension
979  * @tc.type: FUNC
980  */
981 HWTEST_F(SceneSessionTest, ModalUIExtension, TestSize.Level1)
982 {
983     SessionInfo info;
984     info.abilityName_ = "ModalUIExtension";
985     info.bundleName_ = "ModalUIExtension";
986     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
987     ASSERT_NE(sceneSession, nullptr);
988 
989     EXPECT_FALSE(sceneSession->GetLastModalUIExtensionEventInfo());
990     ExtensionWindowEventInfo extensionInfo;
991     extensionInfo.persistentId = 12345;
992     extensionInfo.pid = 1234;
993     extensionInfo.windowRect = { 1, 2, 3, 4 };
994     sceneSession->AddNormalModalUIExtension(extensionInfo);
995 
996     auto getInfo = sceneSession->GetLastModalUIExtensionEventInfo();
997     EXPECT_TRUE(getInfo);
998     EXPECT_EQ(getInfo.value().persistentId, extensionInfo.persistentId);
999     EXPECT_EQ(getInfo.value().pid, extensionInfo.pid);
1000     EXPECT_EQ(getInfo.value().windowRect, extensionInfo.windowRect);
1001 
1002     Rect windowRect = { 5, 6, 7, 8 };
1003     extensionInfo.windowRect = windowRect;
1004     sceneSession->UpdateNormalModalUIExtension(extensionInfo);
1005     getInfo = sceneSession->GetLastModalUIExtensionEventInfo();
1006     EXPECT_TRUE(getInfo);
1007     EXPECT_EQ(getInfo.value().windowRect, windowRect);
1008 
1009     sceneSession->RemoveNormalModalUIExtension(extensionInfo.persistentId);
1010     EXPECT_FALSE(sceneSession->GetLastModalUIExtensionEventInfo());
1011 }
1012 
1013 /**
1014  * @tc.name: NotifySessionRectChange
1015  * @tc.desc: NotifySessionRectChange
1016  * @tc.type: FUNC
1017  */
1018 HWTEST_F(SceneSessionTest, NotifySessionRectChange, TestSize.Level1)
1019 {
1020     SessionInfo info;
1021     info.abilityName_ = "NotifySessionRectChange";
1022     info.bundleName_ = "NotifySessionRectChangebundle";
1023     info.windowType_ = 1;
1024     sptr<Rosen::ISession> session_;
1025     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1026         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1027     EXPECT_NE(specificCallback_, nullptr);
1028     sptr<SceneSession> sceneSession;
1029     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1030     EXPECT_NE(sceneSession, nullptr);
1031     WSRect overlapRect = { 0, 0, 0, 0 };
1032     sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, -1);
1033     sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, 11);
1034     sceneSession->sessionRectChangeFunc_ = [](const WSRect& rect,
1035                                               SizeChangeReason reason,
1036                                               DisplayId displayId,
__anoncf6e0dec0702(const WSRect& rect, SizeChangeReason reason, DisplayId displayId, const RectAnimationConfig& rectAnimationConfig) 1037                                               const RectAnimationConfig& rectAnimationConfig) { return; };
1038     sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, -1);
1039     sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, 11);
1040 
1041     auto oriProperty = sceneSession->GetSessionProperty();
1042     sceneSession->property_ = oriProperty;
1043     auto moveDragController = sptr<MoveDragController>::MakeSptr(2024, sceneSession->GetWindowType());
1044     sceneSession->moveDragController_ = moveDragController;
1045     SizeChangeReason reason = { SizeChangeReason::DRAG };
1046     sceneSession->systemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
1047     sceneSession->systemConfig_.freeMultiWindowSupport_ = true;
1048     sceneSession->systemConfig_.freeMultiWindowEnable_ = true;
1049     sceneSession->dragResizeTypeDuringDrag_ = DragResizeType::RESIZE_SCALE;
1050     sceneSession->moveDragController_->isStartDrag_ = true;
1051     sceneSession->compatibleDragScaleFlags_ = true;
1052     sceneSession->NotifySessionRectChange(overlapRect, reason, 11);
1053     EXPECT_EQ(sceneSession->IsDragResizeScale(reason), true);
1054 }
1055 
1056 /**
1057  * @tc.name: GetKeyboardAvoidArea
1058  * @tc.desc: GetKeyboardAvoidArea
1059  * @tc.type: FUNC
1060  */
1061 HWTEST_F(SceneSessionTest, GetKeyboardAvoidArea, TestSize.Level1)
1062 {
1063     SessionInfo info;
1064     info.abilityName_ = "Background01";
1065     info.bundleName_ = "IsFloatingWindowAppType";
1066     info.windowType_ = 1;
1067     sptr<Rosen::ISession> session_;
1068     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1069         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1070     EXPECT_NE(specificCallback_, nullptr);
__anoncf6e0dec0802(WindowType type) 1071     specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type) -> std::vector<sptr<SceneSession>> {
1072         std::vector<sptr<SceneSession>> backgroundSession;
1073         return backgroundSession;
1074     };
1075 
1076     sptr<SceneSession> sceneSession;
1077     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1078     EXPECT_NE(sceneSession, nullptr);
1079     WSRect overlapRect = { 0, 0, 0, 0 };
1080     AvoidArea avoidArea;
1081     sceneSession->GetKeyboardAvoidArea(overlapRect, avoidArea);
1082     ASSERT_EQ(true, overlapRect.IsEmpty());
1083     ASSERT_EQ(true, sceneSession->keyboardAvoidAreaActive_);
1084     sceneSession->keyboardAvoidAreaActive_ = false;
1085     sceneSession->GetKeyboardAvoidArea(overlapRect, avoidArea);
1086     ASSERT_EQ(false, sceneSession->keyboardAvoidAreaActive_);
1087     ASSERT_EQ(true, overlapRect.IsEmpty());
1088 }
1089 
1090 /**
1091  * @tc.name: GetCutoutAvoidArea
1092  * @tc.desc: GetCutoutAvoidArea
1093  * @tc.type: FUNC
1094  */
1095 HWTEST_F(SceneSessionTest, GetCutoutAvoidArea, TestSize.Level1)
1096 {
1097     SessionInfo info;
1098     info.abilityName_ = "Background01";
1099     info.bundleName_ = "IsFloatingWindowAppType";
1100     info.windowType_ = 1;
1101     sptr<Rosen::ISession> session_;
1102     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1103         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1104     EXPECT_NE(specificCallback_, nullptr);
1105     sptr<SceneSession> sceneSession;
1106     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1107     EXPECT_NE(sceneSession, nullptr);
1108     WSRect overlapRect = { 0, 0, 0, 0 };
1109     AvoidArea avoidArea;
1110     int ret = 1;
1111     sceneSession->GetCutoutAvoidArea(overlapRect, avoidArea);
1112     ASSERT_EQ(ret, 1);
1113 }
1114 
1115 /**
1116  * @tc.name: SetSystemBarProperty
1117  * @tc.desc: SetSystemBarProperty
1118  * @tc.type: FUNC
1119  */
1120 HWTEST_F(SceneSessionTest, SetSystemBarProperty, TestSize.Level0)
1121 {
1122     SessionInfo info;
1123     info.abilityName_ = "Background01";
1124     info.bundleName_ = "IsFloatingWindowAppType";
1125     info.windowType_ = 1;
1126     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1127         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1128 
1129     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1130     SystemBarProperty statusBarProperty;
1131     sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1132     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1133     ASSERT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_FLOAT_CAMERA, statusBarProperty),
1134               WSError::WS_OK);
1135 }
1136 
1137 /**
1138  * @tc.name: SetSystemBarProperty02
1139  * @tc.desc: SetSystemBarProperty02
1140  * @tc.type: FUNC
1141  */
1142 HWTEST_F(SceneSessionTest, SetSystemBarProperty02, TestSize.Level0)
1143 {
1144     SessionInfo info;
1145     info.abilityName_ = "Background01";
1146     info.bundleName_ = "IsFloatingWindowAppType";
1147     info.windowType_ = 1;
1148     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1149         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1150     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1151     SystemBarProperty statusBarProperty;
1152     ASSERT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, statusBarProperty),
1153               WSError::WS_OK);
1154     auto propMap = sceneSession->property_->GetSystemBarProperty();
1155     ASSERT_EQ(statusBarProperty, propMap[WindowType::WINDOW_TYPE_STATUS_BAR]);
1156     sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1157     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1158     ASSERT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_FLOAT_CAMERA, statusBarProperty),
1159               WSError::WS_OK);
1160 }
1161 
1162 /**
1163  * @tc.name: SetSystemBarProperty03
1164  * @tc.desc: SetSystemBarProperty03
1165  * @tc.type: FUNC
1166  */
1167 HWTEST_F(SceneSessionTest, SetSystemBarProperty03, TestSize.Level0)
1168 {
1169     SessionInfo info;
1170     info.abilityName_ = "SetSystemBarProperty03";
1171     info.bundleName_ = "SetSystemBarProperty03";
1172     info.windowType_ = 1;
1173     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1174         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1175     specificCallback->onNotifyWindowSystemBarPropertyChangeFunc_ = [](
__anoncf6e0dec0902( WindowType type, const SystemBarProperty& systemBarProperty) 1176         WindowType type, const SystemBarProperty& systemBarProperty) {};
1177     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1178     sceneSession->onSystemBarPropertyChange_ =[](
__anoncf6e0dec0a02( const std::unordered_map<WindowType, SystemBarProperty>& propertyMap) 1179         const std::unordered_map<WindowType, SystemBarProperty>& propertyMap) {};
1180     SystemBarProperty statusBarProperty;
1181     EXPECT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, statusBarProperty),
1182         WSError::WS_OK);
1183     auto propMap = sceneSession->property_->GetSystemBarProperty();
1184     EXPECT_EQ(statusBarProperty, propMap[WindowType::WINDOW_TYPE_STATUS_BAR]);
1185     EXPECT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR, statusBarProperty),
1186         WSError::WS_OK);
1187     sceneSession->specificCallback_->onNotifyWindowSystemBarPropertyChangeFunc_ = nullptr;
1188     EXPECT_EQ(sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, statusBarProperty),
1189         WSError::WS_OK);
1190 }
1191 
1192 /**
1193  * @tc.name: OnShowWhenLocked
1194  * @tc.desc: OnShowWhenLocked
1195  * @tc.type: FUNC ok
1196  */
1197 HWTEST_F(SceneSessionTest, OnShowWhenLocked, TestSize.Level1)
1198 {
1199     SessionInfo info;
1200     info.abilityName_ = "Background01";
1201     info.bundleName_ = "IsFloatingWindowAppType";
1202     info.windowType_ = 1;
1203     sptr<Rosen::ISession> session_;
1204     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1205         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1206     EXPECT_NE(specificCallback_, nullptr);
1207     sptr<SceneSession> sceneSession;
1208     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1209     EXPECT_NE(sceneSession, nullptr);
1210     int ret = 0;
1211     sceneSession->OnShowWhenLocked(false);
1212     ASSERT_EQ(ret, 0);
1213 }
1214 
1215 /**
1216  * @tc.name: IsShowWhenLocked
1217  * @tc.desc: IsShowWhenLocked
1218  * @tc.type: FUNC ok
1219  */
1220 HWTEST_F(SceneSessionTest, IsShowWhenLocked, TestSize.Level1)
1221 {
1222     SessionInfo info;
1223     info.abilityName_ = "Background01";
1224     info.bundleName_ = "IsFloatingWindowAppType";
1225     info.windowType_ = 1;
1226     sptr<Rosen::ISession> session_;
1227     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1228         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1229     EXPECT_NE(specificCallback_, nullptr);
1230     sptr<SceneSession> sceneSession;
1231     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1232     EXPECT_NE(sceneSession, nullptr);
1233     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1234     EXPECT_NE(property, nullptr);
1235     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1236     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1237     ASSERT_EQ(sceneSession->IsShowWhenLocked(), false);
1238     sceneSession->property_ = property;
1239     sceneSession->SetTemporarilyShowWhenLocked(true);
1240     ASSERT_EQ(sceneSession->IsShowWhenLocked(), true);
1241     property->SetWindowFlags(4);
1242     sceneSession->SetTemporarilyShowWhenLocked(false);
1243     ASSERT_EQ(sceneSession->IsShowWhenLocked(), true);
1244     sceneSession->SetTemporarilyShowWhenLocked(true);
1245     ASSERT_EQ(sceneSession->IsShowWhenLocked(), true);
1246 }
1247 
1248 /**
1249  * @tc.name: GetAvoidAreaByType
1250  * @tc.desc: GetAvoidAreaByType
1251  * @tc.type: FUNC ok
1252  */
1253 HWTEST_F(SceneSessionTest, GetAvoidAreaByType, TestSize.Level1)
1254 {
1255     SessionInfo info;
1256     info.abilityName_ = "Background01";
1257     info.bundleName_ = "IsFloatingWindowAppType";
1258     info.windowType_ = 1;
1259     sptr<Rosen::ISession> session_;
1260     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1261         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1262     EXPECT_NE(specificCallback_, nullptr);
1263     specificCallback_->onGetSceneSessionVectorByTypeAndDisplayId_ =
__anoncf6e0dec0b02(WindowType type, uint64_t displayId) 1264         [](WindowType type, uint64_t displayId) -> std::vector<sptr<SceneSession>> {
1265         SessionInfo info_;
1266         info_.abilityName_ = "Background01";
1267         info_.bundleName_ = "IsFloatingWindowAppType";
1268         std::vector<sptr<SceneSession>> backgroundSession;
1269         sptr<SceneSession> session2 = sptr<SceneSession>::MakeSptr(info_, nullptr);
1270         backgroundSession.push_back(session2);
1271         return backgroundSession;
1272     };
1273     sptr<SceneSession> sceneSession;
1274     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1275     EXPECT_NE(sceneSession, nullptr);
1276     WSRect rect = { 0, 0, 320, 240 }; // width: 320, height: 240
1277     sceneSession->SetSessionRect(rect);
1278     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1279     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1280     sceneSession->property_ = property;
1281     AvoidArea avoidArea;
1282     sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_CUTOUT);
1283     sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_SYSTEM);
1284     sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_KEYBOARD);
1285     sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_SYSTEM_GESTURE);
1286     EXPECT_NE(sceneSession, nullptr);
1287 }
1288 
1289 /**
1290  * @tc.name: TransferPointerEvent
1291  * @tc.desc: TransferPointerEvent
1292  * @tc.type: FUNC
1293  */
1294 HWTEST_F(SceneSessionTest, TransferPointerEvent, TestSize.Level1)
1295 {
1296     SessionInfo info;
1297     info.abilityName_ = "Background01";
1298     info.bundleName_ = "IsFloatingWindowAppType";
1299     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1300         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1301     EXPECT_NE(specificCallback_, nullptr);
1302     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1303     std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
1304     ASSERT_EQ(sceneSession->TransferPointerEvent(pointerEvent), WSError::WS_OK);
1305 
1306     std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
1307     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1308     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1309     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
1310     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1311     property->SetPersistentId(11);
1312     sceneSession->SetSessionProperty(property);
1313     ASSERT_EQ(sceneSession->TransferPointerEvent(pointerEvent_), WSError::WS_OK);
1314 }
1315 
1316 /**
1317  * @tc.name: TransferPointerEventDecorDialog
1318  * @tc.desc: TransferPointerEventDecorDialog
1319  * @tc.type: FUNC
1320  */
1321 HWTEST_F(SceneSessionTest, TransferPointerEventDecorDialog, TestSize.Level1)
1322 {
1323     SessionInfo info;
1324     info.abilityName_ = "TransferPointerEventDecorDialog";
1325     info.bundleName_ = "TransferPointerEventDecorDialogbundle";
1326     info.windowType_ = 1;
1327     sptr<Rosen::ISession> session_;
1328     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1329         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1330     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1331     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(12, WindowType::WINDOW_TYPE_FLOAT);
1332     sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
1333     std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
1334     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1335     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1336     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
1337     property->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1338     property->SetDecorEnable(true);
1339     property->SetDragEnabled(true);
1340     property->SetPersistentId(12);
1341     sceneSession->property_ = property;
1342     EXPECT_NE(sceneSession, nullptr);
1343 }
1344 
1345 /**
1346  * @tc.name: NotifyAddOrRemoveSnapshotWindowTest
1347  * @tc.desc: NotifyAddOrRemoveSnapshotWindowTest
1348  * @tc.type: FUNC
1349  */
1350 HWTEST_F(SceneSessionTest, NotifyAddOrRemoveSnapshotWindowTest, TestSize.Level1)
1351 {
1352     SessionInfo info;
1353     info.abilityName_ = "test";
1354     info.bundleName_ = "test";
1355     info.windowType_ = 1;
1356     auto specificCallback = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1357     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1358     EXPECT_NE(sceneSession, nullptr);
1359     sceneSession->showRecent_ = true;
1360     sceneSession->NotifyAddOrRemoveSnapshotWindow(true);
1361 }
1362 
1363 /**
1364  * @tc.name: ProcessWindowMoving
1365  * @tc.desc: ProcessWindowMoving
1366  * @tc.type: FUNC
1367  */
1368 HWTEST_F(SceneSessionTest, ProcessWindowMoving, TestSize.Level1)
1369 {
1370     SessionInfo info;
1371     info.abilityName_ = "ProcessWindowMoving";
1372     info.bundleName_ = "ProcessWindowMovingBundle";
1373     info.windowType_ = 1;
1374     auto specificCallback = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1375     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1376     EXPECT_NE(sceneSession, nullptr);
1377     std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
1378     sceneSession->ProcessWindowMoving(pointerEvent);
1379 }
1380 
1381 /**
1382  * @tc.name: PrintAvoidAreaInfo
1383  * @tc.desc: PrintAvoidAreaInfo
1384  * @tc.type: FUNC
1385  */
1386 HWTEST_F(SceneSessionTest, PrintAvoidAreaInfo, TestSize.Level1)
1387 {
1388     SessionInfo info;
1389     info.abilityName_ = "PrintAvoidAreaInfo";
1390     info.bundleName_ = "PrintAvoidAreaInfo";
1391     sptr<SceneSession>sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1392     sceneSession->property_ = sptr<WindowSessionProperty>::MakeSptr();
1393     sceneSession->property_->displayId_ = 0;
1394     WSRect winRect;
1395     WSRect avoidRect;
1396     auto type = AvoidAreaType::TYPE_SYSTEM;
1397     sceneSession->PrintAvoidAreaInfo(sceneSession->property_->displayId_, type, winRect, avoidRect);
1398     std::tuple<DisplayId, WSRect, WSRect> inputParamters(sceneSession->property_->displayId_, winRect, avoidRect);
1399     EXPECT_EQ(inputParamters, sceneSession->lastAvoidAreaInputParamtersMap_[type]);
1400     sceneSession->property_->displayId_ = 1;
1401     sceneSession->PrintAvoidAreaInfo(sceneSession->property_->displayId_, type, winRect, avoidRect);
1402     std::tuple<DisplayId, WSRect, WSRect> inputParamters1(sceneSession->property_->displayId_, winRect, avoidRect);
1403     EXPECT_EQ(inputParamters1, sceneSession->lastAvoidAreaInputParamtersMap_[type]);
1404     sceneSession->PrintAvoidAreaInfo(sceneSession->property_->displayId_, type, winRect, avoidRect);
1405     EXPECT_EQ(inputParamters1, sceneSession->lastAvoidAreaInputParamtersMap_[type]);
1406     AvoidArea avoidArea;
1407     sceneSession->CalculateAvoidAreaByType(type, winRect, avoidRect, avoidArea);
1408     EXPECT_EQ(inputParamters1, sceneSession->lastAvoidAreaInputParamtersMap_[type]);
1409 }
1410 
1411 /**
1412  * @tc.name: CalculateAvoidAreaRect
1413  * @tc.desc: CalculateAvoidAreaRect
1414  * @tc.type: FUNC
1415  */
1416 HWTEST_F(SceneSessionTest, CalculateAvoidAreaRect, TestSize.Level1)
1417 {
1418     SessionInfo info;
1419     info.abilityName_ = "Background01";
1420     info.bundleName_ = "IsFloatingWindowAppType";
1421     info.windowType_ = 1;
1422     sptr<Rosen::ISession> session_;
1423     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1424         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1425     EXPECT_NE(specificCallback_, nullptr);
1426     sptr<SceneSession> sceneSession;
1427     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1428     EXPECT_NE(sceneSession, nullptr);
1429     int ret = 0;
1430     WSRect overlapRect = { 0, 0, 0, 0 };
1431     WSRect avoidRect = { 0, 0, 0, 0 };
1432     AvoidArea avoidArea;
1433     sceneSession->CalculateAvoidAreaRect(overlapRect, avoidRect, avoidArea);
1434     WSRect overlapRect_ = { 1, 1, 1, 1 };
1435     WSRect avoidRect_ = { 1, 1, 1, 1 };
1436     sceneSession->CalculateAvoidAreaRect(overlapRect_, avoidRect_, avoidArea);
1437     ASSERT_EQ(ret, 0);
1438 }
1439 
1440 /**
1441  * @tc.name: OnNeedAvoid
1442  * @tc.desc: OnNeedAvoid
1443  * @tc.type: FUNC
1444  */
1445 HWTEST_F(SceneSessionTest, OnNeedAvoid, TestSize.Level1)
1446 {
1447     SessionInfo info;
1448     info.abilityName_ = "Background01";
1449     info.bundleName_ = "IsFloatingWindowAppType";
1450     info.windowType_ = 1;
1451     sptr<Rosen::ISession> session_;
1452     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1453         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1454     EXPECT_NE(specificCallback_, nullptr);
1455     sptr<SceneSession> sceneSession;
1456     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1457     EXPECT_NE(sceneSession, nullptr);
1458     ASSERT_EQ(sceneSession->OnNeedAvoid(false), WSError::WS_OK);
1459 
__anoncf6e0dec0c02(bool state) 1460     sceneSession->onNeedAvoid_ = [](bool state) {};
1461     ASSERT_EQ(sceneSession->OnNeedAvoid(false), WSError::WS_OK);
1462 }
1463 
1464 /**
1465  * @tc.name: SetCollaboratorType
1466  * @tc.desc: SetCollaboratorType
1467  * @tc.type: FUNC
1468  */
1469 HWTEST_F(SceneSessionTest, SetCollaboratorType, TestSize.Level1)
1470 {
1471     SessionInfo info;
1472     info.abilityName_ = "Background01";
1473     info.bundleName_ = "IsFloatingWindowAppType";
1474     info.windowType_ = 1;
1475     sptr<Rosen::ISession> session_;
1476     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1477         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1478     EXPECT_NE(specificCallback_, nullptr);
1479     sptr<SceneSession> sceneSession;
1480     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1481     EXPECT_NE(sceneSession, nullptr);
1482     sceneSession->SetCollaboratorType(2);
1483     ASSERT_EQ(sceneSession->GetCollaboratorType(), 2);
1484 }
1485 
1486 /**
1487  * @tc.name: GetAbilityInfo
1488  * @tc.desc: GetAbilityInfo
1489  * @tc.type: FUNC
1490  */
1491 HWTEST_F(SceneSessionTest, GetAbilityInfo, TestSize.Level1)
1492 {
1493     SessionInfo info;
1494     info.abilityName_ = "Background01";
1495     info.bundleName_ = "IsFloatingWindowAppType";
1496     info.windowType_ = 1;
1497     sptr<Rosen::ISession> session_;
1498     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1499         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1500     EXPECT_NE(specificCallback_, nullptr);
1501     sptr<SceneSession> sceneSession;
1502     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1503     EXPECT_NE(sceneSession, nullptr);
1504     std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo;
1505     sceneSession->SetAbilitySessionInfo(abilityInfo);
1506     ASSERT_EQ(sceneSession->GetAbilityInfo(), abilityInfo);
1507 }
1508 
1509 /**
1510  * @tc.name: UpdateCameraWindowStatus
1511  * @tc.desc: UpdateCameraWindowStatus
1512  * @tc.type: FUNC
1513  */
1514 HWTEST_F(SceneSessionTest, UpdateCameraWindowStatus, TestSize.Level1)
1515 {
1516     SessionInfo info;
1517     info.abilityName_ = "Background01";
1518     info.bundleName_ = "UpdateCameraWindowStatus";
1519     info.windowType_ = 1;
1520     sptr<Rosen::ISession> session_;
1521     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1522         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1523     EXPECT_NE(specificCallback_, nullptr);
1524     sptr<SystemSession> sysSession;
1525     sysSession = sptr<SystemSession>::MakeSptr(info, specificCallback_);
1526     EXPECT_NE(sysSession, nullptr);
1527     int ret = 1;
__anoncf6e0dec0d02(uint32_t accessTokenId, bool isShowing) 1528     specificCallback_->onCameraFloatSessionChange_ = [](uint32_t accessTokenId, bool isShowing) {};
__anoncf6e0dec0e02(uint32_t accessTokenId, bool isShowing) 1529     specificCallback_->onCameraSessionChange_ = [](uint32_t accessTokenId, bool isShowing) {};
1530 
1531     sysSession->UpdateCameraWindowStatus(false);
1532     sysSession = sptr<SystemSession>::MakeSptr(info, specificCallback_);
1533     sysSession->UpdateCameraWindowStatus(false);
1534     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1535     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1536     sysSession->property_ = property;
1537     sysSession->UpdateCameraWindowStatus(false);
1538     property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT_CAMERA);
1539     sysSession->property_ = property;
1540     sysSession->UpdateCameraWindowStatus(false);
1541     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
1542     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1543     PiPTemplateInfo pipType;
1544     pipType.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
1545     sysSession->SetPiPTemplateInfo(pipType);
1546     sysSession->property_ = property;
1547     sysSession->UpdateCameraWindowStatus(false);
1548     ASSERT_EQ(ret, 1);
1549 }
1550 
1551 /**
1552  * @tc.name: GetRatioPreferenceKey
1553  * @tc.desc: GetRatioPreferenceKey
1554  * @tc.type: FUNC
1555  */
1556 HWTEST_F(SceneSessionTest, GetRatioPreferenceKey, TestSize.Level1)
1557 {
1558     SessionInfo info;
1559     info.abilityName_ = "ability";
1560     info.bundleName_ = "bundle";
1561     info.moduleName_ = "module";
1562     info.windowType_ = 1;
1563     sptr<Rosen::ISession> session_;
1564     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1565         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1566     EXPECT_NE(specificCallback_, nullptr);
1567     sptr<SceneSession> sceneSession;
1568     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1569     EXPECT_NE(sceneSession, nullptr);
1570     std::string key = info.bundleName_ + info.moduleName_ + info.abilityName_;
1571     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1572     ASSERT_EQ(key, sceneSession->GetRatioPreferenceKey());
1573 
1574     std::string key2(30, 'a');
1575     std::string key3(80, 'a');
1576     sceneSession->sessionInfo_.bundleName_ = key2;
1577     sceneSession->sessionInfo_.moduleName_ = key2;
1578     sceneSession->sessionInfo_.abilityName_ = key2;
1579     ASSERT_EQ(key3, sceneSession->GetRatioPreferenceKey());
1580 }
1581 
1582 /**
1583  * @tc.name: NotifyPropertyWhenConnect
1584  * @tc.desc: NotifyPropertyWhenConnect
1585  * @tc.type: FUNC
1586  */
1587 HWTEST_F(SceneSessionTest, NotifyPropertyWhenConnect, TestSize.Level1)
1588 {
1589     SessionInfo info;
1590     info.abilityName_ = "ability";
1591     info.bundleName_ = "bundle";
1592     info.moduleName_ = "module";
1593     info.windowType_ = 1;
1594     sptr<Rosen::ISession> session_;
1595     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1596         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1597     EXPECT_NE(specificCallback_, nullptr);
1598     sptr<SceneSession> sceneSession;
1599     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1600     EXPECT_NE(sceneSession, nullptr);
1601     int ret = 1;
1602     std::string key = info.bundleName_ + info.moduleName_ + info.abilityName_;
1603     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1604     sceneSession->NotifyPropertyWhenConnect();
1605     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1606     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1607     sceneSession->property_ = property;
1608     sceneSession->NotifyPropertyWhenConnect();
1609     ASSERT_EQ(ret, 1);
1610 }
1611 
1612 /**
1613  * @tc.name: CalcRectForStatusBar
1614  * @tc.desc: CalcRectForStatusBar
1615  * @tc.type: FUNC
1616  */
1617 HWTEST_F(SceneSessionTest, CalcRectForStatusBar, TestSize.Level1)
1618 {
1619     SessionInfo info;
1620     info.abilityName_ = "CalcRectForStatusBar";
1621     info.bundleName_ = "CalcRectForStatusBar";
1622     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1623     DMRect statusBarRect = sceneSession->CalcRectForStatusBar();
1624     ASSERT_EQ(statusBarRect.width_, 0);
1625     ASSERT_EQ(statusBarRect.height_, 0);
1626 
1627     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1628         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1629     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
1630     statusBarRect = sceneSession->CalcRectForStatusBar();
1631     ASSERT_EQ(statusBarRect.width_, 0);
1632     ASSERT_EQ(statusBarRect.height_, 0);
1633 
1634     WSRect rect({0, 0, 1, 1});
1635     sceneSession->GetLayoutController()->SetSessionRect(rect);
1636     sceneSession->specificCallback_->onGetSceneSessionVectorByTypeAndDisplayId_ =
__anoncf6e0dec0f02(WindowType type, uint64_t displayId) 1637         [&](WindowType type, uint64_t displayId) -> std::vector<sptr<SceneSession>> {
1638         std::vector<sptr<SceneSession>> vec;
1639         vec.push_back(sceneSession);
1640         return vec;
1641     };
1642 
1643     sceneSession->isVisible_ = false;
1644     statusBarRect = sceneSession->CalcRectForStatusBar();
1645     EXPECT_EQ(statusBarRect.width_, 1);
1646     EXPECT_EQ(statusBarRect.height_, 0);
1647 
1648     sceneSession->isVisible_ = true;
1649     statusBarRect = sceneSession->CalcRectForStatusBar();
1650     EXPECT_EQ(statusBarRect.width_, 1);
1651     EXPECT_EQ(statusBarRect.height_, 1);
1652 }
1653 
1654 /**
1655  * @tc.name: InitializeMoveInputBar
1656  * @tc.desc: InitializeMoveInputBar
1657  * @tc.type: FUNC
1658  */
1659 HWTEST_F(SceneSessionTest, InitializeMoveInputBar, TestSize.Level1)
1660 {
1661     SessionInfo info;
1662     info.abilityName_ = "InitializeMoveInputBar";
1663     info.bundleName_ = "InitializeMoveInputBar";
1664     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1665     auto property = sceneSession->GetSessionProperty();
1666     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_STATUS_BAR);
1667     property->SetDisplayId(1);
1668 
1669     auto result = sceneSession->InitializeMoveInputBar();
1670     EXPECT_EQ(result, WSError::WS_ERROR_INVALID_OPERATION);
1671 }
1672 
1673 /**
1674  * @tc.name: OnSessionEvent
1675  * @tc.desc: normal function
1676  * @tc.type: FUNC
1677  */
1678 HWTEST_F(SceneSessionTest, OnSessionEvent, TestSize.Level1)
1679 {
1680     SessionInfo info;
1681     info.abilityName_ = "OnSessionEvent";
1682     info.bundleName_ = "OnSessionEvent";
1683     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1684     EXPECT_NE(sceneSession, nullptr);
1685     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(1, WindowType::WINDOW_TYPE_FLOAT);
1686     sceneSession->OnSessionEvent(SessionEvent::EVENT_START_MOVE);
1687     sceneSession->moveDragController_->isStartDrag_ = true;
1688     sceneSession->moveDragController_->hasPointDown_ = true;
1689     ASSERT_EQ(sceneSession->OnSessionEvent(SessionEvent::EVENT_START_MOVE), WSError::WS_OK);
1690     ASSERT_EQ(sceneSession->OnSessionEvent(SessionEvent::EVENT_END_MOVE), WSError::WS_OK);
1691 }
1692 
1693 /**
1694  * @tc.name: SyncSessionEvent
1695  * @tc.desc: normal function
1696  * @tc.type: FUNC
1697  */
1698 HWTEST_F(SceneSessionTest, SyncSessionEvent, TestSize.Level1)
1699 {
1700     SessionInfo info;
1701     info.abilityName_ = "SyncSessionEvent";
1702     info.bundleName_ = "SyncSessionEvent";
1703     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1704 
1705     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1706     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
1707     property->isSystemCalling_ = true;
1708     sceneSession->SetSessionProperty(property);
1709     sceneSession->isActive_ = false;
1710 
1711     SessionEvent event = SessionEvent::EVENT_START_MOVE;
1712     auto result = sceneSession->SyncSessionEvent(event);
1713     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
1714 
1715     sceneSession->property_->isSystemCalling_ = false;
1716     result = sceneSession->SyncSessionEvent(event);
1717     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
1718 }
1719 
1720 /**
1721  * @tc.name: SetTopmost
1722  * @tc.desc: normal function
1723  * @tc.type: FUNC
1724  */
1725 HWTEST_F(SceneSessionTest, SetTopmost, TestSize.Level1)
1726 {
1727     SessionInfo info;
1728     info.abilityName_ = "SetTopmost";
1729     info.bundleName_ = "SetTopmost";
1730     sptr<Rosen::ISession> session_;
1731     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
1732     EXPECT_NE(sceneSession, nullptr);
1733 
1734     auto result = sceneSession->SetTopmost(false);
1735     ASSERT_EQ(result, WSError::WS_OK);
1736     ASSERT_FALSE(sceneSession->IsTopmost());
1737 }
1738 
1739 /**
1740  * @tc.name: SetMainWindowTopmost
1741  * @tc.desc: normal function
1742  * @tc.type: FUNC
1743  */
1744 HWTEST_F(SceneSessionTest, SetMainWindowTopmost, TestSize.Level1)
1745 {
1746     SessionInfo info;
1747     info.abilityName_ = "SetMainWindowTopmost";
1748     info.bundleName_ = "SetMainWindowTopmost";
1749     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info, nullptr);
1750     auto result = sceneSession->SetMainWindowTopmost(false);
1751     ASSERT_EQ(result, WSError::WS_OK);
1752     ASSERT_FALSE(sceneSession->IsMainWindowTopmost());
1753 }
1754 
1755 /**
1756  * @tc.name: UpdateSessionRectPosYFromClient01
1757  * @tc.desc: normal function
1758  * @tc.type: FUNC
1759  */
1760 HWTEST_F(SceneSessionTest, UpdateSessionRectPosYFromClient01, TestSize.Level1)
1761 {
1762     DisplayId displayId = 0;
1763     SessionInfo info;
1764     info.abilityName_ = "UpdateSessionRectPosYFromClient";
1765     info.bundleName_ = "UpdateSessionRectPosYFromClient";
1766     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1767     ASSERT_NE(sceneSession, nullptr);
1768     sceneSession->sessionInfo_.screenId_ = 0;
1769     EXPECT_EQ(sceneSession->GetScreenId(), 0);
1770     PcFoldScreenManager::GetInstance().UpdateFoldScreenStatus(
1771         0, SuperFoldStatus::EXPANDED, { 0, 0, 2472, 1648 }, { 0, 1648, 2472, 1648 }, { 0, 1624, 2472, 1648 });
1772     WSRect rect = { 0, 0, 0, 0 };
1773     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::UNDEFINED, displayId, rect);
1774     EXPECT_EQ(rect.posY_, 0);
1775     PcFoldScreenManager::GetInstance().UpdateFoldScreenStatus(
1776         0, SuperFoldStatus::KEYBOARD, { 0, 0, 2472, 1648 }, { 0, 1648, 2472, 1648 }, { 0, 1624, 2472, 1648 });
1777     rect = { 0, 100, 0, 0 };
1778     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::UNDEFINED, displayId, rect);
1779     EXPECT_EQ(rect.posY_, 100);
1780 
1781     PcFoldScreenManager::GetInstance().UpdateFoldScreenStatus(
1782         0, SuperFoldStatus::HALF_FOLDED, { 0, 0, 2472, 1648 }, { 0, 1648, 2472, 1648 }, { 0, 1649, 2472, 40 });
1783     sceneSession->clientDisplayId_ = 0;
1784     rect = { 0, 100, 100, 100 };
1785     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::UNDEFINED, displayId, rect);
1786     EXPECT_EQ(rect.posY_, 100);
1787     sceneSession->clientDisplayId_ = 999;
1788     sceneSession->configDisplayId_ = 999;
1789     rect = { 0, 100, 100, 100 };
1790     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::RESIZE, displayId, rect);
1791     EXPECT_EQ(rect.posY_, 100 + 1648 + 40);
1792 
1793     sceneSession->clientDisplayId_ = 999;
1794     sceneSession->configDisplayId_ = 999;
1795     rect = { 0, 1700, 100, 100 };
1796     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::RESIZE, displayId, rect);
1797     EXPECT_EQ(rect.posY_, 1700);
1798 
1799     WSRect sessionRect = {100, 200, 1000, 1000};
1800     sceneSession->SetSessionRect(sessionRect);
1801     sceneSession->clientDisplayId_ = 999;
1802     sceneSession->configDisplayId_ = 999;
1803     rect = { 0, -100, 100, 100 };
1804     sceneSession->UpdateSessionRectPosYFromClient(SizeChangeReason::RESIZE, displayId, rect);
1805     EXPECT_EQ(rect.posY_, -100 + sessionRect.posY_);
1806 }
1807 
1808 /**
1809  * @tc.name: UpdateSessionRect
1810  * @tc.desc: normal function
1811  * @tc.type: FUNC
1812  */
1813 HWTEST_F(SceneSessionTest, UpdateSessionRect, TestSize.Level1)
1814 {
1815     SessionInfo info;
1816     info.abilityName_ = "UpdateSessionRect";
1817     info.bundleName_ = "UpdateSessionRect";
1818     sptr<Rosen::ISession> session_;
1819     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1820         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1821     EXPECT_NE(specificCallback_, nullptr);
1822     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1823     EXPECT_NE(sceneSession, nullptr);
1824     sceneSession->isActive_ = true;
1825 
1826     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1827     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1828     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1829 
1830     sceneSession->SetSessionProperty(property);
1831     WSRect rect({ 1, 1, 1, 1 });
1832     SizeChangeReason reason = SizeChangeReason::MOVE;
1833     WSError result = sceneSession->UpdateSessionRect(rect, reason);
1834     ASSERT_EQ(result, WSError::WS_OK);
1835 }
1836 
1837 /**
1838  * @tc.name: UpdateSessionRect1
1839  * @tc.desc: normal function
1840  * @tc.type: FUNC
1841  */
1842 HWTEST_F(SceneSessionTest, UpdateSessionRect1, TestSize.Level1)
1843 {
1844     SessionInfo info;
1845     info.abilityName_ = "UpdateSessionRect";
1846     info.bundleName_ = "UpdateSessionRect";
1847     sptr<Rosen::ISession> session_;
1848     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1849         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1850     EXPECT_NE(specificCallback_, nullptr);
1851     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1852     EXPECT_NE(sceneSession, nullptr);
1853     sceneSession->isActive_ = true;
1854 
1855     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1856     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1857     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1858 
1859     sceneSession->SetSessionProperty(property);
1860     WSRect rect({ 1, 1, 1, 1 });
1861     SizeChangeReason reason = SizeChangeReason::RESIZE;
1862     WSError result = sceneSession->UpdateSessionRect(rect, reason);
1863     ASSERT_EQ(result, WSError::WS_OK);
1864 }
1865 
1866 /**
1867  * @tc.name: UpdateSessionRect2
1868  * @tc.desc: normal function
1869  * @tc.type: FUNC
1870  */
1871 HWTEST_F(SceneSessionTest, UpdateSessionRect2, TestSize.Level1)
1872 {
1873     SessionInfo info;
1874     info.abilityName_ = "UpdateSessionRect";
1875     info.bundleName_ = "UpdateSessionRect";
1876     sptr<Rosen::ISession> session_;
1877     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1878         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1879     EXPECT_NE(specificCallback_, nullptr);
1880     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1881     EXPECT_NE(sceneSession, nullptr);
1882     sceneSession->isActive_ = true;
1883 
1884     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1885     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1886     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1887 
1888     sceneSession->SetSessionProperty(property);
1889     WSRect rect({ 1, 1, 1, 1 });
1890     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
1891     WSError result = sceneSession->UpdateSessionRect(rect, reason);
1892     ASSERT_EQ(result, WSError::WS_OK);
1893 }
1894 
1895 /**
1896  * @tc.name: UpdateSessionRect3
1897  * @tc.desc: test for isGlobal is true
1898  * @tc.type: FUNC
1899  */
1900 HWTEST_F(SceneSessionTest, UpdateSessionRect3, TestSize.Level1)
1901 {
1902     SessionInfo info;
1903     info.abilityName_ = "UpdateSessionRect";
1904     info.bundleName_ = "UpdateSessionRect";
1905     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1906     sceneSession->isActive_ = true;
1907 
1908     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1909     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
1910     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1911 
1912     sceneSession->SetSessionProperty(property);
1913     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
1914     WSRect oldRect({ 1, 1, 1, 1 });
1915     WSRect parentRect({ 10, 10, 1, 1 });
1916 
1917     sptr<SceneSession> parentSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1918     sceneSession->SetParentSession(parentSession);
1919     EXPECT_NE(sceneSession->GetParentSession(), nullptr);
1920     parentSession->SetSessionRect(parentRect);
1921     sceneSession->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1922 
1923     bool isGlobal = true;
1924     WSError result = sceneSession->UpdateSessionRect(oldRect, reason, isGlobal);
1925     ASSERT_EQ(result, WSError::WS_OK);
1926 
1927     WSRect newRect = sceneSession->GetSessionRect();
1928     ASSERT_EQ(newRect.posX_, oldRect.posX_ - parentRect.posX_);
1929     ASSERT_EQ(newRect.posY_, oldRect.posY_ - parentRect.posY_);
1930 }
1931 
1932 /**
1933  * @tc.name: UpdateSessionRect4
1934  * @tc.desc: test for isGlobal is true and multilevel subWindow
1935  * @tc.type: FUNC
1936  */
1937 HWTEST_F(SceneSessionTest, UpdateSessionRect4, TestSize.Level1)
1938 {
1939     SessionInfo info;
1940     info.abilityName_ = "UpdateSessionRect4";
1941     info.bundleName_ = "UpdateSessionRect4";
1942     sptr<SceneSession> mainSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1943     mainSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1944     mainSession->property_->SetPersistentId(1111);
1945     mainSession->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1946     sptr<SceneSession> subSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1947     subSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
1948     subSession->property_->SetPersistentId(1122);
1949     subSession->SetParentSession(mainSession);
1950     subSession->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1951     sptr<SceneSession> subSubSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1952     subSubSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
1953     subSubSession->property_->SetPersistentId(1133);
1954     subSubSession->SetParentSession(subSession);
1955     subSubSession->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1956     // Test the changes in the rect value of the first-level subWindow in the phone scenario
1957     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
1958     WSRect oldRect1({ 20, 20, 20, 20 });
1959     WSRect mainRect({ 10, 10, 10, 10 });
1960     mainSession->SetSessionRect(mainRect);
1961     bool isGlobal = true;
1962     WSError result = subSession->UpdateSessionRect(oldRect1, reason, isGlobal);
1963     EXPECT_EQ(result, WSError::WS_OK);
1964     WSRect newRect1 = subSession->GetSessionRect();
1965     EXPECT_EQ(newRect1.posX_, oldRect1.posX_ - mainRect.posX_);
1966     EXPECT_EQ(newRect1.posY_, oldRect1.posY_ - mainRect.posY_);
1967     mainSession->systemConfig_.freeMultiWindowSupport_ = true;
1968     mainSession->systemConfig_.freeMultiWindowEnable_ = true;
1969     result = mainSession->UpdateSessionRect(oldRect1, reason, isGlobal);
1970     result = mainSession->UpdateSessionRect(oldRect1, reason, isGlobal, true);
1971     mainSession->systemConfig_.freeMultiWindowEnable_ = false;
1972     result = mainSession->UpdateSessionRect(oldRect1, reason, isGlobal);
1973     result = mainSession->UpdateSessionRect(oldRect1, reason, isGlobal, true);
1974     subSubSession->systemConfig_.freeMultiWindowSupport_ = true;
1975     subSubSession->systemConfig_.freeMultiWindowEnable_ = true;
1976     result = subSubSession->UpdateSessionRect(oldRect1, reason, isGlobal);
1977     result = subSubSession->UpdateSessionRect(oldRect1, reason, isGlobal, true);
1978     subSubSession->systemConfig_.freeMultiWindowEnable_ = false;
1979     result = subSubSession->UpdateSessionRect(oldRect1, reason, isGlobal);
1980     result = subSubSession->UpdateSessionRect(oldRect1, reason, isGlobal, true);
1981     ASSERT_EQ(result, WSError::WS_OK);
1982     // Test the changes of rect values of multi-level subWindow in the phone scenario
1983     WSRect oldRect2({ 30, 30, 30, 30 });
1984     result = subSubSession->UpdateSessionRect(oldRect2, reason, isGlobal);
1985     EXPECT_EQ(result, WSError::WS_OK);
1986     WSRect newRect2 = subSubSession->GetSessionRect();
1987     EXPECT_EQ(newRect2.posX_, oldRect2.posX_ - mainRect.posX_);
1988     EXPECT_EQ(newRect2.posY_, oldRect2.posY_ - mainRect.posY_);
1989 }
1990 
1991 /**
1992  * @tc.name: GetStatusBarHeight
1993  * @tc.desc: normal function
1994  * @tc.type: FUNC
1995  */
1996 HWTEST_F(SceneSessionTest, GetStatusBarHeight, TestSize.Level1)
1997 {
1998     SessionInfo info;
1999     info.abilityName_ = "GetStatusBarHeight";
2000     info.bundleName_ = "GetStatusBarHeight";
2001     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2002     EXPECT_NE(sceneSession, nullptr);
2003     int32_t height = sceneSession->GetStatusBarHeight();
2004     ASSERT_EQ(height, 0);
2005     SystemBarProperty propertyHide;
2006     propertyHide.enable_ = false;
2007     ASSERT_EQ(WSError::WS_OK, sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, propertyHide));
2008     ASSERT_EQ(height, 0);
2009     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
2010         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2011     EXPECT_NE(specificCallback_, nullptr);
2012     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
2013     height = sceneSession->GetStatusBarHeight();
2014     ASSERT_EQ(height, 0);
2015     WSRect rect({ 0, 0, 0, 1 });
2016     sceneSession->GetLayoutController()->SetSessionRect(rect);
2017     specificCallback_->onGetSceneSessionVectorByTypeAndDisplayId_ =
__anoncf6e0dec1002(WindowType type, uint64_t displayId) 2018         [&](WindowType type, uint64_t displayId) -> std::vector<sptr<SceneSession>> {
2019         std::vector<sptr<SceneSession>> vec;
2020         vec.push_back(sceneSession);
2021         return vec;
2022     };
2023     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
2024     EXPECT_NE(property, nullptr);
2025     sceneSession->property_ = property;
2026     height = sceneSession->GetStatusBarHeight();
2027     ASSERT_EQ(height, 1);
2028     ASSERT_EQ(WSError::WS_OK, sceneSession->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, propertyHide));
2029     ASSERT_EQ(height, 1);
2030 }
2031 
2032 /**
2033  * @tc.name: GetDockHeight
2034  * @tc.desc: normal function
2035  * @tc.type: FUNC
2036  */
2037 HWTEST_F(SceneSessionTest, GetDockHeight, TestSize.Level1)
2038 {
2039     SessionInfo info;
2040     info.abilityName_ = "GetDockHeight";
2041     info.bundleName_ = "GetDockHeight";
2042     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2043     EXPECT_NE(sceneSession, nullptr);
2044     ASSERT_EQ(sceneSession->GetDockHeight(), 0);
2045     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
2046         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2047     EXPECT_NE(specificCallback_, nullptr);
2048     sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
2049     ASSERT_EQ(sceneSession->GetDockHeight(), 0);
2050     WSRect rect({ 0, 0, 0, 112 });
2051     sceneSession->GetLayoutController()->SetSessionRect(rect);
2052     specificCallback_->onGetSceneSessionVectorByTypeAndDisplayId_ =
__anoncf6e0dec1102(WindowType type, uint64_t displayId) 2053         [&](WindowType type, uint64_t displayId) -> std::vector<sptr<SceneSession>> {
2054         std::vector<sptr<SceneSession>> vec;
2055         vec.push_back(sceneSession);
2056         return vec;
2057     };
2058     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
2059     EXPECT_NE(property, nullptr);
2060     sceneSession->property_ = property;
2061     ASSERT_EQ(sceneSession->GetDockHeight(), 0);
2062     sceneSession->isVisible_ = true;
2063     ASSERT_EQ(sceneSession->GetDockHeight(), 0);
2064     sceneSession->property_->windowName_ = "SCBSmartDock";
2065     ASSERT_EQ(sceneSession->GetDockHeight(), 112);
2066 }
2067 
2068 /**
2069  * @tc.name: GetAppForceLandscapeConfig
2070  * @tc.desc: GetAppForceLandscapeConfig
2071  * @tc.type: FUNC
2072  */
2073 HWTEST_F(SceneSessionTest, GetAppForceLandscapeConfig, TestSize.Level1)
2074 {
2075     SessionInfo info;
2076     info.abilityName_ = "GetAppForceLandscapeConfig";
2077     info.bundleName_ = "GetAppForceLandscapeConfig";
2078     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2079         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2080     EXPECT_NE(specificCallback, nullptr);
2081     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2082     EXPECT_NE(sceneSession, nullptr);
2083     AppForceLandscapeConfig config = {};
2084     auto result = sceneSession->GetAppForceLandscapeConfig(config);
2085     ASSERT_EQ(result, WMError::WM_ERROR_NULLPTR);
2086 }
2087 
2088 /**
2089  * @tc.name: SetMoveDragCallback
2090  * @tc.desc: SetMoveDragCallback
2091  * @tc.type: FUNC
2092  */
2093 HWTEST_F(SceneSessionTest, SetMoveDragCallback, TestSize.Level1)
2094 {
2095     SessionInfo info;
2096     info.abilityName_ = "SetMoveDragCallback";
2097     info.bundleName_ = "SetMoveDragCallback";
2098     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2099         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2100     EXPECT_NE(specificCallback, nullptr);
2101     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2102     EXPECT_NE(sceneSession, nullptr);
2103 
2104     sceneSession->moveDragController_ = nullptr;
2105     sceneSession->SetMoveDragCallback();
2106 }
2107 
2108 /**
2109  * @tc.name: SetDefaultDisplayIdIfNeed
2110  * @tc.desc: SetDefaultDisplayIdIfNeed
2111  * @tc.type: FUNC
2112  */
2113 HWTEST_F(SceneSessionTest, SetDefaultDisplayIdIfNeed, TestSize.Level0)
2114 {
2115     SessionInfo info;
2116     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2117     EXPECT_NE(sceneSession, nullptr);
2118     sceneSession->SetDefaultDisplayIdIfNeed();
2119 
2120     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
2121     EXPECT_NE(property, nullptr);
2122     property->SetDisplayId(-1);
2123     sceneSession->SetSessionProperty(property);
2124     sceneSession->SetDefaultDisplayIdIfNeed();
2125     EXPECT_EQ(property->GetDisplayId(), SCREEN_ID_INVALID);
2126 }
2127 
2128 /**
2129  * @tc.name: SetSessionGlobalRect/GetSessionGlobalRect
2130  * @tc.desc: SetSessionGlobalRect
2131  * @tc.type: FUNC
2132  */
2133 HWTEST_F(SceneSessionTest, SetSessionGlobalRect, TestSize.Level1)
2134 {
2135     SessionInfo info;
2136     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
2137     EXPECT_NE(sceneSession, nullptr);
2138     WSRect test = { 100, 100, 100, 100 };
2139     sceneSession->SetSessionGlobalRect(test);
2140     sceneSession->SetScbCoreEnabled(true);
2141     EXPECT_EQ(test, sceneSession->GetSessionGlobalRect());
2142 }
2143 
2144 /**
2145  * @tc.name: SetSessionGlobalRect/GetSessionGlobalRect
2146  * @tc.desc: SetSessionGlobalRect
2147  * @tc.type: FUNC
2148  */
2149 HWTEST_F(SceneSessionTest, SetIsStatusBarVisibleInner01, TestSize.Level0)
2150 {
2151     SessionInfo info;
2152     info.abilityName_ = "SetIsStatusBarVisibleInner01";
2153     info.bundleName_ = "SetIsStatusBarVisibleInner01";
2154     info.windowType_ = 1;
2155     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2156         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2157     EXPECT_NE(specificCallback, nullptr);
2158     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2159     EXPECT_NE(sceneSession, nullptr);
2160     sceneSession->isStatusBarVisible_ = true;
2161     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_OK);
2162     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_ERROR_NULLPTR);
2163 
__anoncf6e0dec1202(bool& isLayoutFinished) 2164     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) { return WSError::WS_ERROR_NULLPTR; };
2165     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_ERROR_NULLPTR);
2166 
__anoncf6e0dec1302(bool& isLayoutFinished) 2167     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
2168         isLayoutFinished = false;
2169         return WSError::WS_OK;
2170     };
2171     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK);
2172 
__anoncf6e0dec1402(bool& isLayoutFinished) 2173     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
2174         isLayoutFinished = true;
2175         return WSError::WS_OK;
2176     };
2177     sceneSession->specificCallback_ = nullptr;
2178     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK);
2179 }
2180 
2181 /**
2182  * @tc.name: SetMousePointerDownEventStatus
2183  * @tc.desc: SetMousePointerDownEventStatus
2184  * @tc.type: FUNC
2185  */
2186 HWTEST_F(SceneSessionTest, SetMousePointerDownEventStatus, TestSize.Level1)
2187 {
2188     SessionInfo info;
2189     info.abilityName_ = "SetMousePointerDownEventStatus";
2190     info.bundleName_ = "SetMousePointerDownEventStatus";
2191     info.windowType_ = 1;
2192     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2193         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2194     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2195     EXPECT_NE(sceneSession, nullptr);
2196 
2197     sceneSession->SetMousePointerDownEventStatus(true);
2198     EXPECT_EQ(sceneSession->GetMousePointerDownEventStatus(), true);
2199 }
2200 
2201 /**
2202  * @tc.name: SetFingerPointerDownStatus
2203  * @tc.desc: SetFingerPointerDownStatus
2204  * @tc.type: FUNC
2205  */
2206 HWTEST_F(SceneSessionTest, SetFingerPointerDownStatus, TestSize.Level1)
2207 {
2208     SessionInfo info;
2209     info.abilityName_ = "SetFingerPointerDownStatus";
2210     info.bundleName_ = "SetFingerPointerDownStatus";
2211     info.windowType_ = 1;
2212     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2213         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2214     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2215     EXPECT_NE(sceneSession, nullptr);
2216 
2217     sceneSession->SetFingerPointerDownStatus(0);
2218     sceneSession->SetFingerPointerDownStatus(1);
2219     auto fingerPointerDownStatusList = sceneSession->GetFingerPointerDownStatusList();
2220     EXPECT_EQ(fingerPointerDownStatusList.size(), 2);
2221     sceneSession->RemoveFingerPointerDownStatus(0);
2222     fingerPointerDownStatusList = sceneSession->GetFingerPointerDownStatusList();
2223     EXPECT_EQ(fingerPointerDownStatusList.size(), 1);
2224 
2225     sceneSession->RemoveFingerPointerDownStatus(1);
2226     fingerPointerDownStatusList = sceneSession->GetFingerPointerDownStatusList();
2227     EXPECT_EQ(fingerPointerDownStatusList.size(), 0);
2228 }
2229 
2230 /**
2231  * @tc.name: SetUIFirstSwitch
2232  * @tc.desc: SetUIFirstSwitch
2233  * @tc.type: FUNC
2234  */
2235 HWTEST_F(SceneSessionTest, SetUIFirstSwitch, TestSize.Level1)
2236 {
2237     SessionInfo info;
2238     info.abilityName_ = "SetUIFirstSwitch";
2239     info.bundleName_ = "SetUIFirstSwitch";
2240     info.windowType_ = 1;
2241     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2242         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2243     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2244     EXPECT_NE(sceneSession, nullptr);
2245     sceneSession->SetUIFirstSwitch(RSUIFirstSwitch::FORCE_DISABLE_NONFOCUS);
2246 }
2247 
2248 /**
2249  * @tc.name: IsFollowParentMultiScreenPolicy
2250  * @tc.desc: IsFollowParentMultiScreenPolicy
2251  * @tc.type: FUNC
2252  */
2253 HWTEST_F(SceneSessionTest, IsFollowParentMultiScreenPolicy, TestSize.Level1)
2254 {
2255     SessionInfo info;
2256     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2257         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2258     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2259     EXPECT_EQ(sceneSession->IsFollowParentMultiScreenPolicy(), false);
2260 }
2261 
2262 /**
2263  * @tc.name: CloneWindow
2264  * @tc.desc: CloneWindow
2265  * @tc.type: FUNC
2266  */
2267 HWTEST_F(SceneSessionTest, CloneWindow, TestSize.Level1)
2268 {
2269     LOG_SetCallback(SceneSessionLogCallback);
2270     SessionInfo info;
2271     info.abilityName_ = "CloneWindow";
2272     info.bundleName_ = "CloneWindow";
2273     info.windowType_ = 1;
2274     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2275         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2276     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2277     EXPECT_NE(sceneSession, nullptr);
2278     uint64_t surfaceNodeId = 1;
2279     bool needOffScreen = false;
2280     struct RSSurfaceNodeConfig config;
2281     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
2282     sceneSession->SetSurfaceNode(surfaceNode);
2283     sceneSession->CloneWindow(surfaceNodeId, needOffScreen);
2284     EXPECT_TRUE(logMsg.find("cloned") != std::string::npos);
2285 }
2286 
2287 /**
2288  * @tc.name: GetGlobalOrWinRect
2289  * @tc.desc: GetGlobalOrWinRect
2290  * @tc.type: FUNC
2291  */
2292 HWTEST_F(SceneSessionTest, GetGlobalOrWinRect, Function | SmallTest | Level2)
2293 {
2294     SessionInfo info;
2295     sptr<SceneSession::SpecificSessionCallback> specificCallback =
2296         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
2297     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
2298     sceneSession->GetLayoutController()->SetSessionRect({1, 1, 1, 1});
2299     sceneSession->SetSessionGlobalRect({2, 2, 1, 1});
2300     sceneSession->isScbCoreEnabled_ = true;
2301     sceneSession->systemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
2302     auto rect = sceneSession->GetGlobalOrWinRect();
2303     EXPECT_EQ(1, rect.posX_);
2304     EXPECT_EQ(1, rect.posY_);
2305 
2306     sceneSession->systemConfig_.windowUIType_ = WindowUIType::PAD_WINDOW;
2307     sceneSession->systemConfig_.freeMultiWindowEnable_ = true;
2308     sceneSession->systemConfig_.freeMultiWindowSupport_ = true;
2309     rect = sceneSession->GetGlobalOrWinRect();
2310     EXPECT_EQ(1, rect.posX_);
2311     EXPECT_EQ(1, rect.posY_);
2312 
2313     sceneSession->systemConfig_.freeMultiWindowEnable_ = false;
2314     sceneSession->systemConfig_.freeMultiWindowSupport_ = false;
2315     rect = sceneSession->GetGlobalOrWinRect();
2316     EXPECT_EQ(2, rect.posX_);
2317     EXPECT_EQ(2, rect.posY_);
2318 }
2319 } // namespace
2320 } // namespace Rosen
2321 } // namespace OHOS