1e0dac50fSopenharmony_ci/* 2e0dac50fSopenharmony_ci * Copyright (c) 2021-2022 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 "ability_context_impl.h" 18e0dac50fSopenharmony_ci#include "accessibility_event_info.h" 19e0dac50fSopenharmony_ci#include "key_event.h" 20e0dac50fSopenharmony_ci#include "mock_window_adapter.h" 21e0dac50fSopenharmony_ci#include "scene_board_judgement.h" 22e0dac50fSopenharmony_ci#include "singleton_mocker.h" 23e0dac50fSopenharmony_ci#include "window.h" 24e0dac50fSopenharmony_ci#include "window_session_impl.h" 25e0dac50fSopenharmony_ci#include "wm_common.h" 26e0dac50fSopenharmony_ci 27e0dac50fSopenharmony_ciusing namespace testing; 28e0dac50fSopenharmony_ciusing namespace testing::ext; 29e0dac50fSopenharmony_ci 30e0dac50fSopenharmony_cinamespace OHOS { 31e0dac50fSopenharmony_cinamespace Rosen { 32e0dac50fSopenharmony_ciusing Mocker = SingletonMocker<WindowAdapter, MockWindowAdapter>; 33e0dac50fSopenharmony_ciclass WindowTest : public testing::Test { 34e0dac50fSopenharmony_cipublic: 35e0dac50fSopenharmony_ci static void SetUpTestCase(); 36e0dac50fSopenharmony_ci static void TearDownTestCase(); 37e0dac50fSopenharmony_ci virtual void SetUp() override; 38e0dac50fSopenharmony_ci virtual void TearDown() override; 39e0dac50fSopenharmony_ci static inline std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext_; 40e0dac50fSopenharmony_ci}; 41e0dac50fSopenharmony_civoid WindowTest::SetUpTestCase() 42e0dac50fSopenharmony_ci{ 43e0dac50fSopenharmony_ci abilityContext_ = std::make_shared<AbilityRuntime::AbilityContextImpl>(); 44e0dac50fSopenharmony_ci} 45e0dac50fSopenharmony_ci 46e0dac50fSopenharmony_civoid WindowTest::TearDownTestCase() 47e0dac50fSopenharmony_ci{ 48e0dac50fSopenharmony_ci} 49e0dac50fSopenharmony_ci 50e0dac50fSopenharmony_civoid WindowTest::SetUp() 51e0dac50fSopenharmony_ci{ 52e0dac50fSopenharmony_ci} 53e0dac50fSopenharmony_ci 54e0dac50fSopenharmony_civoid WindowTest::TearDown() 55e0dac50fSopenharmony_ci{ 56e0dac50fSopenharmony_ci} 57e0dac50fSopenharmony_ci 58e0dac50fSopenharmony_cinamespace { 59e0dac50fSopenharmony_ci/** 60e0dac50fSopenharmony_ci * @tc.name: Create01 61e0dac50fSopenharmony_ci * @tc.desc: Create window with no WindowName,no option and no context 62e0dac50fSopenharmony_ci * @tc.type: FUNC 63e0dac50fSopenharmony_ci */ 64e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Create01, Function | SmallTest | Level2) 65e0dac50fSopenharmony_ci{ 66e0dac50fSopenharmony_ci sptr<WindowOption> option = nullptr; 67e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::Create("", option)); 68e0dac50fSopenharmony_ci} 69e0dac50fSopenharmony_ci 70e0dac50fSopenharmony_ci/** 71e0dac50fSopenharmony_ci * @tc.name: Create02 72e0dac50fSopenharmony_ci * @tc.desc: Create window with WindowName,no option and no context 73e0dac50fSopenharmony_ci * @tc.type: FUNC 74e0dac50fSopenharmony_ci */ 75e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Create02, Function | SmallTest | Level2) 76e0dac50fSopenharmony_ci{ 77e0dac50fSopenharmony_ci // no option: Window::Create with defult option 78e0dac50fSopenharmony_ci // default option : default WindowType is WindowType::WINDOW_TYPE_APP_MAIN_WINDOW 79e0dac50fSopenharmony_ci // default onlySupportSceneBoard_ is false 80e0dac50fSopenharmony_ci sptr<WindowOption> option = nullptr; 81e0dac50fSopenharmony_ci auto window = Window::Create("WindowTest02", option); 82e0dac50fSopenharmony_ci // Create app main window need context and isession 83e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window); 84e0dac50fSopenharmony_ci} 85e0dac50fSopenharmony_ci 86e0dac50fSopenharmony_ci/** 87e0dac50fSopenharmony_ci * @tc.name: Create03 88e0dac50fSopenharmony_ci * @tc.desc: Create window with WindowName, option and no context 89e0dac50fSopenharmony_ci * @tc.type: FUNC 90e0dac50fSopenharmony_ci */ 91e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Create03, Function | SmallTest | Level2) 92e0dac50fSopenharmony_ci{ 93e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption(); 94e0dac50fSopenharmony_ci option->SetWindowType(WindowType::WINDOW_TYPE_UI_EXTENSION); 95e0dac50fSopenharmony_ci // WindowType::WINDOW_TYPE_UI_EXTENSION is neither appWindow nor systemWindow 96e0dac50fSopenharmony_ci auto window = Window::Create("WindowTest03", option); 97e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window); 98e0dac50fSopenharmony_ci} 99e0dac50fSopenharmony_ci 100e0dac50fSopenharmony_ci/** 101e0dac50fSopenharmony_ci * @tc.name: Create04 102e0dac50fSopenharmony_ci * @tc.desc: Create window with WindowName and no abilityToken 103e0dac50fSopenharmony_ci * @tc.type: FUNC 104e0dac50fSopenharmony_ci */ 105e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Create04, Function | SmallTest | Level2) 106e0dac50fSopenharmony_ci{ 107e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption(); 108e0dac50fSopenharmony_ci // Create app float window but only support sceneBoard 109e0dac50fSopenharmony_ci // Create app float window no need context and isession 110e0dac50fSopenharmony_ci option->SetWindowType(WindowType::WINDOW_TYPE_FLOAT); 111e0dac50fSopenharmony_ci option->SetOnlySupportSceneBoard(true); 112e0dac50fSopenharmony_ci auto window = Window::Create("WindowTest04", option); 113e0dac50fSopenharmony_ci if (SceneBoardJudgement::IsSceneBoardEnabled()) { 114e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 115e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 116e0dac50fSopenharmony_ci } else { 117e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window); 118e0dac50fSopenharmony_ci } 119e0dac50fSopenharmony_ci} 120e0dac50fSopenharmony_ci 121e0dac50fSopenharmony_ci/** 122e0dac50fSopenharmony_ci * @tc.name: Create05 123e0dac50fSopenharmony_ci * @tc.desc: Create window with WindowName option and context 124e0dac50fSopenharmony_ci * @tc.type: FUNC 125e0dac50fSopenharmony_ci */ 126e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Create05, Function | SmallTest | Level2) 127e0dac50fSopenharmony_ci{ 128e0dac50fSopenharmony_ci std::unique_ptr<Mocker> m = std::make_unique<Mocker>(); 129e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption(); 130e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::Create("WindowTest05", option, abilityContext_)); 131e0dac50fSopenharmony_ci} 132e0dac50fSopenharmony_ci 133e0dac50fSopenharmony_ci/** 134e0dac50fSopenharmony_ci * @tc.name: CreatePiP 135e0dac50fSopenharmony_ci * @tc.desc: Create PiP window with option 136e0dac50fSopenharmony_ci * @tc.type: FUNC 137e0dac50fSopenharmony_ci */ 138e0dac50fSopenharmony_ciHWTEST_F(WindowTest, CreatePiP, Function | SmallTest | Level2) 139e0dac50fSopenharmony_ci{ 140e0dac50fSopenharmony_ci sptr<WindowOption> option = nullptr; 141e0dac50fSopenharmony_ci PiPTemplateInfo pipTemplateInfo; 142e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::CreatePiP(option, pipTemplateInfo, abilityContext_)); 143e0dac50fSopenharmony_ci option = new WindowOption(); 144e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::CreatePiP(option, pipTemplateInfo, abilityContext_)); 145e0dac50fSopenharmony_ci option->SetWindowName("pip_window"); 146e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::CreatePiP(option, pipTemplateInfo, abilityContext_)); 147e0dac50fSopenharmony_ci option->SetWindowType(WindowType::WINDOW_TYPE_PIP); 148e0dac50fSopenharmony_ci option->SetWindowMode(WindowMode::WINDOW_MODE_PIP); 149e0dac50fSopenharmony_ci Rect rect = {0, 0, 10, 10}; 150e0dac50fSopenharmony_ci option->SetWindowRect(rect); 151e0dac50fSopenharmony_ci WMError errCode; 152e0dac50fSopenharmony_ci if (SceneBoardJudgement::IsSceneBoardEnabled()) { 153e0dac50fSopenharmony_ci sptr<Window> window = Window::CreatePiP(option, pipTemplateInfo, abilityContext_, errCode); 154e0dac50fSopenharmony_ci if (errCode == WMError::WM_OK) { 155e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 156e0dac50fSopenharmony_ci } else { 157e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window); 158e0dac50fSopenharmony_ci } 159e0dac50fSopenharmony_ci } else { 160e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::CreatePiP(option, pipTemplateInfo, abilityContext_, errCode)); 161e0dac50fSopenharmony_ci } 162e0dac50fSopenharmony_ci} 163e0dac50fSopenharmony_ci 164e0dac50fSopenharmony_ci/** 165e0dac50fSopenharmony_ci * @tc.name: Find01 166e0dac50fSopenharmony_ci * @tc.desc: Find with no name 167e0dac50fSopenharmony_ci * @tc.type: FUNC 168e0dac50fSopenharmony_ci */ 169e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Find01, Function | SmallTest | Level2) 170e0dac50fSopenharmony_ci{ 171e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, Window::Find("")); 172e0dac50fSopenharmony_ci} 173e0dac50fSopenharmony_ci 174e0dac50fSopenharmony_ci/** 175e0dac50fSopenharmony_ci * @tc.name: Find02 176e0dac50fSopenharmony_ci * @tc.desc: Find with name 177e0dac50fSopenharmony_ci * @tc.type: FUNC 178e0dac50fSopenharmony_ci */ 179e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Find02, Function | SmallTest | Level2) 180e0dac50fSopenharmony_ci{ 181e0dac50fSopenharmony_ci std::unique_ptr<Mocker> m = std::make_unique<Mocker>(); 182e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption(); 183e0dac50fSopenharmony_ci 184e0dac50fSopenharmony_ci auto window = Window::Create("WindowTest03", option); 185e0dac50fSopenharmony_ci if (window != nullptr) { 186e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 187e0dac50fSopenharmony_ci } 188e0dac50fSopenharmony_ci if (Window::Find("WindowTest03") != nullptr) { 189e0dac50fSopenharmony_ci ASSERT_NE(nullptr, Window::Find("WindowTest03")); 190e0dac50fSopenharmony_ci } 191e0dac50fSopenharmony_ci 192e0dac50fSopenharmony_ci if (window != nullptr) { 193e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 194e0dac50fSopenharmony_ci } 195e0dac50fSopenharmony_ci} 196e0dac50fSopenharmony_ci 197e0dac50fSopenharmony_ci/** 198e0dac50fSopenharmony_ci * @tc.name: GetSurfaceNode 199e0dac50fSopenharmony_ci * @tc.desc: get node 200e0dac50fSopenharmony_ci * @tc.type: FUNC 201e0dac50fSopenharmony_ci */ 202e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetSurfaceNode, Function | SmallTest | Level2) 203e0dac50fSopenharmony_ci{ 204e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 205e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 206e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetSurfaceNode()); 207e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 208e0dac50fSopenharmony_ci} 209e0dac50fSopenharmony_ci 210e0dac50fSopenharmony_ci/** 211e0dac50fSopenharmony_ci * @tc.name: GetContext 212e0dac50fSopenharmony_ci * @tc.desc: get context 213e0dac50fSopenharmony_ci * @tc.type: FUNC 214e0dac50fSopenharmony_ci */ 215e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetContext, Function | SmallTest | Level2) 216e0dac50fSopenharmony_ci{ 217e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 218e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 219e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetContext()); 220e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 221e0dac50fSopenharmony_ci} 222e0dac50fSopenharmony_ci 223e0dac50fSopenharmony_ci/** 224e0dac50fSopenharmony_ci * @tc.name: GetTopWindowWithId 225e0dac50fSopenharmony_ci * @tc.desc: get top window with id 226e0dac50fSopenharmony_ci * @tc.type: FUNC 227e0dac50fSopenharmony_ci */ 228e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetTopWindowWithId, Function | SmallTest | Level2) 229e0dac50fSopenharmony_ci{ 230e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 231e0dac50fSopenharmony_ci std::unique_ptr<Mocker> m = std::make_unique<Mocker>(); 232e0dac50fSopenharmony_ci ASSERT_NE(nullptr, m); 233e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(Return(WMError::WM_DO_NOTHING)); 234e0dac50fSopenharmony_ci uint32_t mainWinId = 0; 235e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithId(mainWinId)); 236e0dac50fSopenharmony_ci 237e0dac50fSopenharmony_ci sptr<WindowOption> option = sptr<WindowOption>::MakeSptr(); 238e0dac50fSopenharmony_ci sptr<WindowSessionImpl> windowSession = sptr<WindowSessionImpl>::MakeSptr(option); 239e0dac50fSopenharmony_ci string winName = "test"; 240e0dac50fSopenharmony_ci int32_t winId = 1; 241e0dac50fSopenharmony_ci WindowSessionImpl::windowSessionMap_.insert( 242e0dac50fSopenharmony_ci std::make_pair(winName, pair<int32_t, sptr<WindowSessionImpl>>(winId, windowSession))); 243e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(DoAll( 244e0dac50fSopenharmony_ci SetArgReferee<1>(winId), 245e0dac50fSopenharmony_ci Return(WMError::WM_OK) 246e0dac50fSopenharmony_ci )); 247e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window->GetTopWindowWithId(mainWinId)); 248e0dac50fSopenharmony_ci 249e0dac50fSopenharmony_ci int32_t tempWinId = 3; 250e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(DoAll( 251e0dac50fSopenharmony_ci SetArgReferee<1>(tempWinId), 252e0dac50fSopenharmony_ci Return(WMError::WM_OK) 253e0dac50fSopenharmony_ci )); 254e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithId(mainWinId)); 255e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 256e0dac50fSopenharmony_ci 257e0dac50fSopenharmony_ci WindowSessionImpl::windowSessionMap_.erase(winName); 258e0dac50fSopenharmony_ci} 259e0dac50fSopenharmony_ci 260e0dac50fSopenharmony_ci/** 261e0dac50fSopenharmony_ci * @tc.name: GetRect 262e0dac50fSopenharmony_ci * @tc.desc: get rect 263e0dac50fSopenharmony_ci * @tc.type: FUNC 264e0dac50fSopenharmony_ci */ 265e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetRect, Function | SmallTest | Level2) 266e0dac50fSopenharmony_ci{ 267e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 268e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 269e0dac50fSopenharmony_ci ASSERT_EQ(Rect(), window->GetRect()); 270e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 271e0dac50fSopenharmony_ci} 272e0dac50fSopenharmony_ci 273e0dac50fSopenharmony_ci/** 274e0dac50fSopenharmony_ci * @tc.name: GetRequestRect 275e0dac50fSopenharmony_ci * @tc.desc: get rect 276e0dac50fSopenharmony_ci * @tc.type: FUNC 277e0dac50fSopenharmony_ci */ 278e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetRequestRect, Function | SmallTest | Level2) 279e0dac50fSopenharmony_ci{ 280e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 281e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 282e0dac50fSopenharmony_ci ASSERT_EQ(Rect(), window->GetRequestRect()); 283e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 284e0dac50fSopenharmony_ci} 285e0dac50fSopenharmony_ci 286e0dac50fSopenharmony_ci/** 287e0dac50fSopenharmony_ci * @tc.name: GetType 288e0dac50fSopenharmony_ci * @tc.desc: get type 289e0dac50fSopenharmony_ci * @tc.type: FUNC 290e0dac50fSopenharmony_ci */ 291e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetType, Function | SmallTest | Level2) 292e0dac50fSopenharmony_ci{ 293e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 294e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 295e0dac50fSopenharmony_ci ASSERT_EQ(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, window->GetType()); 296e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 297e0dac50fSopenharmony_ci} 298e0dac50fSopenharmony_ci 299e0dac50fSopenharmony_ci/** 300e0dac50fSopenharmony_ci * @tc.name: GetMode 301e0dac50fSopenharmony_ci * @tc.desc: get mode 302e0dac50fSopenharmony_ci * @tc.type: FUNC 303e0dac50fSopenharmony_ci */ 304e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetMode, Function | SmallTest | Level2) 305e0dac50fSopenharmony_ci{ 306e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 307e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 308e0dac50fSopenharmony_ci ASSERT_EQ(WindowMode::WINDOW_MODE_UNDEFINED, window->GetMode()); 309e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 310e0dac50fSopenharmony_ci 311e0dac50fSopenharmony_ci auto window_ = new (std::nothrow)Window(); 312e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 313e0dac50fSopenharmony_ci ASSERT_EQ(WindowMode::WINDOW_MODE_UNDEFINED, window_->GetMode()); 314e0dac50fSopenharmony_ci} 315e0dac50fSopenharmony_ci 316e0dac50fSopenharmony_ci/** 317e0dac50fSopenharmony_ci * @tc.name: GetAlpha 318e0dac50fSopenharmony_ci * @tc.desc: get alpha 319e0dac50fSopenharmony_ci * @tc.type: FUNC 320e0dac50fSopenharmony_ci */ 321e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetAlpha, Function | SmallTest | Level2) 322e0dac50fSopenharmony_ci{ 323e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 324e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 325e0dac50fSopenharmony_ci ASSERT_EQ(0.0f, window->GetAlpha()); 326e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 327e0dac50fSopenharmony_ci} 328e0dac50fSopenharmony_ci 329e0dac50fSopenharmony_ci/** 330e0dac50fSopenharmony_ci * @tc.name: GetFocusable 331e0dac50fSopenharmony_ci * @tc.desc: get focusable 332e0dac50fSopenharmony_ci * @tc.type: FUNC 333e0dac50fSopenharmony_ci */ 334e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetFocusable, Function | SmallTest | Level2) 335e0dac50fSopenharmony_ci{ 336e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 337e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 338e0dac50fSopenharmony_ci ASSERT_EQ(false, window->GetFocusable()); 339e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 340e0dac50fSopenharmony_ci} 341e0dac50fSopenharmony_ci 342e0dac50fSopenharmony_ci/** 343e0dac50fSopenharmony_ci * @tc.name: SetFocusable 344e0dac50fSopenharmony_ci * @tc.desc: set Focusable 345e0dac50fSopenharmony_ci * @tc.type: FUNC 346e0dac50fSopenharmony_ci */ 347e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetFocusable, Function | SmallTest | Level2) 348e0dac50fSopenharmony_ci{ 349e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 350e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 351e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->SetFocusable(true)); 352e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 353e0dac50fSopenharmony_ci} 354e0dac50fSopenharmony_ci 355e0dac50fSopenharmony_ci/** 356e0dac50fSopenharmony_ci * @tc.name: GetTouchable 357e0dac50fSopenharmony_ci * @tc.desc: get Touchable 358e0dac50fSopenharmony_ci * @tc.type: FUNC 359e0dac50fSopenharmony_ci */ 360e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetTouchable, Function | SmallTest | Level2) 361e0dac50fSopenharmony_ci{ 362e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 363e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 364e0dac50fSopenharmony_ci ASSERT_EQ(false, window->GetTouchable()); 365e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 366e0dac50fSopenharmony_ci} 367e0dac50fSopenharmony_ci 368e0dac50fSopenharmony_ci/** 369e0dac50fSopenharmony_ci * @tc.name: SetTouchable 370e0dac50fSopenharmony_ci * @tc.desc: set Touchable 371e0dac50fSopenharmony_ci * @tc.type: FUNC 372e0dac50fSopenharmony_ci */ 373e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTouchable, Function | SmallTest | Level2) 374e0dac50fSopenharmony_ci{ 375e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 376e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 377e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->SetTouchable(true)); 378e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 379e0dac50fSopenharmony_ci} 380e0dac50fSopenharmony_ci 381e0dac50fSopenharmony_ci/** 382e0dac50fSopenharmony_ci * @tc.name: GetSystemBarPropertyByType 383e0dac50fSopenharmony_ci * @tc.desc: get SystemBarPropertyByType 384e0dac50fSopenharmony_ci * @tc.type: FUNC 385e0dac50fSopenharmony_ci */ 386e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetSystemBarPropertyByType, Function | SmallTest | Level2) 387e0dac50fSopenharmony_ci{ 388e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 389e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 390e0dac50fSopenharmony_ci ASSERT_EQ(SystemBarProperty(), window->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW)); 391e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 392e0dac50fSopenharmony_ci} 393e0dac50fSopenharmony_ci 394e0dac50fSopenharmony_ci/** 395e0dac50fSopenharmony_ci * @tc.name: SetSystemBarProperty 396e0dac50fSopenharmony_ci * @tc.desc: set SystemBarProperty 397e0dac50fSopenharmony_ci * @tc.type: FUNC 398e0dac50fSopenharmony_ci */ 399e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetSystemBarProperty, Function | SmallTest | Level2) 400e0dac50fSopenharmony_ci{ 401e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 402e0dac50fSopenharmony_ci SystemBarProperty prop; 403e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 404e0dac50fSopenharmony_ci auto ret = window->SetSystemBarProperty(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, prop); 405e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 406e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 407e0dac50fSopenharmony_ci} 408e0dac50fSopenharmony_ci 409e0dac50fSopenharmony_ci/** 410e0dac50fSopenharmony_ci * @tc.name: IsFullScreen 411e0dac50fSopenharmony_ci * @tc.desc: get FullScreen 412e0dac50fSopenharmony_ci * @tc.type: FUNC 413e0dac50fSopenharmony_ci */ 414e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsFullScreen, Function | SmallTest | Level2) 415e0dac50fSopenharmony_ci{ 416e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 417e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 418e0dac50fSopenharmony_ci ASSERT_EQ(false, window->IsFullScreen()); 419e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 420e0dac50fSopenharmony_ci} 421e0dac50fSopenharmony_ci 422e0dac50fSopenharmony_ci/** 423e0dac50fSopenharmony_ci * @tc.name: IsLayoutFullScreen 424e0dac50fSopenharmony_ci * @tc.desc: get 425e0dac50fSopenharmony_ci * @tc.type: FUNC 426e0dac50fSopenharmony_ci */ 427e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsLayoutFullScreen, Function | SmallTest | Level2) 428e0dac50fSopenharmony_ci{ 429e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 430e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 431e0dac50fSopenharmony_ci ASSERT_EQ(false, window->IsLayoutFullScreen()); 432e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 433e0dac50fSopenharmony_ci} 434e0dac50fSopenharmony_ci 435e0dac50fSopenharmony_ci/** 436e0dac50fSopenharmony_ci * @tc.name: SetAlpha 437e0dac50fSopenharmony_ci * @tc.desc: set 438e0dac50fSopenharmony_ci * @tc.type: FUNC 439e0dac50fSopenharmony_ci */ 440e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetAlpha, Function | SmallTest | Level2) 441e0dac50fSopenharmony_ci{ 442e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 443e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 444e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->SetAlpha(0.0f)); 445e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 446e0dac50fSopenharmony_ci} 447e0dac50fSopenharmony_ci 448e0dac50fSopenharmony_ci/** 449e0dac50fSopenharmony_ci * @tc.name: SetTransform 450e0dac50fSopenharmony_ci * @tc.desc: set 451e0dac50fSopenharmony_ci * @tc.type: FUNC 452e0dac50fSopenharmony_ci */ 453e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTransform, Function | SmallTest | Level2) 454e0dac50fSopenharmony_ci{ 455e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 456e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 457e0dac50fSopenharmony_ci Transform trans; 458e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->SetTransform(trans)); 459e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 460e0dac50fSopenharmony_ci} 461e0dac50fSopenharmony_ci 462e0dac50fSopenharmony_ci/** 463e0dac50fSopenharmony_ci * @tc.name: GetTransform 464e0dac50fSopenharmony_ci * @tc.desc: get 465e0dac50fSopenharmony_ci * @tc.type: FUNC 466e0dac50fSopenharmony_ci */ 467e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetTransform, Function | SmallTest | Level2) 468e0dac50fSopenharmony_ci{ 469e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 470e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 471e0dac50fSopenharmony_ci Transform trans; 472e0dac50fSopenharmony_ci ASSERT_EQ(trans, window->GetTransform()); 473e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 474e0dac50fSopenharmony_ci} 475e0dac50fSopenharmony_ci 476e0dac50fSopenharmony_ci/** 477e0dac50fSopenharmony_ci * @tc.name: GetAvoidAreaByType 478e0dac50fSopenharmony_ci * @tc.desc: get 479e0dac50fSopenharmony_ci * @tc.type: FUNC 480e0dac50fSopenharmony_ci */ 481e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetAvoidAreaByType, Function | SmallTest | Level2) 482e0dac50fSopenharmony_ci{ 483e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 484e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 485e0dac50fSopenharmony_ci AvoidArea avoidArea; 486e0dac50fSopenharmony_ci auto ret = window->GetAvoidAreaByType(AvoidAreaType::TYPE_CUTOUT, avoidArea); 487e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 488e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 489e0dac50fSopenharmony_ci} 490e0dac50fSopenharmony_ci 491e0dac50fSopenharmony_ci/** 492e0dac50fSopenharmony_ci * @tc.name: SetImmersiveModeEnabledState 493e0dac50fSopenharmony_ci * @tc.desc: get 494e0dac50fSopenharmony_ci * @tc.type: FUNC 495e0dac50fSopenharmony_ci */ 496e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetImmersiveModeEnabledState, Function | SmallTest | Level2) 497e0dac50fSopenharmony_ci{ 498e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 499e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 500e0dac50fSopenharmony_ci auto ret = window->SetImmersiveModeEnabledState(true); 501e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 502e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 503e0dac50fSopenharmony_ci} 504e0dac50fSopenharmony_ci 505e0dac50fSopenharmony_ci/** 506e0dac50fSopenharmony_ci * @tc.name: SetLayoutFullScreen 507e0dac50fSopenharmony_ci * @tc.desc: get 508e0dac50fSopenharmony_ci * @tc.type: FUNC 509e0dac50fSopenharmony_ci */ 510e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetLayoutFullScreen, Function | SmallTest | Level2) 511e0dac50fSopenharmony_ci{ 512e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 513e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 514e0dac50fSopenharmony_ci auto ret = window->SetLayoutFullScreen(true); 515e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 516e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 517e0dac50fSopenharmony_ci} 518e0dac50fSopenharmony_ci 519e0dac50fSopenharmony_ci/** 520e0dac50fSopenharmony_ci * @tc.name: SetTitleAndDockHoverShown 521e0dac50fSopenharmony_ci * @tc.desc: get 522e0dac50fSopenharmony_ci * @tc.type: FUNC 523e0dac50fSopenharmony_ci */ 524e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTitleAndDockHoverShown, Function | SmallTest | Level2) 525e0dac50fSopenharmony_ci{ 526e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 527e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 528e0dac50fSopenharmony_ci auto ret = window->SetTitleAndDockHoverShown(true, true); 529e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 530e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_OK, window->Destroy()); 531e0dac50fSopenharmony_ci} 532e0dac50fSopenharmony_ci 533e0dac50fSopenharmony_ci/** 534e0dac50fSopenharmony_ci * @tc.name: SetFullScreen 535e0dac50fSopenharmony_ci * @tc.desc: get 536e0dac50fSopenharmony_ci * @tc.type: FUNC 537e0dac50fSopenharmony_ci */ 538e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetFullScreen, Function | SmallTest | Level2) 539e0dac50fSopenharmony_ci{ 540e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 541e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 542e0dac50fSopenharmony_ci auto ret = window->SetFullScreen(true); 543e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 544e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 545e0dac50fSopenharmony_ci} 546e0dac50fSopenharmony_ci 547e0dac50fSopenharmony_ci/** 548e0dac50fSopenharmony_ci * @tc.name: Destroy 549e0dac50fSopenharmony_ci * @tc.desc: get 550e0dac50fSopenharmony_ci * @tc.type: FUNC 551e0dac50fSopenharmony_ci */ 552e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Destroy, Function | SmallTest | Level2) 553e0dac50fSopenharmony_ci{ 554e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 555e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 556e0dac50fSopenharmony_ci auto ret = window->Destroy(); 557e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 558e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 559e0dac50fSopenharmony_ci} 560e0dac50fSopenharmony_ci 561e0dac50fSopenharmony_ci/** 562e0dac50fSopenharmony_ci * @tc.name: Show 563e0dac50fSopenharmony_ci * @tc.desc: get 564e0dac50fSopenharmony_ci * @tc.type: FUNC 565e0dac50fSopenharmony_ci */ 566e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Show, Function | SmallTest | Level2) 567e0dac50fSopenharmony_ci{ 568e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 569e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 570e0dac50fSopenharmony_ci auto ret = window->Show(); 571e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 572e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 573e0dac50fSopenharmony_ci} 574e0dac50fSopenharmony_ci 575e0dac50fSopenharmony_ci/** 576e0dac50fSopenharmony_ci * @tc.name: Hide 577e0dac50fSopenharmony_ci * @tc.desc: get 578e0dac50fSopenharmony_ci * @tc.type: FUNC 579e0dac50fSopenharmony_ci */ 580e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Hide, Function | SmallTest | Level2) 581e0dac50fSopenharmony_ci{ 582e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 583e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 584e0dac50fSopenharmony_ci auto ret = window->Hide(); 585e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 586e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 587e0dac50fSopenharmony_ci} 588e0dac50fSopenharmony_ci 589e0dac50fSopenharmony_ci/** 590e0dac50fSopenharmony_ci * @tc.name: MoveTo 591e0dac50fSopenharmony_ci * @tc.desc: get 592e0dac50fSopenharmony_ci * @tc.type: FUNC 593e0dac50fSopenharmony_ci */ 594e0dac50fSopenharmony_ciHWTEST_F(WindowTest, MoveTo, Function | SmallTest | Level2) 595e0dac50fSopenharmony_ci{ 596e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 597e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 598e0dac50fSopenharmony_ci auto ret = window->MoveTo(0, 0); 599e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 600e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 601e0dac50fSopenharmony_ci} 602e0dac50fSopenharmony_ci 603e0dac50fSopenharmony_ci/** 604e0dac50fSopenharmony_ci * @tc.name: Resize 605e0dac50fSopenharmony_ci * @tc.desc: get 606e0dac50fSopenharmony_ci * @tc.type: FUNC 607e0dac50fSopenharmony_ci */ 608e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Resize, Function | SmallTest | Level2) 609e0dac50fSopenharmony_ci{ 610e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 611e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 612e0dac50fSopenharmony_ci auto ret = window->Resize(0, 0); 613e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 614e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 615e0dac50fSopenharmony_ci} 616e0dac50fSopenharmony_ci 617e0dac50fSopenharmony_ci/** 618e0dac50fSopenharmony_ci * @tc.name: SetKeepScreenOn 619e0dac50fSopenharmony_ci * @tc.desc: get 620e0dac50fSopenharmony_ci * @tc.type: FUNC 621e0dac50fSopenharmony_ci */ 622e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetKeepScreenOn, Function | SmallTest | Level2) 623e0dac50fSopenharmony_ci{ 624e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 625e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 626e0dac50fSopenharmony_ci auto ret = window->SetKeepScreenOn(true); 627e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 628e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 629e0dac50fSopenharmony_ci} 630e0dac50fSopenharmony_ci 631e0dac50fSopenharmony_ci/** 632e0dac50fSopenharmony_ci * @tc.name: IsKeepScreenOn 633e0dac50fSopenharmony_ci * @tc.desc: get 634e0dac50fSopenharmony_ci * @tc.type: FUNC 635e0dac50fSopenharmony_ci */ 636e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsKeepScreenOn, Function | SmallTest | Level2) 637e0dac50fSopenharmony_ci{ 638e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 639e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 640e0dac50fSopenharmony_ci auto ret = window->IsKeepScreenOn(); 641e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 642e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 643e0dac50fSopenharmony_ci} 644e0dac50fSopenharmony_ci 645e0dac50fSopenharmony_ci/** 646e0dac50fSopenharmony_ci * @tc.name: SetTurnScreenOn 647e0dac50fSopenharmony_ci * @tc.desc: get 648e0dac50fSopenharmony_ci * @tc.type: FUNC 649e0dac50fSopenharmony_ci */ 650e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTurnScreenOn, Function | SmallTest | Level2) 651e0dac50fSopenharmony_ci{ 652e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 653e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 654e0dac50fSopenharmony_ci auto ret = window->SetTurnScreenOn(true); 655e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 656e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 657e0dac50fSopenharmony_ci} 658e0dac50fSopenharmony_ci 659e0dac50fSopenharmony_ci/** 660e0dac50fSopenharmony_ci * @tc.name: IsTurnScreenOn 661e0dac50fSopenharmony_ci * @tc.desc: get 662e0dac50fSopenharmony_ci * @tc.type: FUNC 663e0dac50fSopenharmony_ci */ 664e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsTurnScreenOn, Function | SmallTest | Level2) 665e0dac50fSopenharmony_ci{ 666e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 667e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 668e0dac50fSopenharmony_ci auto ret = window->IsTurnScreenOn(); 669e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 670e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 671e0dac50fSopenharmony_ci} 672e0dac50fSopenharmony_ci 673e0dac50fSopenharmony_ci/** 674e0dac50fSopenharmony_ci * @tc.name: SetBackgroundColor 675e0dac50fSopenharmony_ci * @tc.desc: get 676e0dac50fSopenharmony_ci * @tc.type: FUNC 677e0dac50fSopenharmony_ci */ 678e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetBackgroundColor, Function | SmallTest | Level2) 679e0dac50fSopenharmony_ci{ 680e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 681e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 682e0dac50fSopenharmony_ci auto ret = window->SetBackgroundColor("0x00000000"); 683e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 684e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 685e0dac50fSopenharmony_ci} 686e0dac50fSopenharmony_ci 687e0dac50fSopenharmony_ci/** 688e0dac50fSopenharmony_ci * @tc.name: SetTransparent 689e0dac50fSopenharmony_ci * @tc.desc: get 690e0dac50fSopenharmony_ci * @tc.type: FUNC 691e0dac50fSopenharmony_ci */ 692e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTransparent, Function | SmallTest | Level2) 693e0dac50fSopenharmony_ci{ 694e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 695e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 696e0dac50fSopenharmony_ci auto ret = window->SetTransparent(true); 697e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 698e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 699e0dac50fSopenharmony_ci} 700e0dac50fSopenharmony_ci 701e0dac50fSopenharmony_ci/** 702e0dac50fSopenharmony_ci * @tc.name: IsTransparent 703e0dac50fSopenharmony_ci * @tc.desc: get 704e0dac50fSopenharmony_ci * @tc.type: FUNC 705e0dac50fSopenharmony_ci */ 706e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsTransparent, Function | SmallTest | Level2) 707e0dac50fSopenharmony_ci{ 708e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 709e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 710e0dac50fSopenharmony_ci auto ret = window->IsTransparent(); 711e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 712e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 713e0dac50fSopenharmony_ci} 714e0dac50fSopenharmony_ci 715e0dac50fSopenharmony_ci/** 716e0dac50fSopenharmony_ci * @tc.name: SetBrightness 717e0dac50fSopenharmony_ci * @tc.desc: get 718e0dac50fSopenharmony_ci * @tc.type: FUNC 719e0dac50fSopenharmony_ci */ 720e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetBrightness, Function | SmallTest | Level2) 721e0dac50fSopenharmony_ci{ 722e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 723e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 724e0dac50fSopenharmony_ci auto ret = window->SetBrightness(0.0f); 725e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 726e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 727e0dac50fSopenharmony_ci} 728e0dac50fSopenharmony_ci 729e0dac50fSopenharmony_ci/** 730e0dac50fSopenharmony_ci * @tc.name: GetBrightness 731e0dac50fSopenharmony_ci * @tc.desc: get 732e0dac50fSopenharmony_ci * @tc.type: FUNC 733e0dac50fSopenharmony_ci */ 734e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetBrightness, Function | SmallTest | Level2) 735e0dac50fSopenharmony_ci{ 736e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 737e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 738e0dac50fSopenharmony_ci auto ret = window->GetBrightness(); 739e0dac50fSopenharmony_ci ASSERT_EQ(0.0f, ret); 740e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 741e0dac50fSopenharmony_ci} 742e0dac50fSopenharmony_ci 743e0dac50fSopenharmony_ci/** 744e0dac50fSopenharmony_ci * @tc.name: SetPrivacyMode 745e0dac50fSopenharmony_ci * @tc.desc: get 746e0dac50fSopenharmony_ci * @tc.type: FUNC 747e0dac50fSopenharmony_ci */ 748e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetPrivacyMode, Function | SmallTest | Level2) 749e0dac50fSopenharmony_ci{ 750e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 751e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 752e0dac50fSopenharmony_ci auto ret = window->SetPrivacyMode(0.0f); 753e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 754e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 755e0dac50fSopenharmony_ci} 756e0dac50fSopenharmony_ci 757e0dac50fSopenharmony_ci/** 758e0dac50fSopenharmony_ci * @tc.name: IsPrivacyMode 759e0dac50fSopenharmony_ci * @tc.desc: get 760e0dac50fSopenharmony_ci * @tc.type: FUNC 761e0dac50fSopenharmony_ci */ 762e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsPrivacyMode, Function | SmallTest | Level2) 763e0dac50fSopenharmony_ci{ 764e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 765e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 766e0dac50fSopenharmony_ci auto ret = window->IsPrivacyMode(); 767e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 768e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 769e0dac50fSopenharmony_ci} 770e0dac50fSopenharmony_ci 771e0dac50fSopenharmony_ci/** 772e0dac50fSopenharmony_ci * @tc.name: SetSystemPrivacyMode 773e0dac50fSopenharmony_ci * @tc.desc: get 774e0dac50fSopenharmony_ci * @tc.type: FUNC 775e0dac50fSopenharmony_ci */ 776e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetSystemPrivacyMode, Function | SmallTest | Level2) 777e0dac50fSopenharmony_ci{ 778e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 779e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 780e0dac50fSopenharmony_ci auto ret = false; 781e0dac50fSopenharmony_ci window->SetSystemPrivacyMode(true); 782e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 783e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 784e0dac50fSopenharmony_ci} 785e0dac50fSopenharmony_ci 786e0dac50fSopenharmony_ci/** 787e0dac50fSopenharmony_ci * @tc.name: BindDialogTarget 788e0dac50fSopenharmony_ci * @tc.desc: get 789e0dac50fSopenharmony_ci * @tc.type: FUNC 790e0dac50fSopenharmony_ci */ 791e0dac50fSopenharmony_ciHWTEST_F(WindowTest, BindDialogTarget, Function | SmallTest | Level2) 792e0dac50fSopenharmony_ci{ 793e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 794e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 795e0dac50fSopenharmony_ci sptr<IRemoteObject> targetToken; 796e0dac50fSopenharmony_ci auto ret = window->BindDialogTarget(targetToken); 797e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 798e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 799e0dac50fSopenharmony_ci} 800e0dac50fSopenharmony_ci 801e0dac50fSopenharmony_ci/** 802e0dac50fSopenharmony_ci * @tc.name: RaiseToAppTop 803e0dac50fSopenharmony_ci * @tc.desc: get 804e0dac50fSopenharmony_ci * @tc.type: FUNC 805e0dac50fSopenharmony_ci */ 806e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RaiseToAppTop, Function | SmallTest | Level2) 807e0dac50fSopenharmony_ci{ 808e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 809e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 810e0dac50fSopenharmony_ci auto ret = window->RaiseToAppTop(); 811e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 812e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 813e0dac50fSopenharmony_ci} 814e0dac50fSopenharmony_ci 815e0dac50fSopenharmony_ci/** 816e0dac50fSopenharmony_ci * @tc.name: SetSnapshotSkip 817e0dac50fSopenharmony_ci * @tc.desc: get 818e0dac50fSopenharmony_ci * @tc.type: FUNC 819e0dac50fSopenharmony_ci */ 820e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetSnapshotSkip, Function | SmallTest | Level2) 821e0dac50fSopenharmony_ci{ 822e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 823e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 824e0dac50fSopenharmony_ci auto ret = window->SetSnapshotSkip(true); 825e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 826e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 827e0dac50fSopenharmony_ci} 828e0dac50fSopenharmony_ci 829e0dac50fSopenharmony_ci/** 830e0dac50fSopenharmony_ci * @tc.name: SetCornerRadius 831e0dac50fSopenharmony_ci * @tc.desc: get 832e0dac50fSopenharmony_ci * @tc.type: FUNC 833e0dac50fSopenharmony_ci */ 834e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetCornerRadius, Function | SmallTest | Level2) 835e0dac50fSopenharmony_ci{ 836e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 837e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 838e0dac50fSopenharmony_ci auto ret = window->SetCornerRadius(1.0f); 839e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 840e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 841e0dac50fSopenharmony_ci} 842e0dac50fSopenharmony_ci 843e0dac50fSopenharmony_ci/** 844e0dac50fSopenharmony_ci * @tc.name: SetShadowRadius 845e0dac50fSopenharmony_ci * @tc.desc: get 846e0dac50fSopenharmony_ci * @tc.type: FUNC 847e0dac50fSopenharmony_ci */ 848e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetShadowRadius, Function | SmallTest | Level2) 849e0dac50fSopenharmony_ci{ 850e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 851e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 852e0dac50fSopenharmony_ci auto ret = window->SetShadowRadius(1.0f); 853e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 854e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 855e0dac50fSopenharmony_ci} 856e0dac50fSopenharmony_ci 857e0dac50fSopenharmony_ci/** 858e0dac50fSopenharmony_ci * @tc.name: SetShadowColor 859e0dac50fSopenharmony_ci * @tc.desc: get 860e0dac50fSopenharmony_ci * @tc.type: FUNC 861e0dac50fSopenharmony_ci */ 862e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetShadowColor, Function | SmallTest | Level2) 863e0dac50fSopenharmony_ci{ 864e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 865e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 866e0dac50fSopenharmony_ci auto ret = window->SetShadowColor("0x00000000"); 867e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 868e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 869e0dac50fSopenharmony_ci} 870e0dac50fSopenharmony_ci 871e0dac50fSopenharmony_ci/** 872e0dac50fSopenharmony_ci * @tc.name: SetShadowOffsetX 873e0dac50fSopenharmony_ci * @tc.desc: get 874e0dac50fSopenharmony_ci * @tc.type: FUNC 875e0dac50fSopenharmony_ci */ 876e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetShadowOffsetX, Function | SmallTest | Level2) 877e0dac50fSopenharmony_ci{ 878e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 879e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 880e0dac50fSopenharmony_ci auto ret = window->SetShadowOffsetX(0.0f); 881e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 882e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 883e0dac50fSopenharmony_ci} 884e0dac50fSopenharmony_ci 885e0dac50fSopenharmony_ci/** 886e0dac50fSopenharmony_ci * @tc.name: SetShadowOffsetY 887e0dac50fSopenharmony_ci * @tc.desc: get 888e0dac50fSopenharmony_ci * @tc.type: FUNC 889e0dac50fSopenharmony_ci */ 890e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetShadowOffsetY, Function | SmallTest | Level2) 891e0dac50fSopenharmony_ci{ 892e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 893e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 894e0dac50fSopenharmony_ci auto ret = window->SetShadowOffsetY(0.0f); 895e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 896e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 897e0dac50fSopenharmony_ci} 898e0dac50fSopenharmony_ci 899e0dac50fSopenharmony_ci/** 900e0dac50fSopenharmony_ci * @tc.name: SetBlur 901e0dac50fSopenharmony_ci * @tc.desc: get 902e0dac50fSopenharmony_ci * @tc.type: FUNC 903e0dac50fSopenharmony_ci */ 904e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetBlur, Function | SmallTest | Level2) 905e0dac50fSopenharmony_ci{ 906e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 907e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 908e0dac50fSopenharmony_ci auto ret = window->SetBlur(0.0f); 909e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 910e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 911e0dac50fSopenharmony_ci} 912e0dac50fSopenharmony_ci 913e0dac50fSopenharmony_ci/** 914e0dac50fSopenharmony_ci * @tc.name: SetBackdropBlur 915e0dac50fSopenharmony_ci * @tc.desc: get 916e0dac50fSopenharmony_ci * @tc.type: FUNC 917e0dac50fSopenharmony_ci */ 918e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetBackdropBlur, Function | SmallTest | Level2) 919e0dac50fSopenharmony_ci{ 920e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 921e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 922e0dac50fSopenharmony_ci auto ret = window->SetBackdropBlur(0.0f); 923e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 924e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 925e0dac50fSopenharmony_ci} 926e0dac50fSopenharmony_ci 927e0dac50fSopenharmony_ci/** 928e0dac50fSopenharmony_ci * @tc.name: SetBackdropBlurStyle 929e0dac50fSopenharmony_ci * @tc.desc: get 930e0dac50fSopenharmony_ci * @tc.type: FUNC 931e0dac50fSopenharmony_ci */ 932e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetBackdropBlurStyle, Function | SmallTest | Level2) 933e0dac50fSopenharmony_ci{ 934e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 935e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 936e0dac50fSopenharmony_ci auto ret = window->SetBackdropBlurStyle(WindowBlurStyle::WINDOW_BLUR_OFF); 937e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 938e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 939e0dac50fSopenharmony_ci} 940e0dac50fSopenharmony_ci 941e0dac50fSopenharmony_ci/** 942e0dac50fSopenharmony_ci * @tc.name: RequestFocus 943e0dac50fSopenharmony_ci * @tc.desc: get 944e0dac50fSopenharmony_ci * @tc.type: FUNC 945e0dac50fSopenharmony_ci */ 946e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RequestFocus, Function | SmallTest | Level2) 947e0dac50fSopenharmony_ci{ 948e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 949e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 950e0dac50fSopenharmony_ci auto ret = window->RequestFocus(); 951e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 952e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 953e0dac50fSopenharmony_ci} 954e0dac50fSopenharmony_ci 955e0dac50fSopenharmony_ci/** 956e0dac50fSopenharmony_ci * @tc.name: IsFocused 957e0dac50fSopenharmony_ci * @tc.desc: get 958e0dac50fSopenharmony_ci * @tc.type: FUNC 959e0dac50fSopenharmony_ci */ 960e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsFocused, Function | SmallTest | Level2) 961e0dac50fSopenharmony_ci{ 962e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 963e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 964e0dac50fSopenharmony_ci auto ret = window->IsFocused(); 965e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 966e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 967e0dac50fSopenharmony_ci} 968e0dac50fSopenharmony_ci 969e0dac50fSopenharmony_ci/** 970e0dac50fSopenharmony_ci * @tc.name: UpdateSurfaceNodeAfterCustomAnimation 971e0dac50fSopenharmony_ci * @tc.desc: get 972e0dac50fSopenharmony_ci * @tc.type: FUNC 973e0dac50fSopenharmony_ci */ 974e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UpdateSurfaceNodeAfterCustomAnimation, Function | SmallTest | Level2) 975e0dac50fSopenharmony_ci{ 976e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 977e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 978e0dac50fSopenharmony_ci auto ret = window->UpdateSurfaceNodeAfterCustomAnimation(false); 979e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 980e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 981e0dac50fSopenharmony_ci} 982e0dac50fSopenharmony_ci 983e0dac50fSopenharmony_ci/** 984e0dac50fSopenharmony_ci * @tc.name: SetInputEventConsumer 985e0dac50fSopenharmony_ci * @tc.desc: get 986e0dac50fSopenharmony_ci * @tc.type: FUNC 987e0dac50fSopenharmony_ci */ 988e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetInputEventConsumer, Function | SmallTest | Level2) 989e0dac50fSopenharmony_ci{ 990e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 991e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 992e0dac50fSopenharmony_ci auto ret = true; 993e0dac50fSopenharmony_ci std::shared_ptr<IInputEventConsumer> inputEventConsumer; 994e0dac50fSopenharmony_ci window->SetInputEventConsumer(inputEventConsumer); 995e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 996e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 997e0dac50fSopenharmony_ci} 998e0dac50fSopenharmony_ci 999e0dac50fSopenharmony_ci/** 1000e0dac50fSopenharmony_ci * @tc.name: ConsumeKeyEvent 1001e0dac50fSopenharmony_ci * @tc.desc: get 1002e0dac50fSopenharmony_ci * @tc.type: FUNC 1003e0dac50fSopenharmony_ci */ 1004e0dac50fSopenharmony_ciHWTEST_F(WindowTest, ConsumeKeyEvent, Function | SmallTest | Level2) 1005e0dac50fSopenharmony_ci{ 1006e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1007e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1008e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1009e0dac50fSopenharmony_ci std::shared_ptr<MMI::KeyEvent> inputEvent = nullptr; 1010e0dac50fSopenharmony_ci window->ConsumeKeyEvent(inputEvent); 1011e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1012e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1013e0dac50fSopenharmony_ci} 1014e0dac50fSopenharmony_ci 1015e0dac50fSopenharmony_ci/** 1016e0dac50fSopenharmony_ci * @tc.name: PreNotifyKeyEvent 1017e0dac50fSopenharmony_ci * @tc.desc: get 1018e0dac50fSopenharmony_ci * @tc.type: FUNC 1019e0dac50fSopenharmony_ci */ 1020e0dac50fSopenharmony_ciHWTEST_F(WindowTest, PreNotifyKeyEvent, Function | SmallTest | Level2) 1021e0dac50fSopenharmony_ci{ 1022e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1023e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1024e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1025e0dac50fSopenharmony_ci std::shared_ptr<MMI::KeyEvent> inputEvent = nullptr; 1026e0dac50fSopenharmony_ci window->PreNotifyKeyEvent(inputEvent); 1027e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1028e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1029e0dac50fSopenharmony_ci} 1030e0dac50fSopenharmony_ci 1031e0dac50fSopenharmony_ci/** 1032e0dac50fSopenharmony_ci * @tc.name: ConsumePointerEvent 1033e0dac50fSopenharmony_ci * @tc.desc: get 1034e0dac50fSopenharmony_ci * @tc.type: FUNC 1035e0dac50fSopenharmony_ci */ 1036e0dac50fSopenharmony_ciHWTEST_F(WindowTest, ConsumePointerEvent, Function | SmallTest | Level2) 1037e0dac50fSopenharmony_ci{ 1038e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1039e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1040e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1041e0dac50fSopenharmony_ci std::shared_ptr<MMI::PointerEvent> inputEvent = nullptr; 1042e0dac50fSopenharmony_ci window->ConsumePointerEvent(inputEvent); 1043e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1044e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1045e0dac50fSopenharmony_ci} 1046e0dac50fSopenharmony_ci 1047e0dac50fSopenharmony_ci/** 1048e0dac50fSopenharmony_ci * @tc.name: RequestVsync 1049e0dac50fSopenharmony_ci * @tc.desc: get 1050e0dac50fSopenharmony_ci * @tc.type: FUNC 1051e0dac50fSopenharmony_ci */ 1052e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RequestVsync, Function | SmallTest | Level2) 1053e0dac50fSopenharmony_ci{ 1054e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1055e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1056e0dac50fSopenharmony_ci std::shared_ptr<VsyncCallback> vsyncCallback = nullptr; 1057e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1058e0dac50fSopenharmony_ci window->RequestVsync(vsyncCallback); 1059e0dac50fSopenharmony_ci // no return 1060e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1061e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1062e0dac50fSopenharmony_ci} 1063e0dac50fSopenharmony_ci 1064e0dac50fSopenharmony_ci/** 1065e0dac50fSopenharmony_ci * @tc.name: UpdateConfiguration 1066e0dac50fSopenharmony_ci * @tc.desc: get 1067e0dac50fSopenharmony_ci * @tc.type: FUNC 1068e0dac50fSopenharmony_ci */ 1069e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UpdateConfiguration, Function | SmallTest | Level2) 1070e0dac50fSopenharmony_ci{ 1071e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1072e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1073e0dac50fSopenharmony_ci std::shared_ptr<AppExecFwk::Configuration> conf = nullptr; 1074e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1075e0dac50fSopenharmony_ci window->UpdateConfiguration(conf); 1076e0dac50fSopenharmony_ci // no return 1077e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1078e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1079e0dac50fSopenharmony_ci} 1080e0dac50fSopenharmony_ci 1081e0dac50fSopenharmony_ci/** 1082e0dac50fSopenharmony_ci * @tc.name: RegisterLifeCycleListener 1083e0dac50fSopenharmony_ci * @tc.desc: get 1084e0dac50fSopenharmony_ci * @tc.type: FUNC 1085e0dac50fSopenharmony_ci */ 1086e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterLifeCycleListener, Function | SmallTest | Level2) 1087e0dac50fSopenharmony_ci{ 1088e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1089e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1090e0dac50fSopenharmony_ci sptr<IWindowLifeCycle> listener = nullptr; 1091e0dac50fSopenharmony_ci auto ret = window->RegisterLifeCycleListener(listener); 1092e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1093e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1094e0dac50fSopenharmony_ci} 1095e0dac50fSopenharmony_ci 1096e0dac50fSopenharmony_ci/** 1097e0dac50fSopenharmony_ci * @tc.name: UnregisterLifeCycleListener 1098e0dac50fSopenharmony_ci * @tc.desc: get 1099e0dac50fSopenharmony_ci * @tc.type: FUNC 1100e0dac50fSopenharmony_ci */ 1101e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterLifeCycleListener, Function | SmallTest | Level2) 1102e0dac50fSopenharmony_ci{ 1103e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1104e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1105e0dac50fSopenharmony_ci sptr<IWindowLifeCycle> listener = nullptr; 1106e0dac50fSopenharmony_ci auto ret = window->UnregisterLifeCycleListener(listener); 1107e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1108e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1109e0dac50fSopenharmony_ci} 1110e0dac50fSopenharmony_ci 1111e0dac50fSopenharmony_ci/** 1112e0dac50fSopenharmony_ci * @tc.name: RegisterWindowChangeListener 1113e0dac50fSopenharmony_ci * @tc.desc: get 1114e0dac50fSopenharmony_ci * @tc.type: FUNC 1115e0dac50fSopenharmony_ci */ 1116e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterWindowChangeListener, Function | SmallTest | Level2) 1117e0dac50fSopenharmony_ci{ 1118e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1119e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1120e0dac50fSopenharmony_ci sptr<IWindowChangeListener> listener = nullptr; 1121e0dac50fSopenharmony_ci auto ret = window->RegisterWindowChangeListener(listener); 1122e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1123e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1124e0dac50fSopenharmony_ci} 1125e0dac50fSopenharmony_ci 1126e0dac50fSopenharmony_ci/** 1127e0dac50fSopenharmony_ci * @tc.name: UnregisterWindowChangeListener 1128e0dac50fSopenharmony_ci * @tc.desc: get 1129e0dac50fSopenharmony_ci * @tc.type: FUNC 1130e0dac50fSopenharmony_ci */ 1131e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterWindowChangeListener, Function | SmallTest | Level2) 1132e0dac50fSopenharmony_ci{ 1133e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1134e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1135e0dac50fSopenharmony_ci sptr<IWindowChangeListener> listener = nullptr; 1136e0dac50fSopenharmony_ci auto ret = window->UnregisterWindowChangeListener(listener); 1137e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1138e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1139e0dac50fSopenharmony_ci} 1140e0dac50fSopenharmony_ci 1141e0dac50fSopenharmony_ci/** 1142e0dac50fSopenharmony_ci * @tc.name: RegisterAvoidAreaChangeListener 1143e0dac50fSopenharmony_ci * @tc.desc: get 1144e0dac50fSopenharmony_ci * @tc.type: FUNC 1145e0dac50fSopenharmony_ci */ 1146e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterAvoidAreaChangeListener, Function | SmallTest | Level2) 1147e0dac50fSopenharmony_ci{ 1148e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1149e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1150e0dac50fSopenharmony_ci sptr<IAvoidAreaChangedListener> listener = nullptr; 1151e0dac50fSopenharmony_ci auto ret = window->RegisterAvoidAreaChangeListener(listener); 1152e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1153e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1154e0dac50fSopenharmony_ci} 1155e0dac50fSopenharmony_ci 1156e0dac50fSopenharmony_ci/** 1157e0dac50fSopenharmony_ci * @tc.name: UnregisterAvoidAreaChangeListener 1158e0dac50fSopenharmony_ci * @tc.desc: get 1159e0dac50fSopenharmony_ci * @tc.type: FUNC 1160e0dac50fSopenharmony_ci */ 1161e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterAvoidAreaChangeListener, Function | SmallTest | Level2) 1162e0dac50fSopenharmony_ci{ 1163e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1164e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1165e0dac50fSopenharmony_ci sptr<IAvoidAreaChangedListener> listener = nullptr; 1166e0dac50fSopenharmony_ci auto ret = window->UnregisterAvoidAreaChangeListener(listener); 1167e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1168e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1169e0dac50fSopenharmony_ci} 1170e0dac50fSopenharmony_ci 1171e0dac50fSopenharmony_ci/** 1172e0dac50fSopenharmony_ci * @tc.name: RegisterDragListener 1173e0dac50fSopenharmony_ci * @tc.desc: get 1174e0dac50fSopenharmony_ci * @tc.type: FUNC 1175e0dac50fSopenharmony_ci */ 1176e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterDragListener, Function | SmallTest | Level2) 1177e0dac50fSopenharmony_ci{ 1178e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1179e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1180e0dac50fSopenharmony_ci sptr<IWindowDragListener> listener = nullptr; 1181e0dac50fSopenharmony_ci auto ret = window->RegisterDragListener(listener); 1182e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1183e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1184e0dac50fSopenharmony_ci} 1185e0dac50fSopenharmony_ci 1186e0dac50fSopenharmony_ci/** 1187e0dac50fSopenharmony_ci * @tc.name: UnregisterDragListener 1188e0dac50fSopenharmony_ci * @tc.desc: get 1189e0dac50fSopenharmony_ci * @tc.type: FUNC 1190e0dac50fSopenharmony_ci */ 1191e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterDragListener, Function | SmallTest | Level2) 1192e0dac50fSopenharmony_ci{ 1193e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1194e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1195e0dac50fSopenharmony_ci sptr<IWindowDragListener> listener = nullptr; 1196e0dac50fSopenharmony_ci auto ret = window->UnregisterDragListener(listener); 1197e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1198e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1199e0dac50fSopenharmony_ci} 1200e0dac50fSopenharmony_ci 1201e0dac50fSopenharmony_ci/** 1202e0dac50fSopenharmony_ci * @tc.name: RegisterDisplayMoveListener 1203e0dac50fSopenharmony_ci * @tc.desc: get 1204e0dac50fSopenharmony_ci * @tc.type: FUNC 1205e0dac50fSopenharmony_ci */ 1206e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterDisplayMoveListener, Function | SmallTest | Level2) 1207e0dac50fSopenharmony_ci{ 1208e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1209e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1210e0dac50fSopenharmony_ci sptr<IDisplayMoveListener> listener = nullptr; 1211e0dac50fSopenharmony_ci auto ret = window->RegisterDisplayMoveListener(listener); 1212e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1213e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1214e0dac50fSopenharmony_ci} 1215e0dac50fSopenharmony_ci 1216e0dac50fSopenharmony_ci/** 1217e0dac50fSopenharmony_ci * @tc.name: UnregisterDisplayMoveListener 1218e0dac50fSopenharmony_ci * @tc.desc: get 1219e0dac50fSopenharmony_ci * @tc.type: FUNC 1220e0dac50fSopenharmony_ci */ 1221e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterDisplayMoveListener, Function | SmallTest | Level2) 1222e0dac50fSopenharmony_ci{ 1223e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1224e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1225e0dac50fSopenharmony_ci sptr<IDisplayMoveListener> listener = nullptr; 1226e0dac50fSopenharmony_ci auto ret = window->UnregisterDisplayMoveListener(listener); 1227e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1228e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1229e0dac50fSopenharmony_ci} 1230e0dac50fSopenharmony_ci 1231e0dac50fSopenharmony_ci/** 1232e0dac50fSopenharmony_ci * @tc.name: RegisterWindowDestroyedListener 1233e0dac50fSopenharmony_ci * @tc.desc: get 1234e0dac50fSopenharmony_ci * @tc.type: FUNC 1235e0dac50fSopenharmony_ci */ 1236e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterWindowDestroyedListener, Function | SmallTest | Level2) 1237e0dac50fSopenharmony_ci{ 1238e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1239e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1240e0dac50fSopenharmony_ci NotifyNativeWinDestroyFunc func = nullptr; 1241e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1242e0dac50fSopenharmony_ci window->RegisterWindowDestroyedListener(func); 1243e0dac50fSopenharmony_ci // no return 1244e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1245e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1246e0dac50fSopenharmony_ci} 1247e0dac50fSopenharmony_ci 1248e0dac50fSopenharmony_ci/** 1249e0dac50fSopenharmony_ci * @tc.name: RegisterOccupiedAreaChangeListener 1250e0dac50fSopenharmony_ci * @tc.desc: get 1251e0dac50fSopenharmony_ci * @tc.type: FUNC 1252e0dac50fSopenharmony_ci */ 1253e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterOccupiedAreaChangeListener, Function | SmallTest | Level2) 1254e0dac50fSopenharmony_ci{ 1255e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1256e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1257e0dac50fSopenharmony_ci sptr<IOccupiedAreaChangeListener> listener = nullptr; 1258e0dac50fSopenharmony_ci auto ret = window->RegisterOccupiedAreaChangeListener(listener); 1259e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1260e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1261e0dac50fSopenharmony_ci} 1262e0dac50fSopenharmony_ci 1263e0dac50fSopenharmony_ci/** 1264e0dac50fSopenharmony_ci * @tc.name: UnregisterOccupiedAreaChangeListener 1265e0dac50fSopenharmony_ci * @tc.desc: get 1266e0dac50fSopenharmony_ci * @tc.type: FUNC 1267e0dac50fSopenharmony_ci */ 1268e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterOccupiedAreaChangeListener, Function | SmallTest | Level2) 1269e0dac50fSopenharmony_ci{ 1270e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1271e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1272e0dac50fSopenharmony_ci sptr<IOccupiedAreaChangeListener> listener = nullptr; 1273e0dac50fSopenharmony_ci auto ret = window->UnregisterOccupiedAreaChangeListener(listener); 1274e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1275e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1276e0dac50fSopenharmony_ci} 1277e0dac50fSopenharmony_ci 1278e0dac50fSopenharmony_ci/** 1279e0dac50fSopenharmony_ci * @tc.name: RegisterTouchOutsideListener 1280e0dac50fSopenharmony_ci * @tc.desc: get 1281e0dac50fSopenharmony_ci * @tc.type: FUNC 1282e0dac50fSopenharmony_ci */ 1283e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterTouchOutsideListener, Function | SmallTest | Level2) 1284e0dac50fSopenharmony_ci{ 1285e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1286e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1287e0dac50fSopenharmony_ci sptr<ITouchOutsideListener> listener = nullptr; 1288e0dac50fSopenharmony_ci auto ret = window->RegisterTouchOutsideListener(listener); 1289e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1290e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1291e0dac50fSopenharmony_ci} 1292e0dac50fSopenharmony_ci 1293e0dac50fSopenharmony_ci/** 1294e0dac50fSopenharmony_ci * @tc.name: UnregisterTouchOutsideListener 1295e0dac50fSopenharmony_ci * @tc.desc: get 1296e0dac50fSopenharmony_ci * @tc.type: FUNC 1297e0dac50fSopenharmony_ci */ 1298e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterTouchOutsideListener, Function | SmallTest | Level2) 1299e0dac50fSopenharmony_ci{ 1300e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1301e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1302e0dac50fSopenharmony_ci sptr<ITouchOutsideListener> listener = nullptr; 1303e0dac50fSopenharmony_ci auto ret = window->UnregisterTouchOutsideListener(listener); 1304e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1305e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1306e0dac50fSopenharmony_ci} 1307e0dac50fSopenharmony_ci 1308e0dac50fSopenharmony_ci/** 1309e0dac50fSopenharmony_ci * @tc.name: RegisterAnimationTransitionController 1310e0dac50fSopenharmony_ci * @tc.desc: get 1311e0dac50fSopenharmony_ci * @tc.type: FUNC 1312e0dac50fSopenharmony_ci */ 1313e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterAnimationTransitionController, Function | SmallTest | Level2) 1314e0dac50fSopenharmony_ci{ 1315e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1316e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1317e0dac50fSopenharmony_ci sptr<IAnimationTransitionController> listener = nullptr; 1318e0dac50fSopenharmony_ci auto ret = window->RegisterAnimationTransitionController(listener); 1319e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1320e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1321e0dac50fSopenharmony_ci} 1322e0dac50fSopenharmony_ci 1323e0dac50fSopenharmony_ci/** 1324e0dac50fSopenharmony_ci * @tc.name: RegisterScreenshotListener 1325e0dac50fSopenharmony_ci * @tc.desc: get 1326e0dac50fSopenharmony_ci * @tc.type: FUNC 1327e0dac50fSopenharmony_ci */ 1328e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterScreenshotListener, Function | SmallTest | Level2) 1329e0dac50fSopenharmony_ci{ 1330e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1331e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1332e0dac50fSopenharmony_ci sptr<IScreenshotListener> listener = nullptr; 1333e0dac50fSopenharmony_ci auto ret = window->RegisterScreenshotListener(listener); 1334e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1335e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1336e0dac50fSopenharmony_ci} 1337e0dac50fSopenharmony_ci 1338e0dac50fSopenharmony_ci/** 1339e0dac50fSopenharmony_ci * @tc.name: UnregisterScreenshotListener 1340e0dac50fSopenharmony_ci * @tc.desc: get 1341e0dac50fSopenharmony_ci * @tc.type: FUNC 1342e0dac50fSopenharmony_ci */ 1343e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterScreenshotListener, Function | SmallTest | Level2) 1344e0dac50fSopenharmony_ci{ 1345e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1346e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1347e0dac50fSopenharmony_ci sptr<IScreenshotListener> listener = nullptr; 1348e0dac50fSopenharmony_ci auto ret = window->UnregisterScreenshotListener(listener); 1349e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1350e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1351e0dac50fSopenharmony_ci} 1352e0dac50fSopenharmony_ci 1353e0dac50fSopenharmony_ci/** 1354e0dac50fSopenharmony_ci * @tc.name: RegisterDialogTargetTouchListener 1355e0dac50fSopenharmony_ci * @tc.desc: get 1356e0dac50fSopenharmony_ci * @tc.type: FUNC 1357e0dac50fSopenharmony_ci */ 1358e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterDialogTargetTouchListener, Function | SmallTest | Level2) 1359e0dac50fSopenharmony_ci{ 1360e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1361e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1362e0dac50fSopenharmony_ci sptr<IDialogTargetTouchListener> listener = nullptr; 1363e0dac50fSopenharmony_ci auto ret = window->RegisterDialogTargetTouchListener(listener); 1364e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1365e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1366e0dac50fSopenharmony_ci 1367e0dac50fSopenharmony_ci auto window_ = new (std::nothrow)Window(); 1368e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 1369e0dac50fSopenharmony_ci sptr<IDialogTargetTouchListener> listener_; 1370e0dac50fSopenharmony_ci auto ret_ = window_->RegisterDialogTargetTouchListener(listener_); 1371e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret_); 1372e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->Destroy()); 1373e0dac50fSopenharmony_ci} 1374e0dac50fSopenharmony_ci 1375e0dac50fSopenharmony_ci/** 1376e0dac50fSopenharmony_ci * @tc.name: UnregisterDialogTargetTouchListener 1377e0dac50fSopenharmony_ci * @tc.desc: get 1378e0dac50fSopenharmony_ci * @tc.type: FUNC 1379e0dac50fSopenharmony_ci */ 1380e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterDialogTargetTouchListener, Function | SmallTest | Level2) 1381e0dac50fSopenharmony_ci{ 1382e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1383e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1384e0dac50fSopenharmony_ci sptr<IDialogTargetTouchListener> listener = nullptr; 1385e0dac50fSopenharmony_ci auto ret = window->UnregisterDialogTargetTouchListener(listener); 1386e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1387e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1388e0dac50fSopenharmony_ci 1389e0dac50fSopenharmony_ci auto window_ = new (std::nothrow)Window(); 1390e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 1391e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->UnregisterDialogTargetTouchListener(listener)); 1392e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->Destroy()); 1393e0dac50fSopenharmony_ci} 1394e0dac50fSopenharmony_ci 1395e0dac50fSopenharmony_ci/** 1396e0dac50fSopenharmony_ci * @tc.name: RegisterDialogDeathRecipientListener 1397e0dac50fSopenharmony_ci * @tc.desc: get 1398e0dac50fSopenharmony_ci * @tc.type: FUNC 1399e0dac50fSopenharmony_ci */ 1400e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterDialogDeathRecipientListener, Function | SmallTest | Level2) 1401e0dac50fSopenharmony_ci{ 1402e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1403e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1404e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1405e0dac50fSopenharmony_ci sptr<IDialogDeathRecipientListener> listener = nullptr; 1406e0dac50fSopenharmony_ci window->RegisterDialogDeathRecipientListener(listener); 1407e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1408e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1409e0dac50fSopenharmony_ci} 1410e0dac50fSopenharmony_ci 1411e0dac50fSopenharmony_ci/** 1412e0dac50fSopenharmony_ci * @tc.name: UnregisterDialogDeathRecipientListener 1413e0dac50fSopenharmony_ci * @tc.desc: get 1414e0dac50fSopenharmony_ci * @tc.type: FUNC 1415e0dac50fSopenharmony_ci */ 1416e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterDialogDeathRecipientListener, Function | SmallTest | Level2) 1417e0dac50fSopenharmony_ci{ 1418e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1419e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1420e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1421e0dac50fSopenharmony_ci sptr<IDialogDeathRecipientListener> listener = nullptr; 1422e0dac50fSopenharmony_ci window->UnregisterDialogDeathRecipientListener(listener); 1423e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1424e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1425e0dac50fSopenharmony_ci} 1426e0dac50fSopenharmony_ci 1427e0dac50fSopenharmony_ci/** 1428e0dac50fSopenharmony_ci * @tc.name: NotifyTouchDialogTarget 1429e0dac50fSopenharmony_ci * @tc.desc: get 1430e0dac50fSopenharmony_ci * @tc.type: FUNC 1431e0dac50fSopenharmony_ci */ 1432e0dac50fSopenharmony_ciHWTEST_F(WindowTest, NotifyTouchDialogTarget, Function | SmallTest | Level2) 1433e0dac50fSopenharmony_ci{ 1434e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1435e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1436e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1437e0dac50fSopenharmony_ci sptr<IDialogTargetTouchListener> listener = nullptr; 1438e0dac50fSopenharmony_ci window->NotifyTouchDialogTarget(); 1439e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1440e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1441e0dac50fSopenharmony_ci} 1442e0dac50fSopenharmony_ci 1443e0dac50fSopenharmony_ci/** 1444e0dac50fSopenharmony_ci * @tc.name: SetAceAbilityHandler 1445e0dac50fSopenharmony_ci * @tc.desc: get 1446e0dac50fSopenharmony_ci * @tc.type: FUNC 1447e0dac50fSopenharmony_ci */ 1448e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetAceAbilityHandler, Function | SmallTest | Level2) 1449e0dac50fSopenharmony_ci{ 1450e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1451e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1452e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1453e0dac50fSopenharmony_ci sptr<IAceAbilityHandler> handler = nullptr; 1454e0dac50fSopenharmony_ci window->SetAceAbilityHandler(handler); 1455e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1456e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1457e0dac50fSopenharmony_ci} 1458e0dac50fSopenharmony_ci 1459e0dac50fSopenharmony_ci/** 1460e0dac50fSopenharmony_ci * @tc.name: NapiSetUIContent 1461e0dac50fSopenharmony_ci * @tc.desc: get 1462e0dac50fSopenharmony_ci * @tc.type: FUNC 1463e0dac50fSopenharmony_ci */ 1464e0dac50fSopenharmony_ciHWTEST_F(WindowTest, NapiSetUIContent, Function | SmallTest | Level2) 1465e0dac50fSopenharmony_ci{ 1466e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1467e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1468e0dac50fSopenharmony_ci napi_env env = nullptr; 1469e0dac50fSopenharmony_ci napi_value storage = nullptr; 1470e0dac50fSopenharmony_ci auto ret = window->NapiSetUIContent("info", env, storage); 1471e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1472e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1473e0dac50fSopenharmony_ci} 1474e0dac50fSopenharmony_ci 1475e0dac50fSopenharmony_ci/** 1476e0dac50fSopenharmony_ci * @tc.name: SetUIContentByAbc 1477e0dac50fSopenharmony_ci * @tc.desc: get 1478e0dac50fSopenharmony_ci * @tc.type: FUNC 1479e0dac50fSopenharmony_ci */ 1480e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetUIContentByAbc, Function | SmallTest | Level2) 1481e0dac50fSopenharmony_ci{ 1482e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1483e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1484e0dac50fSopenharmony_ci napi_env env = nullptr; 1485e0dac50fSopenharmony_ci napi_value storage = nullptr; 1486e0dac50fSopenharmony_ci auto ret = window->SetUIContentByAbc("/system/etc/window/resources/test.abc", env, storage); 1487e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1488e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1489e0dac50fSopenharmony_ci} 1490e0dac50fSopenharmony_ci 1491e0dac50fSopenharmony_ci/** 1492e0dac50fSopenharmony_ci * @tc.name: GetContentInfo 1493e0dac50fSopenharmony_ci * @tc.desc: get 1494e0dac50fSopenharmony_ci * @tc.type: FUNC 1495e0dac50fSopenharmony_ci */ 1496e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetContentInfo, Function | SmallTest | Level2) 1497e0dac50fSopenharmony_ci{ 1498e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1499e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1500e0dac50fSopenharmony_ci auto ret = window->GetContentInfo(); 1501e0dac50fSopenharmony_ci ASSERT_EQ(std::string(), ret); 1502e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1503e0dac50fSopenharmony_ci} 1504e0dac50fSopenharmony_ci 1505e0dac50fSopenharmony_ci/** 1506e0dac50fSopenharmony_ci * @tc.name: GetUIContent 1507e0dac50fSopenharmony_ci * @tc.desc: get 1508e0dac50fSopenharmony_ci * @tc.type: FUNC 1509e0dac50fSopenharmony_ci */ 1510e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetUIContent, Function | SmallTest | Level2) 1511e0dac50fSopenharmony_ci{ 1512e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1513e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1514e0dac50fSopenharmony_ci auto ret = window->GetUIContent(); 1515e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, ret); 1516e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1517e0dac50fSopenharmony_ci} 1518e0dac50fSopenharmony_ci 1519e0dac50fSopenharmony_ci/** 1520e0dac50fSopenharmony_ci * @tc.name: OnNewWant 1521e0dac50fSopenharmony_ci * @tc.desc: get 1522e0dac50fSopenharmony_ci * @tc.type: FUNC 1523e0dac50fSopenharmony_ci */ 1524e0dac50fSopenharmony_ciHWTEST_F(WindowTest, OnNewWant, Function | SmallTest | Level2) 1525e0dac50fSopenharmony_ci{ 1526e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1527e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1528e0dac50fSopenharmony_ci AAFwk::Want want; 1529e0dac50fSopenharmony_ci auto ret = true; 1530e0dac50fSopenharmony_ci window->OnNewWant(want); 1531e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 1532e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1533e0dac50fSopenharmony_ci} 1534e0dac50fSopenharmony_ci 1535e0dac50fSopenharmony_ci/** 1536e0dac50fSopenharmony_ci * @tc.name: SetRequestedOrientation 1537e0dac50fSopenharmony_ci * @tc.desc: get 1538e0dac50fSopenharmony_ci * @tc.type: FUNC 1539e0dac50fSopenharmony_ci */ 1540e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetRequestedOrientation, Function | SmallTest | Level2) 1541e0dac50fSopenharmony_ci{ 1542e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1543e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1544e0dac50fSopenharmony_ci auto ret = true; 1545e0dac50fSopenharmony_ci Orientation ori = Orientation::UNSPECIFIED; 1546e0dac50fSopenharmony_ci window->SetRequestedOrientation(ori); 1547e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 1548e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1549e0dac50fSopenharmony_ci} 1550e0dac50fSopenharmony_ci 1551e0dac50fSopenharmony_ci/** 1552e0dac50fSopenharmony_ci * @tc.name: GetRequestedOrientation 1553e0dac50fSopenharmony_ci * @tc.desc: get 1554e0dac50fSopenharmony_ci * @tc.type: FUNC 1555e0dac50fSopenharmony_ci */ 1556e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetRequestedOrientation, Function | SmallTest | Level2) 1557e0dac50fSopenharmony_ci{ 1558e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1559e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1560e0dac50fSopenharmony_ci auto ret = window->GetRequestedOrientation(); 1561e0dac50fSopenharmony_ci ASSERT_EQ(Orientation::UNSPECIFIED, ret); 1562e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1563e0dac50fSopenharmony_ci} 1564e0dac50fSopenharmony_ci 1565e0dac50fSopenharmony_ci/** 1566e0dac50fSopenharmony_ci * @tc.name: SetRequestModeSupportInfo 1567e0dac50fSopenharmony_ci * @tc.desc: get 1568e0dac50fSopenharmony_ci * @tc.type: FUNC 1569e0dac50fSopenharmony_ci */ 1570e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetRequestModeSupportInfo, Function | SmallTest | Level2) 1571e0dac50fSopenharmony_ci{ 1572e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1573e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1574e0dac50fSopenharmony_ci uint32_t modeSupportInfo = 0; 1575e0dac50fSopenharmony_ci window->SetRequestModeSupportInfo(modeSupportInfo); 1576e0dac50fSopenharmony_ci ASSERT_EQ(static_cast<uint32_t>(Orientation::UNSPECIFIED), modeSupportInfo); 1577e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1578e0dac50fSopenharmony_ci} 1579e0dac50fSopenharmony_ci 1580e0dac50fSopenharmony_ci/** 1581e0dac50fSopenharmony_ci * @tc.name: GetRequestModeSupportInfo 1582e0dac50fSopenharmony_ci * @tc.desc: get 1583e0dac50fSopenharmony_ci * @tc.type: FUNC 1584e0dac50fSopenharmony_ci */ 1585e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetRequestModeSupportInfo, Function | SmallTest | Level2) 1586e0dac50fSopenharmony_ci{ 1587e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1588e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1589e0dac50fSopenharmony_ci uint32_t ret = window->GetRequestModeSupportInfo(); 1590e0dac50fSopenharmony_ci ASSERT_EQ(true, ret == 0); 1591e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1592e0dac50fSopenharmony_ci} 1593e0dac50fSopenharmony_ci 1594e0dac50fSopenharmony_ci/** 1595e0dac50fSopenharmony_ci * @tc.name: SetTouchHotAreas 1596e0dac50fSopenharmony_ci * @tc.desc: get 1597e0dac50fSopenharmony_ci * @tc.type: FUNC 1598e0dac50fSopenharmony_ci */ 1599e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTouchHotAreas, Function | SmallTest | Level2) 1600e0dac50fSopenharmony_ci{ 1601e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1602e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1603e0dac50fSopenharmony_ci std::vector<Rect> rects; 1604e0dac50fSopenharmony_ci auto ret = window->SetTouchHotAreas(rects); 1605e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1606e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1607e0dac50fSopenharmony_ci} 1608e0dac50fSopenharmony_ci 1609e0dac50fSopenharmony_ci/** 1610e0dac50fSopenharmony_ci * @tc.name: GetRequestedTouchHotAreas 1611e0dac50fSopenharmony_ci * @tc.desc: get 1612e0dac50fSopenharmony_ci * @tc.type: FUNC 1613e0dac50fSopenharmony_ci */ 1614e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetRequestedTouchHotAreas, Function | SmallTest | Level2) 1615e0dac50fSopenharmony_ci{ 1616e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1617e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1618e0dac50fSopenharmony_ci std::vector<Rect> rects; 1619e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1620e0dac50fSopenharmony_ci window->GetRequestedTouchHotAreas(rects); 1621e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1622e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1623e0dac50fSopenharmony_ci} 1624e0dac50fSopenharmony_ci 1625e0dac50fSopenharmony_ci/** 1626e0dac50fSopenharmony_ci * @tc.name: IsMainHandlerAvailable 1627e0dac50fSopenharmony_ci * @tc.desc: get 1628e0dac50fSopenharmony_ci * @tc.type: FUNC 1629e0dac50fSopenharmony_ci */ 1630e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsMainHandlerAvailable, Function | SmallTest | Level2) 1631e0dac50fSopenharmony_ci{ 1632e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1633e0dac50fSopenharmony_ci sptr<WindowOption> option = new (std::nothrow)WindowOption(); 1634e0dac50fSopenharmony_ci option->SetMainHandlerAvailable(false); 1635e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1636e0dac50fSopenharmony_ci auto ret = window->IsMainHandlerAvailable(); 1637e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 1638e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1639e0dac50fSopenharmony_ci} 1640e0dac50fSopenharmony_ci 1641e0dac50fSopenharmony_ci/** 1642e0dac50fSopenharmony_ci * @tc.name: SetAPPWindowLabel 1643e0dac50fSopenharmony_ci * @tc.desc: get 1644e0dac50fSopenharmony_ci * @tc.type: FUNC 1645e0dac50fSopenharmony_ci */ 1646e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetAPPWindowLabel, Function | SmallTest | Level2) 1647e0dac50fSopenharmony_ci{ 1648e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1649e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1650e0dac50fSopenharmony_ci auto ret = window->SetAPPWindowLabel(""); 1651e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1652e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1653e0dac50fSopenharmony_ci 1654e0dac50fSopenharmony_ci auto window_ = new (std::nothrow)Window(); 1655e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 1656e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->SetAPPWindowLabel("000111")); 1657e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1658e0dac50fSopenharmony_ci} 1659e0dac50fSopenharmony_ci 1660e0dac50fSopenharmony_ci/** 1661e0dac50fSopenharmony_ci * @tc.name: IsDecorEnable 1662e0dac50fSopenharmony_ci * @tc.desc: get 1663e0dac50fSopenharmony_ci * @tc.type: FUNC 1664e0dac50fSopenharmony_ci */ 1665e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsDecorEnable, Function | SmallTest | Level2) 1666e0dac50fSopenharmony_ci{ 1667e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1668e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1669e0dac50fSopenharmony_ci auto ret = window->IsDecorEnable(); 1670e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 1671e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1672e0dac50fSopenharmony_ci} 1673e0dac50fSopenharmony_ci 1674e0dac50fSopenharmony_ci/** 1675e0dac50fSopenharmony_ci * @tc.name: Maximize 1676e0dac50fSopenharmony_ci * @tc.desc: get 1677e0dac50fSopenharmony_ci * @tc.type: FUNC 1678e0dac50fSopenharmony_ci */ 1679e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Maximize, Function | SmallTest | Level2) 1680e0dac50fSopenharmony_ci{ 1681e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1682e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1683e0dac50fSopenharmony_ci auto ret = window->Maximize(); 1684e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1685e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1686e0dac50fSopenharmony_ci} 1687e0dac50fSopenharmony_ci 1688e0dac50fSopenharmony_ci/** 1689e0dac50fSopenharmony_ci * @tc.name: MaximizeFloating 1690e0dac50fSopenharmony_ci * @tc.desc: get 1691e0dac50fSopenharmony_ci * @tc.type: FUNC 1692e0dac50fSopenharmony_ci */ 1693e0dac50fSopenharmony_ciHWTEST_F(WindowTest, MaximizeFloating, Function | SmallTest | Level2) 1694e0dac50fSopenharmony_ci{ 1695e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1696e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1697e0dac50fSopenharmony_ci auto ret = window->MaximizeFloating(); 1698e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1699e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1700e0dac50fSopenharmony_ci} 1701e0dac50fSopenharmony_ci 1702e0dac50fSopenharmony_ci/** 1703e0dac50fSopenharmony_ci * @tc.name: Minimize 1704e0dac50fSopenharmony_ci * @tc.desc: get 1705e0dac50fSopenharmony_ci * @tc.type: FUNC 1706e0dac50fSopenharmony_ci */ 1707e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Minimize, Function | SmallTest | Level2) 1708e0dac50fSopenharmony_ci{ 1709e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1710e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1711e0dac50fSopenharmony_ci auto ret = window->Minimize(); 1712e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 1713e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1714e0dac50fSopenharmony_ci} 1715e0dac50fSopenharmony_ci 1716e0dac50fSopenharmony_ci/** 1717e0dac50fSopenharmony_ci * @tc.name: Recover 1718e0dac50fSopenharmony_ci * @tc.desc: get 1719e0dac50fSopenharmony_ci * @tc.type: FUNC 1720e0dac50fSopenharmony_ci */ 1721e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Recover, Function | SmallTest | Level2) 1722e0dac50fSopenharmony_ci{ 1723e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1724e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1725e0dac50fSopenharmony_ci auto ret = window->Recover(); 1726e0dac50fSopenharmony_ci 1727e0dac50fSopenharmony_ci if (SceneBoardJudgement::IsSceneBoardEnabled()) { 1728e0dac50fSopenharmony_ci ASSERT_NE(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 1729e0dac50fSopenharmony_ci } else { 1730e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1731e0dac50fSopenharmony_ci } 1732e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1733e0dac50fSopenharmony_ci} 1734e0dac50fSopenharmony_ci 1735e0dac50fSopenharmony_ci/** 1736e0dac50fSopenharmony_ci * @tc.name: Close 1737e0dac50fSopenharmony_ci * @tc.desc: get 1738e0dac50fSopenharmony_ci * @tc.type: FUNC 1739e0dac50fSopenharmony_ci */ 1740e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Close, Function | SmallTest | Level2) 1741e0dac50fSopenharmony_ci{ 1742e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1743e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1744e0dac50fSopenharmony_ci auto ret = window->Close(); 1745e0dac50fSopenharmony_ci ASSERT_EQ(true, ret == WMError::WM_OK); 1746e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1747e0dac50fSopenharmony_ci} 1748e0dac50fSopenharmony_ci 1749e0dac50fSopenharmony_ci/** 1750e0dac50fSopenharmony_ci * @tc.name: StartMove 1751e0dac50fSopenharmony_ci * @tc.desc: get 1752e0dac50fSopenharmony_ci * @tc.type: FUNC 1753e0dac50fSopenharmony_ci */ 1754e0dac50fSopenharmony_ciHWTEST_F(WindowTest, StartMove, Function | SmallTest | Level2) 1755e0dac50fSopenharmony_ci{ 1756e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1757e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1758e0dac50fSopenharmony_ci auto ret = WMError::WM_OK; 1759e0dac50fSopenharmony_ci window->StartMove(); 1760e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1761e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1762e0dac50fSopenharmony_ci} 1763e0dac50fSopenharmony_ci 1764e0dac50fSopenharmony_ci/** 1765e0dac50fSopenharmony_ci * @tc.name: SetGlobalMaximizeMode 1766e0dac50fSopenharmony_ci * @tc.desc: get 1767e0dac50fSopenharmony_ci * @tc.type: FUNC 1768e0dac50fSopenharmony_ci */ 1769e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetGlobalMaximizeMode, Function | SmallTest | Level2) 1770e0dac50fSopenharmony_ci{ 1771e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1772e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1773e0dac50fSopenharmony_ci auto ret = window->SetGlobalMaximizeMode(MaximizeMode::MODE_AVOID_SYSTEM_BAR); 1774e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1775e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1776e0dac50fSopenharmony_ci} 1777e0dac50fSopenharmony_ci 1778e0dac50fSopenharmony_ci/** 1779e0dac50fSopenharmony_ci * @tc.name: GetGlobalMaximizeMode 1780e0dac50fSopenharmony_ci * @tc.desc: get 1781e0dac50fSopenharmony_ci * @tc.type: FUNC 1782e0dac50fSopenharmony_ci */ 1783e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetGlobalMaximizeMode, Function | SmallTest | Level2) 1784e0dac50fSopenharmony_ci{ 1785e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1786e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1787e0dac50fSopenharmony_ci 1788e0dac50fSopenharmony_ci auto ret = window->GetGlobalMaximizeMode(); 1789e0dac50fSopenharmony_ci ASSERT_EQ(MaximizeMode::MODE_FULL_FILL, ret); 1790e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1791e0dac50fSopenharmony_ci} 1792e0dac50fSopenharmony_ci 1793e0dac50fSopenharmony_ci/** 1794e0dac50fSopenharmony_ci * @tc.name: IsSupportWideGamut 1795e0dac50fSopenharmony_ci * @tc.desc: get 1796e0dac50fSopenharmony_ci * @tc.type: FUNC 1797e0dac50fSopenharmony_ci */ 1798e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsSupportWideGamut, Function | SmallTest | Level2) 1799e0dac50fSopenharmony_ci{ 1800e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1801e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1802e0dac50fSopenharmony_ci auto ret = window->IsSupportWideGamut(); 1803e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 1804e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1805e0dac50fSopenharmony_ci} 1806e0dac50fSopenharmony_ci 1807e0dac50fSopenharmony_ci/** 1808e0dac50fSopenharmony_ci * @tc.name: SetColorSpace 1809e0dac50fSopenharmony_ci * @tc.desc: get 1810e0dac50fSopenharmony_ci * @tc.type: FUNC 1811e0dac50fSopenharmony_ci */ 1812e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetColorSpace, Function | SmallTest | Level2) 1813e0dac50fSopenharmony_ci{ 1814e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1815e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1816e0dac50fSopenharmony_ci bool ret = true; 1817e0dac50fSopenharmony_ci window->SetColorSpace(ColorSpace::COLOR_SPACE_DEFAULT); 1818e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 1819e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1820e0dac50fSopenharmony_ci} 1821e0dac50fSopenharmony_ci 1822e0dac50fSopenharmony_ci/** 1823e0dac50fSopenharmony_ci * @tc.name: GetColorSpace 1824e0dac50fSopenharmony_ci * @tc.desc: get 1825e0dac50fSopenharmony_ci * @tc.type: FUNC 1826e0dac50fSopenharmony_ci */ 1827e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetColorSpace, Function | SmallTest | Level2) 1828e0dac50fSopenharmony_ci{ 1829e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1830e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1831e0dac50fSopenharmony_ci auto ret = window->GetColorSpace(); 1832e0dac50fSopenharmony_ci ASSERT_EQ(ColorSpace::COLOR_SPACE_DEFAULT, ret); 1833e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1834e0dac50fSopenharmony_ci} 1835e0dac50fSopenharmony_ci 1836e0dac50fSopenharmony_ci/** 1837e0dac50fSopenharmony_ci * @tc.name: DumpInfo 1838e0dac50fSopenharmony_ci * @tc.desc: get 1839e0dac50fSopenharmony_ci * @tc.type: FUNC 1840e0dac50fSopenharmony_ci */ 1841e0dac50fSopenharmony_ciHWTEST_F(WindowTest, DumpInfo, Function | SmallTest | Level2) 1842e0dac50fSopenharmony_ci{ 1843e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1844e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1845e0dac50fSopenharmony_ci std::vector<std::string> params; 1846e0dac50fSopenharmony_ci std::vector<std::string> info; 1847e0dac50fSopenharmony_ci auto ret = true; 1848e0dac50fSopenharmony_ci window->DumpInfo(params, info); 1849e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 1850e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1851e0dac50fSopenharmony_ci} 1852e0dac50fSopenharmony_ci 1853e0dac50fSopenharmony_ci/** 1854e0dac50fSopenharmony_ci * @tc.name: Snapshot 1855e0dac50fSopenharmony_ci * @tc.desc: get 1856e0dac50fSopenharmony_ci * @tc.type: FUNC 1857e0dac50fSopenharmony_ci */ 1858e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Snapshot, Function | SmallTest | Level2) 1859e0dac50fSopenharmony_ci{ 1860e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1861e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1862e0dac50fSopenharmony_ci auto pixmap = window->Snapshot(); 1863e0dac50fSopenharmony_ci ASSERT_EQ(pixmap, nullptr); 1864e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1865e0dac50fSopenharmony_ci} 1866e0dac50fSopenharmony_ci 1867e0dac50fSopenharmony_ci/** 1868e0dac50fSopenharmony_ci * @tc.name: NotifyMemoryLevel 1869e0dac50fSopenharmony_ci * @tc.desc: get 1870e0dac50fSopenharmony_ci * @tc.type: FUNC 1871e0dac50fSopenharmony_ci */ 1872e0dac50fSopenharmony_ciHWTEST_F(WindowTest, NotifyMemoryLevel, Function | SmallTest | Level2) 1873e0dac50fSopenharmony_ci{ 1874e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1875e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1876e0dac50fSopenharmony_ci auto ret = window->NotifyMemoryLevel(0); 1877e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1878e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1879e0dac50fSopenharmony_ci 1880e0dac50fSopenharmony_ci auto window_ = new (std::nothrow) Window(); 1881e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 1882e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->NotifyMemoryLevel(22)); 1883e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->Destroy()); 1884e0dac50fSopenharmony_ci} 1885e0dac50fSopenharmony_ci 1886e0dac50fSopenharmony_ci/** 1887e0dac50fSopenharmony_ci * @tc.name: IsAllowHaveSystemSubWindow 1888e0dac50fSopenharmony_ci * @tc.desc: get 1889e0dac50fSopenharmony_ci * @tc.type: FUNC 1890e0dac50fSopenharmony_ci */ 1891e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsAllowHaveSystemSubWindow, Function | SmallTest | Level2) 1892e0dac50fSopenharmony_ci{ 1893e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1894e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1895e0dac50fSopenharmony_ci window->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW); 1896e0dac50fSopenharmony_ci auto ret = window->IsAllowHaveSystemSubWindow(); 1897e0dac50fSopenharmony_ci ASSERT_EQ(false, ret); 1898e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1899e0dac50fSopenharmony_ci} 1900e0dac50fSopenharmony_ci 1901e0dac50fSopenharmony_ci/** 1902e0dac50fSopenharmony_ci * @tc.name: SetAspectRatio 1903e0dac50fSopenharmony_ci * @tc.desc: get 1904e0dac50fSopenharmony_ci * @tc.type: FUNC 1905e0dac50fSopenharmony_ci */ 1906e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetAspectRatio, Function | SmallTest | Level2) 1907e0dac50fSopenharmony_ci{ 1908e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1909e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1910e0dac50fSopenharmony_ci auto ret = window->SetAspectRatio(0.0f); 1911e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1912e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1913e0dac50fSopenharmony_ci 1914e0dac50fSopenharmony_ci auto window_ = new (std::nothrow) Window(); 1915e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 1916e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window_->SetAspectRatio(0.1f)); 1917e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1918e0dac50fSopenharmony_ci} 1919e0dac50fSopenharmony_ci 1920e0dac50fSopenharmony_ci/** 1921e0dac50fSopenharmony_ci * @tc.name: ResetAspectRatio 1922e0dac50fSopenharmony_ci * @tc.desc: get 1923e0dac50fSopenharmony_ci * @tc.type: FUNC 1924e0dac50fSopenharmony_ci */ 1925e0dac50fSopenharmony_ciHWTEST_F(WindowTest, ResetAspectRatio, Function | SmallTest | Level2) 1926e0dac50fSopenharmony_ci{ 1927e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1928e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1929e0dac50fSopenharmony_ci auto ret = window->ResetAspectRatio(); 1930e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1931e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1932e0dac50fSopenharmony_ci} 1933e0dac50fSopenharmony_ci 1934e0dac50fSopenharmony_ci/** 1935e0dac50fSopenharmony_ci * @tc.name: GetKeyboardAnimationConfig 1936e0dac50fSopenharmony_ci * @tc.desc: get 1937e0dac50fSopenharmony_ci * @tc.type: FUNC 1938e0dac50fSopenharmony_ci */ 1939e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetKeyboardAnimationConfig, Function | SmallTest | Level2) 1940e0dac50fSopenharmony_ci{ 1941e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1942e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1943e0dac50fSopenharmony_ci KeyboardAnimationCurve curve; 1944e0dac50fSopenharmony_ci auto ret = window->GetKeyboardAnimationConfig(); 1945e0dac50fSopenharmony_ci ASSERT_EQ(true, ret.curveIn.duration_ == curve.duration_); 1946e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1947e0dac50fSopenharmony_ci} 1948e0dac50fSopenharmony_ci 1949e0dac50fSopenharmony_ci/** 1950e0dac50fSopenharmony_ci * @tc.name: SetNeedDefaultAnimation 1951e0dac50fSopenharmony_ci * @tc.desc: get 1952e0dac50fSopenharmony_ci * @tc.type: FUNC 1953e0dac50fSopenharmony_ci */ 1954e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetNeedDefaultAnimation, Function | SmallTest | Level2) 1955e0dac50fSopenharmony_ci{ 1956e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1957e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1958e0dac50fSopenharmony_ci auto ret = true; 1959e0dac50fSopenharmony_ci window->SetNeedDefaultAnimation(true); 1960e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 1961e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1962e0dac50fSopenharmony_ci} 1963e0dac50fSopenharmony_ci 1964e0dac50fSopenharmony_ci/** 1965e0dac50fSopenharmony_ci * @tc.name: TransferAbilityResult 1966e0dac50fSopenharmony_ci * @tc.desc: get 1967e0dac50fSopenharmony_ci * @tc.type: FUNC 1968e0dac50fSopenharmony_ci */ 1969e0dac50fSopenharmony_ciHWTEST_F(WindowTest, TransferAbilityResult, Function | SmallTest | Level2) 1970e0dac50fSopenharmony_ci{ 1971e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1972e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1973e0dac50fSopenharmony_ci AAFwk::Want want; 1974e0dac50fSopenharmony_ci auto ret = window->TransferAbilityResult(0, want); 1975e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1976e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1977e0dac50fSopenharmony_ci} 1978e0dac50fSopenharmony_ci 1979e0dac50fSopenharmony_ci/** 1980e0dac50fSopenharmony_ci * @tc.name: TransferExtensionData 1981e0dac50fSopenharmony_ci * @tc.desc: get 1982e0dac50fSopenharmony_ci * @tc.type: FUNC 1983e0dac50fSopenharmony_ci */ 1984e0dac50fSopenharmony_ciHWTEST_F(WindowTest, TransferExtensionData, Function | SmallTest | Level2) 1985e0dac50fSopenharmony_ci{ 1986e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 1987e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 1988e0dac50fSopenharmony_ci AAFwk::WantParams wantParams; 1989e0dac50fSopenharmony_ci auto ret = window->TransferExtensionData(wantParams); 1990e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 1991e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 1992e0dac50fSopenharmony_ci} 1993e0dac50fSopenharmony_ci 1994e0dac50fSopenharmony_ci/** 1995e0dac50fSopenharmony_ci * @tc.name: RegisterTransferComponentDataListener 1996e0dac50fSopenharmony_ci * @tc.desc: get 1997e0dac50fSopenharmony_ci * @tc.type: FUNC 1998e0dac50fSopenharmony_ci */ 1999e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterTransferComponentDataListener, Function | SmallTest | Level2) 2000e0dac50fSopenharmony_ci{ 2001e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2002e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2003e0dac50fSopenharmony_ci NotifyTransferComponentDataFunc func; 2004e0dac50fSopenharmony_ci auto ret = true; 2005e0dac50fSopenharmony_ci window->RegisterTransferComponentDataListener(func); 2006e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2007e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2008e0dac50fSopenharmony_ci} 2009e0dac50fSopenharmony_ci 2010e0dac50fSopenharmony_ci/** 2011e0dac50fSopenharmony_ci * @tc.name: WindowChangeListener 2012e0dac50fSopenharmony_ci * @tc.desc: WindowChangeListener01 fun 2013e0dac50fSopenharmony_ci * @tc.type: FUNC 2014e0dac50fSopenharmony_ci */ 2015e0dac50fSopenharmony_ciHWTEST_F(WindowTest, WindowChangeListener01, Function | SmallTest | Level3) 2016e0dac50fSopenharmony_ci{ 2017e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2018e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2019e0dac50fSopenharmony_ci auto ret = true; 2020e0dac50fSopenharmony_ci sptr<IWindowChangeListener> listener = new IWindowChangeListener(); 2021e0dac50fSopenharmony_ci window->RegisterWindowChangeListener(listener); 2022e0dac50fSopenharmony_ci listener->OnModeChange(WindowMode::WINDOW_MODE_UNDEFINED, false); 2023e0dac50fSopenharmony_ci window->UnregisterWindowChangeListener(listener); 2024e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2025e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2026e0dac50fSopenharmony_ci} 2027e0dac50fSopenharmony_ci 2028e0dac50fSopenharmony_ci/** 2029e0dac50fSopenharmony_ci * @tc.name: IOccupiedAreaChangeListener 2030e0dac50fSopenharmony_ci * @tc.desc: IOccupiedAreaChangeListener fun 2031e0dac50fSopenharmony_ci * @tc.type: FUNC 2032e0dac50fSopenharmony_ci */ 2033e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IOccupiedAreaChangeListener, Function | SmallTest | Level3) 2034e0dac50fSopenharmony_ci{ 2035e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2036e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2037e0dac50fSopenharmony_ci auto ret = true; 2038e0dac50fSopenharmony_ci sptr<IOccupiedAreaChangeListener> listener = new IOccupiedAreaChangeListener(); 2039e0dac50fSopenharmony_ci Rect rect_ = {0, 0, 0, 0}; 2040e0dac50fSopenharmony_ci window->RegisterOccupiedAreaChangeListener(listener); 2041e0dac50fSopenharmony_ci sptr<OccupiedAreaChangeInfo> info = new OccupiedAreaChangeInfo(OccupiedAreaType::TYPE_INPUT, rect_, 80); 2042e0dac50fSopenharmony_ci listener->OnSizeChange(info, nullptr); 2043e0dac50fSopenharmony_ci window->UnregisterOccupiedAreaChangeListener(listener); 2044e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2045e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2046e0dac50fSopenharmony_ci} 2047e0dac50fSopenharmony_ci 2048e0dac50fSopenharmony_ci/** 2049e0dac50fSopenharmony_ci * @tc.name: WindowChangeListener 2050e0dac50fSopenharmony_ci * @tc.desc: WindowChangeListener02 fun 2051e0dac50fSopenharmony_ci * @tc.type: FUNC 2052e0dac50fSopenharmony_ci */ 2053e0dac50fSopenharmony_ciHWTEST_F(WindowTest, WindowChangeListener02, Function | SmallTest | Level3) 2054e0dac50fSopenharmony_ci{ 2055e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2056e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2057e0dac50fSopenharmony_ci auto ret = true; 2058e0dac50fSopenharmony_ci sptr<IWindowChangeListener> listener = new IWindowChangeListener(); 2059e0dac50fSopenharmony_ci window->RegisterWindowChangeListener(listener); 2060e0dac50fSopenharmony_ci Rect rect_ = {0, 0, 0, 0}; 2061e0dac50fSopenharmony_ci std::shared_ptr<RSTransaction> rstransaction; 2062e0dac50fSopenharmony_ci listener->OnSizeChange(rect_, WindowSizeChangeReason::UNDEFINED, rstransaction); 2063e0dac50fSopenharmony_ci window->UnregisterWindowChangeListener(listener); 2064e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2065e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2066e0dac50fSopenharmony_ci} 2067e0dac50fSopenharmony_ci 2068e0dac50fSopenharmony_ci/** 2069e0dac50fSopenharmony_ci * @tc.name: IAnimationTransitionController 2070e0dac50fSopenharmony_ci * @tc.desc: IAnimationTransitionController fun 2071e0dac50fSopenharmony_ci * @tc.type: FUNC 2072e0dac50fSopenharmony_ci */ 2073e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IAnimationTransitionController, Function | SmallTest | Level3) 2074e0dac50fSopenharmony_ci{ 2075e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2076e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2077e0dac50fSopenharmony_ci auto ret = true; 2078e0dac50fSopenharmony_ci sptr<IAnimationTransitionController> listener = new IAnimationTransitionController(); 2079e0dac50fSopenharmony_ci window->RegisterAnimationTransitionController(listener); 2080e0dac50fSopenharmony_ci listener->AnimationForShown(); 2081e0dac50fSopenharmony_ci listener->AnimationForHidden(); 2082e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2083e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2084e0dac50fSopenharmony_ci} 2085e0dac50fSopenharmony_ci 2086e0dac50fSopenharmony_ci/** 2087e0dac50fSopenharmony_ci * @tc.name: IInputEventConsumer 2088e0dac50fSopenharmony_ci * @tc.desc: IInputEventConsumer fun 2089e0dac50fSopenharmony_ci * @tc.type: FUNC 2090e0dac50fSopenharmony_ci */ 2091e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IInputEventConsumer, Function | SmallTest | Level3) 2092e0dac50fSopenharmony_ci{ 2093e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2094e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2095e0dac50fSopenharmony_ci auto ret = true; 2096e0dac50fSopenharmony_ci std::shared_ptr<IInputEventConsumer> listener = std::make_shared<IInputEventConsumer>(); 2097e0dac50fSopenharmony_ci std::shared_ptr<MMI::KeyEvent> keyEvent = nullptr; 2098e0dac50fSopenharmony_ci std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr; 2099e0dac50fSopenharmony_ci std::shared_ptr<MMI::AxisEvent> axisEvent = nullptr; 2100e0dac50fSopenharmony_ci listener->OnInputEvent(keyEvent); 2101e0dac50fSopenharmony_ci listener->OnInputEvent(pointerEvent); 2102e0dac50fSopenharmony_ci listener->OnInputEvent(axisEvent); 2103e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2104e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2105e0dac50fSopenharmony_ci} 2106e0dac50fSopenharmony_ci 2107e0dac50fSopenharmony_ci/** 2108e0dac50fSopenharmony_ci * @tc.name: IDialogDeathRecipientListener 2109e0dac50fSopenharmony_ci * @tc.desc: IDialogDeathRecipientListener fun 2110e0dac50fSopenharmony_ci * @tc.type: FUNC 2111e0dac50fSopenharmony_ci */ 2112e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IDialogDeathRecipientListener, Function | SmallTest | Level3) 2113e0dac50fSopenharmony_ci{ 2114e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2115e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2116e0dac50fSopenharmony_ci auto ret = true; 2117e0dac50fSopenharmony_ci sptr<IDialogDeathRecipientListener> listener = new IDialogDeathRecipientListener(); 2118e0dac50fSopenharmony_ci Rect rect_ = {0, 0, 0, 0}; 2119e0dac50fSopenharmony_ci sptr<OccupiedAreaChangeInfo> info = new OccupiedAreaChangeInfo(OccupiedAreaType::TYPE_INPUT, rect_, 80); 2120e0dac50fSopenharmony_ci listener->OnDialogDeathRecipient(); 2121e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2122e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2123e0dac50fSopenharmony_ci} 2124e0dac50fSopenharmony_ci 2125e0dac50fSopenharmony_ci/** 2126e0dac50fSopenharmony_ci * @tc.name: IAceAbilityHandler 2127e0dac50fSopenharmony_ci * @tc.desc: IAceAbilityHandler fun 2128e0dac50fSopenharmony_ci * @tc.type: FUNC 2129e0dac50fSopenharmony_ci */ 2130e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IAceAbilityHandler, Function | SmallTest | Level3) 2131e0dac50fSopenharmony_ci{ 2132e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2133e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2134e0dac50fSopenharmony_ci auto ret = true; 2135e0dac50fSopenharmony_ci sptr<IAceAbilityHandler> listener = new IAceAbilityHandler(); 2136e0dac50fSopenharmony_ci uint32_t color = 66; 2137e0dac50fSopenharmony_ci listener->SetBackgroundColor(color); 2138e0dac50fSopenharmony_ci listener->GetBackgroundColor(); 2139e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2140e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2141e0dac50fSopenharmony_ci} 2142e0dac50fSopenharmony_ci 2143e0dac50fSopenharmony_ci/** 2144e0dac50fSopenharmony_ci * @tc.name: IDispatchInputEventListener 2145e0dac50fSopenharmony_ci * @tc.desc: IDispatchInputEventListener fun 2146e0dac50fSopenharmony_ci * @tc.type: FUNC 2147e0dac50fSopenharmony_ci */ 2148e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IDispatchInputEventListener, Function | SmallTest | Level3) 2149e0dac50fSopenharmony_ci{ 2150e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2151e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2152e0dac50fSopenharmony_ci auto ret = true; 2153e0dac50fSopenharmony_ci sptr<IDispatchInputEventListener> listener = new IDispatchInputEventListener(); 2154e0dac50fSopenharmony_ci std::shared_ptr<MMI::KeyEvent> keyEvent = nullptr; 2155e0dac50fSopenharmony_ci std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr; 2156e0dac50fSopenharmony_ci std::shared_ptr<MMI::AxisEvent> axisEvent = nullptr; 2157e0dac50fSopenharmony_ci listener->OnDispatchPointerEvent(pointerEvent); 2158e0dac50fSopenharmony_ci listener->OnDispatchKeyEvent(keyEvent); 2159e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2160e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2161e0dac50fSopenharmony_ci} 2162e0dac50fSopenharmony_ci 2163e0dac50fSopenharmony_ci/** 2164e0dac50fSopenharmony_ci * @tc.name: Marshalling 2165e0dac50fSopenharmony_ci * @tc.desc: keyboardAnimationCurve marshalling 2166e0dac50fSopenharmony_ci * @tc.type: FUNC 2167e0dac50fSopenharmony_ci */ 2168e0dac50fSopenharmony_ciHWTEST_F(WindowTest, keyboardAnimationCurveMarshalling, Function | SmallTest | Level3) 2169e0dac50fSopenharmony_ci{ 2170e0dac50fSopenharmony_ci MessageParcel data; 2171e0dac50fSopenharmony_ci KeyboardAnimationCurve curveConfig; 2172e0dac50fSopenharmony_ci auto ret = data.WriteParcelable(&curveConfig); 2173e0dac50fSopenharmony_ci Parcel parcel; 2174e0dac50fSopenharmony_ci curveConfig.Unmarshalling(parcel); 2175e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2176e0dac50fSopenharmony_ci} 2177e0dac50fSopenharmony_ci 2178e0dac50fSopenharmony_ci/** 2179e0dac50fSopenharmony_ci * @tc.name: BackgroundFailed 2180e0dac50fSopenharmony_ci * @tc.desc: window life cycle BackgroundFailed 2181e0dac50fSopenharmony_ci * @tc.type: FUNC 2182e0dac50fSopenharmony_ci */ 2183e0dac50fSopenharmony_ciHWTEST_F(WindowTest, WindowLifeCycleBackgroundFailed, Function | SmallTest | Level3) 2184e0dac50fSopenharmony_ci{ 2185e0dac50fSopenharmony_ci IWindowLifeCycle windowLifeCycle; 2186e0dac50fSopenharmony_ci int32_t ret = 0; 2187e0dac50fSopenharmony_ci windowLifeCycle.BackgroundFailed(ret); 2188e0dac50fSopenharmony_ci ASSERT_EQ(0, ret); 2189e0dac50fSopenharmony_ci} 2190e0dac50fSopenharmony_ci 2191e0dac50fSopenharmony_ci/** 2192e0dac50fSopenharmony_ci * @tc.name: GetVSyncPeriod 2193e0dac50fSopenharmony_ci * @tc.desc: window GetVSyncPeriod 2194e0dac50fSopenharmony_ci * @tc.type: FUNC 2195e0dac50fSopenharmony_ci */ 2196e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetVSyncPeriod, Function | SmallTest | Level3) 2197e0dac50fSopenharmony_ci{ 2198e0dac50fSopenharmony_ci sptr<WindowOption> winOption = nullptr; 2199e0dac50fSopenharmony_ci winOption = new (std::nothrow) OHOS::Rosen::WindowOption(); 2200e0dac50fSopenharmony_ci ASSERT_NE(nullptr, winOption); 2201e0dac50fSopenharmony_ci winOption->SetWindowType(OHOS::Rosen::WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT); 2202e0dac50fSopenharmony_ci 2203e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption; 2204e0dac50fSopenharmony_ci sptr<Window> window = Window::Create("win", option); 2205e0dac50fSopenharmony_ci if (window != nullptr) { 2206e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2207e0dac50fSopenharmony_ci int64_t period = window->GetVSyncPeriod(); 2208e0dac50fSopenharmony_ci ASSERT_LE(-1, period); 2209e0dac50fSopenharmony_ci } 2210e0dac50fSopenharmony_ci sptr<Window> window_ = new Window(); 2211e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 2212e0dac50fSopenharmony_ci int64_t period_ = window_->GetVSyncPeriod(); 2213e0dac50fSopenharmony_ci ASSERT_LE(-1, period_); 2214e0dac50fSopenharmony_ci} 2215e0dac50fSopenharmony_ci 2216e0dac50fSopenharmony_ci/** 2217e0dac50fSopenharmony_ci * @tc.name: performBack 2218e0dac50fSopenharmony_ci * @tc.desc: window performBack 2219e0dac50fSopenharmony_ci * @tc.type: FUNC 2220e0dac50fSopenharmony_ci */ 2221e0dac50fSopenharmony_ciHWTEST_F(WindowTest, performBack, Function | SmallTest | Level3) 2222e0dac50fSopenharmony_ci{ 2223e0dac50fSopenharmony_ci sptr<WindowOption> winOption = nullptr; 2224e0dac50fSopenharmony_ci winOption = new (std::nothrow) OHOS::Rosen::WindowOption(); 2225e0dac50fSopenharmony_ci ASSERT_NE(nullptr, winOption); 2226e0dac50fSopenharmony_ci winOption->SetWindowType(OHOS::Rosen::WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT); 2227e0dac50fSopenharmony_ci 2228e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption; 2229e0dac50fSopenharmony_ci sptr<Window> window = Window::Create("performBack", option); 2230e0dac50fSopenharmony_ci if (window != nullptr) { 2231e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2232e0dac50fSopenharmony_ci window->PerformBack() 2233e0dac50fSopenharmony_ci ; 2234e0dac50fSopenharmony_ci } 2235e0dac50fSopenharmony_ci sptr<Window> window_ = new Window(); 2236e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 2237e0dac50fSopenharmony_ci window_->PerformBack(); 2238e0dac50fSopenharmony_ci} 2239e0dac50fSopenharmony_ci 2240e0dac50fSopenharmony_ci/** 2241e0dac50fSopenharmony_ci * @tc.name: SetResizeByDragEnabled 2242e0dac50fSopenharmony_ci * @tc.desc: set dragEnabled flag 2243e0dac50fSopenharmony_ci * @tc.type: FUNC 2244e0dac50fSopenharmony_ci */ 2245e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetResizeByDragEnabled, Function | SmallTest | Level2) 2246e0dac50fSopenharmony_ci{ 2247e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2248e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2249e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetResizeByDragEnabled(true)); 2250e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2251e0dac50fSopenharmony_ci} 2252e0dac50fSopenharmony_ci 2253e0dac50fSopenharmony_ci/** 2254e0dac50fSopenharmony_ci * @tc.name: SetRaiseByClickEnabled 2255e0dac50fSopenharmony_ci * @tc.desc: set raiseEnabled flag 2256e0dac50fSopenharmony_ci * @tc.type: FUNC 2257e0dac50fSopenharmony_ci */ 2258e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetRaiseByClickEnabled, Function | SmallTest | Level2) 2259e0dac50fSopenharmony_ci{ 2260e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2261e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2262e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetRaiseByClickEnabled(true)); 2263e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2264e0dac50fSopenharmony_ci} 2265e0dac50fSopenharmony_ci 2266e0dac50fSopenharmony_ci/** 2267e0dac50fSopenharmony_ci * @tc.name: RaiseAboveTarget 2268e0dac50fSopenharmony_ci * @tc.desc: RaiseAboveTarget flag 2269e0dac50fSopenharmony_ci * @tc.type: FUNC 2270e0dac50fSopenharmony_ci */ 2271e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RaiseAboveTarget, Function | SmallTest | Level2) 2272e0dac50fSopenharmony_ci{ 2273e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2274e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2275e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->RaiseAboveTarget(2)); 2276e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2277e0dac50fSopenharmony_ci} 2278e0dac50fSopenharmony_ci 2279e0dac50fSopenharmony_ci/** 2280e0dac50fSopenharmony_ci * @tc.name: HideNonSystemFloatingWindows 2281e0dac50fSopenharmony_ci * @tc.desc: set shouldHide flag 2282e0dac50fSopenharmony_ci * @tc.type: FUNC 2283e0dac50fSopenharmony_ci */ 2284e0dac50fSopenharmony_ciHWTEST_F(WindowTest, HideNonSystemFloatingWindows, Function | SmallTest | Level2) 2285e0dac50fSopenharmony_ci{ 2286e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2287e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2288e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->HideNonSystemFloatingWindows(false)); 2289e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2290e0dac50fSopenharmony_ci} 2291e0dac50fSopenharmony_ci 2292e0dac50fSopenharmony_ci/** 2293e0dac50fSopenharmony_ci * @tc.name: GetWindowLimits 2294e0dac50fSopenharmony_ci * @tc.desc: window GetWindowLimits 2295e0dac50fSopenharmony_ci * @tc.type: FUNC 2296e0dac50fSopenharmony_ci */ 2297e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetWindowLimits, Function | SmallTest | Level2) 2298e0dac50fSopenharmony_ci{ 2299e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2300e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2301e0dac50fSopenharmony_ci WindowLimits windowLimits; 2302e0dac50fSopenharmony_ci auto ret = window->GetWindowLimits(windowLimits); 2303e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2304e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2305e0dac50fSopenharmony_ci} 2306e0dac50fSopenharmony_ci 2307e0dac50fSopenharmony_ci/** 2308e0dac50fSopenharmony_ci * @tc.name: SetWindowLimits 2309e0dac50fSopenharmony_ci * @tc.desc: window SetWindowLimits 2310e0dac50fSopenharmony_ci * @tc.type: FUNC 2311e0dac50fSopenharmony_ci */ 2312e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetWindowLimits, Function | SmallTest | Level2) 2313e0dac50fSopenharmony_ci{ 2314e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2315e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2316e0dac50fSopenharmony_ci WindowLimits windowLimits; 2317e0dac50fSopenharmony_ci auto ret = window->SetWindowLimits(windowLimits); 2318e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2319e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2320e0dac50fSopenharmony_ci} 2321e0dac50fSopenharmony_ci 2322e0dac50fSopenharmony_ci/** 2323e0dac50fSopenharmony_ci * @tc.name: RegisterWindowVisibilityChangeListener 2324e0dac50fSopenharmony_ci * @tc.desc: Register window visibility change listener 2325e0dac50fSopenharmony_ci * @tc.type: FUNC 2326e0dac50fSopenharmony_ci */ 2327e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterWindowVisibilityChangeListener, Function | SmallTest | Level2) 2328e0dac50fSopenharmony_ci{ 2329e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2330e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2331e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->RegisterWindowVisibilityChangeListener(nullptr)); 2332e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2333e0dac50fSopenharmony_ci} 2334e0dac50fSopenharmony_ci 2335e0dac50fSopenharmony_ci/** 2336e0dac50fSopenharmony_ci * @tc.name: UnregisterWindowVisibilityChangeListener 2337e0dac50fSopenharmony_ci * @tc.desc: Unregister window visibility change listener 2338e0dac50fSopenharmony_ci * @tc.type: FUNC 2339e0dac50fSopenharmony_ci */ 2340e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterWindowVisibilityChangeListener, Function | SmallTest | Level2) 2341e0dac50fSopenharmony_ci{ 2342e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2343e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2344e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->UnregisterWindowVisibilityChangeListener(nullptr)); 2345e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2346e0dac50fSopenharmony_ci} 2347e0dac50fSopenharmony_ci 2348e0dac50fSopenharmony_ci/** 2349e0dac50fSopenharmony_ci * @tc.name: TransferAccessibilityEvent 2350e0dac50fSopenharmony_ci * @tc.desc: get 2351e0dac50fSopenharmony_ci * @tc.type: FUNC 2352e0dac50fSopenharmony_ci */ 2353e0dac50fSopenharmony_ciHWTEST_F(WindowTest, TransferAccessibilityEvent, Function | SmallTest | Level2) 2354e0dac50fSopenharmony_ci{ 2355e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2356e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2357e0dac50fSopenharmony_ci Accessibility::AccessibilityEventInfo info; 2358e0dac50fSopenharmony_ci int64_t uiExtensionIdLevel = 0; 2359e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->TransferAccessibilityEvent(info, uiExtensionIdLevel)); 2360e0dac50fSopenharmony_ci} 2361e0dac50fSopenharmony_ci 2362e0dac50fSopenharmony_ci/** 2363e0dac50fSopenharmony_ci * @tc.name: FlushFrameRate 2364e0dac50fSopenharmony_ci * @tc.desc: FlushFrameRate Test 2365e0dac50fSopenharmony_ci * @tc.type: FUNC 2366e0dac50fSopenharmony_ci */ 2367e0dac50fSopenharmony_ciHWTEST_F(WindowTest, FlushFrameRate, Function | SmallTest | Level2) 2368e0dac50fSopenharmony_ci{ 2369e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2370e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2371e0dac50fSopenharmony_ci uint32_t rate = 120; 2372e0dac50fSopenharmony_ci uint32_t rateType = 0; 2373e0dac50fSopenharmony_ci int32_t animatorExpectedFrameRate = -1; 2374e0dac50fSopenharmony_ci window->FlushFrameRate(rate, animatorExpectedFrameRate, rateType); 2375e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2376e0dac50fSopenharmony_ci} 2377e0dac50fSopenharmony_ci 2378e0dac50fSopenharmony_ci/** 2379e0dac50fSopenharmony_ci * @tc.name: SetSingleFrameComposerEnabled 2380e0dac50fSopenharmony_ci * @tc.desc: set single frame composer enable flag 2381e0dac50fSopenharmony_ci * @tc.type: FUNC 2382e0dac50fSopenharmony_ci */ 2383e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetSingleFrameComposerEnabled, Function | SmallTest | Level2) 2384e0dac50fSopenharmony_ci{ 2385e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2386e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2387e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetSingleFrameComposerEnabled(false)); 2388e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2389e0dac50fSopenharmony_ci} 2390e0dac50fSopenharmony_ci 2391e0dac50fSopenharmony_ci/** 2392e0dac50fSopenharmony_ci * @tc.name: Maximize01 2393e0dac50fSopenharmony_ci * @tc.desc: maximize interface Test 2394e0dac50fSopenharmony_ci * @tc.type: FUNC 2395e0dac50fSopenharmony_ci */ 2396e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Maximize01, Function | SmallTest | Level2) 2397e0dac50fSopenharmony_ci{ 2398e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2399e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2400e0dac50fSopenharmony_ci MaximizePresentation presentation = MaximizePresentation::ENTER_IMMERSIVE; 2401e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->Maximize(presentation)); 2402e0dac50fSopenharmony_ci} 2403e0dac50fSopenharmony_ci 2404e0dac50fSopenharmony_ci/** 2405e0dac50fSopenharmony_ci * @tc.name: RegisterWindowRectChangeListener 2406e0dac50fSopenharmony_ci * @tc.desc: get 2407e0dac50fSopenharmony_ci * @tc.type: FUNC 2408e0dac50fSopenharmony_ci */ 2409e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterWindowRectChangeListener, Function | SmallTest | Level2) 2410e0dac50fSopenharmony_ci{ 2411e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2412e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2413e0dac50fSopenharmony_ci sptr<IWindowRectChangeListener> listener = nullptr; 2414e0dac50fSopenharmony_ci auto ret = window->RegisterWindowRectChangeListener(listener); 2415e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2416e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2417e0dac50fSopenharmony_ci} 2418e0dac50fSopenharmony_ci 2419e0dac50fSopenharmony_ci/** 2420e0dac50fSopenharmony_ci * @tc.name: UnregisterWindowRectChangeListener 2421e0dac50fSopenharmony_ci * @tc.desc: get 2422e0dac50fSopenharmony_ci * @tc.type: FUNC 2423e0dac50fSopenharmony_ci */ 2424e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterWindowRectChangeListener, Function | SmallTest | Level2) 2425e0dac50fSopenharmony_ci{ 2426e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2427e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2428e0dac50fSopenharmony_ci sptr<IWindowRectChangeListener> listener = nullptr; 2429e0dac50fSopenharmony_ci auto ret = window->UnregisterWindowRectChangeListener(listener); 2430e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2431e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2432e0dac50fSopenharmony_ci} 2433e0dac50fSopenharmony_ci 2434e0dac50fSopenharmony_ci/** 2435e0dac50fSopenharmony_ci * @tc.name: RegisterKeyboardPanelInfoChangeListener 2436e0dac50fSopenharmony_ci * @tc.desc: get 2437e0dac50fSopenharmony_ci * @tc.type: FUNC 2438e0dac50fSopenharmony_ci */ 2439e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterKeyboardPanelInfoChangeListener, Function | SmallTest | Level2) 2440e0dac50fSopenharmony_ci{ 2441e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2442e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2443e0dac50fSopenharmony_ci sptr<IKeyboardPanelInfoChangeListener> listener = nullptr; 2444e0dac50fSopenharmony_ci auto ret = window->RegisterKeyboardPanelInfoChangeListener(listener); 2445e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 2446e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2447e0dac50fSopenharmony_ci} 2448e0dac50fSopenharmony_ci 2449e0dac50fSopenharmony_ci/** 2450e0dac50fSopenharmony_ci * @tc.name: UnregisterKeyboardPanelInfoChangeListener 2451e0dac50fSopenharmony_ci * @tc.desc: get 2452e0dac50fSopenharmony_ci * @tc.type: FUNC 2453e0dac50fSopenharmony_ci */ 2454e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterKeyboardPanelInfoChangeListener, Function | SmallTest | Level2) 2455e0dac50fSopenharmony_ci{ 2456e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2457e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2458e0dac50fSopenharmony_ci sptr<IKeyboardPanelInfoChangeListener> listener = nullptr; 2459e0dac50fSopenharmony_ci auto ret = window->UnregisterKeyboardPanelInfoChangeListener(listener); 2460e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 2461e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2462e0dac50fSopenharmony_ci} 2463e0dac50fSopenharmony_ci 2464e0dac50fSopenharmony_ci/** 2465e0dac50fSopenharmony_ci * @tc.name: GetTopWindowWithContext 2466e0dac50fSopenharmony_ci * @tc.desc: get 2467e0dac50fSopenharmony_ci * @tc.type: FUNC 2468e0dac50fSopenharmony_ci */ 2469e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetTopWindowWithContext, Function | SmallTest | Level2) 2470e0dac50fSopenharmony_ci{ 2471e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 2472e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithContext(nullptr)); 2473e0dac50fSopenharmony_ci 2474e0dac50fSopenharmony_ci sptr<WindowOption> option = sptr<WindowOption>::MakeSptr(); 2475e0dac50fSopenharmony_ci sptr<WindowSessionImpl> winSession = sptr<WindowSessionImpl>::MakeSptr(option); 2476e0dac50fSopenharmony_ci winSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW); 2477e0dac50fSopenharmony_ci winSession->property_->SetPersistentId(1); 2478e0dac50fSopenharmony_ci string winName = "test"; 2479e0dac50fSopenharmony_ci int32_t winId = 1; 2480e0dac50fSopenharmony_ci WindowSessionImpl::windowSessionMap_.insert( 2481e0dac50fSopenharmony_ci make_pair(winName, std::pair<int32_t, sptr<WindowSessionImpl>>(winId, winSession))); 2482e0dac50fSopenharmony_ci std::unique_ptr<Mocker> m = std::make_unique<Mocker>(); 2483e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(DoAll( 2484e0dac50fSopenharmony_ci SetArgReferee<1>(winId), 2485e0dac50fSopenharmony_ci Return(WMError::WM_OK) 2486e0dac50fSopenharmony_ci )); 2487e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window->GetTopWindowWithContext(nullptr)); 2488e0dac50fSopenharmony_ci 2489e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(DoAll( 2490e0dac50fSopenharmony_ci SetArgReferee<1>(winId), 2491e0dac50fSopenharmony_ci Return(WMError::WM_DO_NOTHING) 2492e0dac50fSopenharmony_ci )); 2493e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithContext(nullptr)); 2494e0dac50fSopenharmony_ci 2495e0dac50fSopenharmony_ci winSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW); 2496e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithContext(nullptr)); 2497e0dac50fSopenharmony_ci 2498e0dac50fSopenharmony_ci winSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW); 2499e0dac50fSopenharmony_ci int32_t tempWinId = 4; 2500e0dac50fSopenharmony_ci EXPECT_CALL(m->Mock(), GetTopWindowId(_, _)).Times(1).WillOnce(DoAll( 2501e0dac50fSopenharmony_ci SetArgReferee<1>(tempWinId), 2502e0dac50fSopenharmony_ci Return(WMError::WM_OK) 2503e0dac50fSopenharmony_ci )); 2504e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetTopWindowWithContext(nullptr)); 2505e0dac50fSopenharmony_ci 2506e0dac50fSopenharmony_ci WindowSessionImpl::windowSessionMap_.erase(winName); 2507e0dac50fSopenharmony_ci} 2508e0dac50fSopenharmony_ci 2509e0dac50fSopenharmony_ci/** 2510e0dac50fSopenharmony_ci * @tc.name: GetMainWindowWithContext|GetWindowWithId 2511e0dac50fSopenharmony_ci * |GetSubWindow|UpdateConfigurationForAll 2512e0dac50fSopenharmony_ci * @tc.desc: get 2513e0dac50fSopenharmony_ci * @tc.type: FUNC 2514e0dac50fSopenharmony_ci */ 2515e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetMainWindowWithContext, Function | SmallTest | Level2) 2516e0dac50fSopenharmony_ci{ 2517e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2518e0dac50fSopenharmony_ci uint32_t windId = 0; 2519e0dac50fSopenharmony_ci uint32_t parentId = 1; 2520e0dac50fSopenharmony_ci std::shared_ptr<AppExecFwk::Configuration> configuration = nullptr; 2521e0dac50fSopenharmony_ci 2522e0dac50fSopenharmony_ci std::shared_ptr<AbilityRuntime::Context> context = nullptr; 2523e0dac50fSopenharmony_ci auto ret = window->GetMainWindowWithContext(context); 2524e0dac50fSopenharmony_ci window->GetWindowWithId(windId); 2525e0dac50fSopenharmony_ci window->GetSubWindow(parentId); 2526e0dac50fSopenharmony_ci window->UpdateConfigurationForAll(configuration); 2527e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, ret); 2528e0dac50fSopenharmony_ci} 2529e0dac50fSopenharmony_ci 2530e0dac50fSopenharmony_ci/** 2531e0dac50fSopenharmony_ci * @tc.name: SetTopmost|GetWIsTopmostindowWithId 2532e0dac50fSopenharmony_ci * @tc.desc: get 2533e0dac50fSopenharmony_ci * @tc.type: FUNC 2534e0dac50fSopenharmony_ci */ 2535e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTopmost, Function | SmallTest | Level2) 2536e0dac50fSopenharmony_ci{ 2537e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2538e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2539e0dac50fSopenharmony_ci auto ret = window->SetTopmost(false); 2540e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 2541e0dac50fSopenharmony_ci ASSERT_EQ(false, window->IsTopmost()); 2542e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2543e0dac50fSopenharmony_ci} 2544e0dac50fSopenharmony_ci 2545e0dac50fSopenharmony_ci/** 2546e0dac50fSopenharmony_ci * @tc.name: SetUIContentByName 2547e0dac50fSopenharmony_ci * @tc.desc: get 2548e0dac50fSopenharmony_ci * @tc.type: FUNC 2549e0dac50fSopenharmony_ci */ 2550e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetUIContentByName, Function | SmallTest | Level2) 2551e0dac50fSopenharmony_ci{ 2552e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2553e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2554e0dac50fSopenharmony_ci napi_env env = nullptr; 2555e0dac50fSopenharmony_ci napi_value storage = nullptr; 2556e0dac50fSopenharmony_ci auto ret = window->SetUIContentByName("/system/etc/window/resources/test.abc", env, storage); 2557e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 2558e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2559e0dac50fSopenharmony_ci} 2560e0dac50fSopenharmony_ci 2561e0dac50fSopenharmony_ci/** 2562e0dac50fSopenharmony_ci * @tc.name: TriggerBindModalUIExtension 2563e0dac50fSopenharmony_ci * @tc.desc: get 2564e0dac50fSopenharmony_ci * @tc.type: FUNC 2565e0dac50fSopenharmony_ci */ 2566e0dac50fSopenharmony_ciHWTEST_F(WindowTest, TriggerBindModalUIExtension, Function | SmallTest | Level2) 2567e0dac50fSopenharmony_ci{ 2568e0dac50fSopenharmony_ci sptr<WindowOption> winOption = nullptr; 2569e0dac50fSopenharmony_ci winOption = new(std::nothrow) OHOS::Rosen::WindowOption(); 2570e0dac50fSopenharmony_ci ASSERT_NE(nullptr, winOption); 2571e0dac50fSopenharmony_ci winOption->SetWindowType(OHOS::Rosen::WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT); 2572e0dac50fSopenharmony_ci sptr<WindowOption> option = new WindowOption(); 2573e0dac50fSopenharmony_ci sptr<Window> window = Window::Create("TriggerBindModalUIExtension", option); 2574e0dac50fSopenharmony_ci if (window != nullptr) { 2575e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2576e0dac50fSopenharmony_ci window->TriggerBindModalUIExtension(); 2577e0dac50fSopenharmony_ci } 2578e0dac50fSopenharmony_ci sptr<Window> window_ = new Window(); 2579e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window_); 2580e0dac50fSopenharmony_ci window_->PerformBack(); 2581e0dac50fSopenharmony_ci} 2582e0dac50fSopenharmony_ci 2583e0dac50fSopenharmony_ci/** 2584e0dac50fSopenharmony_ci * @tc.name: RegisterTransferComponentDataForResultListener 2585e0dac50fSopenharmony_ci * @tc.desc: get 2586e0dac50fSopenharmony_ci * @tc.type: FUNC 2587e0dac50fSopenharmony_ci */ 2588e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterTransferComponentDataForResultListener, Function | SmallTest | Level2) 2589e0dac50fSopenharmony_ci{ 2590e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2591e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2592e0dac50fSopenharmony_ci NotifyTransferComponentDataForResultFunc func; 2593e0dac50fSopenharmony_ci auto ret = true; 2594e0dac50fSopenharmony_ci window->RegisterTransferComponentDataForResultListener(func); 2595e0dac50fSopenharmony_ci ASSERT_EQ(true, ret); 2596e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2597e0dac50fSopenharmony_ci} 2598e0dac50fSopenharmony_ci 2599e0dac50fSopenharmony_ci/** 2600e0dac50fSopenharmony_ci * @tc.name: SetTextFieldAvoidInfo|KeepKeyboardOnFocus 2601e0dac50fSopenharmony_ci * @tc.desc: get 2602e0dac50fSopenharmony_ci * @tc.type: FUNC 2603e0dac50fSopenharmony_ci */ 2604e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTextFieldAvoidInfo, Function | SmallTest | Level2) 2605e0dac50fSopenharmony_ci{ 2606e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2607e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2608e0dac50fSopenharmony_ci auto ret = window->SetTextFieldAvoidInfo(50.0, 100.0); 2609e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, ret); 2610e0dac50fSopenharmony_ci auto retur = window->KeepKeyboardOnFocus(false); 2611e0dac50fSopenharmony_ci ASSERT_EQ(WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT, retur); 2612e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2613e0dac50fSopenharmony_ci} 2614e0dac50fSopenharmony_ci 2615e0dac50fSopenharmony_ci/** 2616e0dac50fSopenharmony_ci * @tc.name: Test01 2617e0dac50fSopenharmony_ci * @tc.desc: Test01 2618e0dac50fSopenharmony_ci * @tc.type: FUNC 2619e0dac50fSopenharmony_ci */ 2620e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Test01, Function | SmallTest | Level2) 2621e0dac50fSopenharmony_ci{ 2622e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2623e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2624e0dac50fSopenharmony_ci SystemBarProperty prop; 2625e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->SetSpecificBarProperty(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, prop)); 2626e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetDecorVisible(true)); 2627e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetTitleButtonVisible(true, true, true, true)); 2628e0dac50fSopenharmony_ci auto var = 5; 2629e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetDecorHeight(var)); 2630e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->GetDecorHeight(var)); 2631e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->ClearKeyEventFilter()); 2632e0dac50fSopenharmony_ci IWindowVisibilityChangedListener windowVisibilityChangedListener; 2633e0dac50fSopenharmony_ci windowVisibilityChangedListener.OnWindowVisibilityChangedCallback(false); 2634e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2635e0dac50fSopenharmony_ci} 2636e0dac50fSopenharmony_ci 2637e0dac50fSopenharmony_ci/** 2638e0dac50fSopenharmony_ci * @tc.name: Test02 2639e0dac50fSopenharmony_ci * @tc.desc: Test02 2640e0dac50fSopenharmony_ci * @tc.type: FUNC 2641e0dac50fSopenharmony_ci */ 2642e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Test02, Function | SmallTest | Level2) 2643e0dac50fSopenharmony_ci{ 2644e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2645e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2646e0dac50fSopenharmony_ci IWindowLifeCycle windowLifeCycle; 2647e0dac50fSopenharmony_ci windowLifeCycle.AfterResumed(); 2648e0dac50fSopenharmony_ci windowLifeCycle.AfterPaused(); 2649e0dac50fSopenharmony_ci windowLifeCycle.AfterDestroyed(); 2650e0dac50fSopenharmony_ci IWindowStatusChangeListener windowStatusChangeListener; 2651e0dac50fSopenharmony_ci windowStatusChangeListener.OnWindowStatusChange(WindowStatus::WINDOW_STATUS_UNDEFINED); 2652e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetDefaultDensityEnabled(true)); 2653e0dac50fSopenharmony_ci ASSERT_EQ(false, window->GetDefaultDensityEnabled()); 2654e0dac50fSopenharmony_ci Rect rect_ = {0, 0, 0, 0}; 2655e0dac50fSopenharmony_ci window->UpdatePiPRect(rect_, WindowSizeChangeReason::UNDEFINED); 2656e0dac50fSopenharmony_ci IWindowRectChangeListener windowRectChangeListener; 2657e0dac50fSopenharmony_ci windowRectChangeListener.OnRectChange(rect_, WindowSizeChangeReason::UNDEFINED); 2658e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2659e0dac50fSopenharmony_ci} 2660e0dac50fSopenharmony_ci 2661e0dac50fSopenharmony_ci/** 2662e0dac50fSopenharmony_ci * @tc.name: Test03 2663e0dac50fSopenharmony_ci * @tc.desc: Test03 2664e0dac50fSopenharmony_ci * @tc.type: FUNC 2665e0dac50fSopenharmony_ci */ 2666e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Test03, Function | SmallTest | Level2) 2667e0dac50fSopenharmony_ci{ 2668e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2669e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2670e0dac50fSopenharmony_ci KeyEventFilterFunc keyEventFilterFunc; 2671e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetKeyEventFilter(keyEventFilterFunc)); 2672e0dac50fSopenharmony_ci IWindowNoInteractionListener windowNoInteractionListener; 2673e0dac50fSopenharmony_ci windowNoInteractionListener.OnWindowNoInteractionCallback(); 2674e0dac50fSopenharmony_ci windowNoInteractionListener.SetTimeout(100); 2675e0dac50fSopenharmony_ci ASSERT_EQ(0, windowNoInteractionListener.GetTimeout()); 2676e0dac50fSopenharmony_ci TitleButtonRect titleButtonRect = {3, 3, 3, 3}; 2677e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->GetTitleButtonArea(titleButtonRect)); 2678e0dac50fSopenharmony_ci IWindowTitleButtonRectChangedListener windowTitleButtonRectChangedListener; 2679e0dac50fSopenharmony_ci windowTitleButtonRectChangedListener.OnWindowTitleButtonRectChanged(titleButtonRect); 2680e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2681e0dac50fSopenharmony_ci} 2682e0dac50fSopenharmony_ci 2683e0dac50fSopenharmony_ci/** 2684e0dac50fSopenharmony_ci * @tc.name: Test04 2685e0dac50fSopenharmony_ci * @tc.desc: Test04 2686e0dac50fSopenharmony_ci * @tc.type: FUNC 2687e0dac50fSopenharmony_ci */ 2688e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Test04, Function | SmallTest | Level2) 2689e0dac50fSopenharmony_ci{ 2690e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2691e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2692e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window->GetUIContentWithId(0)); 2693e0dac50fSopenharmony_ci window->TriggerBindModalUIExtension(); 2694e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetGrayScale(0)); 2695e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2696e0dac50fSopenharmony_ci} 2697e0dac50fSopenharmony_ci 2698e0dac50fSopenharmony_ci/** 2699e0dac50fSopenharmony_ci * @tc.name: Test05 2700e0dac50fSopenharmony_ci * @tc.desc: Test05 2701e0dac50fSopenharmony_ci * @tc.type: FUNC 2702e0dac50fSopenharmony_ci */ 2703e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Test05, Function | SmallTest | Level2) 2704e0dac50fSopenharmony_ci{ 2705e0dac50fSopenharmony_ci sptr<Window> window = new Window(); 2706e0dac50fSopenharmony_ci ASSERT_NE(nullptr, window); 2707e0dac50fSopenharmony_ci auto mainWinId = 0; 2708e0dac50fSopenharmony_ci auto window1 = window->GetTopWindowWithId(mainWinId); 2709e0dac50fSopenharmony_ci ASSERT_EQ(nullptr, window1); 2710e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2711e0dac50fSopenharmony_ci} 2712e0dac50fSopenharmony_ci 2713e0dac50fSopenharmony_ci/** 2714e0dac50fSopenharmony_ci * @tc.name: SetTitleButtonVisible 2715e0dac50fSopenharmony_ci * @tc.desc: SetTitleButtonVisible 2716e0dac50fSopenharmony_ci * @tc.type: FUNC 2717e0dac50fSopenharmony_ci*/ 2718e0dac50fSopenharmony_ciHWTEST_F(WindowTest, SetTitleButtonVisible, Function | SmallTest | Level2) 2719e0dac50fSopenharmony_ci{ 2720e0dac50fSopenharmony_ci sptr<Window> window = new (std::nothrow) Window(); 2721e0dac50fSopenharmony_ci ASSERT_NE(window, nullptr); 2722e0dac50fSopenharmony_ci WMError res = window->SetTitleButtonVisible(true, true, true, true); 2723e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2724e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(false, true, true, true); 2725e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2726e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(true, false, true, true); 2727e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2728e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(true, true, false, true); 2729e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2730e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(false, false, true, true); 2731e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2732e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(false, true, false, true); 2733e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2734e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(true, false, false, true); 2735e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2736e0dac50fSopenharmony_ci res = window->SetTitleButtonVisible(false, false, false, true); 2737e0dac50fSopenharmony_ci ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT); 2738e0dac50fSopenharmony_ci} 2739e0dac50fSopenharmony_ci 2740e0dac50fSopenharmony_ci/** 2741e0dac50fSopenharmony_ci * @tc.name: GetWindowStatus 2742e0dac50fSopenharmony_ci * @tc.desc: GetWindowStatus 2743e0dac50fSopenharmony_ci * @tc.type: FUNC 2744e0dac50fSopenharmony_ci */ 2745e0dac50fSopenharmony_ciHWTEST_F(WindowTest, GetWindowStatus, Function | SmallTest | Level2) 2746e0dac50fSopenharmony_ci{ 2747e0dac50fSopenharmony_ci sptr<Window> window = new (std::nothrow) Window(); 2748e0dac50fSopenharmony_ci ASSERT_NE(window, nullptr); 2749e0dac50fSopenharmony_ci WindowStatus windowStatus; 2750e0dac50fSopenharmony_ci auto ret = window->GetWindowStatus(windowStatus); 2751e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2752e0dac50fSopenharmony_ci ASSERT_EQ(WMError::WM_OK, window->Destroy()); 2753e0dac50fSopenharmony_ci} 2754e0dac50fSopenharmony_ci 2755e0dac50fSopenharmony_ci/** 2756e0dac50fSopenharmony_ci * @tc.name: IsPcOrPadCapabilityEnabled 2757e0dac50fSopenharmony_ci * @tc.desc: IsPcOrPadCapabilityEnabled 2758e0dac50fSopenharmony_ci * @tc.type: FUNC 2759e0dac50fSopenharmony_ci */ 2760e0dac50fSopenharmony_ciHWTEST_F(WindowTest, IsPcOrPadCapabilityEnabled, Function | SmallTest | Level2) 2761e0dac50fSopenharmony_ci{ 2762e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 2763e0dac50fSopenharmony_ci ASSERT_NE(window, nullptr); 2764e0dac50fSopenharmony_ci auto ret = window->IsPcOrPadCapabilityEnabled(); 2765e0dac50fSopenharmony_ci EXPECT_EQ(false, ret); 2766e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_OK, window->Destroy()); 2767e0dac50fSopenharmony_ci} 2768e0dac50fSopenharmony_ci 2769e0dac50fSopenharmony_ci/** 2770e0dac50fSopenharmony_ci * @tc.name: RegisterMainWindowCloseListeners 2771e0dac50fSopenharmony_ci * @tc.desc: RegisterMainWindowCloseListeners 2772e0dac50fSopenharmony_ci * @tc.type: FUNC 2773e0dac50fSopenharmony_ci */ 2774e0dac50fSopenharmony_ciHWTEST_F(WindowTest, RegisterMainWindowCloseListeners, Function | SmallTest | Level2) 2775e0dac50fSopenharmony_ci{ 2776e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 2777e0dac50fSopenharmony_ci ASSERT_NE(window, nullptr); 2778e0dac50fSopenharmony_ci sptr<IMainWindowCloseListener> listener = sptr<IMainWindowCloseListener>::MakeSptr(); 2779e0dac50fSopenharmony_ci auto ret = window->RegisterMainWindowCloseListeners(listener); 2780e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2781e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_OK, window->Destroy()); 2782e0dac50fSopenharmony_ci} 2783e0dac50fSopenharmony_ci 2784e0dac50fSopenharmony_ci/** 2785e0dac50fSopenharmony_ci * @tc.name: UnregisterMainWindowCloseListeners 2786e0dac50fSopenharmony_ci * @tc.desc: UnregisterMainWindowCloseListeners 2787e0dac50fSopenharmony_ci * @tc.type: FUNC 2788e0dac50fSopenharmony_ci */ 2789e0dac50fSopenharmony_ciHWTEST_F(WindowTest, UnregisterMainWindowCloseListeners, Function | SmallTest | Level2) 2790e0dac50fSopenharmony_ci{ 2791e0dac50fSopenharmony_ci sptr<Window> window = sptr<Window>::MakeSptr(); 2792e0dac50fSopenharmony_ci ASSERT_NE(window, nullptr); 2793e0dac50fSopenharmony_ci sptr<IMainWindowCloseListener> listener = sptr<IMainWindowCloseListener>::MakeSptr(); 2794e0dac50fSopenharmony_ci auto ret = window->UnregisterMainWindowCloseListeners(listener); 2795e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); 2796e0dac50fSopenharmony_ci EXPECT_EQ(WMError::WM_OK, window->Destroy()); 2797e0dac50fSopenharmony_ci} 2798e0dac50fSopenharmony_ci 2799e0dac50fSopenharmony_ci/** 2800e0dac50fSopenharmony_ci * @tc.name: Marshalling 2801e0dac50fSopenharmony_ci * @tc.desc: Marshalling 2802e0dac50fSopenharmony_ci * @tc.type: FUNC 2803e0dac50fSopenharmony_ci */ 2804e0dac50fSopenharmony_ciHWTEST_F(WindowTest, Marshalling, Function | SmallTest | Level2) 2805e0dac50fSopenharmony_ci{ 2806e0dac50fSopenharmony_ci OccupiedAreaType type = OccupiedAreaType::TYPE_INPUT; 2807e0dac50fSopenharmony_ci Rect rect = { 0, 0, 0, 0 }; 2808e0dac50fSopenharmony_ci auto safeHeight = 0; 2809e0dac50fSopenharmony_ci auto textFieldPositionY = 0.0; 2810e0dac50fSopenharmony_ci auto textFieldHeight = 0.0; 2811e0dac50fSopenharmony_ci sptr<OccupiedAreaChangeInfo> info = sptr<OccupiedAreaChangeInfo>::MakeSptr(type, rect, safeHeight, 2812e0dac50fSopenharmony_ci textFieldPositionY, textFieldHeight); 2813e0dac50fSopenharmony_ci ASSERT_NE(info, nullptr); 2814e0dac50fSopenharmony_ci Parcel parcel; 2815e0dac50fSopenharmony_ci auto ret = info->Marshalling(parcel); 2816e0dac50fSopenharmony_ci EXPECT_EQ(true, ret); 2817e0dac50fSopenharmony_ci} 2818e0dac50fSopenharmony_ci} 2819e0dac50fSopenharmony_ci} // namespace Rosen 2820e0dac50fSopenharmony_ci} // namespace OHOS