• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <memory>
18 #include "accessibility_event_info.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace Accessibility {
25 class AccessibilityEventInfoUnitTest : public ::testing::Test {
26 public:
AccessibilityEventInfoUnitTest()27     AccessibilityEventInfoUnitTest()
28     {}
~AccessibilityEventInfoUnitTest()29     ~AccessibilityEventInfoUnitTest()
30     {}
SetUpTestCase()31     static void SetUpTestCase()
32     {
33         GTEST_LOG_(INFO) << "AccessibilityEventInfoUnitTest Start";
34     }
TearDownTestCase()35     static void TearDownTestCase()
36     {
37         GTEST_LOG_(INFO) << "AccessibilityEventInfoUnitTest End";
38     }
SetUp()39     void SetUp()
40     {
41         GTEST_LOG_(INFO) << "AccessibilityEventInfoUnitTest SetUp() Start";
42         eventInfo_ = std::make_shared<AccessibilityEventInfo>();
43         GTEST_LOG_(INFO) << "AccessibilityEventInfoUnitTest SetUp() End";
44     };
TearDown()45     void TearDown()
46     {
47         GTEST_LOG_(INFO) << "AccessibilityEventInfoUnitTest TearDown()";
48         eventInfo_ = nullptr;
49     }
50 
51     std::shared_ptr<AccessibilityEventInfo> eventInfo_ = nullptr;
52 };
53 
54 /**
55  * @tc.number: SetWindowChangeTypes_001
56  * @tc.name: SetWindowChangeTypes
57  * @tc.desc: Test function SetWindowChangeTypes
58  */
59 HWTEST_F(AccessibilityEventInfoUnitTest, SetWindowChangeTypes_001, TestSize.Level1)
60 {
61     GTEST_LOG_(INFO) << "SetWindowChangeTypes_001 start";
62     if (!eventInfo_) {
63         GTEST_LOG_(INFO) << "eventInfo_ is null";
64         return;
65     }
66     eventInfo_->SetWindowChangeTypes(WindowUpdateType::WINDOW_UPDATE_ACTIVE);
67     EXPECT_EQ(eventInfo_->GetWindowChangeTypes(), WindowUpdateType::WINDOW_UPDATE_ACTIVE);
68     GTEST_LOG_(INFO) << "SetWindowChangeTypes_001 end";
69 }
70 
71 /**
72  * @tc.number: SetEventType_001
73  * @tc.name: SetEventType
74  * @tc.desc: Test function SetEventType
75  */
76 HWTEST_F(AccessibilityEventInfoUnitTest, SetEventType_001, TestSize.Level1)
77 {
78     GTEST_LOG_(INFO) << "SetEventType_001 start";
79     if (!eventInfo_) {
80         GTEST_LOG_(INFO) << "eventInfo_ is null";
81         return;
82     }
83     eventInfo_->SetEventType(EventType::TYPE_PAGE_CONTENT_UPDATE);
84     EXPECT_EQ(eventInfo_->GetEventType(), EventType::TYPE_PAGE_CONTENT_UPDATE);
85     GTEST_LOG_(INFO) << "SetEventType_001 end";
86 }
87 
88 /**
89  * @tc.number: SetWindowContentChangeTypes_001
90  * @tc.name: SetWindowContentChangeTypes
91  * @tc.desc: Test function SetWindowContentChangeTypes
92  */
93 HWTEST_F(AccessibilityEventInfoUnitTest, SetWindowContentChangeTypes_001, TestSize.Level1)
94 {
95     GTEST_LOG_(INFO) << "SetWindowContentChangeTypes_001 start";
96     if (!eventInfo_) {
97         GTEST_LOG_(INFO) << "eventInfo_ is null";
98         return;
99     }
100     eventInfo_->SetWindowContentChangeTypes(WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_TEXT);
101     EXPECT_EQ(eventInfo_->GetWindowContentChangeTypes(), WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_TEXT);
102     GTEST_LOG_(INFO) << "SetWindowContentChangeTypes_001 end";
103 }
104 
105 /**
106  * @tc.number: SetTimeStamp_001
107  * @tc.name: SetTimeStamp
108  * @tc.desc: Test function SetTimeStamp
109  */
110 HWTEST_F(AccessibilityEventInfoUnitTest, SetTimeStamp_001, TestSize.Level1)
111 {
112     GTEST_LOG_(INFO) << "SetTimeStamp_001 start";
113     if (!eventInfo_) {
114         GTEST_LOG_(INFO) << "eventInfo_ is null";
115         return;
116     }
117     eventInfo_->SetTimeStamp(6000);
118     EXPECT_EQ(eventInfo_->GetTimeStamp(), 6000);
119     GTEST_LOG_(INFO) << "SetTimeStamp_001 end";
120 }
121 
122 /**
123  * @tc.number: SetResourceId_001
124  * @tc.name: SetResourceId
125  * @tc.desc: Test function SetResourceId
126  */
127 HWTEST_F(AccessibilityEventInfoUnitTest, SetResourceId_001, TestSize.Level1)
128 {
129     GTEST_LOG_(INFO) << "SetResourceId_001 start";
130     if (!eventInfo_) {
131         GTEST_LOG_(INFO) << "eventInfo_ is null";
132         return;
133     }
134     eventInfo_->SetResourceId(12345);
135     EXPECT_EQ(eventInfo_->GetResourceId(), 12345);
136     GTEST_LOG_(INFO) << "SetResourceId_001 end";
137 }
138 
139 /**
140  * @tc.number: SetResourceModuleName_001
141  * @tc.name: SetResourceModuleName
142  * @tc.desc: Test function SetResourceModuleName
143  */
144 HWTEST_F(AccessibilityEventInfoUnitTest, SetResourceModuleName_001, TestSize.Level1)
145 {
146     GTEST_LOG_(INFO) << "SetResourceModuleName_001 start";
147     if (!eventInfo_) {
148         GTEST_LOG_(INFO) << "eventInfo_ is null";
149         return;
150     }
151     eventInfo_->SetResourceModuleName("accessibilityResourceModuleNameTest");
152     EXPECT_EQ(eventInfo_->GetResourceModuleName(), "accessibilityResourceModuleNameTest");
153     GTEST_LOG_(INFO) << "SetResourceModuleName_001 end";
154 }
155 
156 /**
157  * @tc.number: SetResourceBundleName_001
158  * @tc.name: SetResourceBundleName
159  * @tc.desc: Test function SetResourceBundleName
160  */
161 HWTEST_F(AccessibilityEventInfoUnitTest, SetResourceBundleName_001, TestSize.Level1)
162 {
163     GTEST_LOG_(INFO) << "SetResourceBundleName_001 start";
164     if (!eventInfo_) {
165         GTEST_LOG_(INFO) << "eventInfo_ is null";
166         return;
167     }
168     eventInfo_->SetResourceBundleName("accessibilityResourceBundleNameTest");
169     EXPECT_EQ(eventInfo_->GetResourceBundleName(), "accessibilityResourceBundleNameTest");
170     GTEST_LOG_(INFO) << "SetResourceBundleName_001 end";
171 }
172 
173 /**
174  * @tc.number: SetBundleName_001
175  * @tc.name: SetBundleName
176  * @tc.desc: Test function SetBundleName
177  */
178 HWTEST_F(AccessibilityEventInfoUnitTest, SetBundleName_001, TestSize.Level1)
179 {
180     GTEST_LOG_(INFO) << "SetBundleName_001 start";
181     if (!eventInfo_) {
182         GTEST_LOG_(INFO) << "eventInfo_ is null";
183         return;
184     }
185     std::string bundleName = "accessibilityTest";
186     eventInfo_->SetBundleName(bundleName);
187     EXPECT_EQ(eventInfo_->GetBundleName(), bundleName);
188     GTEST_LOG_(INFO) << "SetBundleName_001 end";
189 }
190 
191 /**
192  * @tc.number: SetNotificationContent_001
193  * @tc.name: SetNotificationContent
194  * @tc.desc: Test function SetNotificationContent
195  */
196 HWTEST_F(AccessibilityEventInfoUnitTest, SetNotificationContent_001, TestSize.Level1)
197 {
198     GTEST_LOG_(INFO) << "SetNotificationContent_001 start";
199     if (!eventInfo_) {
200         GTEST_LOG_(INFO) << "eventInfo_ is null";
201         return;
202     }
203     std::string content = "notificationContent";
204     eventInfo_->SetNotificationContent(content);
205     EXPECT_EQ(eventInfo_->GetNotificationContent(), content);
206     GTEST_LOG_(INFO) << "SetNotificationContent_001 end";
207 }
208 
209 /**
210  * @tc.number: SetTextMovementStep_001
211  * @tc.name: SetTextMovementStep
212  * @tc.desc: Test function SetTextMovementStep
213  */
214 HWTEST_F(AccessibilityEventInfoUnitTest, SetTextMovementStep_001, TestSize.Level1)
215 {
216     GTEST_LOG_(INFO) << "SetTextMovementStep_001 start";
217     if (!eventInfo_) {
218         GTEST_LOG_(INFO) << "eventInfo_ is null";
219         return;
220     }
221     eventInfo_->SetTextMovementStep(TextMoveUnit::STEP_LINE);
222     EXPECT_EQ(eventInfo_->GetTextMovementStep(), TextMoveUnit::STEP_LINE);
223     GTEST_LOG_(INFO) << "SetTextMovementStep_001 end";
224 }
225 
226 /**
227  * @tc.number: SetTriggerAction_001
228  * @tc.name: SetTriggerAction
229  * @tc.desc: Test function SetTriggerAction
230  */
231 HWTEST_F(AccessibilityEventInfoUnitTest, SetTriggerAction_001, TestSize.Level1)
232 {
233     GTEST_LOG_(INFO) << "SetTriggerAction_001 start";
234     if (!eventInfo_) {
235         GTEST_LOG_(INFO) << "eventInfo_ is null";
236         return;
237     }
238     eventInfo_->SetTriggerAction(ActionType::ACCESSIBILITY_ACTION_CLICK);
239     EXPECT_EQ(eventInfo_->GetTriggerAction(), ActionType::ACCESSIBILITY_ACTION_CLICK);
240     GTEST_LOG_(INFO) << "SetTriggerAction_001 end";
241 }
242 
243 /**
244  * @tc.number: SetNotificationInfo_001
245  * @tc.name: SetNotificationInfo
246  * @tc.desc: Test function SetNotificationInfo
247  */
248 HWTEST_F(AccessibilityEventInfoUnitTest, SetNotificationInfo_001, TestSize.Level1)
249 {
250     GTEST_LOG_(INFO) << "SetNotificationInfo_001 start";
251     if (!eventInfo_) {
252         GTEST_LOG_(INFO) << "eventInfo_ is null";
253         return;
254     }
255     eventInfo_->SetNotificationInfo(NotificationCategory::CATEGORY_CALL);
256     EXPECT_EQ(eventInfo_->GetNotificationInfo(), NotificationCategory::CATEGORY_CALL);
257     GTEST_LOG_(INFO) << "SetNotificationInfo_001 end";
258 }
259 
260 /**
261  * @tc.number: SetGestureType_001
262  * @tc.name: SetGestureType
263  * @tc.desc: Test function SetGestureType
264  */
265 HWTEST_F(AccessibilityEventInfoUnitTest, SetGestureType_001, TestSize.Level1)
266 {
267     GTEST_LOG_(INFO) << "SetGestureType_001 start";
268     if (!eventInfo_) {
269         GTEST_LOG_(INFO) << "eventInfo_ is null";
270         return;
271     }
272     eventInfo_->SetGestureType(GestureType::GESTURE_SWIPE_UP);
273     EXPECT_EQ(eventInfo_->GetGestureType(), GestureType::GESTURE_SWIPE_UP);
274     GTEST_LOG_(INFO) << "SetGestureType_001 end";
275 }
276 
277 /**
278  * @tc.number: SetPageId_001
279  * @tc.name: SetPageId
280  * @tc.desc: Test function SetPageId
281  */
282 HWTEST_F(AccessibilityEventInfoUnitTest, SetPageId_001, TestSize.Level1)
283 {
284     GTEST_LOG_(INFO) << "SetPageId_001 start";
285     if (!eventInfo_) {
286         GTEST_LOG_(INFO) << "eventInfo_ is null";
287         return;
288     }
289     eventInfo_->SetPageId(1);
290     EXPECT_EQ(eventInfo_->GetPageId(), 1);
291     GTEST_LOG_(INFO) << "SetPageId_001 end";
292 }
293 
294 /**
295  * @tc.number: SetSource_001
296  * @tc.name: SetSource
297  * @tc.desc: Test function SetSource
298  */
299 HWTEST_F(AccessibilityEventInfoUnitTest, SetSource_001, TestSize.Level1)
300 {
301     GTEST_LOG_(INFO) << "SetSource_001 start";
302     if (!eventInfo_) {
303         GTEST_LOG_(INFO) << "eventInfo_ is null";
304         return;
305     }
306     eventInfo_->SetSource(1001);
307     EXPECT_EQ(eventInfo_->GetViewId(), 1001);
308     EXPECT_EQ(eventInfo_->GetAccessibilityId(), 1001);
309     GTEST_LOG_(INFO) << "SetSource_001 end";
310 }
311 
312 /**
313  * @tc.number: SetWindowId_001
314  * @tc.name: SetWindowId
315  * @tc.desc: Test function SetWindowId
316  */
317 HWTEST_F(AccessibilityEventInfoUnitTest, SetWindowId_001, TestSize.Level1)
318 {
319     GTEST_LOG_(INFO) << "SetWindowId_001 start";
320     if (!eventInfo_) {
321         GTEST_LOG_(INFO) << "eventInfo_ is null";
322         return;
323     }
324     eventInfo_->SetWindowId(1002);
325     EXPECT_EQ(eventInfo_->GetWindowId(), 1002);
326     GTEST_LOG_(INFO) << "SetWindowId_001 end";
327 }
328 
329 /**
330  * @tc.number: SetCurrentIndex_001
331  * @tc.name: SetCurrentIndex
332  * @tc.desc: Test function SetCurrentIndex
333  */
334 HWTEST_F(AccessibilityEventInfoUnitTest, SetCurrentIndex_001, TestSize.Level1)
335 {
336     GTEST_LOG_(INFO) << "SetCurrentIndex_001 start";
337     if (!eventInfo_) {
338         GTEST_LOG_(INFO) << "eventInfo_ is null";
339         return;
340     }
341     eventInfo_->SetCurrentIndex(1);
342     EXPECT_EQ(eventInfo_->GetCurrentIndex(), 1);
343     GTEST_LOG_(INFO) << "SetCurrentIndex_001 end";
344 }
345 
346 /**
347  * @tc.number: SetBeginIndex_001
348  * @tc.name: SetBeginIndex
349  * @tc.desc: Test function SetBeginIndex
350  */
351 HWTEST_F(AccessibilityEventInfoUnitTest, SetBeginIndex_001, TestSize.Level1)
352 {
353     GTEST_LOG_(INFO) << "SetBeginIndex_001 start";
354     if (!eventInfo_) {
355         GTEST_LOG_(INFO) << "eventInfo_ is null";
356         return;
357     }
358     eventInfo_->SetBeginIndex(1);
359     EXPECT_EQ(eventInfo_->GetBeginIndex(), 1);
360     GTEST_LOG_(INFO) << "SetBeginIndex_001 end";
361 }
362 
363 /**
364  * @tc.number: SetEndIndex_001
365  * @tc.name: SetEndIndex
366  * @tc.desc: Test function SetEndIndex
367  */
368 HWTEST_F(AccessibilityEventInfoUnitTest, SetEndIndex_001, TestSize.Level1)
369 {
370     GTEST_LOG_(INFO) << "SetEndIndex_001 start";
371     if (!eventInfo_) {
372         GTEST_LOG_(INFO) << "eventInfo_ is null";
373         return;
374     }
375     eventInfo_->SetEndIndex(1);
376     EXPECT_EQ(eventInfo_->GetEndIndex(), 1);
377     GTEST_LOG_(INFO) << "SetEndIndex_001 end";
378 }
379 
380 /**
381  * @tc.number: SetItemCounts_001
382  * @tc.name: SetItemCounts
383  * @tc.desc: Test function SetItemCounts
384  */
385 HWTEST_F(AccessibilityEventInfoUnitTest, SetItemCounts_001, TestSize.Level1)
386 {
387     GTEST_LOG_(INFO) << "SetItemCounts_001 start";
388     if (!eventInfo_) {
389         GTEST_LOG_(INFO) << "eventInfo_ is null";
390         return;
391     }
392     eventInfo_->SetItemCounts(1);
393     EXPECT_EQ(eventInfo_->GetItemCounts(), 1);
394     GTEST_LOG_(INFO) << "SetItemCounts_001 end";
395 }
396 
397 /**
398  * @tc.number: SetComponentType_001
399  * @tc.name: SetComponentType
400  * @tc.desc: Test function SetComponentType
401  */
402 HWTEST_F(AccessibilityEventInfoUnitTest, SetComponentType_001, TestSize.Level1)
403 {
404     GTEST_LOG_(INFO) << "SetComponentType_001 start";
405     if (!eventInfo_) {
406         GTEST_LOG_(INFO) << "eventInfo_ is null";
407         return;
408     }
409     std::string componentType = "text";
410     eventInfo_->SetComponentType(componentType);
411     EXPECT_EQ(eventInfo_->GetComponentType(), componentType);
412     GTEST_LOG_(INFO) << "SetComponentType_001 end";
413 }
414 
415 /**
416  * @tc.number: SetBeforeText_001
417  * @tc.name: SetBeforeText
418  * @tc.desc: Test function SetBeforeText
419  */
420 HWTEST_F(AccessibilityEventInfoUnitTest, SetBeforeText_001, TestSize.Level1)
421 {
422     GTEST_LOG_(INFO) << "SetBeforeText_001 start";
423     if (!eventInfo_) {
424         GTEST_LOG_(INFO) << "eventInfo_ is null";
425         return;
426     }
427     std::string text = "accessibility";
428     eventInfo_->SetBeforeText(text);
429     EXPECT_EQ(eventInfo_->GetBeforeText(), text);
430     GTEST_LOG_(INFO) << "SetBeforeText_001 end";
431 }
432 
433 /**
434  * @tc.number: SetLatestContent_001
435  * @tc.name: SetLatestContent
436  * @tc.desc: Test function SetLatestContent
437  */
438 HWTEST_F(AccessibilityEventInfoUnitTest, SetLatestContent_001, TestSize.Level1)
439 {
440     GTEST_LOG_(INFO) << "SetLatestContent_001 start";
441     if (!eventInfo_) {
442         GTEST_LOG_(INFO) << "eventInfo_ is null";
443         return;
444     }
445     std::string context = "lastContext";
446     eventInfo_->SetLatestContent(context);
447     EXPECT_EQ(eventInfo_->GetLatestContent(), context);
448     GTEST_LOG_(INFO) << "SetLatestContent_001 end";
449 }
450 
451 /**
452  * @tc.number: SetDescription_001
453  * @tc.name: SetDescription
454  * @tc.desc: Test function SetDescription
455  */
456 HWTEST_F(AccessibilityEventInfoUnitTest, SetDescription_001, TestSize.Level1)
457 {
458     GTEST_LOG_(INFO) << "SetDescription_001 start";
459     if (!eventInfo_) {
460         GTEST_LOG_(INFO) << "eventInfo_ is null";
461         return;
462     }
463     std::string descripion = "descripion";
464     eventInfo_->SetDescription(descripion);
465     EXPECT_EQ(eventInfo_->GetDescription(), descripion);
466     GTEST_LOG_(INFO) << "SetDescription_001 end";
467 }
468 
469 /**
470  * @tc.number: SetTextAnnouncedForAccessibility_001
471  * @tc.name: SetTextAnnouncedForAccessibility
472  * @tc.desc: Test function SetTextAnnouncedForAccessibility
473  */
474 HWTEST_F(AccessibilityEventInfoUnitTest, SetTextAnnouncedForAccessibility_001, TestSize.Level1)
475 {
476     GTEST_LOG_(INFO) << "SetTextAnnouncedForAccessibility_001 start";
477     if (!eventInfo_) {
478         GTEST_LOG_(INFO) << "eventInfo_ is null";
479         return;
480     }
481     std::string textAnnouncedForAccessibility = "textAnnouncedForAccessibility";
482     eventInfo_->SetTextAnnouncedForAccessibility(textAnnouncedForAccessibility);
483     EXPECT_EQ(eventInfo_->GetTextAnnouncedForAccessibility(), textAnnouncedForAccessibility);
484     GTEST_LOG_(INFO) << "SetTextAnnouncedForAccessibility_001 end";
485 }
486 
487 /**
488  * @tc.number: SetInspectorKey_001
489  * @tc.name: SetInspectorKey
490  * @tc.desc: Test function SetInspectorKey
491  */
492 HWTEST_F(AccessibilityEventInfoUnitTest, SetInspectorKey_001, TestSize.Level1)
493 {
494     GTEST_LOG_(INFO) << "SetInspectorKey_001 start";
495     if (!eventInfo_) {
496         GTEST_LOG_(INFO) << "eventInfo_ is null";
497         return;
498     }
499     std::string inspectorKey = "inspectorKey";
500     eventInfo_->SetInspectorKey(inspectorKey);
501     EXPECT_EQ(eventInfo_->GetInspectorKey(), inspectorKey);
502     GTEST_LOG_(INFO) << "SetInspectorKey_001 end";
503 }
504 
505 /**
506  * @tc.number: SetRequestFocusElementId_001
507  * @tc.name: SetRequestFocusElementId
508  * @tc.desc: Test function SetRequestFocusElementId
509  */
510 HWTEST_F(AccessibilityEventInfoUnitTest, SetRequestFocusElementId_001, TestSize.Level1)
511 {
512     GTEST_LOG_(INFO) << "SetRequestFocusElementId_001 start";
513     if (!eventInfo_) {
514         GTEST_LOG_(INFO) << "eventInfo_ is null";
515         return;
516     }
517     int32_t requestFocusElementId = 1;
518     eventInfo_->SetRequestFocusElementId(requestFocusElementId);
519     EXPECT_EQ(eventInfo_->GetRequestFocusElementId(), requestFocusElementId);
520     GTEST_LOG_(INFO) << "SetRequestFocusElementId_001 end";
521 }
522 
523 /**
524  * @tc.number: AddContent_001
525  * @tc.name: AddContent
526  * @tc.desc: Test function AddContent
527  */
528 HWTEST_F(AccessibilityEventInfoUnitTest, AddContent_001, TestSize.Level1)
529 {
530     GTEST_LOG_(INFO) << "AddContent_001 start";
531     if (!eventInfo_) {
532         GTEST_LOG_(INFO) << "eventInfo_ is null";
533         return;
534     }
535     std::string content1 = "content1";
536     eventInfo_->AddContent(content1);
537     std::string content2 = "content2";
538     eventInfo_->AddContent(content2);
539     std::vector<std::string> contentLs = eventInfo_->GetContentList();
540     int32_t index = 0;
541     for (auto &content : contentLs) {
542         if (!index) {
543             EXPECT_EQ(content, content1);
544         } else {
545             EXPECT_EQ(content, content2);
546         }
547         index++;
548     }
549     GTEST_LOG_(INFO) << "AddContent_001 end";
550 }
551 
552 /**
553  * @tc.number: SetElementInfo_001
554  * @tc.name: SetElementInfo
555  * @tc.desc: Test function SetElement&GetElement
556  */
557 HWTEST_F(AccessibilityEventInfoUnitTest, SetElementInfo_001, TestSize.Level1)
558 {
559     GTEST_LOG_(INFO) << "SetElementInfo_001 start";
560     int accessibilityId = 1;
561     AccessibilityElementInfo elementInfo;
562     std::shared_ptr<AccessibilityEventInfo> eventInfo =
563         std::make_shared<AccessibilityEventInfo>(1, WINDOW_UPDATE_FOCUSED);
564     elementInfo.SetAccessibilityId(accessibilityId);
565     ASSERT_TRUE(eventInfo);
566     eventInfo->SetElementInfo(elementInfo);
567     EXPECT_EQ(eventInfo->GetElementInfo().GetAccessibilityId(), accessibilityId);
568     GTEST_LOG_(INFO) << "SetElementInfo_001 end";
569 }
570 
571 /**
572  * @tc.number: AccessibilityEventInfo_001
573  * @tc.name: AccessibilityEventInfo
574  * @tc.desc: Test function AccessibilityEventInfo
575  */
576 HWTEST_F(AccessibilityEventInfoUnitTest, AccessibilityEventInfo_001, TestSize.Level1)
577 {
578     GTEST_LOG_(INFO) << "AccessibilityEventInfo_001 start";
579     std::shared_ptr<AccessibilityEventInfo> eventInfo =
580         std::make_shared<AccessibilityEventInfo>(1, WINDOW_UPDATE_FOCUSED);
581     ASSERT_TRUE(eventInfo);
582     EXPECT_EQ(eventInfo->GetWindowId(), 1);
583     EXPECT_EQ(eventInfo->GetWindowChangeTypes(), WINDOW_UPDATE_FOCUSED);
584     GTEST_LOG_(INFO) << "AccessibilityEventInfo_001 end";
585 }
586 } // namespace Accessibility
587 } // namespace OHOS
588