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