1 /*
2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #include "mock_RSIWindowAnimationController.h"
18
19 #include "remote_animation.h"
20 #include "starting_window.h"
21 #include "window_transition_info.h"
22 #include "window_property.h"
23 #include "window_agent.h"
24 #include "window_adapter.h"
25 #include "scene_board_judgement.h"
26
27 using namespace testing;
28 using namespace testing::ext;
29
30 namespace OHOS {
31 namespace Rosen {
32 constexpr uint32_t WINDOW_ID = 1000;
33 class WindowAdapterTest : public testing::Test {
34 public:
35 static void SetUpTestCase();
36 static void TearDownTestCase();
37 void SetUp() override;
38 void TearDown() override;
39 };
40
SetUpTestCase()41 void WindowAdapterTest::SetUpTestCase()
42 {
43 }
44
TearDownTestCase()45 void WindowAdapterTest::TearDownTestCase()
46 {
47 }
48
SetUp()49 void WindowAdapterTest::SetUp()
50 {
51 }
52
TearDown()53 void WindowAdapterTest::TearDown()
54 {
55 }
56
57 namespace {
58 /**
59 * @tc.name: AddWindow
60 * @tc.desc: WindowAdapter/AddWindow
61 * @tc.type: FUNC
62 */
63 HWTEST_F(WindowAdapterTest, AddWindow, Function | SmallTest | Level2)
64 {
65 sptr<WindowProperty> windowProperty = nullptr;
66 WindowAdapter windowAdapter;
67
68 windowAdapter.AddWindow(windowProperty);
69 auto ret = windowAdapter.InitWMSProxy();
70 ASSERT_EQ(true, ret);
71 }
72
73 /**
74 * @tc.name: RemoveWindow
75 * @tc.desc: WindowAdapter/RemoveWindow
76 * @tc.type: FUNC
77 */
78 HWTEST_F(WindowAdapterTest, RemoveWindow, Function | SmallTest | Level2)
79 {
80 uint32_t windowId = 0;
81 bool isFromInnerkits = false;
82 WindowAdapter windowAdapter;
83
84 windowAdapter.RemoveWindow(windowId, isFromInnerkits);
85 auto ret = windowAdapter.InitWMSProxy();
86 ASSERT_EQ(true, ret);
87 }
88
89 /**
90 * @tc.name: RequestFocus
91 * @tc.desc: WindowAdapter/RequestFocus
92 * @tc.type: FUNC
93 */
94 HWTEST_F(WindowAdapterTest, RequestFocus, Function | SmallTest | Level2)
95 {
96 uint32_t windowId = 0;
97 WindowAdapter windowAdapter;
98
99 windowAdapter.RequestFocus(windowId);
100 auto ret = windowAdapter.InitWMSProxy();
101 ASSERT_EQ(true, ret);
102 }
103
104 /**
105 * @tc.name: GetUIContentRemoteObj
106 * @tc.desc: WindowAdapter/GetUIContentRemoteObj
107 * @tc.type: FUNC
108 */
109 HWTEST_F(WindowAdapterTest, GetUIContentRemoteObj, Function | SmallTest | Level2)
110 {
111 WindowAdapter windowAdapter;
112 sptr<IRemoteObject> remoteObj;
113 auto ret = windowAdapter.GetUIContentRemoteObj(WINDOW_ID, remoteObj);
114 if (SceneBoardJudgement::IsSceneBoardEnabled()) {
115 ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
116 } else {
117 ASSERT_EQ(ret, WMError::WM_OK);
118 }
119 }
120
121 /**
122 * @tc.name: CheckWindowId
123 * @tc.desc: WindowAdapter/CheckWindowId
124 * @tc.type: FUNC
125 */
126 HWTEST_F(WindowAdapterTest, CheckWindowId, Function | SmallTest | Level2)
127 {
128 int32_t windowId = 0;
129 int32_t pid = 0;
130 WindowAdapter windowAdapter;
131
132 windowAdapter.CheckWindowId(windowId, pid);
133 auto ret = windowAdapter.InitWMSProxy();
134 ASSERT_EQ(true, ret);
135 }
136
137 /**
138 * @tc.name: SetWindowAnimationController
139 * @tc.desc: WindowAdapter/SetWindowAnimationController
140 * @tc.type: FUNC
141 */
142 HWTEST_F(WindowAdapterTest, SetWindowAnimationController, Function | SmallTest | Level2)
143 {
144 sptr<RSIWindowAnimationController> controller = nullptr;
145 WindowAdapter windowAdapter;
146
147 windowAdapter.SetWindowAnimationController(controller);
148 auto ret = windowAdapter.InitWMSProxy();
149 ASSERT_EQ(true, ret);
150 }
151
152 /**
153 * @tc.name: GetAvoidAreaByType
154 * @tc.desc: WindowAdapter/GetAvoidAreaByType
155 * @tc.type: FUNC
156 */
157 HWTEST_F(WindowAdapterTest, GetAvoidAreaByType, Function | SmallTest | Level2)
158 {
159 uint32_t windowId = 0;
160 AvoidAreaType type = AvoidAreaType::TYPE_CUTOUT;
161 AvoidArea avoidArea;
162 WindowAdapter windowAdapter;
163
164 windowAdapter.GetAvoidAreaByType(windowId, type, avoidArea);
165 auto ret = windowAdapter.InitWMSProxy();
166 ASSERT_EQ(true, ret);
167 }
168
169 /**
170 * @tc.name: NotifyServerReadyToMoveOrDrag
171 * @tc.desc: WindowAdapter/NotifyServerReadyToMoveOrDrag
172 * @tc.type: FUNC
173 */
174 HWTEST_F(WindowAdapterTest, NotifyServerReadyToMoveOrDrag, Function | SmallTest | Level2)
175 {
176 uint32_t windowId = 0;
177 sptr<WindowProperty> windowProperty = nullptr;
178 sptr<MoveDragProperty> moveDragProperty = nullptr;
179 WindowAdapter windowAdapter;
180
181 windowAdapter.NotifyServerReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty);
182 auto ret = windowAdapter.InitWMSProxy();
183 ASSERT_EQ(true, ret);
184 }
185
186 /**
187 * @tc.name: ProcessPointDown
188 * @tc.desc: WindowAdapter/ProcessPointDown
189 * @tc.type: FUNC
190 */
191 HWTEST_F(WindowAdapterTest, ProcessPointDown, Function | SmallTest | Level2)
192 {
193 uint32_t windowId = 0;
194 bool isPointDown = false;
195 WindowAdapter windowAdapter;
196
197 windowAdapter.ProcessPointDown(windowId, isPointDown);
198 windowAdapter.ProcessPointUp(windowId);
199 auto ret = windowAdapter.InitWMSProxy();
200 ASSERT_EQ(true, ret);
201 }
202
203 /**
204 * @tc.name: ToggleShownStateForAllAppWindows
205 * @tc.desc: WindowAdapter/ToggleShownStateForAllAppWindows
206 * @tc.type: FUNC
207 */
208 HWTEST_F(WindowAdapterTest, ToggleShownStateForAllAppWindows, Function | SmallTest | Level2)
209 {
210 WindowAdapter windowAdapter;
211
212 windowAdapter.ToggleShownStateForAllAppWindows();
213 auto ret = windowAdapter.InitWMSProxy();
214 ASSERT_EQ(true, ret);
215 }
216
217 /**
218 * @tc.name: GetSnapshotByWindowId
219 * @tc.desc: WindowAdapter/GetSnapshotByWindowId
220 * @tc.type: FUNC
221 */
222 HWTEST_F(WindowAdapterTest, GetSnapshotByWindowId, Function | SmallTest | Level2)
223 {
224 WindowAdapter windowAdapter;
225 int32_t persistentId = -1;
226 std::shared_ptr<Media::PixelMap> pixelMap = nullptr;
227 windowAdapter.GetSnapshotByWindowId(persistentId, pixelMap);
228 auto ret = windowAdapter.InitWMSProxy();
229 ASSERT_EQ(true, ret);
230 }
231
232 /**
233 * @tc.name: InitWMSProxy
234 * @tc.desc: WindowAdapter/InitWMSProxy
235 * @tc.type: FUNC
236 */
237 HWTEST_F(WindowAdapterTest, InitWMSProxy, Function | SmallTest | Level2)
238 {
239 WindowAdapter windowAdapter;
240 auto ret = windowAdapter.InitWMSProxy();
241 ASSERT_EQ(true, ret);
242 }
243
244 /**
245 * @tc.name: GetUnreliableWindowInfo
246 * @tc.desc: WindowAdapter/GetUnreliableWindowInfo
247 * @tc.type: FUNC
248 */
249 HWTEST_F(WindowAdapterTest, GetUnreliableWindowInfo, Function | SmallTest | Level2)
250 {
251 int32_t windowId = 0;
252 std::vector<sptr<UnreliableWindowInfo>> infos;
253 WindowAdapter windowAdapter;
254 windowAdapter.GetUnreliableWindowInfo(windowId, infos);
255 auto ret = windowAdapter.InitWMSProxy();
256 ASSERT_EQ(true, ret);
257 }
258
259 /**
260 * @tc.name: DestroyAndDisconnectSpecificSession
261 * @tc.desc: WindowAdapter/DestroyAndDisconnectSpecificSession
262 * @tc.type: FUNC
263 */
264 HWTEST_F(WindowAdapterTest, DestroyAndDisconnectSpecificSession, Function | SmallTest | Level2)
265 {
266 uint32_t persistentId = 0;
267 WindowAdapter windowAdapter;
268 windowAdapter.DestroyAndDisconnectSpecificSession(persistentId);
269 auto ret = windowAdapter.InitWMSProxy();
270 ASSERT_EQ(true, ret);
271 }
272
273 /**
274 * @tc.name: DestroyAndDisconnectSpecificSessionWithDetachCallback
275 * @tc.desc: WindowAdapter/DestroyAndDisconnectSpecificSessionWithDetachCallback
276 * @tc.type: FUNC
277 */
278 HWTEST_F(WindowAdapterTest, DestroyAndDisconnectSpecificSessionWithDetachCallback, Function | SmallTest | Level2)
279 {
280 uint32_t persistentId = 0;
281 WindowAdapter windowAdapter;
282 windowAdapter.DestroyAndDisconnectSpecificSessionWithDetachCallback(persistentId, nullptr);
283 auto ret = windowAdapter.InitWMSProxy();
284 ASSERT_EQ(true, ret);
285 }
286
287 /**
288 * @tc.name: UpdateModalExtensionRect
289 * @tc.desc: WindowAdapter/UpdateModalExtensionRect
290 * @tc.type: FUNC
291 */
292 HWTEST_F(WindowAdapterTest, UpdateModalExtensionRect, Function | SmallTest | Level2)
293 {
294 WindowAdapter windowAdapter;
295 Rect rect { 1, 2, 3, 4 };
296 sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
297 ASSERT_NE(token, nullptr);
298 windowAdapter.UpdateModalExtensionRect(token, rect);
299 windowAdapter.UpdateModalExtensionRect(nullptr, rect);
300 auto ret = windowAdapter.InitWMSProxy();
301 EXPECT_TRUE(ret);
302 }
303
304 /**
305 * @tc.name: ProcessModalExtensionPointDown
306 * @tc.desc: WindowAdapter/ProcessModalExtensionPointDown
307 * @tc.type: FUNC
308 */
309 HWTEST_F(WindowAdapterTest, ProcessModalExtensionPointDown, Function | SmallTest | Level2)
310 {
311 WindowAdapter windowAdapter;
312 sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
313 ASSERT_NE(token, nullptr);
314 windowAdapter.ProcessModalExtensionPointDown(token, 0, 0);
315 windowAdapter.ProcessModalExtensionPointDown(nullptr, 0, 0);
316 auto ret = windowAdapter.InitWMSProxy();
317 EXPECT_TRUE(ret);
318 }
319
320 /**
321 * @tc.name: AddExtensionWindowStageToSCB
322 * @tc.desc: WindowAdapter/AddExtensionWindowStageToSCB
323 * @tc.type: FUNC
324 */
325 HWTEST_F(WindowAdapterTest, AddExtensionWindowStageToSCB, Function | SmallTest | Level2)
326 {
327 WindowAdapter windowAdapter;
328 windowAdapter.AddExtensionWindowStageToSCB(nullptr, nullptr, 0);
329 auto ret = windowAdapter.InitWMSProxy();
330 EXPECT_TRUE(ret);
331 }
332
333 /**
334 * @tc.name: RemoveExtensionWindowStageFromSCB
335 * @tc.desc: WindowAdapter/RemoveExtensionWindowStageFromSCB
336 * @tc.type: FUNC
337 */
338 HWTEST_F(WindowAdapterTest, RemoveExtensionWindowStageFromSCB, Function | SmallTest | Level2)
339 {
340 WindowAdapter windowAdapter;
341 windowAdapter.RemoveExtensionWindowStageFromSCB(nullptr, nullptr);
342 auto ret = windowAdapter.InitWMSProxy();
343 EXPECT_TRUE(ret);
344 }
345
346 /**
347 * @tc.name: AddOrRemoveSecureSession
348 * @tc.desc: WindowAdapter/AddOrRemoveSecureSession
349 * @tc.type: FUNC
350 */
351 HWTEST_F(WindowAdapterTest, AddOrRemoveSecureSession, Function | SmallTest | Level2)
352 {
353 int32_t persistentId = 0;
354 WindowAdapter windowAdapter;
355 windowAdapter.AddOrRemoveSecureSession(persistentId, true);
356 auto ret = windowAdapter.InitWMSProxy();
357 ASSERT_EQ(true, ret);
358 }
359
360 /**
361 * @tc.name: UpdateExtWindowFlags
362 * @tc.desc: WindowAdapter/UpdateExtWindowFlags
363 * @tc.type: FUNC
364 */
365 HWTEST_F(WindowAdapterTest, UpdateExtWindowFlags, Function | SmallTest | Level2)
366 {
367 WindowAdapter windowAdapter;
368 sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
369 ASSERT_NE(token, nullptr);
370 windowAdapter.UpdateExtWindowFlags(token, 7, 7);
371 windowAdapter.UpdateExtWindowFlags(nullptr, 7, 7);
372 auto ret = windowAdapter.InitWMSProxy();
373 ASSERT_EQ(true, ret);
374 }
375
376 /**
377 * @tc.name: GetVisibilityWindowInfo
378 * @tc.desc: WindowAdapter/GetVisibilityWindowInfo
379 * @tc.type: FUNC
380 */
381 HWTEST_F(WindowAdapterTest, GetVisibilityWindowInfo, Function | SmallTest | Level2)
382 {
383 WindowAdapter windowAdapter;
384 std::vector<sptr<WindowVisibilityInfo>> infos;
385 auto ret = windowAdapter.GetVisibilityWindowInfo(infos);
386 windowAdapter.WindowManagerAndSessionRecover();
387 ASSERT_EQ(WMError::WM_OK, ret);
388 }
389
390 /**
391 * @tc.name: ReregisterWindowManagerAgent
392 * @tc.desc: WindowAdapter/ReregisterWindowManagerAgent
393 * @tc.type: FUNC
394 */
395 HWTEST_F(WindowAdapterTest, ReregisterWindowManagerAgent, Function | SmallTest | Level2)
396 {
397 WindowAdapter windowAdapter;
398 auto displayId = 0;
399 ModeChangeHotZones hotZones;
400 auto ret = windowAdapter.GetModeChangeHotZones(displayId, hotZones);
401 windowAdapter.ReregisterWindowManagerAgent();
402 ASSERT_EQ(WMError::WM_OK, ret);
403 }
404
405 /**
406 * @tc.name: UpdateProperty
407 * @tc.desc: WindowAdapter/UpdateProperty
408 * @tc.type: FUNC
409 */
410 HWTEST_F(WindowAdapterTest, UpdateProperty, Function | SmallTest | Level2)
411 {
412 WindowAdapter windowAdapter;
413 sptr<WindowProperty> windowProperty = sptr<WindowProperty>::MakeSptr();
414 PropertyChangeAction action = PropertyChangeAction::ACTION_UPDATE_RECT;
415 auto ret = windowAdapter.UpdateProperty(windowProperty, action);
416 windowAdapter.OnUserSwitch();
417 windowAdapter.ClearWindowAdapter();
418 ASSERT_EQ(WMError::WM_OK, ret);
419 }
420
421 /**
422 * @tc.name: SetWindowGravity
423 * @tc.desc: WindowAdapter/SetWindowGravity
424 * @tc.type: FUNC
425 */
426 HWTEST_F(WindowAdapterTest, SetWindowGravity, Function | SmallTest | Level2)
427 {
428 WindowAdapter windowAdapter;
429 uint32_t windowId = 0;
430 WindowGravity gravity = WindowGravity::WINDOW_GRAVITY_FLOAT;
431 uint32_t percent = 0;
432 auto ret = windowAdapter.SetWindowGravity(windowId, gravity, percent);
433 ASSERT_EQ(WMError::WM_ERROR_NULLPTR, ret);
434 }
435
436 /**
437 * @tc.name: NotifyWindowTransition
438 * @tc.desc: WindowAdapter/NotifyWindowTransition
439 * @tc.type: FUNC
440 */
441 HWTEST_F(WindowAdapterTest, NotifyWindowTransition, Function | SmallTest | Level2)
442 {
443 WindowAdapter windowAdapter;
444 sptr<WindowTransitionInfo> from = nullptr;
445 sptr<WindowTransitionInfo> to = nullptr;
446 auto ret = windowAdapter.NotifyWindowTransition(from, to);
447 ASSERT_EQ(WMError::WM_ERROR_NO_REMOTE_ANIMATION, ret);
448 }
449
450 /**
451 * @tc.name: RaiseToAppTop
452 * @tc.desc: WindowAdapter/RaiseToAppTop
453 * @tc.type: FUNC
454 */
455 HWTEST_F(WindowAdapterTest, RaiseToAppTop, Function | SmallTest | Level2)
456 {
457 WindowAdapter windowAdapter;
458 uint32_t windowId = 0;
459 auto ret = windowAdapter.RaiseToAppTop(windowId);
460 std::shared_ptr<MMI::KeyEvent> event = nullptr;
461 windowAdapter.DispatchKeyEvent(windowId, event);
462 ASSERT_EQ(WMError::WM_OK, ret);
463 }
464
465 /**
466 * @tc.name: GetSnapshot
467 * @tc.desc: WindowAdapter/GetSnapshot
468 * @tc.type: FUNC
469 */
470 HWTEST_F(WindowAdapterTest, GetSnapshot, Function | SmallTest | Level2)
471 {
472 WindowAdapter windowAdapter;
473 int32_t windowId = 0;
474 auto ret = windowAdapter.GetSnapshot(windowId);
475 ASSERT_EQ(nullptr, ret);
476 }
477
478 /**
479 * @tc.name: GetWindowAnimationTargets
480 * @tc.desc: WindowAdapter/GetWindowAnimationTargets
481 * @tc.type: FUNC
482 */
483 HWTEST_F(WindowAdapterTest, GetWindowAnimationTargets, Function | SmallTest | Level2)
484 {
485 WindowAdapter windowAdapter;
486 std::vector<uint32_t> missionIds;
487 std::vector<sptr<RSWindowAnimationTarget>> targets;
488 auto ret = windowAdapter.GetWindowAnimationTargets(missionIds, targets);
489 if (SceneBoardJudgement::IsSceneBoardEnabled()) {
490 ASSERT_EQ(WMError::WM_OK, ret);
491 } else {
492 ASSERT_EQ(WMError::WM_ERROR_NO_MEM, ret);
493 }
494 }
495
496 /**
497 * @tc.name: GetMaximizeMode
498 * @tc.desc: WindowAdapter/GetMaximizeMode
499 * @tc.type: FUNC
500 */
501 HWTEST_F(WindowAdapterTest, GetMaximizeMode, Function | SmallTest | Level2)
502 {
503 WindowAdapter windowAdapter;
504 windowAdapter.isProxyValid_ = true;
505 windowAdapter.windowManagerServiceProxy_ = nullptr;
506 auto ret = windowAdapter.GetMaximizeMode();
507 ASSERT_EQ(MaximizeMode::MODE_FULL_FILL, ret);
508 }
509
510 /**
511 * @tc.name: UpdateSessionAvoidAreaListener
512 * @tc.desc: WindowAdapter/UpdateSessionAvoidAreaListener
513 * @tc.type: FUNC
514 */
515 HWTEST_F(WindowAdapterTest, UpdateSessionAvoidAreaListener, Function | SmallTest | Level2)
516 {
517 WindowAdapter windowAdapter;
518 windowAdapter.isProxyValid_ = true;
519 windowAdapter.windowManagerServiceProxy_ = nullptr;
520 int32_t persistentId = 0;
521 bool haveListener = true;
522 auto ret = windowAdapter.UpdateSessionAvoidAreaListener(persistentId, haveListener);
523 ASSERT_EQ(WMError::WM_DO_NOTHING, ret);
524 }
525
526 /**
527 * @tc.name: UpdateSessionTouchOutsideListener
528 * @tc.desc: WindowAdapter/UpdateSessionTouchOutsideListener
529 * @tc.type: FUNC
530 */
531 HWTEST_F(WindowAdapterTest, UpdateSessionTouchOutsideListener, Function | SmallTest | Level2)
532 {
533 WindowAdapter windowAdapter;
534 windowAdapter.isProxyValid_ = true;
535 windowAdapter.windowManagerServiceProxy_ = nullptr;
536 int32_t persistentId = 0;
537 bool haveListener = true;
538 auto ret = windowAdapter.UpdateSessionTouchOutsideListener(persistentId, haveListener);
539 ASSERT_EQ(WMError::WM_DO_NOTHING, ret);
540 }
541
542 /**
543 * @tc.name: SetSessionGravity
544 * @tc.desc: WindowAdapter/SetSessionGravity
545 * @tc.type: FUNC
546 */
547 HWTEST_F(WindowAdapterTest, SetSessionGravity, Function | SmallTest | Level2)
548 {
549 WindowAdapter windowAdapter;
550 int32_t persistentId = 0;
551 SessionGravity gravity = SessionGravity::SESSION_GRAVITY_FLOAT;
552 uint32_t percent = 0;
553 auto ret = windowAdapter.SetSessionGravity(persistentId, gravity, percent);
554 ASSERT_EQ(WMError::WM_OK, ret);
555 }
556
557 /**
558 * @tc.name: BindDialogSessionTarget
559 * @tc.desc: WindowAdapter/BindDialogSessionTarget
560 * @tc.type: FUNC
561 */
562 HWTEST_F(WindowAdapterTest, BindDialogSessionTarget, Function | SmallTest | Level2)
563 {
564 WindowAdapter windowAdapter;
565 windowAdapter.isProxyValid_ = true;
566 windowAdapter.windowManagerServiceProxy_ = nullptr;
567 uint64_t persistentId = 0;
568 sptr<IRemoteObject> targetToken = nullptr;
569 auto ret = windowAdapter.BindDialogSessionTarget(persistentId, targetToken);
570 ASSERT_EQ(WMError::WM_DO_NOTHING, ret);
571 }
572
573 /**
574 * @tc.name: GetHostWindowRect
575 * @tc.desc: WindowAdapter/GetHostWindowRect
576 * @tc.type: FUNC
577 */
578 HWTEST_F(WindowAdapterTest, GetHostWindowRect, Function | SmallTest | Level2)
579 {
580 WindowAdapter windowAdapter;
581 int32_t hostWindowId = 0;
582 Rect rect = {0, 0, 0, 0};
583 auto ret = windowAdapter.GetHostWindowRect(hostWindowId, rect);
584 ASSERT_EQ(WMError::WM_OK, ret);
585 }
586
587 /**
588 * @tc.name: GetWindowStyleType
589 * @tc.desc: WindowAdapter/GetWindowStyleType
590 * @tc.type: FUNC
591 */
592 HWTEST_F(WindowAdapterTest, GetWindowStyleType, Function | SmallTest | Level2)
593 {
594 WindowAdapter windowAdapter;
595 WindowStyleType windowStyleType = Rosen::WindowStyleType::WINDOW_STYLE_DEFAULT;
596 windowAdapter.GetWindowStyleType(windowStyleType);
597 ASSERT_EQ(Rosen::WindowStyleType::WINDOW_STYLE_DEFAULT, windowStyleType);
598 }
599
600 /**
601 * @tc.name: ReleaseForegroundSessionScreenLock
602 * @tc.desc: WindowAdapter/ReleaseForegroundSessionScreenLock
603 * @tc.type: FUNC
604 */
605 HWTEST_F(WindowAdapterTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
606 {
607 WindowAdapter windowAdapter;
608 auto err = windowAdapter.ReleaseForegroundSessionScreenLock();
609 ASSERT_EQ(err, WMError::WM_OK);
610 auto ret = windowAdapter.InitWMSProxy();
611 ASSERT_EQ(ret, true);
612 }
613
614 /**
615 * @tc.name: GetDisplayIdByWindowId
616 * @tc.desc: WindowAdapter/GetDisplayIdByWindowId
617 * @tc.type: FUNC
618 */
619 HWTEST_F(WindowAdapterTest, GetDisplayIdByWindowId, Function | SmallTest | Level2)
620 {
621 WindowAdapter windowAdapter;
622 const std::vector<uint64_t> windowIds = {1, 2};
623 std::unordered_map<uint64_t, DisplayId> windowDisplayIdMap;
624 auto err = windowAdapter.GetDisplayIdByWindowId(windowIds, windowDisplayIdMap);
625 ASSERT_EQ(err, WMError::WM_OK);
626 }
627 }
628 }
629 }