1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <gtest/gtest.h> 17 #include "accessibility_def.h" 18 #include "accessibility_element_info.h" 19 20 using namespace testing; 21 using namespace testing::ext; 22 23 namespace OHOS { 24 namespace Accessibility { 25 class AccessibilityElementInfoTest : public ::testing::Test { 26 public: AccessibilityElementInfoTest()27 AccessibilityElementInfoTest() 28 {} ~AccessibilityElementInfoTest()29 ~AccessibilityElementInfoTest() 30 {} 31 32 std::shared_ptr<AccessibilityElementInfo> elementInfo_ = nullptr; 33 SetUpTestCase()34 static void SetUpTestCase() 35 { 36 GTEST_LOG_(INFO) << "AccessibilityElementInfoTest Start"; 37 } 38 TearDownTestCase()39 static void TearDownTestCase() 40 { 41 GTEST_LOG_(INFO) << "AccessibilityElementInfoTest End"; 42 } 43 SetUp()44 void SetUp() 45 { 46 elementInfo_ = std::make_shared<AccessibilityElementInfo>(); 47 ASSERT_TRUE(elementInfo_); 48 } 49 TearDown()50 void TearDown() 51 { 52 elementInfo_ = nullptr; 53 } 54 }; 55 56 class RangeInfoTest : public ::testing::Test { 57 public: RangeInfoTest()58 RangeInfoTest() 59 {} ~RangeInfoTest()60 ~RangeInfoTest() 61 {} 62 63 std::shared_ptr<RangeInfo> rangeInfo_ = nullptr; 64 SetUpTestCase()65 static void SetUpTestCase() 66 { 67 GTEST_LOG_(INFO) << "AccessibilityRangeInfoTest Start"; 68 } 69 TearDownTestCase()70 static void TearDownTestCase() 71 { 72 GTEST_LOG_(INFO) << "AccessibilityRangeInfoTest End"; 73 } 74 SetUp()75 void SetUp() 76 { 77 rangeInfo_ = std::make_shared<RangeInfo>(); 78 ASSERT_TRUE(rangeInfo_); 79 } 80 TearDown()81 void TearDown() 82 { 83 rangeInfo_ = nullptr; 84 } 85 }; 86 87 class GridInfoTest : public ::testing::Test { 88 public: GridInfoTest()89 GridInfoTest() 90 {} ~GridInfoTest()91 ~GridInfoTest() 92 {} 93 94 std::shared_ptr<GridInfo> gridInfo_ = nullptr; 95 SetUpTestCase()96 static void SetUpTestCase() 97 { 98 GTEST_LOG_(INFO) << "GridInfoTest Start"; 99 } 100 TearDownTestCase()101 static void TearDownTestCase() 102 { 103 GTEST_LOG_(INFO) << "GridInfoTest End"; 104 } 105 SetUp()106 void SetUp() 107 { 108 gridInfo_ = std::make_shared<GridInfo>(); 109 ASSERT_TRUE(gridInfo_); 110 } 111 TearDown()112 void TearDown() 113 { 114 gridInfo_ = nullptr; 115 } 116 }; 117 118 class GridItemInfoTest : public ::testing::Test { 119 public: GridItemInfoTest()120 GridItemInfoTest() 121 {} ~GridItemInfoTest()122 ~GridItemInfoTest() 123 {} 124 125 std::shared_ptr<GridItemInfo> gridItemInfo_ = nullptr; 126 SetUpTestCase()127 static void SetUpTestCase() 128 { 129 GTEST_LOG_(INFO) << "GridItemInfoTest Start"; 130 } 131 TearDownTestCase()132 static void TearDownTestCase() 133 { 134 GTEST_LOG_(INFO) << "GridItemInfoTest End"; 135 } 136 SetUp()137 void SetUp() 138 { 139 gridItemInfo_ = std::make_shared<GridItemInfo>(); 140 ASSERT_TRUE(gridItemInfo_); 141 } 142 TearDown()143 void TearDown() 144 { 145 gridItemInfo_ = nullptr; 146 } 147 }; 148 149 class AccessibleActionTest : public ::testing::Test { 150 public: AccessibleActionTest()151 AccessibleActionTest() 152 {} ~AccessibleActionTest()153 ~AccessibleActionTest() 154 {} 155 SetUpTestCase()156 static void SetUpTestCase() 157 { 158 GTEST_LOG_(INFO) << "AccessibleActionTest Start"; 159 } 160 TearDownTestCase()161 static void TearDownTestCase() 162 { 163 GTEST_LOG_(INFO) << "AccessibleActionTest End"; 164 } 165 SetUp()166 void SetUp() 167 {} 168 TearDown()169 void TearDown() 170 {} 171 }; 172 173 /** 174 * @tc.number: SetComponentId_001 175 * @tc.name: SetComponentId 176 * @tc.desc: Test function SetComponentId, GetAccessibilityId 177 */ 178 HWTEST_F(AccessibilityElementInfoTest, SetComponentId_001, TestSize.Level1) 179 { 180 GTEST_LOG_(INFO) << "SetComponentId_001 start"; 181 elementInfo_->SetComponentId(0); 182 EXPECT_EQ(elementInfo_->GetAccessibilityId(), 0); 183 GTEST_LOG_(INFO) << "SetComponentId_001 end"; 184 } 185 186 /** 187 * @tc.number: GetChildId_001 188 * @tc.name: GetChildId 189 * @tc.desc: Test function GetChildId 190 */ 191 HWTEST_F(AccessibilityElementInfoTest, GetChildId_001, TestSize.Level1) 192 { 193 GTEST_LOG_(INFO) << "GetChildId_001 start"; 194 EXPECT_EQ(elementInfo_->GetChildId(0), -1); 195 GTEST_LOG_(INFO) << "GetChildId_001 end"; 196 } 197 198 /** 199 * @tc.number: GetChildCount_001 200 * @tc.name: GetChildCount 201 * @tc.desc: Test function GetChildCount 202 */ 203 HWTEST_F(AccessibilityElementInfoTest, GetChildCount_001, TestSize.Level1) 204 { 205 GTEST_LOG_(INFO) << "GetChildCount_001 start"; 206 EXPECT_EQ(elementInfo_->GetChildCount(), 0); 207 GTEST_LOG_(INFO) << "GetChildCount_001 end"; 208 } 209 210 /** 211 * @tc.number: GetChildIds_001 212 * @tc.name: GetChildIds 213 * @tc.desc: Test function GetChildIds 214 */ 215 HWTEST_F(AccessibilityElementInfoTest, GetChildIds_001, TestSize.Level1) 216 { 217 GTEST_LOG_(INFO) << "GetChildIds_001 start"; 218 EXPECT_EQ(static_cast<int>(elementInfo_->GetChildIds().size()), 0); 219 GTEST_LOG_(INFO) << "GetChildIds_001 end"; 220 } 221 222 /** 223 * @tc.number: AddChild_001 224 * @tc.name: AddChild 225 * @tc.desc: Test function AddChild 226 */ 227 HWTEST_F(AccessibilityElementInfoTest, AddChild_001, TestSize.Level1) 228 { 229 GTEST_LOG_(INFO) << "AddChild_001 start"; 230 elementInfo_->AddChild(1); 231 EXPECT_EQ(elementInfo_->GetChildCount(), 1); 232 EXPECT_EQ(static_cast<int>(elementInfo_->GetChildIds().size()), 1); 233 GTEST_LOG_(INFO) << "AddChild_001 end"; 234 } 235 236 /** 237 * @tc.number: RemoveChild_001 238 * @tc.name: RemoveChild 239 * @tc.desc: Test function RemoveChild 240 */ 241 HWTEST_F(AccessibilityElementInfoTest, RemoveChild_001, TestSize.Level1) 242 { 243 GTEST_LOG_(INFO) << "RemoveChild_001 start"; 244 EXPECT_FALSE(elementInfo_->RemoveChild(1)); 245 GTEST_LOG_(INFO) << "RemoveChild_001 end"; 246 } 247 248 /** 249 * @tc.number: GetActionList_001 250 * @tc.name: GetActionList 251 * @tc.desc: Test function GetActionList 252 */ 253 HWTEST_F(AccessibilityElementInfoTest, GetActionList_001, TestSize.Level1) 254 { 255 GTEST_LOG_(INFO) << "GetActionList_001 start"; 256 EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 0); 257 GTEST_LOG_(INFO) << "GetActionList_001 end"; 258 } 259 260 /** 261 * @tc.number: AddAction_001 262 * @tc.name: AddAction 263 * @tc.desc: Test function AddAction 264 */ 265 HWTEST_F(AccessibilityElementInfoTest, AddAction_001, TestSize.Level1) 266 { 267 GTEST_LOG_(INFO) << "AddAction_001 start"; 268 AccessibleAction action(ACCESSIBILITY_ACTION_FOCUS, "test"); 269 elementInfo_->AddAction(action); 270 ASSERT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1); 271 EXPECT_EQ(elementInfo_->GetActionList().front().GetActionType(), ACCESSIBILITY_ACTION_FOCUS); 272 EXPECT_STREQ(elementInfo_->GetActionList().front().GetDescriptionInfo().c_str(), "test"); 273 GTEST_LOG_(INFO) << "AddAction_001 end"; 274 } 275 276 /** 277 * @tc.number: DeleteAction_001 278 * @tc.name: DeleteAction 279 * @tc.desc: Test function DeleteAction 280 */ 281 HWTEST_F(AccessibilityElementInfoTest, DeleteAction_001, TestSize.Level1) 282 { 283 GTEST_LOG_(INFO) << "DeleteAction_001 start"; 284 AccessibleAction action; 285 elementInfo_->AddAction(action); 286 EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1); 287 288 elementInfo_->DeleteAction(action); 289 EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 0); 290 GTEST_LOG_(INFO) << "DeleteAction_001 end"; 291 } 292 293 /** 294 * @tc.number: DeleteAction_002 295 * @tc.name: DeleteAction 296 * @tc.desc: Test function DeleteAction 297 */ 298 HWTEST_F(AccessibilityElementInfoTest, DeleteAction_002, TestSize.Level1) 299 { 300 GTEST_LOG_(INFO) << "DeleteAction_002 start"; 301 ActionType action = ActionType::ACCESSIBILITY_ACTION_FOCUS; 302 EXPECT_FALSE(elementInfo_->DeleteAction(action)); 303 GTEST_LOG_(INFO) << "DeleteAction_002 end"; 304 } 305 306 /** 307 * @tc.number: DeleteAllActions_001 308 * @tc.name: DeleteAllActions 309 * @tc.desc: Test function DeleteAllActions 310 */ 311 HWTEST_F(AccessibilityElementInfoTest, DeleteAllActions_001, TestSize.Level1) 312 { 313 GTEST_LOG_(INFO) << "DeleteAllActions_001 start"; 314 AccessibleAction action; 315 elementInfo_->AddAction(action); 316 EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1); 317 318 elementInfo_->DeleteAllActions(); 319 EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 0); 320 GTEST_LOG_(INFO) << "DeleteAllActions_001 end"; 321 } 322 323 /** 324 * @tc.number: SetTextLengthLimit_001 325 * @tc.name: SetTextLengthLimit 326 * @tc.desc: Test function SetTextLengthLimit, GetTextLengthLimit 327 */ 328 HWTEST_F(AccessibilityElementInfoTest, SetTextLengthLimit_001, TestSize.Level1) 329 { 330 GTEST_LOG_(INFO) << "SetTextLengthLimit_001 start"; 331 elementInfo_->SetTextLengthLimit(1); 332 EXPECT_EQ(elementInfo_->GetTextLengthLimit(), 1); 333 GTEST_LOG_(INFO) << "SetTextLengthLimit_001 end"; 334 } 335 336 /** 337 * @tc.number: SetWindowId_001 338 * @tc.name: SetWindowId 339 * @tc.desc: Test function SetWindowId, GetWindowId 340 */ 341 HWTEST_F(AccessibilityElementInfoTest, SetWindowId_001, TestSize.Level1) 342 { 343 GTEST_LOG_(INFO) << "SetWindowId_001 start"; 344 elementInfo_->SetWindowId(1); 345 EXPECT_EQ(elementInfo_->GetWindowId(), 1); 346 GTEST_LOG_(INFO) << "SetWindowId_001 end"; 347 } 348 349 /** 350 * @tc.number: SetParent_001 351 * @tc.name: SetParent 352 * @tc.desc: Test function SetParent, GetParentNodeId 353 */ 354 HWTEST_F(AccessibilityElementInfoTest, SetParent_001, TestSize.Level1) 355 { 356 GTEST_LOG_(INFO) << "SetParent_001 start"; 357 elementInfo_->SetParent(1); 358 EXPECT_EQ(elementInfo_->GetParentNodeId(), 1); 359 GTEST_LOG_(INFO) << "SetParent_001 end"; 360 } 361 362 /** 363 * @tc.number: SetRectInScreen_001 364 * @tc.name: SetRectInScreen 365 * @tc.desc: Test function SetRectInScreen, GetRectInScreen 366 */ 367 HWTEST_F(AccessibilityElementInfoTest, SetRectInScreen_001, TestSize.Level1) 368 { 369 GTEST_LOG_(INFO) << "SetRectInScreen_001 start"; 370 Rect bounds(1, 1, 1, 1); 371 elementInfo_->SetRectInScreen(bounds); 372 EXPECT_EQ(elementInfo_->GetRectInScreen().GetLeftTopXScreenPostion(), 1); 373 EXPECT_EQ(elementInfo_->GetRectInScreen().GetLeftTopYScreenPostion(), 1); 374 EXPECT_EQ(elementInfo_->GetRectInScreen().GetRightBottomXScreenPostion(), 1); 375 EXPECT_EQ(elementInfo_->GetRectInScreen().GetRightBottomYScreenPostion(), 1); 376 GTEST_LOG_(INFO) << "SetRectInScreen_001 end"; 377 } 378 379 /** 380 * @tc.number: SetCheckable_001 381 * @tc.name: SetCheckable 382 * @tc.desc: Test function SetCheckable, IsCheckable 383 */ 384 HWTEST_F(AccessibilityElementInfoTest, SetCheckable_001, TestSize.Level1) 385 { 386 GTEST_LOG_(INFO) << "SetCheckable_001 start"; 387 elementInfo_->SetCheckable(true); 388 EXPECT_TRUE(elementInfo_->IsCheckable()); 389 GTEST_LOG_(INFO) << "SetCheckable_001 end"; 390 } 391 392 /** 393 * @tc.number: SetChecked_001 394 * @tc.name: SetChecked 395 * @tc.desc: Test function SetChecked, IsChecked 396 */ 397 HWTEST_F(AccessibilityElementInfoTest, SetChecked_001, TestSize.Level1) 398 { 399 GTEST_LOG_(INFO) << "SetChecked_001 start"; 400 elementInfo_->SetChecked(true); 401 EXPECT_TRUE(elementInfo_->IsChecked()); 402 GTEST_LOG_(INFO) << "SetChecked_001 end"; 403 } 404 405 /** 406 * @tc.number: SetFocusable_001 407 * @tc.name: SetFocusable 408 * @tc.desc: Test function SetFocusable, IsFocusable 409 */ 410 HWTEST_F(AccessibilityElementInfoTest, SetFocusable_001, TestSize.Level1) 411 { 412 GTEST_LOG_(INFO) << "SetFocusable_001 start"; 413 elementInfo_->SetFocusable(true); 414 EXPECT_TRUE(elementInfo_->IsFocusable()); 415 GTEST_LOG_(INFO) << "SetFocusable_001 end"; 416 } 417 418 /** 419 * @tc.number: SetFocused_001 420 * @tc.name: SetFocused 421 * @tc.desc: Test function SetFocused, IsFocused 422 */ 423 HWTEST_F(AccessibilityElementInfoTest, SetFocused_001, TestSize.Level1) 424 { 425 GTEST_LOG_(INFO) << "SetFocused_001 start"; 426 elementInfo_->SetFocused(true); 427 EXPECT_TRUE(elementInfo_->IsFocused()); 428 GTEST_LOG_(INFO) << "SetFocused_001 end"; 429 } 430 431 /** 432 * @tc.number: SetVisible_001 433 * @tc.name: SetVisible 434 * @tc.desc: Test function SetVisible, IsVisible 435 */ 436 HWTEST_F(AccessibilityElementInfoTest, SetVisible_001, TestSize.Level1) 437 { 438 GTEST_LOG_(INFO) << "SetVisible_001 start"; 439 elementInfo_->SetVisible(true); 440 EXPECT_TRUE(elementInfo_->IsVisible()); 441 GTEST_LOG_(INFO) << "SetVisible_001 end"; 442 } 443 444 /** 445 * @tc.number: SetAccessibilityFocus_001 446 * @tc.name: SetAccessibilityFocus 447 * @tc.desc: Test function SetAccessibilityFocus, HasAccessibilityFocus 448 */ 449 HWTEST_F(AccessibilityElementInfoTest, SetAccessibilityFocus_001, TestSize.Level1) 450 { 451 GTEST_LOG_(INFO) << "SetAccessibilityFocus_001 start"; 452 elementInfo_->SetAccessibilityFocus(true); 453 EXPECT_TRUE(elementInfo_->HasAccessibilityFocus()); 454 GTEST_LOG_(INFO) << "SetAccessibilityFocus_001 end"; 455 } 456 457 /** 458 * @tc.number: SetSelected_001 459 * @tc.name: SetSelected 460 * @tc.desc: Test function SetSelected, IsSelected 461 */ 462 HWTEST_F(AccessibilityElementInfoTest, SetSelected_001, TestSize.Level1) 463 { 464 GTEST_LOG_(INFO) << "SetSelected_001 start"; 465 elementInfo_->SetSelected(true); 466 EXPECT_TRUE(elementInfo_->IsSelected()); 467 GTEST_LOG_(INFO) << "SetSelected_001 end"; 468 } 469 470 /** 471 * @tc.number: SetClickable_001 472 * @tc.name: SetClickable 473 * @tc.desc: Test function SetClickable, IsClickable 474 */ 475 HWTEST_F(AccessibilityElementInfoTest, SetClickable_001, TestSize.Level1) 476 { 477 GTEST_LOG_(INFO) << "SetClickable_001 start"; 478 elementInfo_->SetClickable(true); 479 EXPECT_TRUE(elementInfo_->IsClickable()); 480 GTEST_LOG_(INFO) << "SetClickable_001 end"; 481 } 482 483 /** 484 * @tc.number: SetLongClickable_001 485 * @tc.name: SetLongClickable 486 * @tc.desc: Test function SetLongClickable, IsLongClickable 487 */ 488 HWTEST_F(AccessibilityElementInfoTest, SetLongClickable_001, TestSize.Level1) 489 { 490 GTEST_LOG_(INFO) << "SetLongClickable_001 start"; 491 elementInfo_->SetLongClickable(true); 492 EXPECT_TRUE(elementInfo_->IsLongClickable()); 493 GTEST_LOG_(INFO) << "SetLongClickable_001 end"; 494 } 495 496 /** 497 * @tc.number: SetEnabled_001 498 * @tc.name: SetEnabled 499 * @tc.desc: Test function SetEnabled, IsEnabled 500 */ 501 HWTEST_F(AccessibilityElementInfoTest, SetEnabled_001, TestSize.Level1) 502 { 503 GTEST_LOG_(INFO) << "SetEnabled_001 start"; 504 elementInfo_->SetEnabled(true); 505 EXPECT_TRUE(elementInfo_->IsEnabled()); 506 GTEST_LOG_(INFO) << "SetEnabled_001 end"; 507 } 508 509 /** 510 * @tc.number: SetPassword_001 511 * @tc.name: SetPassword 512 * @tc.desc: Test function SetPassword, IsPassword 513 */ 514 HWTEST_F(AccessibilityElementInfoTest, SetPassword_001, TestSize.Level1) 515 { 516 GTEST_LOG_(INFO) << "SetPassword_001 start"; 517 elementInfo_->SetPassword(true); 518 EXPECT_TRUE(elementInfo_->IsPassword()); 519 GTEST_LOG_(INFO) << "SetPassword_001 end"; 520 } 521 522 /** 523 * @tc.number: SetScrollable_001 524 * @tc.name: SetScrollable 525 * @tc.desc: Test function SetScrollable, IsScrollable 526 */ 527 HWTEST_F(AccessibilityElementInfoTest, SetScrollable_001, TestSize.Level1) 528 { 529 GTEST_LOG_(INFO) << "SetScrollable_001 start"; 530 elementInfo_->SetScrollable(true); 531 EXPECT_TRUE(elementInfo_->IsScrollable()); 532 GTEST_LOG_(INFO) << "SetScrollable_001 end"; 533 } 534 535 /** 536 * @tc.number: SetEditable_001 537 * @tc.name: SetEditable 538 * @tc.desc: Test function SetEditable, IsEditable 539 */ 540 HWTEST_F(AccessibilityElementInfoTest, SetEditable_001, TestSize.Level1) 541 { 542 GTEST_LOG_(INFO) << "SetEditable_001 start"; 543 elementInfo_->SetEditable(true); 544 EXPECT_TRUE(elementInfo_->IsEditable()); 545 GTEST_LOG_(INFO) << "SetEditable_001 end"; 546 } 547 548 /** 549 * @tc.number: SetPluraLineSupported_001 550 * @tc.name: SetPluraLineSupported 551 * @tc.desc: Test function SetPluraLineSupported, IsPluraLineSupported 552 */ 553 HWTEST_F(AccessibilityElementInfoTest, SetPluraLineSupported_001, TestSize.Level1) 554 { 555 GTEST_LOG_(INFO) << "SetPluraLineSupported_001 start"; 556 elementInfo_->SetPluraLineSupported(true); 557 EXPECT_TRUE(elementInfo_->IsPluraLineSupported()); 558 GTEST_LOG_(INFO) << "SetPluraLineSupported_001 end"; 559 } 560 561 /** 562 * @tc.number: SetPopupSupported_001 563 * @tc.name: SetPopupSupported 564 * @tc.desc: Test function SetPopupSupported, IsPopupSupported 565 */ 566 HWTEST_F(AccessibilityElementInfoTest, SetPopupSupported_001, TestSize.Level1) 567 { 568 GTEST_LOG_(INFO) << "SetPopupSupported_001 start"; 569 elementInfo_->SetPopupSupported(true); 570 EXPECT_TRUE(elementInfo_->IsPopupSupported()); 571 GTEST_LOG_(INFO) << "SetPopupSupported_001 end"; 572 } 573 574 /** 575 * @tc.number: SetDeletable_001 576 * @tc.name: SetDeletable 577 * @tc.desc: Test function SetDeletable, IsDeletable 578 */ 579 HWTEST_F(AccessibilityElementInfoTest, SetDeletable_001, TestSize.Level1) 580 { 581 GTEST_LOG_(INFO) << "SetDeletable_001 start"; 582 elementInfo_->SetDeletable(true); 583 EXPECT_TRUE(elementInfo_->IsDeletable()); 584 GTEST_LOG_(INFO) << "SetDeletable_001 end"; 585 } 586 587 /** 588 * @tc.number: SetEssential_001 589 * @tc.name: SetEssential 590 * @tc.desc: Test function SetEssential, IsEssential 591 */ 592 HWTEST_F(AccessibilityElementInfoTest, SetEssential_001, TestSize.Level1) 593 { 594 GTEST_LOG_(INFO) << "SetEssential_001 start"; 595 elementInfo_->SetEssential(true); 596 EXPECT_TRUE(elementInfo_->IsEssential()); 597 GTEST_LOG_(INFO) << "SetEssential_001 end"; 598 } 599 600 /** 601 * @tc.number: SetHinting_001 602 * @tc.name: SetHinting 603 * @tc.desc: Test function SetHinting, IsGivingHint 604 */ 605 HWTEST_F(AccessibilityElementInfoTest, SetHinting_001, TestSize.Level1) 606 { 607 GTEST_LOG_(INFO) << "SetHinting_001 start"; 608 elementInfo_->SetHinting(true); 609 EXPECT_TRUE(elementInfo_->IsGivingHint()); 610 GTEST_LOG_(INFO) << "SetHinting_001 end"; 611 } 612 613 /** 614 * @tc.number: SetBundleName_001 615 * @tc.name: SetBundleName 616 * @tc.desc: Test function SetBundleName, GetBundleName 617 */ 618 HWTEST_F(AccessibilityElementInfoTest, SetBundleName_001, TestSize.Level1) 619 { 620 GTEST_LOG_(INFO) << "SetBundleName_001 start"; 621 elementInfo_->SetBundleName("test"); 622 EXPECT_STREQ(elementInfo_->GetBundleName().c_str(), "test"); 623 GTEST_LOG_(INFO) << "SetBundleName_001 end"; 624 } 625 626 /** 627 * @tc.number: SetComponentType_001 628 * @tc.name: SetComponentType 629 * @tc.desc: Test function SetComponentType, GetComponentType 630 */ 631 HWTEST_F(AccessibilityElementInfoTest, SetComponentType_001, TestSize.Level1) 632 { 633 GTEST_LOG_(INFO) << "SetComponentType_001 start"; 634 elementInfo_->SetComponentType("test"); 635 EXPECT_STREQ(elementInfo_->GetComponentType().c_str(), "test"); 636 GTEST_LOG_(INFO) << "SetComponentType_001 end"; 637 } 638 639 /** 640 * @tc.number: SetContent_001 641 * @tc.name: SetContent 642 * @tc.desc: Test function SetContent, GetContent 643 */ 644 HWTEST_F(AccessibilityElementInfoTest, SetContent_001, TestSize.Level1) 645 { 646 GTEST_LOG_(INFO) << "SetContent_001 start"; 647 elementInfo_->SetContent("test"); 648 EXPECT_STREQ(elementInfo_->GetContent().c_str(), "test"); 649 GTEST_LOG_(INFO) << "SetContent_001 end"; 650 } 651 652 /** 653 * @tc.number: SetHint_001 654 * @tc.name: SetHint 655 * @tc.desc: Test function SetHint, GetHint 656 */ 657 HWTEST_F(AccessibilityElementInfoTest, SetHint_001, TestSize.Level1) 658 { 659 GTEST_LOG_(INFO) << "SetHint_001 start"; 660 elementInfo_->SetHint("test"); 661 EXPECT_STREQ(elementInfo_->GetHint().c_str(), "test"); 662 GTEST_LOG_(INFO) << "SetHint_001 end"; 663 } 664 665 /** 666 * @tc.number: SetDescriptionInfo_001 667 * @tc.name: SetDescriptionInfo 668 * @tc.desc: Test function SetDescriptionInfo, GetDescriptionInfo 669 */ 670 HWTEST_F(AccessibilityElementInfoTest, SetDescriptionInfo_001, TestSize.Level1) 671 { 672 GTEST_LOG_(INFO) << "SetDescriptionInfo_001 start"; 673 elementInfo_->SetDescriptionInfo("test"); 674 EXPECT_STREQ(elementInfo_->GetDescriptionInfo().c_str(), "test"); 675 GTEST_LOG_(INFO) << "SetDescriptionInfo_001 end"; 676 } 677 678 /** 679 * @tc.number: SetComponentResourceId_001 680 * @tc.name: SetComponentResourceId 681 * @tc.desc: Test function SetComponentResourceId, GetComponentResourceId 682 */ 683 HWTEST_F(AccessibilityElementInfoTest, SetComponentResourceId_001, TestSize.Level1) 684 { 685 GTEST_LOG_(INFO) << "SetComponentResourceId_001 start"; 686 elementInfo_->SetComponentResourceId("test"); 687 EXPECT_STREQ(elementInfo_->GetComponentResourceId().c_str(), "test"); 688 GTEST_LOG_(INFO) << "SetComponentResourceId_001 end"; 689 } 690 691 /** 692 * @tc.number: SetLiveRegion_001 693 * @tc.name: SetLiveRegion 694 * @tc.desc: Test function SetLiveRegion, GetLiveRegion 695 */ 696 HWTEST_F(AccessibilityElementInfoTest, SetLiveRegion_001, TestSize.Level1) 697 { 698 GTEST_LOG_(INFO) << "SetLiveRegion_001 start"; 699 elementInfo_->SetLiveRegion(1); 700 EXPECT_EQ(elementInfo_->GetLiveRegion(), 1); 701 GTEST_LOG_(INFO) << "SetLiveRegion_001 end"; 702 } 703 704 /** 705 * @tc.number: SetContentInvalid_001 706 * @tc.name: SetContentInvalid 707 * @tc.desc: Test function SetContentInvalid, GetContentInvalid 708 */ 709 HWTEST_F(AccessibilityElementInfoTest, SetContentInvalid_001, TestSize.Level1) 710 { 711 GTEST_LOG_(INFO) << "SetContentInvalid_001 start"; 712 elementInfo_->SetContentInvalid(false); 713 EXPECT_FALSE(elementInfo_->GetContentInvalid()); 714 GTEST_LOG_(INFO) << "SetContentInvalid_001 end"; 715 } 716 717 /** 718 * @tc.number: SetError_001 719 * @tc.name: SetError 720 * @tc.desc: Test function SetError, GetError 721 */ 722 HWTEST_F(AccessibilityElementInfoTest, SetError_001, TestSize.Level1) 723 { 724 GTEST_LOG_(INFO) << "SetError_001 start"; 725 elementInfo_->SetError("test"); 726 EXPECT_STREQ(elementInfo_->GetError().c_str(), "test"); 727 GTEST_LOG_(INFO) << "SetError_001 end"; 728 } 729 730 /** 731 * @tc.number: SetLabeled_001 732 * @tc.name: SetLabeled 733 * @tc.desc: Test function SetLabeled, GetLabeledAccessibilityId 734 */ 735 HWTEST_F(AccessibilityElementInfoTest, SetLabeled_001, TestSize.Level1) 736 { 737 GTEST_LOG_(INFO) << "SetLabeled_001 start"; 738 elementInfo_->SetLabeled(1); 739 EXPECT_EQ(elementInfo_->GetLabeledAccessibilityId(), 1); 740 GTEST_LOG_(INFO) << "SetLabeled_001 end"; 741 } 742 743 /** 744 * @tc.number: SetAccessibilityId_001 745 * @tc.name: SetAccessibilityId 746 * @tc.desc: Test function SetAccessibilityId, GetAccessibilityId 747 */ 748 HWTEST_F(AccessibilityElementInfoTest, SetAccessibilityId_001, TestSize.Level1) 749 { 750 GTEST_LOG_(INFO) << "SetAccessibilityId_001 start"; 751 elementInfo_->SetAccessibilityId(1); 752 EXPECT_EQ(elementInfo_->GetAccessibilityId(), 1); 753 GTEST_LOG_(INFO) << "SetAccessibilityId_001 end"; 754 } 755 756 /** 757 * @tc.number: SetRange_001 758 * @tc.name: SetRange 759 * @tc.desc: Test function SetRange, GetRange 760 */ 761 HWTEST_F(AccessibilityElementInfoTest, SetRange_001, TestSize.Level1) 762 { 763 GTEST_LOG_(INFO) << "SetRange_001 start"; 764 RangeInfo rangeInfo(1, 1, 1); 765 elementInfo_->SetRange(rangeInfo); 766 EXPECT_EQ(elementInfo_->GetRange().GetMin(), 1); 767 EXPECT_EQ(elementInfo_->GetRange().GetMax(), 1); 768 EXPECT_EQ(elementInfo_->GetRange().GetCurrent(), 1); 769 GTEST_LOG_(INFO) << "SetRange_001 end"; 770 } 771 772 /** 773 * @tc.number: SetSelectedBegin_001 774 * @tc.name: SetSelectedBegin 775 * @tc.desc: Test function SetSelectedBegin, GetSelectedBegin 776 */ 777 HWTEST_F(AccessibilityElementInfoTest, SetSelectedBegin_001, TestSize.Level1) 778 { 779 GTEST_LOG_(INFO) << "SetSelectedBegin_001 start"; 780 elementInfo_->SetSelectedBegin(1); 781 EXPECT_EQ(elementInfo_->GetSelectedBegin(), 1); 782 GTEST_LOG_(INFO) << "SetSelectedBegin_001 end"; 783 } 784 785 /** 786 * @tc.number: SetSelectedEnd_001 787 * @tc.name: SetSelectedEnd 788 * @tc.desc: Test function SetSelectedEnd, GetSelectedEnd 789 */ 790 HWTEST_F(AccessibilityElementInfoTest, SetSelectedEnd_001, TestSize.Level1) 791 { 792 GTEST_LOG_(INFO) << "SetSelectedEnd_001 start"; 793 elementInfo_->SetSelectedEnd(1); 794 EXPECT_EQ(elementInfo_->GetSelectedEnd(), 1); 795 GTEST_LOG_(INFO) << "SetSelectedEnd_001 end"; 796 } 797 798 /** 799 * @tc.number: SetGrid_001 800 * @tc.name: SetGrid 801 * @tc.desc: Test function SetGrid, GetGrid 802 */ 803 HWTEST_F(AccessibilityElementInfoTest, SetGrid_001, TestSize.Level1) 804 { 805 GTEST_LOG_(INFO) << "SetGrid_001 start"; 806 GridInfo grid(1, 1, 1); 807 elementInfo_->SetGrid(grid); 808 EXPECT_EQ(elementInfo_->GetGrid().GetRowCount(), 1); 809 EXPECT_EQ(elementInfo_->GetGrid().GetColumnCount(), 1); 810 EXPECT_EQ(elementInfo_->GetGrid().GetSelectionMode(), 1); 811 GTEST_LOG_(INFO) << "SetGrid_001 end"; 812 } 813 814 /** 815 * @tc.number: SetGridItem_001 816 * @tc.name: SetGridItem 817 * @tc.desc: Test function SetGridItem, GetGridItem 818 */ 819 HWTEST_F(AccessibilityElementInfoTest, SetGridItem_001, TestSize.Level1) 820 { 821 GTEST_LOG_(INFO) << "SetGridItem_001 start"; 822 GridItemInfo gridItem(1, 1, 1, 1, true, true); 823 elementInfo_->SetGridItem(gridItem); 824 EXPECT_EQ(elementInfo_->GetGridItem().GetColumnIndex(), 1); 825 EXPECT_EQ(elementInfo_->GetGridItem().GetRowIndex(), 1); 826 EXPECT_EQ(elementInfo_->GetGridItem().GetColumnSpan(), 1); 827 EXPECT_EQ(elementInfo_->GetGridItem().GetRowSpan(), 1); 828 EXPECT_TRUE(elementInfo_->GetGridItem().IsHeading()); 829 EXPECT_TRUE(elementInfo_->GetGridItem().IsSelected()); 830 GTEST_LOG_(INFO) << "SetGridItem_001 end"; 831 } 832 833 /** 834 * @tc.number: SetCurrentIndex_001 835 * @tc.name: SetCurrentIndex 836 * @tc.desc: Test function SetCurrentIndex, GetCurrentIndex 837 */ 838 HWTEST_F(AccessibilityElementInfoTest, SetCurrentIndex_001, TestSize.Level1) 839 { 840 GTEST_LOG_(INFO) << "SetCurrentIndex_001 start"; 841 elementInfo_->SetCurrentIndex(1); 842 EXPECT_EQ(elementInfo_->GetCurrentIndex(), 1); 843 GTEST_LOG_(INFO) << "SetCurrentIndex_001 end"; 844 } 845 846 /** 847 * @tc.number: SetBeginIndex_001 848 * @tc.name: SetBeginIndex 849 * @tc.desc: Test function SetBeginIndex, GetBeginIndex 850 */ 851 HWTEST_F(AccessibilityElementInfoTest, SetBeginIndex_001, TestSize.Level1) 852 { 853 GTEST_LOG_(INFO) << "SetBeginIndex_001 start"; 854 elementInfo_->SetBeginIndex(1); 855 EXPECT_EQ(elementInfo_->GetBeginIndex(), 1); 856 GTEST_LOG_(INFO) << "SetBeginIndex_001 end"; 857 } 858 859 /** 860 * @tc.number: SetEndIndex_001 861 * @tc.name: SetEndIndex 862 * @tc.desc: Test function SetEndIndex, GetEndIndex 863 */ 864 HWTEST_F(AccessibilityElementInfoTest, SetEndIndex_001, TestSize.Level1) 865 { 866 GTEST_LOG_(INFO) << "SetEndIndex_001 start"; 867 elementInfo_->SetEndIndex(1); 868 EXPECT_EQ(elementInfo_->GetEndIndex(), 1); 869 GTEST_LOG_(INFO) << "SetEndIndex_001 end"; 870 } 871 872 /** 873 * @tc.number: SetInputType_001 874 * @tc.name: SetInputType 875 * @tc.desc: Test function SetInputType, GetInputType 876 */ 877 HWTEST_F(AccessibilityElementInfoTest, SetInputType_001, TestSize.Level1) 878 { 879 GTEST_LOG_(INFO) << "SetInputType_001 start"; 880 elementInfo_->SetInputType(1); 881 EXPECT_EQ(elementInfo_->GetInputType(), 1); 882 GTEST_LOG_(INFO) << "SetInputType_001 end"; 883 } 884 885 /** 886 * @tc.number: SetValidElement_001 887 * @tc.name: SetValidElement 888 * @tc.desc: Test function SetValidElement, IsValidElement 889 */ 890 HWTEST_F(AccessibilityElementInfoTest, SetValidElement_001, TestSize.Level1) 891 { 892 GTEST_LOG_(INFO) << "SetValidElement_001 start"; 893 elementInfo_->SetValidElement(false); 894 EXPECT_FALSE(elementInfo_->IsValidElement()); 895 GTEST_LOG_(INFO) << "SetValidElement_001 end"; 896 } 897 898 /** 899 * @tc.number: SetInspectorKey_001 900 * @tc.name: SetInspectorKey 901 * @tc.desc: Test function SetInspectorKey, GetInspectorKey 902 */ 903 HWTEST_F(AccessibilityElementInfoTest, SetInspectorKey_001, TestSize.Level1) 904 { 905 GTEST_LOG_(INFO) << "SetInspectorKey_001 start"; 906 elementInfo_->SetInspectorKey("test"); 907 EXPECT_STREQ(elementInfo_->GetInspectorKey().c_str(), "test"); 908 GTEST_LOG_(INFO) << "SetInspectorKey_001 end"; 909 } 910 911 /** 912 * @tc.number: SetPagePath_001 913 * @tc.name: SetPagePath 914 * @tc.desc: Test function SetPagePath, GetPagePath 915 */ 916 HWTEST_F(AccessibilityElementInfoTest, SetPagePath_001, TestSize.Level1) 917 { 918 GTEST_LOG_(INFO) << "SetPagePath_001 start"; 919 elementInfo_->SetPagePath("test"); 920 EXPECT_STREQ(elementInfo_->GetPagePath().c_str(), "test"); 921 GTEST_LOG_(INFO) << "SetPagePath_001 end"; 922 } 923 924 /** 925 * @tc.number: SetPageId_001 926 * @tc.name: SetPageId 927 * @tc.desc: Test function SetPageId, GetPageId 928 */ 929 HWTEST_F(AccessibilityElementInfoTest, SetPageId_001, TestSize.Level1) 930 { 931 GTEST_LOG_(INFO) << "SetPageId_001 start"; 932 elementInfo_->SetPageId(1); 933 EXPECT_EQ(elementInfo_->GetPageId(), 1); 934 GTEST_LOG_(INFO) << "SetPageId_001 end"; 935 } 936 937 /** 938 * @tc.number: SetTextMovementStep_001 939 * @tc.name: SetTextMovementStep 940 * @tc.desc: Test function SetTextMovementStep, GetTextMovementStep 941 */ 942 HWTEST_F(AccessibilityElementInfoTest, SetTextMovementStep_001, TestSize.Level1) 943 { 944 GTEST_LOG_(INFO) << "SetTextMovementStep_001 start"; 945 elementInfo_->SetTextMovementStep(STEP_CHARACTER); 946 EXPECT_EQ(elementInfo_->GetTextMovementStep(), STEP_CHARACTER); 947 GTEST_LOG_(INFO) << "SetTextMovementStep_001 end"; 948 } 949 950 /** 951 * @tc.number: SetItemCounts_001 952 * @tc.name: SetItemCounts 953 * @tc.desc: Test function SetItemCounts, GetItemCounts 954 */ 955 HWTEST_F(AccessibilityElementInfoTest, SetItemCounts_001, TestSize.Level1) 956 { 957 GTEST_LOG_(INFO) << "SetItemCounts_001 start"; 958 elementInfo_->SetItemCounts(1); 959 EXPECT_EQ(elementInfo_->GetItemCounts(), 1); 960 GTEST_LOG_(INFO) << "SetItemCounts_001 end"; 961 } 962 963 /** 964 * @tc.number: SetTriggerAction_001 965 * @tc.name: SetTriggerAction 966 * @tc.desc: Test function SetTriggerAction, GetTriggerAction 967 */ 968 HWTEST_F(AccessibilityElementInfoTest, SetTriggerAction_001, TestSize.Level1) 969 { 970 GTEST_LOG_(INFO) << "SetTriggerAction_001 start"; 971 elementInfo_->SetTriggerAction(ACCESSIBILITY_ACTION_FOCUS); 972 EXPECT_EQ(elementInfo_->GetTriggerAction(), ACCESSIBILITY_ACTION_FOCUS); 973 GTEST_LOG_(INFO) << "SetTriggerAction_001 end"; 974 } 975 976 /** 977 * @tc.number: SetContentList_001 978 * @tc.name: SetContentList 979 * @tc.desc: Test function SetContentList, GetContentList 980 */ 981 HWTEST_F(AccessibilityElementInfoTest, SetContentList_001, TestSize.Level1) 982 { 983 GTEST_LOG_(INFO) << "SetContentList_001 start"; 984 std::vector<std::string> contentList; 985 contentList.push_back("test"); 986 elementInfo_->SetContentList(contentList); 987 988 std::vector<std::string> result; 989 elementInfo_->GetContentList(result); 990 ASSERT_EQ(static_cast<int>(result.size()), 1); 991 EXPECT_STREQ(result.front().c_str(), "test"); 992 GTEST_LOG_(INFO) << "SetContentList_001 end"; 993 } 994 995 /** 996 * @tc.number: SetLatestContent_001 997 * @tc.name: SetLatestContent 998 * @tc.desc: Test function SetLatestContent, GetLatestContent 999 */ 1000 HWTEST_F(AccessibilityElementInfoTest, SetLatestContent_001, TestSize.Level1) 1001 { 1002 GTEST_LOG_(INFO) << "SetLatestContent_001 start"; 1003 elementInfo_->SetLatestContent("test"); 1004 EXPECT_STREQ(elementInfo_->GetLatestContent().c_str(), "test"); 1005 GTEST_LOG_(INFO) << "SetLatestContent_001 end"; 1006 } 1007 1008 /** 1009 * @tc.number: SetMin_001 1010 * @tc.name: SetMin 1011 * @tc.desc: Test function SetMin, GetMin 1012 */ 1013 HWTEST_F(RangeInfoTest, SetMin_001, TestSize.Level1) 1014 { 1015 GTEST_LOG_(INFO) << "SetMin_001 start"; 1016 rangeInfo_->SetMin(1); 1017 EXPECT_EQ(rangeInfo_->GetMin(), 1); 1018 GTEST_LOG_(INFO) << "SetMin_001 end"; 1019 } 1020 1021 /** 1022 * @tc.number: SetMax_001 1023 * @tc.name: SetMax 1024 * @tc.desc: Test function SetMax, GetMax 1025 */ 1026 HWTEST_F(RangeInfoTest, SetMax_001, TestSize.Level1) 1027 { 1028 GTEST_LOG_(INFO) << "SetMax_001 start"; 1029 rangeInfo_->SetMax(10); 1030 EXPECT_EQ(rangeInfo_->GetMax(), 10); 1031 GTEST_LOG_(INFO) << "SetMax_001 end"; 1032 } 1033 1034 /** 1035 * @tc.number: SetCurrent_001 1036 * @tc.name: SetCurrent 1037 * @tc.desc: Test function SetCurrent, GetMax 1038 */ 1039 HWTEST_F(RangeInfoTest, SetCurrent_001, TestSize.Level1) 1040 { 1041 GTEST_LOG_(INFO) << "SetCurrent_001 start"; 1042 rangeInfo_->SetCurrent(5); 1043 EXPECT_EQ(rangeInfo_->GetCurrent(), 5); 1044 GTEST_LOG_(INFO) << "SetCurrent_001 end"; 1045 } 1046 1047 /** 1048 * @tc.number: SetGrid_001 1049 * @tc.name: SetGrid 1050 * @tc.desc: Test function SetGrid, GetRowCount, GetColumnCount, GetSelectionMode 1051 */ 1052 HWTEST_F(GridInfoTest, SetGrid_001, TestSize.Level1) 1053 { 1054 GTEST_LOG_(INFO) << "SetGrid_001 start"; 1055 gridInfo_->SetGrid(1, 2, 3); 1056 EXPECT_EQ(gridInfo_->GetRowCount(), 1); 1057 EXPECT_EQ(gridInfo_->GetColumnCount(), 2); 1058 EXPECT_EQ(gridInfo_->GetSelectionMode(), 3); 1059 GTEST_LOG_(INFO) << "SetGrid_001 end"; 1060 } 1061 1062 /** 1063 * @tc.number: SetGrid_002 1064 * @tc.name: SetGrid 1065 * @tc.desc: Test function SetGrid, GetRowCount, GetColumnCount, GetSelectionMode 1066 */ 1067 HWTEST_F(GridInfoTest, SetGrid_002, TestSize.Level1) 1068 { 1069 GTEST_LOG_(INFO) << "SetGrid_002 start"; 1070 GridInfo grid(11, 12, 13); 1071 gridInfo_->SetGrid(grid); 1072 EXPECT_EQ(gridInfo_->GetRowCount(), 11); 1073 EXPECT_EQ(gridInfo_->GetColumnCount(), 12); 1074 EXPECT_EQ(gridInfo_->GetSelectionMode(), 13); 1075 GTEST_LOG_(INFO) << "SetGrid_002 end"; 1076 } 1077 1078 /** 1079 * @tc.number: SetGridItemInfo_001 1080 * @tc.name: SetGridItemInfo 1081 * @tc.desc: Test function SetGridItemInfo, GetRowIndex, GetRowSpan, GetColumnIndex, GetColumnSpan, IsHeading, 1082 * IsSelected 1083 */ 1084 HWTEST_F(GridItemInfoTest, SetGridItemInfo_001, TestSize.Level1) 1085 { 1086 GTEST_LOG_(INFO) << "SetGridItemInfo_001 start"; 1087 gridItemInfo_->SetGridItemInfo(1, 1, 1, 1, true, true); 1088 EXPECT_EQ(gridItemInfo_->GetRowIndex(), 1); 1089 EXPECT_EQ(gridItemInfo_->GetRowSpan(), 1); 1090 EXPECT_EQ(gridItemInfo_->GetColumnIndex(), 1); 1091 EXPECT_EQ(gridItemInfo_->GetColumnSpan(), 1); 1092 EXPECT_TRUE(gridItemInfo_->IsHeading()); 1093 EXPECT_TRUE(gridItemInfo_->IsSelected()); 1094 GTEST_LOG_(INFO) << "SetGridItemInfo_001 end"; 1095 } 1096 1097 /** 1098 * @tc.number: SetGridItemInfo_002 1099 * @tc.name: SetGridItemInfo 1100 * @tc.desc: Test function SetGridItemInfo, GetRowIndex, GetRowSpan, GetColumnIndex, GetColumnSpan, IsHeading, 1101 * IsSelected 1102 */ 1103 HWTEST_F(GridItemInfoTest, SetGridItemInfo_002, TestSize.Level1) 1104 { 1105 GTEST_LOG_(INFO) << "SetGridItemInfo_002 start"; 1106 GridItemInfo itemInfo(11, 12, 13, 14, false, false); 1107 gridItemInfo_->SetGridItemInfo(itemInfo); 1108 EXPECT_EQ(gridItemInfo_->GetRowIndex(), 11); 1109 EXPECT_EQ(gridItemInfo_->GetRowSpan(), 12); 1110 EXPECT_EQ(gridItemInfo_->GetColumnIndex(), 13); 1111 EXPECT_EQ(gridItemInfo_->GetColumnSpan(), 14); 1112 EXPECT_FALSE(gridItemInfo_->IsHeading()); 1113 EXPECT_FALSE(gridItemInfo_->IsSelected()); 1114 GTEST_LOG_(INFO) << "SetGridItemInfo_002 end"; 1115 } 1116 1117 /** 1118 * @tc.number: AccessibleAction_001 1119 * @tc.name: AccessibleAction 1120 * @tc.desc: Test function AccessibleAction, GetActionType, GetDescriptionInfo 1121 */ 1122 HWTEST_F(AccessibleActionTest, AccessibleAction_001, TestSize.Level1) 1123 { 1124 GTEST_LOG_(INFO) << "AccessibleAction_001 start"; 1125 std::shared_ptr<AccessibleAction> action = std::make_shared<AccessibleAction>(ACCESSIBILITY_ACTION_FOCUS, "test"); 1126 ASSERT_TRUE(action); 1127 EXPECT_EQ(action->GetActionType(), ACCESSIBILITY_ACTION_FOCUS); 1128 EXPECT_STREQ(action->GetDescriptionInfo().c_str(), "test"); 1129 action = nullptr; 1130 GTEST_LOG_(INFO) << "AccessibleAction_001 end"; 1131 } 1132 1133 /** 1134 * @tc.number: AccessibleAction_002 1135 * @tc.name: AccessibleAction 1136 * @tc.desc: Test function AccessibleAction, GetActionType, GetDescriptionInfo 1137 */ 1138 HWTEST_F(AccessibleActionTest, AccessibleAction_002, TestSize.Level1) 1139 { 1140 GTEST_LOG_(INFO) << "AccessibleAction_002 start"; 1141 std::shared_ptr<AccessibleAction> action = std::make_shared<AccessibleAction>(); 1142 ASSERT_TRUE(action); 1143 EXPECT_EQ(action->GetActionType(), ACCESSIBILITY_ACTION_INVALID); 1144 EXPECT_STREQ(action->GetDescriptionInfo().c_str(), ""); 1145 action = nullptr; 1146 GTEST_LOG_(INFO) << "AccessibleAction_002 end"; 1147 } 1148 1149 /** 1150 * @tc.number: Rect_001 1151 * @tc.name: Rect 1152 * @tc.desc: Test function Rect 1153 */ 1154 HWTEST_F(AccessibilityElementInfoTest, Rect_001, TestSize.Level1) 1155 { 1156 GTEST_LOG_(INFO) << "Rect_001 start"; 1157 Rect rect(1, 1, 1, 1); 1158 EXPECT_EQ(rect.GetLeftTopXScreenPostion(), 1); 1159 EXPECT_EQ(rect.GetLeftTopYScreenPostion(), 1); 1160 EXPECT_EQ(rect.GetRightBottomXScreenPostion(), 1); 1161 EXPECT_EQ(rect.GetRightBottomYScreenPostion(), 1); 1162 GTEST_LOG_(INFO) << "Rect_001 end"; 1163 } 1164 } // namespace Accessibility 1165 } // namespace OHOS