1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "test/mock/base/mock_task_executor.h" 17 #include "test/unittest/core/base/view_abstract_test_ng.h" 18 19 using namespace testing; 20 using namespace testing::ext; 21 22 namespace OHOS::Ace::NG { 23 /** 24 * @tc.name: ViewAbstractTest031 25 * @tc.desc: Test the operation of View_Abstract 26 * @tc.type: FUNC 27 */ 28 29 /** 30 * @tc.name: SetPixelRoundTest 31 * @tc.desc: Test the operation of SetPixelRound. 32 * @tc.type: FUNC 33 */ 34 HWTEST_F(ViewAbstractTestNg, SetPixelRoundTest, TestSize.Level1) 35 { 36 /** 37 * @tc.steps: step1. Create a FrameNode object. 38 * @tc.steps: step2. Call SetPixelRound with value 2. 39 * @tc.expected: The PixelRound property of the FrameNode is set to 0. 40 */ 41 ViewStackProcessor viewStackProcessor; 42 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 43 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 44 uint8_t value = 2; 45 ViewAbstract::SetPixelRound(AceType::RawPtr(frameNode), value); 46 ASSERT_EQ(frameNode->GetLayoutProperty()->GetPixelRound(), value); 47 } 48 49 /** 50 * @tc.name: SetDashGapTest 51 * @tc.desc: Test the operation of SetDashGap method. 52 * @tc.type: FUNC 53 */ 54 HWTEST_F(ViewAbstractTestNg, SetDashGapTest, TestSize.Level1) 55 { 56 /** 57 * @tc.steps: Build a object viewAbstract and set visual state. 58 */ 59 ViewStackProcessor viewStackProcessor; 60 int32_t index = 1; 61 auto state = static_cast<VisualState>(index); 62 viewStackProcessor.GetInstance()->SetVisualState(state); 63 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 64 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 65 ASSERT_NE(frameNode, nullptr); 66 67 /** 68 * @tc.steps: Build a object viewAbstract and set visual state. 69 * @tc.expected: The value is not changed. 70 */ 71 ViewAbstract::SetDashGap(Dimension(3)); 72 ASSERT_NE(frameNode->GetRenderContext()->GetDashGap()->rightDimen, Dimension(3)); 73 74 /** 75 * @tc.steps: Set visual state to null and SetDashGap 76 * @tc.expected: The value is changed as expected. 77 */ 78 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 79 ViewAbstract::SetDashGap(Dimension(4)); 80 ASSERT_EQ(frameNode->GetRenderContext()->GetDashGap()->rightDimen, Dimension(4)); 81 } 82 83 /** 84 * @tc.name: SetDashGapWithFrameNodeTest 85 * @tc.desc: Test the operation of SetDashGap method with FrameNode. 86 * @tc.type: FUNC 87 */ 88 HWTEST_F(ViewAbstractTestNg, SetDashGapWithFrameNodeTest, TestSize.Level1) 89 { 90 /** 91 * @tc.steps: Build a object viewAbstract and set visual state. 92 */ 93 ViewStackProcessor viewStackProcessor; 94 int32_t index = 1; 95 auto state = static_cast<VisualState>(index); 96 viewStackProcessor.GetInstance()->SetVisualState(state); 97 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 98 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 99 ASSERT_NE(frameNode, nullptr); 100 101 /** 102 * @tc.steps: Set visual state to null and SetDashGap 103 * @tc.expected: The value is changed as expected. 104 */ 105 ViewAbstract::SetDashGap(AceType::RawPtr(frameNode), Dimension(2)); 106 auto dashGapOpt = frameNode->GetRenderContext()->GetDashGap(); 107 ASSERT_EQ(dashGapOpt->rightDimen, Dimension(2)); 108 } 109 110 /** 111 * @tc.name: SetDashGapWithBorderWidthPropertyTest 112 * @tc.desc: Test the operation of SetDashGap method with BorderWidthProperty. 113 * @tc.type: FUNC 114 */ 115 HWTEST_F(ViewAbstractTestNg, SetDashGapWithBorderWidthPropertyTest, TestSize.Level1) 116 { 117 /** 118 * @tc.steps: Build a object viewAbstract and set visual state. 119 */ 120 ViewStackProcessor viewStackProcessor; 121 int32_t index = 1; 122 auto state = static_cast<VisualState>(index); 123 viewStackProcessor.GetInstance()->SetVisualState(state); 124 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 125 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 126 ASSERT_NE(frameNode, nullptr); 127 128 /** 129 * @tc.steps: Build a object dashGap . 130 */ 131 BorderWidthProperty dashGap1; 132 dashGap1.SetBorderWidth(Dimension(3)); 133 134 /** 135 * @tc.steps: SetDashGap. 136 * @tc.expected: The value is not changed. 137 */ 138 ViewAbstract::SetDashGap(dashGap1); 139 ASSERT_NE(frameNode->GetRenderContext()->GetDashGap()->rightDimen, Dimension(3)); 140 141 /** 142 * @tc.steps: Set visual state to null and SetDashGap 143 * @tc.expected: The value is changed as expected. 144 */ 145 BorderWidthProperty dashGap2; 146 dashGap2.SetBorderWidth(Dimension(2)); 147 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 148 ViewAbstract::SetDashGap(dashGap2); 149 ASSERT_EQ(frameNode->GetRenderContext()->GetDashGap()->rightDimen, Dimension(2)); 150 } 151 152 /** 153 * @tc.name: SetDashGapWithFrameNodePropertyTest 154 * @tc.desc: Test the operation of SetDashGap method with FrameNode. 155 * @tc.type: FUNC 156 */ 157 HWTEST_F(ViewAbstractTestNg, SetDashGapWithFrameNodePropertyTest, TestSize.Level1) 158 { 159 /** 160 * @tc.steps: Build a object viewAbstract and set visual state. 161 */ 162 ViewStackProcessor viewStackProcessor; 163 int32_t index = 1; 164 auto state = static_cast<VisualState>(index); 165 viewStackProcessor.GetInstance()->SetVisualState(state); 166 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 167 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 168 ASSERT_NE(frameNode, nullptr); 169 170 /** 171 * @tc.steps: Set visual state to null and SetDashGap 172 * @tc.expected: The value is changed as expected. 173 */ 174 BorderWidthProperty dashGap; 175 dashGap.SetBorderWidth(Dimension(2)); 176 ViewAbstract::SetDashGap(AceType::RawPtr(frameNode), dashGap); 177 auto dashGapOpt = frameNode->GetRenderContext()->GetDashGap(); 178 ASSERT_EQ(dashGapOpt->rightDimen, Dimension(2)); 179 } 180 181 /** 182 * @tc.name: SetDashWidthFrameNodePropertyTest 183 * @tc.desc: Test the operation of SetDashGap method with FrameNode. 184 * @tc.type: FUNC 185 */ 186 HWTEST_F(ViewAbstractTestNg, SetDashWidthFrameNodePropertyTest, TestSize.Level1) 187 { 188 /** 189 * @tc.steps: Build a object viewAbstract and set visual state. 190 */ 191 ViewStackProcessor viewStackProcessor; 192 int32_t index = 1; 193 auto state = static_cast<VisualState>(index); 194 viewStackProcessor.GetInstance()->SetVisualState(state); 195 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 196 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 197 ASSERT_NE(frameNode, nullptr); 198 199 /** 200 * @tc.steps: Set visual state to null and SetDashGap 201 * @tc.expected: The value is changed as expected. 202 */ 203 BorderWidthProperty dashGap; 204 dashGap.SetBorderWidth(Dimension(2)); 205 ViewAbstract::SetDashWidth(AceType::RawPtr(frameNode), dashGap); 206 auto dashGapOpt = frameNode->GetRenderContext()->GetDashWidth(); 207 ASSERT_EQ(dashGapOpt->rightDimen, Dimension(2)); 208 } 209 210 /** 211 * @tc.name: SetDashWidthWithDimensionTest 212 * @tc.desc: Test the operation of SetDashWidth method with Dimension. 213 * @tc.type: FUNC 214 */ 215 HWTEST_F(ViewAbstractTestNg, SetDashWidthWithDimensionTest, TestSize.Level1) 216 { 217 /** 218 * @tc.steps: Build a object viewAbstract and set visual state. 219 */ 220 ViewStackProcessor viewStackProcessor; 221 int32_t index = 1; 222 auto state = static_cast<VisualState>(index); 223 viewStackProcessor.GetInstance()->SetVisualState(state); 224 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 225 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 226 ASSERT_NE(frameNode, nullptr); 227 228 /** 229 * @tc.steps: Build a object viewAbstract and set visual state. 230 * @tc.expected: The value is not changed. 231 */ 232 ViewAbstract::SetDashWidth(Dimension(3)); 233 ASSERT_NE(frameNode->GetRenderContext()->GetDashWidth()->rightDimen, Dimension(3)); 234 235 /** 236 * @tc.steps: Set visual state to null and SetDashGap 237 * @tc.expected: The value is changed as expected. 238 */ 239 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 240 ViewAbstract::SetDashWidth(Dimension(4)); 241 ASSERT_EQ(frameNode->GetRenderContext()->GetDashWidth()->rightDimen, Dimension(4)); 242 } 243 244 /** 245 * @tc.name: SetDashWidthWithFrameNodeAndDimensionTest 246 * @tc.desc: Test the operation of SetDashWidth method with FrameNode and Dimension. 247 * @tc.type: FUNC 248 */ 249 HWTEST_F(ViewAbstractTestNg, SetDashWidthWithFrameNodeAndDimensionTest, TestSize.Level1) 250 { 251 /** 252 * @tc.steps: Build a object viewAbstract and set visual state. 253 */ 254 ViewStackProcessor viewStackProcessor; 255 int32_t index = 1; 256 auto state = static_cast<VisualState>(index); 257 viewStackProcessor.GetInstance()->SetVisualState(state); 258 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 259 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 260 ASSERT_NE(frameNode, nullptr); 261 262 /** 263 * @tc.steps: Set visual state to null and SetDashGap 264 * @tc.expected: The value is changed as expected. 265 */ 266 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 267 ViewAbstract::SetDashWidth(AceType::RawPtr(frameNode), Dimension(2)); 268 ASSERT_EQ(frameNode->GetRenderContext()->GetDashWidth()->rightDimen, Dimension(2)); 269 } 270 271 /** 272 * @tc.name: SetDashWidthWithBorderWidthPropertyTest 273 * @tc.desc: Test the operation of SetDashWidth method with BorderWidthProperty. 274 * @tc.type: FUNC 275 */ 276 HWTEST_F(ViewAbstractTestNg, SetDashWidthWithBorderWidthPropertyTest, TestSize.Level1) 277 { 278 /** 279 * @tc.steps: Build a object viewAbstract and set visual state. 280 */ 281 ViewStackProcessor viewStackProcessor; 282 int32_t index = 1; 283 auto state = static_cast<VisualState>(index); 284 viewStackProcessor.GetInstance()->SetVisualState(state); 285 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 286 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 287 ASSERT_NE(frameNode, nullptr); 288 289 BorderWidthProperty dashGap1; 290 dashGap1.SetBorderWidth(Dimension(2)); 291 292 /** 293 * @tc.steps: Build a object viewAbstract and set visual state. 294 * @tc.expected: The value is not changed. 295 */ 296 ViewAbstract::SetDashWidth(dashGap1); 297 ASSERT_NE(frameNode->GetRenderContext()->GetDashWidth()->rightDimen, Dimension(2)); 298 299 /** 300 * @tc.steps: Set visual state to null and check the current visual state process 301 * @tc.expected: The value is changed as expected. 302 */ 303 BorderWidthProperty dashGap2; 304 dashGap2.SetBorderWidth(Dimension(3)); 305 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 306 ViewAbstract::SetDashWidth(dashGap2); 307 ASSERT_EQ(frameNode->GetRenderContext()->GetDashWidth()->rightDimen, Dimension(3)); 308 } 309 310 /** 311 * @tc.name: ViewAbstractDisableOnAttachTest 312 * @tc.desc: Test the operation of View_Abstract. 313 * @tc.type: FUNC 314 */ 315 HWTEST_F(ViewAbstractTestNg, ViewAbstractDisableOnAttachTest, TestSize.Level1) 316 { 317 /** 318 * @tc.steps: step1. create framenode and check callback; 319 * @tc.expected: callback is not null. 320 */ 321 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 322 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 323 324 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 325 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 326 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 327 ASSERT_NE(frameNode, nullptr); 328 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 329 ASSERT_NE(node, nullptr); __anon9dd70e980102() 330 std::function<void()> onAttachCallback = []() {}; 331 ViewAbstract::SetOnAttach(AceType::RawPtr(node), std::move(onAttachCallback)); 332 auto eventHub = node->GetEventHub<EventHub>(); 333 auto& callback = eventHub->onAttach_; 334 EXPECT_NE(callback, nullptr); 335 336 /** 337 * @tc.steps: step2. Disable callback. 338 * @tc.expected: callback is null. 339 */ 340 ViewAbstract::DisableOnAttach(); 341 EXPECT_EQ(callback, nullptr); 342 } 343 344 /** 345 * @tc.name: ViewAbstractDisableOnDetachTest 346 * @tc.desc: Test the operation of View_Abstract. 347 * @tc.type: FUNC 348 */ 349 HWTEST_F(ViewAbstractTestNg, ViewAbstractDisableOnDetachTest, TestSize.Level1) 350 { 351 /** 352 * @tc.steps: step1. create framenode and check callback; 353 * @tc.expected: callback is not null. 354 */ 355 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 356 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 357 358 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 359 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 360 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 361 ASSERT_NE(frameNode, nullptr); 362 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 363 ASSERT_NE(node, nullptr); __anon9dd70e980202() 364 std::function<void()> onDetachCallback = []() {}; 365 ViewAbstract::SetOnDetach(AceType::RawPtr(node), std::move(onDetachCallback)); 366 auto eventHub = node->GetEventHub<EventHub>(); 367 auto& callback = eventHub->onDetach_; 368 EXPECT_NE(callback, nullptr); 369 370 /** 371 * @tc.steps: step2. Disable callback. 372 * @tc.expected: callback is null. 373 */ 374 ViewAbstract::DisableOnDetach(); 375 EXPECT_EQ(callback, nullptr); 376 } 377 378 /** 379 * @tc.name: ViewAbstractDisableOnAttachByFrameNodeTest 380 * @tc.desc: Test the operation of View_Abstract. 381 * @tc.type: FUNC 382 */ 383 HWTEST_F(ViewAbstractTestNg, ViewAbstractDisableOnAttachByFrameNodeTest, TestSize.Level1) 384 { 385 /** 386 * @tc.steps: step1. create framenode and check callback; 387 * @tc.expected: callback is not null. 388 */ 389 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 390 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 391 392 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 393 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 394 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 395 ASSERT_NE(frameNode, nullptr); 396 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 397 ASSERT_NE(node, nullptr); __anon9dd70e980302() 398 std::function<void()> onAttachCallback = []() {}; 399 ViewAbstract::SetOnAttach(AceType::RawPtr(node), std::move(onAttachCallback)); 400 auto eventHub = node->GetEventHub<EventHub>(); 401 auto& callback = eventHub->onAttach_; 402 EXPECT_NE(callback, nullptr); 403 404 /** 405 * @tc.steps: step2. Disable callback. 406 * @tc.expected: callback is null. 407 */ 408 ViewAbstract::DisableOnAttach(AceType::RawPtr(node)); 409 EXPECT_EQ(callback, nullptr); 410 } 411 412 /** 413 * @tc.name: ViewAbstractDisableOnDetachByFrameNodeTest 414 * @tc.desc: Test the operation of View_Abstract. 415 * @tc.type: FUNC 416 */ 417 HWTEST_F(ViewAbstractTestNg, ViewAbstractDisableOnDetachByFrameNodeTest, TestSize.Level1) 418 { 419 /** 420 * @tc.steps: step1. create framenode and check callback; 421 * @tc.expected: callback is not null. 422 */ 423 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 424 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 425 426 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 427 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 428 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 429 ASSERT_NE(frameNode, nullptr); 430 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 431 ASSERT_NE(node, nullptr); __anon9dd70e980402() 432 std::function<void()> onDetachCallback = []() {}; 433 ViewAbstract::SetOnDetach(AceType::RawPtr(node), std::move(onDetachCallback)); 434 auto eventHub = node->GetEventHub<EventHub>(); 435 auto& callback = eventHub->onDetach_; 436 EXPECT_NE(callback, nullptr); 437 438 /** 439 * @tc.steps: step2. Disable callback. 440 * @tc.expected: callback is null. 441 */ 442 ViewAbstract::DisableOnDetach(AceType::RawPtr(node)); 443 EXPECT_EQ(callback, nullptr); 444 } 445 446 /** 447 * @tc.name: ViewAbstractTouchIntercept001 448 * @tc.desc: Test setting touch intercept function on a specific frame node 449 * @tc.type: FUNC 450 */ 451 HWTEST_F(ViewAbstractTestNg, ViewAbstractTouchIntercept001, TestSize.Level1) 452 { 453 /** 454 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 455 */ 456 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 457 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 458 ASSERT_NE(frameNode, nullptr); 459 TouchInterceptFunc touchInterceptFunc; 460 ViewAbstract::SetOnTouchIntercept(std::move(touchInterceptFunc)); 461 462 /** 463 * @tc.steps: step2. Verify that the touch intercept function has been set. 464 * @tc.expected: The touch intercept function should be set correctly. 465 */ 466 auto gestureHub = frameNode->GetOrCreateGestureEventHub(); 467 ASSERT_NE(gestureHub, nullptr); 468 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 469 } 470 471 /** 472 * @tc.name: ViewAbstractTouchIntercept002 473 * @tc.desc: Test setting touch intercept function on the main frame node 474 * @tc.type: FUNC 475 */ 476 HWTEST_F(ViewAbstractTestNg, ViewAbstractTouchIntercept002, TestSize.Level1) 477 { 478 /** 479 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 480 */ 481 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 482 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 483 ASSERT_NE(frameNode, nullptr); 484 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 485 ASSERT_NE(node, nullptr); 486 TouchInterceptFunc touchInterceptFunc; 487 ViewAbstract::SetOnTouchIntercept(AceType::RawPtr(node), std::move(touchInterceptFunc)); 488 489 /** 490 * @tc.steps: step2. Verify that the touch intercept function has been set. 491 * @tc.expected: The touch intercept function should be set correctly. 492 */ 493 auto gestureHub = frameNode->GetOrCreateGestureEventHub(); 494 ASSERT_NE(gestureHub, nullptr); 495 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 496 } 497 498 /** 499 * @tc.name: ViewAbstractRecognizerParallel001 500 * @tc.desc: Test setting ShouldBuiltInRecognizerParallelWith function 501 * @tc.type: FUNC 502 */ 503 HWTEST_F(ViewAbstractTestNg, ViewAbstractRecognizerParallel001, TestSize.Level1) 504 { 505 /** 506 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 507 */ 508 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 509 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 510 ASSERT_NE(frameNode, nullptr); 511 512 NG::ShouldBuiltInRecognizerParallelWithFunc shouldBuiltInRecognizerParallelWithFunc; 513 ViewAbstract::SetShouldBuiltInRecognizerParallelWith(std::move(shouldBuiltInRecognizerParallelWithFunc)); 514 515 /** 516 * @tc.steps: step2. Verify that the touch intercept function has been set. 517 * @tc.expected: The touch intercept function should be set correctly. 518 */ 519 auto gestureHub = frameNode->GetOrCreateGestureEventHub(); 520 ASSERT_NE(gestureHub, nullptr); 521 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 522 } 523 524 /** 525 * @tc.name: ViewAbstractGestureRecognizerJudge001 526 * @tc.desc: Test setting OnGestureRecognizerJudgeBegin function 527 * @tc.type: FUNC 528 */ 529 HWTEST_F(ViewAbstractTestNg, ViewAbstractGestureRecognizerJudge001, TestSize.Level1) 530 { 531 /** 532 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 533 */ 534 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 535 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 536 ASSERT_NE(frameNode, nullptr); 537 538 GestureRecognizerJudgeFunc gestureRecognizerJudgeFunc; 539 ViewAbstract::SetOnGestureRecognizerJudgeBegin(std::move(gestureRecognizerJudgeFunc), false); 540 541 /** 542 * @tc.steps: step2. Verify that the touch intercept function has been set. 543 * @tc.expected: The touch intercept function should be set correctly. 544 */ 545 auto gestureHub = frameNode->GetOrCreateGestureEventHub(); 546 ASSERT_NE(gestureHub, nullptr); 547 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 548 } 549 550 /** 551 * @tc.name: ViewAbstractOnTouchTest001 552 * @tc.desc: Test setting OnTouchTest function 553 * @tc.type: FUNC 554 */ 555 HWTEST_F(ViewAbstractTestNg, ViewAbstractOnTouchTest001, TestSize.Level1) 556 { 557 /** 558 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 559 */ 560 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 561 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 562 ASSERT_NE(frameNode, nullptr); 563 564 NG::OnChildTouchTestFunc onChildTouchTest; 565 ViewAbstract::SetOnTouchTestFunc(std::move(onChildTouchTest)); 566 567 /** 568 * @tc.steps: step2. Verify that the touch intercept function has been set. 569 * @tc.expected: The touch intercept function should be set correctly. 570 */ 571 auto gestureHub = frameNode->GetOrCreateGestureEventHub(); 572 ASSERT_NE(gestureHub, nullptr); 573 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 574 } 575 576 /** 577 * @tc.name: ViewAbstractFocusBoxStyle001 578 * @tc.desc: Test setting focus box style 579 * @tc.type: FUNC 580 */ 581 HWTEST_F(ViewAbstractTestNg, ViewAbstractFocusBoxStyle001, TestSize.Level1) 582 { 583 /** 584 * @tc.steps: step1. Create a new frame node and set the touch intercept function. 585 */ 586 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 587 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 588 ASSERT_NE(frameNode, nullptr); 589 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 590 ASSERT_NE(node, nullptr); 591 592 NG::FocusBoxStyle style; 593 ViewAbstract::SetFocusBoxStyle(std::move(style)); 594 595 /** 596 * @tc.steps: step2. Verify that the touch intercept function has been set. 597 * @tc.expected: The touch intercept function should be set correctly. 598 */ 599 auto focusHub = ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub(); 600 ASSERT_NE(focusHub, nullptr); 601 EXPECT_NE(ViewStackProcessor::GetInstance()->GetMainElementNode(), nullptr); 602 } 603 604 /** 605 * @tc.name: ViewAbstractFocusScopeId001 606 * @tc.desc: Test setting focus scope ID 607 * @tc.type: FUNC 608 */ 609 HWTEST_F(ViewAbstractTestNg, ViewAbstractFocusScopeId001, TestSize.Level1) 610 { 611 /** 612 * @tc.steps: step1. Push main frame node and set the focus scope ID. 613 */ 614 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 615 std::string focusScopeId = "focusScope1"; 616 bool isGroup = true; 617 ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub()->focusType_ = FocusType::SCOPE; 618 ViewAbstract::SetFocusScopeId(focusScopeId, isGroup, true); 619 620 /** 621 * @tc.steps: step2. Verify that the focus scope ID has been set. 622 * @tc.expected: The focus scope ID should be set correctly. 623 */ 624 auto focusHub = ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub(); 625 ASSERT_NE(focusHub, nullptr); 626 EXPECT_EQ(focusHub->focusScopeId_, focusScopeId); 627 628 /** 629 * @tc.steps: step3. Finish view stack. 630 */ 631 ViewStackProcessor::GetInstance()->Finish(); 632 } 633 634 /** 635 * @tc.name: ViewAbstractFocusScopePriority001 636 * @tc.desc: Test setting focus scope priority 637 * @tc.type: FUNC 638 */ 639 HWTEST_F(ViewAbstractTestNg, ViewAbstractFocusScopePriority001, TestSize.Level1) 640 { 641 /** 642 * @tc.steps: step1. Push main frame node and set the focus scope priority. 643 */ 644 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 645 std::string focusScopeId = "focusScope1"; 646 uint32_t focusPriority = 1; 647 ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub()->isFocusScope_ = true; 648 ViewAbstract::SetFocusScopePriority(focusScopeId, focusPriority); 649 650 /** 651 * @tc.steps: step2. Verify that the focus scope priority has been set. 652 * @tc.expected: The focus scope priority should be set correctly. 653 */ 654 auto focusHub = ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub(); 655 ASSERT_NE(focusHub, nullptr); 656 EXPECT_EQ(focusHub->focusScopeId_, focusScopeId); 657 658 /** 659 * @tc.steps: step3. Finish view stack. 660 */ 661 ViewStackProcessor::GetInstance()->Finish(); 662 } 663 664 /** 665 * @tc.name: ViewAbstractFocusScopeIdWithFrameNode001 666 * @tc.desc: Test setting focus scope ID with frame node 667 * @tc.type: FUNC 668 */ 669 HWTEST_F(ViewAbstractTestNg, ViewAbstractFocusScopeIdWithFrameNode001, TestSize.Level1) 670 { 671 /** 672 * @tc.steps: step1. Create a new frame node and set the focus scope ID. 673 */ 674 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 675 auto frameNode = AceType::DynamicCast<FrameNode>(ViewStackProcessor::GetInstance()->Finish()); 676 std::string focusScopeId = "focusScope2"; 677 bool isGroup = true; 678 ViewStackProcessor::GetInstance()->GetOrCreateMainFrameNodeFocusHub()->focusType_ = FocusType::SCOPE; 679 ViewAbstract::SetFocusScopeId(AceType::RawPtr(frameNode), focusScopeId, isGroup, true); 680 681 /** 682 * @tc.steps: step2. Verify that the focus scope ID has been set. 683 * @tc.expected: The focus scope ID should be set correctly. 684 */ 685 auto focusHub = frameNode->GetOrCreateFocusHub(); 686 ASSERT_NE(focusHub, nullptr); 687 688 /** 689 * @tc.steps: step3. Finish view stack. 690 */ 691 ViewStackProcessor::GetInstance()->Finish(); 692 } 693 694 /** 695 * @tc.name: ViewAbstractFocusScopePriorityWithFrameNode001 696 * @tc.desc: Test setting focus scope priority with frame node 697 * @tc.type: FUNC 698 */ 699 HWTEST_F(ViewAbstractTestNg, ViewAbstractFocusScopePriorityWithFrameNode001, TestSize.Level1) 700 { 701 /** 702 * @tc.steps: step1. Create a new frame node and set the focus scope priority. 703 */ 704 auto frameNode = AceType::DynamicCast<FrameNode>(ViewStackProcessor::GetInstance()->Finish()); 705 std::string focusScopeId = "focusScope2"; 706 uint32_t focusPriority = 2; 707 ViewAbstract::SetFocusScopePriority(AceType::RawPtr(frameNode), focusScopeId, focusPriority); 708 709 /** 710 * @tc.steps: step2. Verify that the focus scope priority has been set. 711 * @tc.expected: The focus scope priority should be set correctly. 712 */ 713 auto focusHub = frameNode->GetOrCreateFocusHub(); 714 ASSERT_NE(focusHub, nullptr); 715 EXPECT_EQ(focusHub->focusScopeId_, focusScopeId); 716 717 /** 718 * @tc.steps: step3. Finish view stack. 719 */ 720 ViewStackProcessor::GetInstance()->Finish(); 721 } 722 723 /** 724 * @tc.name: ViewAbstractOnAttach001 725 * @tc.desc: Test setting onAttach function 726 * @tc.type: FUNC 727 */ 728 HWTEST_F(ViewAbstractTestNg, ViewAbstractOnAttach001, TestSize.Level1) 729 { 730 /** 731 * @tc.steps: step1. create framenode and check callback; 732 * @tc.expected: callback is not null. 733 */ 734 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 735 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 736 737 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 738 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 739 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 740 ASSERT_NE(frameNode, nullptr); 741 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 742 ASSERT_NE(node, nullptr); __anon9dd70e980502() 743 std::function<void()> onAttachCallback = []() {}; 744 ViewAbstract::SetOnAttach(AceType::RawPtr(node), std::move(onAttachCallback)); 745 auto eventHub = node->GetEventHub<EventHub>(); 746 auto& callback = eventHub->onAttach_; 747 EXPECT_NE(callback, nullptr); 748 749 /** 750 * @tc.steps: step2. Disable callback. 751 * @tc.expected: callback is null. 752 */ 753 ViewAbstract::DisableOnAttach(AceType::RawPtr(node)); 754 EXPECT_EQ(callback, nullptr); 755 756 /** 757 * @tc.steps: step3. Finish view stack. 758 */ 759 ViewStackProcessor::GetInstance()->Finish(); 760 } 761 762 /** 763 * @tc.name: ViewAbstractOnDetach001 764 * @tc.desc: Test setting onDetach function 765 * @tc.type: FUNC 766 */ 767 HWTEST_F(ViewAbstractTestNg, ViewAbstractOnDetach001, TestSize.Level1) 768 { 769 /** 770 * @tc.steps: step1. create framenode and check callback; 771 * @tc.expected: callback is not null. 772 */ 773 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 774 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 775 776 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 777 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 778 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 779 ASSERT_NE(frameNode, nullptr); 780 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 781 ASSERT_NE(node, nullptr); __anon9dd70e980602() 782 std::function<void()> onDetachCallback = []() {}; 783 ViewAbstract::SetOnDetach(std::move(onDetachCallback)); 784 auto eventHub = node->GetEventHub<EventHub>(); 785 auto& callback = eventHub->onDetach_; 786 EXPECT_NE(callback, nullptr); 787 788 /** 789 * @tc.steps: step2. Disable callback. 790 * @tc.expected: callback is null. 791 */ 792 ViewAbstract::DisableOnDetach(AceType::RawPtr(node)); 793 EXPECT_EQ(callback, nullptr); 794 795 /** 796 * @tc.steps: step3. Finish view stack. 797 */ 798 ViewStackProcessor::GetInstance()->Finish(); 799 } 800 801 /** 802 * @tc.name: ViewAbstractOnAttach002 803 * @tc.desc: Test setting onAttach callback 804 * @tc.type: FUNC 805 */ 806 HWTEST_F(ViewAbstractTestNg, ViewAbstractOnAttach002, TestSize.Level1) 807 { 808 /** 809 * @tc.steps: step1. create framenode and check callback; 810 * @tc.expected: callback is not null. 811 */ 812 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 813 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_CHILD); 814 815 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 816 EXPECT_EQ(strcmp(topFrameNodeOne->GetTag().c_str(), TAG_CHILD), 0); 817 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 818 ASSERT_NE(frameNode, nullptr); 819 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 820 ASSERT_NE(node, nullptr); __anon9dd70e980702() 821 std::function<void()> onAttachCallback = []() {}; 822 ViewAbstract::SetOnAttach(std::move(onAttachCallback)); 823 auto eventHub = node->GetEventHub<EventHub>(); 824 auto& callback = eventHub->onAttach_; 825 EXPECT_NE(callback, nullptr); 826 827 /** 828 * @tc.steps: step2. Disable callback. 829 * @tc.expected: callback is null. 830 */ 831 ViewAbstract::DisableOnAttach(AceType::RawPtr(node)); 832 EXPECT_EQ(callback, nullptr); 833 834 /** 835 * @tc.steps: step3. Finish view stack. 836 */ 837 ViewStackProcessor::GetInstance()->Finish(); 838 } 839 840 /** 841 * @tc.name: ViewAbstractBgDynamicBrightness001 842 * @tc.desc: Test setting background dynamic brightness option 843 * @tc.type: FUNC 844 */ 845 HWTEST_F(ViewAbstractTestNg, ViewAbstractBgDynamicBrightness001, TestSize.Level1) 846 { 847 /** 848 * @tc.steps: Build a object viewAbstract and set visual state. 849 */ 850 ViewStackProcessor viewStackProcessor; 851 int32_t index = 1; 852 auto state = static_cast<VisualState>(index); 853 viewStackProcessor.GetInstance()->SetVisualState(state); 854 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 855 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 856 ASSERT_NE(frameNode, nullptr); 857 858 /** 859 * @tc.steps: Build a object viewAbstract and set visual state. 860 * @tc.expected: The foreground effect is not changed. 861 */ 862 BrightnessOption brightnessOption; 863 ViewAbstract::SetBgDynamicBrightness(brightnessOption); 864 ASSERT_FALSE(frameNode->GetRenderContext()->GetBgDynamicBrightnessOption().has_value()); 865 866 /** 867 * @tc.steps: Set visual state to null and check the current visual state process 868 * @tc.expected: The foreground effect is changed as expected. 869 */ 870 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 871 ViewAbstract::SetBgDynamicBrightness(brightnessOption); 872 ASSERT_TRUE(frameNode->GetRenderContext()->GetBgDynamicBrightnessOption().has_value()); 873 } 874 875 /** 876 * @tc.name: ViewAbstractFgDynamicBrightness001 877 * @tc.desc: Test setting foreground dynamic brightness option 878 * @tc.type: FUNC 879 */ 880 HWTEST_F(ViewAbstractTestNg, ViewAbstractFgDynamicBrightness001, TestSize.Level1) 881 { 882 /** 883 * @tc.steps: Build a object viewAbstract and set visual state. 884 */ 885 ViewStackProcessor viewStackProcessor; 886 int32_t index = 1; 887 auto state = static_cast<VisualState>(index); 888 viewStackProcessor.GetInstance()->SetVisualState(state); 889 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 890 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 891 ASSERT_NE(frameNode, nullptr); 892 893 /** 894 * @tc.steps: Build a object viewAbstract and set visual state. 895 * @tc.expected: The foreground effect is not changed. 896 */ 897 BrightnessOption brightnessOption; 898 ViewAbstract::SetFgDynamicBrightness(brightnessOption); 899 ASSERT_FALSE(frameNode->GetRenderContext()->GetFgDynamicBrightnessOption().has_value()); 900 901 /** 902 * @tc.steps: Set visual state to null and check the current visual state process 903 * @tc.expected: The foreground effect is changed as expected. 904 */ 905 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 906 ViewAbstract::SetFgDynamicBrightness(brightnessOption); 907 ASSERT_TRUE(frameNode->GetRenderContext()->GetFgDynamicBrightnessOption().has_value()); 908 } 909 910 /** 911 * @tc.name: ViewAbstractBgDynamicBrightness002 912 * @tc.desc: Test setting background dynamic brightness option 913 * @tc.type: FUNC 914 */ 915 HWTEST_F(ViewAbstractTestNg, ViewAbstractBgDynamicBrightness002, TestSize.Level1) 916 { 917 /** 918 * @tc.steps: step1. Create a new frame node and set the background dynamic brightness option. 919 */ 920 auto frameNode = AceType::DynamicCast<FrameNode>(ViewStackProcessor::GetInstance()->Finish()); 921 ViewStackProcessor viewStackProcessor; 922 int32_t index = 1; 923 auto state = static_cast<VisualState>(index); 924 viewStackProcessor.GetInstance()->SetVisualState(state); 925 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 926 927 /** 928 * @tc.steps: Build a object viewAbstract and set visual state. 929 * @tc.expected: The foreground effect is not changed. 930 */ 931 BrightnessOption brightnessOption; 932 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 933 ASSERT_NE(node, nullptr); 934 ViewAbstract::SetBgDynamicBrightness(AceType::RawPtr(node), brightnessOption); 935 936 /** 937 * @tc.steps: Set visual state to null and check the current visual state process 938 * @tc.expected: The foreground effect is changed as expected. 939 */ 940 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 941 ViewAbstract::SetBgDynamicBrightness(AceType::RawPtr(node), brightnessOption); 942 ASSERT_TRUE(frameNode->GetRenderContext()->GetBgDynamicBrightnessOption().has_value()); 943 } 944 945 /** 946 * @tc.name: ViewAbstractFgDynamicBrightness002 947 * @tc.desc: Test setting foreground dynamic brightness option 948 * @tc.type: FUNC 949 */ 950 HWTEST_F(ViewAbstractTestNg, ViewAbstractFgDynamicBrightness002, TestSize.Level1) 951 { 952 /** 953 * @tc.steps: step1. Create a new frame node and set the background dynamic brightness option. 954 */ 955 auto frameNode = AceType::DynamicCast<FrameNode>(ViewStackProcessor::GetInstance()->Finish()); 956 ViewStackProcessor viewStackProcessor; 957 int32_t index = 1; 958 auto state = static_cast<VisualState>(index); 959 viewStackProcessor.GetInstance()->SetVisualState(state); 960 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 961 962 /** 963 * @tc.steps: Build a object viewAbstract and set visual state. 964 * @tc.expected: The foreground effect is not changed. 965 */ 966 BrightnessOption brightnessOption; 967 auto node = AceType::DynamicCast<NG::FrameNode>(frameNode); 968 ASSERT_NE(node, nullptr); 969 ViewAbstract::SetFgDynamicBrightness(AceType::RawPtr(node), brightnessOption); 970 971 /** 972 * @tc.steps: Set visual state to null and check the current visual state process 973 * @tc.expected: The foreground effect is changed as expected. 974 */ 975 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 976 ViewAbstract::SetFgDynamicBrightness(AceType::RawPtr(node), brightnessOption); 977 ASSERT_TRUE(frameNode->GetRenderContext()->GetFgDynamicBrightnessOption().has_value()); 978 } 979 980 /** 981 * @tc.name: ViewAbstractSystemBarEffect001 982 * @tc.desc: Test setting system bar effect 983 * @tc.type: FUNC 984 */ 985 HWTEST_F(ViewAbstractTestNg, ViewAbstractSystemBarEffect001, TestSize.Level1) 986 { 987 /** 988 * @tc.steps: step1. Push main frame node and set the system bar effect. 989 */ 990 ViewStackProcessor viewStackProcessor; 991 int32_t index = 1; 992 auto state = static_cast<VisualState>(index); 993 viewStackProcessor.GetInstance()->SetVisualState(state); 994 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 995 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 996 ASSERT_NE(frameNode, nullptr); 997 998 /** 999 * @tc.steps: using a unCurrent visual state Process and set value 1000 * @tc.expected: The valueis not changed. 1001 */ 1002 ViewAbstract::SetSystemBarEffect(true); 1003 ASSERT_FALSE(frameNode->GetRenderContext()->GetSystemBarEffect()); 1004 1005 /** 1006 * @tc.steps: Set visual state to null and check the current visual state process 1007 * @tc.expected: The value is changed as expected. 1008 */ 1009 ViewStackProcessor::GetInstance()->visualState_ = std::nullopt; 1010 ViewAbstract::SetSystemBarEffect(true); 1011 ASSERT_TRUE(frameNode->GetRenderContext()->GetSystemBarEffect()); 1012 } 1013 1014 /** 1015 * @tc.name: ViewAbstractSystemBarEffect002 1016 * @tc.desc: Test setting system bar effect 1017 * @tc.type: FUNC 1018 */ 1019 HWTEST_F(ViewAbstractTestNg, ViewAbstractSystemBarEffect002, TestSize.Level1) 1020 { 1021 /** 1022 * @tc.steps: step1. Push main frame node and set the system bar effect. 1023 */ 1024 ViewStackProcessor viewStackProcessor; 1025 int32_t index = 1; 1026 auto state = static_cast<VisualState>(index); 1027 viewStackProcessor.GetInstance()->SetVisualState(state); 1028 auto topFrameNodeOne = ViewStackProcessor::GetInstance()->GetMainElementNode(); 1029 auto frameNode = AceType::DynamicCast<FrameNode>(topFrameNodeOne); 1030 ASSERT_NE(frameNode, nullptr); 1031 1032 /** 1033 * @tc.steps: Set visual state to null and check the current visual state process 1034 * @tc.expected: The value is changed as expected. 1035 */ 1036 ViewAbstract::SetSystemBarEffect(nullptr, false); 1037 ASSERT_FALSE(frameNode->GetRenderContext()->GetSystemBarEffect()); 1038 } 1039 1040 /** 1041 * @tc.name: ViewAbstractPositionEdges002 1042 * @tc.desc: Test setting position edges 1043 * @tc.type: FUNC 1044 */ 1045 HWTEST_F(ViewAbstractTestNg, ViewAbstractPositionEdges002, TestSize.Level1) 1046 { 1047 /** 1048 * @tc.steps: step1. create and put mainNode, then build some necessary params. 1049 */ 1050 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 1051 1052 /** 1053 * @tc.steps: step2. get node in ViewStackProcessor. 1054 * @tc.expected: node is not null. 1055 */ 1056 auto rootFrameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); 1057 EXPECT_NE(rootFrameNode, nullptr); 1058 1059 /** 1060 * @tc.steps: step3. use ViewAbstract::SetPositionEdges. 1061 * @tc.expected: success set render property PositionEdges value. 1062 */ 1063 EdgesParam edges; 1064 CalcDimension bottom(30, DimensionUnit::VP); 1065 CalcDimension right(20, DimensionUnit::VP); 1066 edges.SetBottom(bottom); 1067 edges.SetRight(right); 1068 ViewAbstract::SetPositionEdges(rootFrameNode, edges); 1069 1070 EXPECT_NE(FRAME_NODE_ROOT->GetRenderContext(), nullptr); 1071 EXPECT_EQ(FRAME_NODE_ROOT->GetRenderContext() 1072 ->GetPositionEdgesValue(EdgesParam {}).bottom.value_or(Dimension {}).ConvertToVp(), 30.0f); 1073 EXPECT_EQ(FRAME_NODE_ROOT->GetRenderContext() 1074 ->GetPositionEdgesValue(EdgesParam {}).right.value_or(Dimension {}).ConvertToVp(), 20.0f); 1075 1076 /** 1077 * @tc.steps: step5. finish view stack. 1078 */ 1079 ViewStackProcessor::GetInstance()->Finish(); 1080 } 1081 1082 /** 1083 * @tc.name: ViewAbstractOffsetEdges002 1084 * @tc.desc: test offset attribute, use Edges type. 1085 * @tc.type: FUNC 1086 */ 1087 HWTEST_F(ViewAbstractTestNg, ViewAbstractOffset002, TestSize.Level1) 1088 { 1089 /** 1090 * @tc.steps: step1. create and put mainNode, then build some necessary params. 1091 */ 1092 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 1093 1094 /** 1095 * @tc.steps: step2. get node in ViewStackProcessor. 1096 * @tc.expected: node is not null. 1097 */ 1098 auto rootFrameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); 1099 EXPECT_NE(rootFrameNode, nullptr); 1100 1101 /** 1102 * @tc.steps: step3. use ViewAbstract::SetOffsetEdges. 1103 * @tc.expected: success set render property offsetEdges value. 1104 */ 1105 EdgesParam edges; 1106 CalcDimension top(30, DimensionUnit::VP); 1107 CalcDimension left(20, DimensionUnit::VP); 1108 edges.SetTop(top); 1109 edges.SetLeft(left); 1110 ViewAbstract::SetOffsetEdges(rootFrameNode, edges); 1111 1112 EXPECT_NE(FRAME_NODE_ROOT->GetRenderContext(), nullptr); 1113 EXPECT_EQ(FRAME_NODE_ROOT->GetRenderContext() 1114 ->GetOffsetEdgesValue(EdgesParam {}).top.value_or(Dimension {}).ConvertToVp(), 30.0f); 1115 EXPECT_EQ(FRAME_NODE_ROOT->GetRenderContext() 1116 ->GetOffsetEdgesValue(EdgesParam {}).left.value_or(Dimension {}).ConvertToVp(), 20.0f); 1117 1118 /** 1119 * @tc.steps: step5. finish view stack. 1120 */ 1121 ViewStackProcessor::GetInstance()->Finish(); 1122 } 1123 1124 /** 1125 * @tc.name: ViewAbstractTest043 1126 * @tc.desc: Test the operation of View_Abstract 1127 * @tc.type: FUNC 1128 */ 1129 HWTEST_F(ViewAbstractTestNg, ViewAbstractTest043, TestSize.Level1) 1130 { 1131 /** 1132 * @tc.steps: step1.ClearStack. 1133 */ 1134 auto state = static_cast<VisualState>(INDEX); 1135 ViewStackProcessor::GetInstance()->SetVisualState(state); 1136 ViewStackProcessor::GetInstance()->ClearStack(); 1137 1138 /** 1139 * @tc.steps: step2. related function is called. 1140 */ 1141 CalcDimension dimensionRadius(0.0); 1142 ViewAbstract::SetLightPosition(dimensionRadius, dimensionRadius, dimensionRadius); 1143 ViewAbstract::SetLightPosition(nullptr, dimensionRadius, dimensionRadius, dimensionRadius); 1144 ViewAbstract::SetLightIntensity(RATIO); 1145 ViewAbstract::SetLightIntensity(nullptr, RATIO); 1146 ViewAbstract::SetIlluminatedBorderWidth(ZERO); 1147 ViewAbstract::SetIlluminatedBorderWidth(nullptr, ZERO); 1148 ViewAbstract::SetDisplayIndex(INDEX); 1149 ViewAbstract::SetDisplayIndex(nullptr, INDEX); 1150 ViewAbstract::SetGrayScale(RADIUS); 1151 ViewAbstract::SetGrayScale(nullptr, RADIUS); 1152 OHOS::Rosen::VisualEffect* visualEffect; 1153 ViewAbstract::SetVisualEffect(visualEffect); 1154 OHOS::Rosen::Filter* backgroundFilter; 1155 ViewAbstract::SetBackgroundFilter(backgroundFilter); 1156 OHOS::Rosen::Filter* foregroundFilter; 1157 ViewAbstract::SetForegroundFilter(foregroundFilter); 1158 OHOS::Rosen::Filter* compositingFilter; 1159 ViewAbstract::SetCompositingFilter(compositingFilter); 1160 ViewAbstract::SetDynamicDim(1.0f); 1161 ViewAbstract::SetSystemBarEffect(false); 1162 ViewAbstract::SetSystemBarEffect(nullptr, false); 1163 ImageResizableSlice slice; 1164 ViewAbstract::SetBackgroundImageResizableSlice(slice); 1165 ViewAbstract::SetBackgroundImageResizableSlice(nullptr, slice); 1166 MotionBlurOption motionBlurOption; 1167 motionBlurOption.radius = 5; 1168 motionBlurOption.anchor.x = 0.5; 1169 motionBlurOption.anchor.y = 0.5; 1170 ViewAbstract::SetMotionBlur(motionBlurOption); 1171 ViewAbstract::SetLayoutWeight(AceType::RawPtr(FRAME_NODE_REGISTER), TEN); 1172 1173 /** 1174 * @tc.expected: Return expected results. 1175 */ 1176 bool result = ViewStackProcessor::GetInstance()->IsCurrentVisualStateProcess(); 1177 EXPECT_FALSE(result); 1178 } 1179 1180 /** 1181 * @tc.name: ViewAbstractDisallowDropForcedly001 1182 * @tc.desc: Test setting disallow drop forcedly 1183 * @tc.type: FUNC 1184 */ 1185 HWTEST_F(ViewAbstractTestNg, ViewAbstractDisallowDropForcedly001, TestSize.Level1) 1186 { 1187 /** 1188 * @tc.steps: step1. Push main frame node and set the disallow drop forcedly. 1189 */ 1190 ViewStackProcessor::GetInstance()->Push(FRAME_NODE_ROOT); 1191 bool isDisallowDropForcedly = true; 1192 ViewAbstract::SetDisallowDropForcedly(isDisallowDropForcedly); 1193 1194 /** 1195 * @tc.steps: step2. Verify that the disallow drop forcedly has been set. 1196 * @tc.expected: The disallow drop forcedly should be set correctly. 1197 */ 1198 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); 1199 ASSERT_NE(frameNode, nullptr); 1200 EXPECT_EQ(frameNode->isDisallowDropForcedly_, isDisallowDropForcedly); 1201 1202 /** 1203 * @tc.steps: step3. Finish view stack. 1204 */ 1205 ViewStackProcessor::GetInstance()->Finish(); 1206 } 1207 1208 /** 1209 * @tc.name: ViewAbstractRequestFocus001 1210 * @tc.desc: Test request focus 1211 * @tc.type: FUNC 1212 */ 1213 HWTEST_F(ViewAbstractTestNg, ViewAbstractRequestFocus001, TestSize.Level1) 1214 { 1215 auto frameNode = FrameNode::CreateFrameNode( 1216 V2::ROW_ETS_TAG, -1, AceType::MakeRefPtr<Pattern>()); 1217 auto focusHub = frameNode->GetOrCreateFocusHub(); 1218 1219 auto eventHub = AceType::MakeRefPtr<EventHub>(); 1220 eventHub->AttachHost(frameNode); 1221 auto context = frameNode->GetContext(); 1222 ASSERT_NE(context, nullptr); 1223 context->GetOrCreateFocusManager(); 1224 1225 /** 1226 * @tc.steps: Set frameNode null 1227 * @tc.expected: retCode is ERROR_CODE_NON_EXIST. 1228 */ 1229 focusHub->focusable_ = false; 1230 auto retCode = ViewAbstract::RequestFocus(nullptr); 1231 ASSERT_EQ(retCode, ERROR_CODE_NON_EXIST); 1232 1233 auto child = FrameNode::CreateFrameNode( 1234 V2::BUTTON_ETS_TAG, -1, AceType::MakeRefPtr<Pattern>()); 1235 frameNode->AddChild(child); 1236 auto childFocusHub = child->GetOrCreateFocusHub(); 1237 childFocusHub->focusType_ = FocusType::NODE; 1238 1239 /** 1240 * @tc.steps: Set frameNode focusable false 1241 * @tc.expected: retCode is ERROR_CODE_NON_FOCUSABLE. 1242 */ 1243 focusHub->focusable_ = true; 1244 childFocusHub->focusable_ = false; 1245 retCode = ViewAbstract::RequestFocus(AceType::RawPtr(child)); 1246 ASSERT_EQ(retCode, ERROR_CODE_NON_FOCUSABLE); 1247 1248 /** 1249 * @tc.steps: Set child focusable false 1250 * @tc.expected: retCode is ERROR_CODE_NON_FOCUSABLE_ANCESTOR. 1251 */ 1252 childFocusHub->parentFocusable_ = false; 1253 childFocusHub->focusable_ = true; 1254 retCode = ViewAbstract::RequestFocus(AceType::RawPtr(child)); 1255 ASSERT_EQ(retCode, ERROR_CODE_NON_FOCUSABLE_ANCESTOR); 1256 1257 1258 /** 1259 * @tc.steps: Set both frameNode and child focusable true 1260 * @tc.expected: retCode is ERROR_CODE_NO_ERROR. 1261 */ 1262 childFocusHub->parentFocusable_ = true; 1263 focusHub->focusable_ = true; 1264 retCode = ViewAbstract::RequestFocus(AceType::RawPtr(child)); 1265 ASSERT_EQ(retCode, ERROR_CODE_NO_ERROR); 1266 } 1267 1268 /** 1269 * @tc.name: ClearFocusTest001 1270 * @tc.desc: Test clear focus 1271 * @tc.type: FUNC 1272 */ 1273 HWTEST_F(ViewAbstractTestNg, ClearFocusTest001, TestSize.Level1) 1274 { 1275 auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::ROW_ETS_TAG, -1, 1276 AceType::MakeRefPtr<Pattern>()); 1277 auto focusHub = frameNode->GetOrCreateFocusHub(); 1278 1279 auto eventHub = AceType::MakeRefPtr<EventHub>(); 1280 eventHub->AttachHost(frameNode); 1281 focusHub->currentFocus_ = true; 1282 auto context = frameNode->GetContext(); 1283 ASSERT_NE(context, nullptr); 1284 auto instanceId = context->GetInstanceId(); 1285 1286 /** 1287 * @tc.steps: Set frameNode focus true 1288 * @tc.expected: focus lost focus to view root. 1289 */ 1290 ViewAbstract::ClearFocus(instanceId); 1291 ASSERT_EQ(focusHub->currentFocus_, true); 1292 1293 /** 1294 * @tc.steps: Set frameNode focus true 1295 * @tc.expected: focus lost focus to view root failed. 1296 */ 1297 focusHub->currentFocus_ = true; 1298 ViewAbstract::ClearFocus(-1); 1299 ASSERT_EQ(focusHub->currentFocus_, true); 1300 } 1301 1302 /** 1303 * @tc.name: FocusActivateTest001 1304 * @tc.desc: Test set focus active 1305 * @tc.type: FUNC 1306 */ 1307 HWTEST_F(ViewAbstractTestNg, FocusActivateTest001, TestSize.Level1) 1308 { 1309 auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::ROW_ETS_TAG, -1, 1310 AceType::MakeRefPtr<Pattern>()); 1311 auto focusHub = frameNode->GetOrCreateFocusHub(); 1312 1313 auto eventHub = AceType::MakeRefPtr<EventHub>(); 1314 eventHub->AttachHost(frameNode); 1315 focusHub->currentFocus_ = true; 1316 auto context = frameNode->GetContext(); 1317 ASSERT_NE(context, nullptr); 1318 auto instanceId = context->GetInstanceId(); 1319 1320 ViewAbstract::FocusActivate(instanceId, false, true); 1321 ASSERT_FALSE(context->isFocusActive_); 1322 ASSERT_TRUE(context->autoFocusInactive_); 1323 } 1324 1325 /** 1326 * @tc.name: SetAutoFocusTransferTest001 1327 * @tc.desc: Test set focus transfer 1328 * @tc.type: FUNC 1329 */ 1330 HWTEST_F(ViewAbstractTestNg, SetAutoFocusTransferTest001, TestSize.Level1) 1331 { 1332 auto frameNode = AceType::MakeRefPtr<FrameNode>(V2::ROW_ETS_TAG, -1, 1333 AceType::MakeRefPtr<Pattern>()); 1334 auto focusHub = frameNode->GetOrCreateFocusHub(); 1335 1336 auto eventHub = AceType::MakeRefPtr<EventHub>(); 1337 eventHub->AttachHost(frameNode); 1338 focusHub->currentFocus_ = true; 1339 auto context = frameNode->GetContext(); 1340 ASSERT_NE(context, nullptr); 1341 auto instanceId = context->GetInstanceId(); 1342 1343 auto focusManager = context->GetOrCreateFocusManager(); 1344 ASSERT_NE(focusManager, nullptr); 1345 1346 ViewAbstract::SetAutoFocusTransfer(instanceId, true); 1347 ASSERT_TRUE(focusManager->isAutoFocusTransfer_); 1348 1349 ViewAbstract::SetAutoFocusTransfer(instanceId, false); 1350 ASSERT_FALSE(focusManager->isAutoFocusTransfer_); 1351 } 1352 1353 /** 1354 * @tc.name: ViewAbstractBindTipsTest001 1355 * @tc.desc: Test the BindTips of View_Abstract. 1356 * @tc.type: FUNC 1357 */ 1358 HWTEST_F(ViewAbstractTestNg, ViewAbstractBindTipsTest001, TestSize.Level1) 1359 { 1360 /** 1361 * @tc.steps: step1. Create some FrameNode and params. 1362 */ 1363 const RefPtr<FrameNode> targetNode = FrameNode::CreateFrameNode("two", 2, AceType::MakeRefPtr<Pattern>()); 1364 const RefPtr<FrameNode> targetNode2 = FrameNode::CreateFrameNode("three", 3, AceType::MakeRefPtr<Pattern>()); 1365 auto param = AceType::MakeRefPtr<PopupParam>(); 1366 auto param2 = AceType::MakeRefPtr<PopupParam>(); 1367 1368 /** 1369 * @tc.steps: step2. get tipsInfo and change some params. 1370 */ 1371 auto container = Container::Current(); 1372 ASSERT_NE(container, nullptr); 1373 auto pipelineContext = container->GetPipelineContext(); 1374 ASSERT_NE(pipelineContext, nullptr); 1375 auto context = AceType::DynamicCast<NG::PipelineContext>(pipelineContext); 1376 ASSERT_NE(context, nullptr); 1377 context->taskExecutor_ = AceType::MakeRefPtr<MockTaskExecutor>(); 1378 auto overlayManager = context->GetOverlayManager(); 1379 ASSERT_NE(overlayManager, nullptr); 1380 auto nodeId = targetNode->GetId(); 1381 PopupInfo info = overlayManager->GetPopupInfo(nodeId); 1382 info.isCurrentOnShow = true; 1383 info.popupId = 1; 1384 auto popupNode1 = FrameNode::CreateFrameNode( 1385 V2::POPUP_ETS_TAG, info.popupId, AceType::MakeRefPtr<BubblePattern>(targetNode->GetId(), targetNode->GetTag())); 1386 info.popupNode = popupNode1; 1387 info.target = targetNode2; 1388 overlayManager->ShowTips(targetNode->GetId(), info, 300, 300); 1389 overlayManager->tipsInfoList_.emplace_back(targetNode->GetId(), info); 1390 overlayManager->ShowTips(targetNode->GetId(), info, 300, 300); 1391 1392 /** 1393 * @tc.steps: step3. Call BindTips many times. 1394 * @tc.expected: popupNode in overlayManager of targetNode not null 1395 */ 1396 ViewAbstract::BindTips(param, targetNode); 1397 overlayManager->HideTips(targetNode->GetId(), info, 300); 1398 auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); 1399 auto popupNode = popupInfo.popupNode; 1400 ASSERT_NE(popupNode, nullptr); 1401 popupNode->GetPattern<BubblePattern>()->transitionStatus_ = TransitionStatus::ENTERING; 1402 auto context1 = targetNode->GetContext(); 1403 ASSERT_NE(context1, nullptr); 1404 auto subwindow = Subwindow::CreateSubwindow(context1->GetInstanceId()); 1405 SubwindowManager::GetInstance()->AddSubwindow(context1->GetInstanceId(), subwindow); 1406 ViewAbstract::BindTips(param, targetNode); 1407 EXPECT_NE(overlayManager->GetPopupInfo(targetNode->GetId()).popupNode, nullptr); 1408 1409 /** 1410 * @tc.steps: step4. Call BindTips with param use custom. 1411 * @tc.expected: popupNode in overlayManager of targetNode not null 1412 */ 1413 param2->SetUseCustomComponent(true); 1414 ViewAbstract::BindTips(param2, targetNode2); 1415 EXPECT_NE(overlayManager->GetPopupInfo(targetNode->GetId()).popupNode, nullptr); 1416 } 1417 1418 /** 1419 * @tc.name: ViewAbstractAddHoverEventForTipsTest001 1420 * @tc.desc: Test the AddHoverEventForTips of View_Abstract. 1421 * @tc.type: FUNC 1422 */ 1423 HWTEST_F(ViewAbstractTestNg, ViewAbstractAddHoverEventForTipsTest001, TestSize.Level1) 1424 { 1425 /** 1426 * @tc.steps: step1. Create some FrameNode and params. 1427 */ 1428 const RefPtr<FrameNode> targetNode = FrameNode::CreateFrameNode("two", 2, AceType::MakeRefPtr<Pattern>()); 1429 auto param = AceType::MakeRefPtr<PopupParam>(); 1430 auto container = Container::Current(); 1431 ASSERT_NE(container, nullptr); 1432 auto pipelineContext = container->GetPipelineContext(); 1433 ASSERT_NE(pipelineContext, nullptr); 1434 auto context = AceType::DynamicCast<NG::PipelineContext>(pipelineContext); 1435 ASSERT_NE(context, nullptr); 1436 auto overlayManager = context->GetOverlayManager(); 1437 ASSERT_NE(overlayManager, nullptr); 1438 1439 auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); 1440 ViewAbstract::AddHoverEventForTips(param, targetNode, popupInfo, true); 1441 auto eventHub = targetNode->GetEventHub<EventHub>(); 1442 ASSERT_NE(eventHub, nullptr); 1443 auto inputHub = eventHub->GetOrCreateInputEventHub(); 1444 ASSERT_NE(inputHub, nullptr); 1445 auto hoverEventActuator = inputHub->hoverEventActuator_; 1446 ASSERT_NE(hoverEventActuator, nullptr); 1447 auto Events = hoverEventActuator->inputEvents_; 1448 bool ishover = true; 1449 for (const auto& callback : Events) { 1450 (*callback)(ishover); 1451 } 1452 ishover = false; 1453 for (const auto& callback : Events) { 1454 (*callback)(ishover); 1455 } 1456 EXPECT_NE(overlayManager->GetPopupInfo(targetNode->GetId()).popupNode, nullptr); 1457 EXPECT_EQ(Events.size(), 1); 1458 } 1459 1460 /** 1461 * @tc.name: ViewAbstractAddHoverEventForTipsTest002 1462 * @tc.desc: Test the AddHoverEventForTips of View_Abstract. 1463 * @tc.type: FUNC 1464 */ 1465 HWTEST_F(ViewAbstractTestNg, ViewAbstractAddHoverEventForTipsTest002, TestSize.Level1) 1466 { 1467 /** 1468 * @tc.steps: step1. Create some FrameNode and params. 1469 */ 1470 const RefPtr<FrameNode> targetNode = FrameNode::CreateFrameNode("two", 2, AceType::MakeRefPtr<Pattern>()); 1471 auto param = AceType::MakeRefPtr<PopupParam>(); 1472 auto container = Container::Current(); 1473 ASSERT_NE(container, nullptr); 1474 auto pipelineContext = container->GetPipelineContext(); 1475 ASSERT_NE(pipelineContext, nullptr); 1476 auto context = AceType::DynamicCast<NG::PipelineContext>(pipelineContext); 1477 ASSERT_NE(context, nullptr); 1478 auto overlayManager = context->GetOverlayManager(); 1479 ASSERT_NE(overlayManager, nullptr); 1480 1481 auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); 1482 ViewAbstract::AddHoverEventForTips(param, targetNode, popupInfo, false); 1483 auto eventHub = targetNode->GetEventHub<EventHub>(); 1484 ASSERT_NE(eventHub, nullptr); 1485 auto inputHub = eventHub->GetOrCreateInputEventHub(); 1486 ASSERT_NE(inputHub, nullptr); 1487 auto hoverEventActuator = inputHub->hoverEventActuator_; 1488 ASSERT_NE(hoverEventActuator, nullptr); 1489 auto Events = hoverEventActuator->inputEvents_; 1490 bool ishover = true; 1491 for (const auto& callback : Events) { 1492 (*callback)(ishover); 1493 } 1494 ishover = false; 1495 for (const auto& callback : Events) { 1496 (*callback)(ishover); 1497 } 1498 EXPECT_NE(overlayManager->GetPopupInfo(targetNode->GetId()).popupNode, nullptr); 1499 EXPECT_EQ(Events.size(), 1); 1500 } 1501 1502 /** 1503 * @tc.name: ViewAbstractHandleHoverTipsInfoTest001 1504 * @tc.desc: Test the handleHoverTipsInfo of View_Abstract. 1505 * @tc.type: FUNC 1506 */ 1507 HWTEST_F(ViewAbstractTestNg, ViewAbstractHandleHoverTipsInfoTest001, TestSize.Level1) 1508 { 1509 /** 1510 * @tc.steps: step1. Create some FrameNode and params. 1511 */ 1512 const RefPtr<FrameNode> targetNode = FrameNode::CreateFrameNode("two", 2, AceType::MakeRefPtr<Pattern>()); 1513 auto param = AceType::MakeRefPtr<PopupParam>(); 1514 auto container = Container::Current(); 1515 ASSERT_NE(container, nullptr); 1516 auto pipelineContext = container->GetPipelineContext(); 1517 ASSERT_NE(pipelineContext, nullptr); 1518 auto context = AceType::DynamicCast<NG::PipelineContext>(pipelineContext); 1519 ASSERT_NE(context, nullptr); 1520 auto overlayManager = context->GetOverlayManager(); 1521 ASSERT_NE(overlayManager, nullptr); 1522 1523 auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); 1524 ViewAbstract::HandleHoverTipsInfo(param, targetNode, popupInfo, false, 1); 1525 for (const auto& destroyCallback : targetNode->destroyCallbacksMap_) { 1526 if (destroyCallback.second) { 1527 destroyCallback.second(); 1528 } 1529 } 1530 ViewAbstract::HandleHoverTipsInfo(param, targetNode, popupInfo, true, 1); 1531 for (const auto& destroyCallback : targetNode->destroyCallbacksMap_) { 1532 if (destroyCallback.second) { 1533 destroyCallback.second(); 1534 } 1535 } 1536 EXPECT_EQ(overlayManager->GetPopupInfo(targetNode->GetId()).popupNode, nullptr); 1537 } 1538 } // namespace OHOS::Ace::NG