1 /*
2  * Copyright (c) 2023 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 <axis_event.h>
18 #include <key_event.h>
19 #include <pointer_event.h>
20 #include "mock/mock_session_stage.h"
21 #include "mock/mock_window_event_channel.h"
22 #include "session/container/include/window_event_channel.h"
23 #include "scene_board_judgement.h"
24 #include "window_manager_hilog.h"
25 #include "iremote_object_mocker.h"
26 
27 using namespace testing;
28 using namespace testing::ext;
29 using namespace OHOS::Accessibility;
30 using namespace std;
31 
32 namespace OHOS::Rosen {
33 namespace {
34 constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelTest" };
35 }
36 class WindowEventChannelTest : public testing::Test {
37 public:
38     static void SetUpTestCase();
39     static void TearDownTestCase();
40     void SetUp() override;
41     void TearDown() override;
42     WSError TransferAccessibilityHoverEvent(bool isChannelNull);
43     WSError TransferAccessibilityChildTreeRegister(bool isChannelNull);
44     WSError TransferAccessibilityChildTreeUnregister(bool isChannelNull);
45     WSError TransferAccessibilityDumpChildInfo(bool isChannelNull);
46 
47     sptr<ISessionStage> sessionStage = new SessionStageMocker();
48     sptr<WindowEventChannel> windowEventChannel_ = new WindowEventChannelMocker(sessionStage);
49 };
50 
SetUpTestCase()51 void WindowEventChannelTest::SetUpTestCase()
52 {
53 }
54 
TearDownTestCase()55 void WindowEventChannelTest::TearDownTestCase()
56 {
57 }
58 
SetUp()59 void WindowEventChannelTest::SetUp()
60 {
61 }
62 
TearDown()63 void WindowEventChannelTest::TearDown()
64 {
65 }
66 
TransferAccessibilityHoverEvent(bool isChannelNull)67 WSError WindowEventChannelTest::TransferAccessibilityHoverEvent(bool isChannelNull)
68 {
69     float pointX = 0.0f;
70     float pointY = 0.0f;
71     int32_t sourceType = 0;
72     int32_t eventType = 0;
73     int64_t timeMs = 0;
74     if (isChannelNull) {
75         windowEventChannel_->sessionStage_ = nullptr;
76     }
77     return windowEventChannel_->TransferAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
78 }
79 
TransferAccessibilityChildTreeRegister(bool isChannelNull)80 WSError WindowEventChannelTest::TransferAccessibilityChildTreeRegister(bool isChannelNull)
81 {
82     uint32_t windowId = 0;
83     int32_t treeId = 0;
84     int64_t accessibilityId = 0;
85     if (isChannelNull) {
86         windowEventChannel_->sessionStage_ = nullptr;
87     }
88     return windowEventChannel_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
89 }
90 
TransferAccessibilityChildTreeUnregister(bool isChannelNull)91 WSError WindowEventChannelTest::TransferAccessibilityChildTreeUnregister(bool isChannelNull)
92 {
93     if (isChannelNull) {
94         windowEventChannel_->sessionStage_ = nullptr;
95     }
96     return windowEventChannel_->TransferAccessibilityChildTreeUnregister();
97 }
98 
TransferAccessibilityDumpChildInfo(bool isChannelNull)99 WSError WindowEventChannelTest::TransferAccessibilityDumpChildInfo(bool isChannelNull)
100 {
101     std::vector<std::string> params;
102     std::vector<std::string> info;
103     if (isChannelNull) {
104         windowEventChannel_->sessionStage_ = nullptr;
105     }
106     return windowEventChannel_->TransferAccessibilityDumpChildInfo(params, info);
107 }
108 
109 namespace {
110 /**
111  * @tc.name: TransferKeyEvent
112  * @tc.desc: normal function TransferKeyEvent
113  * @tc.type: FUNC
114  */
115 HWTEST_F(WindowEventChannelTest, TransferKeyEvent, Function | SmallTest | Level2)
116 {
117     std::shared_ptr<MMI::KeyEvent> keyEvent = MMI::KeyEvent::Create();
118     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_BACK);
119     keyEvent->SetKeyAction(MMI::KeyEvent::KEY_ACTION_UP);
120     auto res = windowEventChannel_->TransferKeyEvent(keyEvent);
121     ASSERT_EQ(res, WSError::WS_OK);
122 }
123 
124 /**
125  * @tc.name: TransferPointerEvent
126  * @tc.desc: normal function TransferPointerEvent
127  * @tc.type: FUNC
128  */
129 HWTEST_F(WindowEventChannelTest, TransferPointerEvent, Function | SmallTest | Level2)
130 {
131     auto pointerEvent = MMI::PointerEvent::Create();
132     sptr<WindowEventChannel> windowEventChannel = new (std::nothrow) WindowEventChannel(sessionStage);
133     ASSERT_NE(nullptr, windowEventChannel);
134 
135     auto res = windowEventChannel->TransferPointerEvent(pointerEvent);
136     EXPECT_EQ(res, WSError::WS_OK);
137 
138     windowEventChannel->SetIsUIExtension(true);
139     windowEventChannel->SetUIExtensionUsage(UIExtensionUsage::MODAL);
140     res = windowEventChannel->TransferPointerEvent(pointerEvent);
141     EXPECT_EQ(res, WSError::WS_OK);
142 
143     windowEventChannel->SetUIExtensionUsage(UIExtensionUsage::EMBEDDED);
144     res = windowEventChannel->TransferPointerEvent(pointerEvent);
145     EXPECT_EQ(res, WSError::WS_OK);
146 
147     windowEventChannel->SetIsUIExtension(false);
148     windowEventChannel->SetUIExtensionUsage(UIExtensionUsage::MODAL);
149     res = windowEventChannel->TransferPointerEvent(pointerEvent);
150     EXPECT_EQ(res, WSError::WS_OK);
151 
152     windowEventChannel->SetUIExtensionUsage(UIExtensionUsage::CONSTRAINED_EMBEDDED);
153     res = windowEventChannel->TransferPointerEvent(pointerEvent);
154     EXPECT_EQ(res, WSError::WS_OK);
155 
156     windowEventChannel->SetUIExtensionUsage(UIExtensionUsage::UIEXTENSION_USAGE_END);
157     res = windowEventChannel->TransferPointerEvent(pointerEvent);
158     EXPECT_EQ(res, WSError::WS_OK);
159 
160     windowEventChannel->sessionStage_ = nullptr;
161     res = windowEventChannel->TransferPointerEvent(pointerEvent);
162     EXPECT_EQ(res, WSError::WS_ERROR_NULLPTR);
163 }
164 
165 /**
166  * @tc.name: TransferBackpressedEventForConsumed
167  * @tc.desc: normal function TransferBackpressedEventForConsumed
168  * @tc.type: FUNC
169  */
170 HWTEST_F(WindowEventChannelTest, TransferBackpressedEventForConsumed, Function | SmallTest | Level2)
171 {
172     bool isConsumed = false;
173     auto res = windowEventChannel_->TransferBackpressedEventForConsumed(isConsumed);
174     ASSERT_EQ(res, WSError::WS_OK);
175     isConsumed = true;
176     res = windowEventChannel_->TransferBackpressedEventForConsumed(isConsumed);
177     ASSERT_EQ(res, WSError::WS_OK);
178 
179     sptr<WindowEventChannel> windowEventChannel = new (std::nothrow) WindowEventChannel(sessionStage);
180     ASSERT_NE(nullptr, windowEventChannel);
181     windowEventChannel->sessionStage_ = nullptr;
182     res = windowEventChannel->TransferBackpressedEventForConsumed(isConsumed);
183     EXPECT_EQ(res, WSError::WS_ERROR_NULLPTR);
184 }
185 
186 /**
187  * @tc.name: TransferKeyEventForConsumed
188  * @tc.desc: normal function TransferKeyEventForConsumed
189  * @tc.type: FUNC
190  */
191 HWTEST_F(WindowEventChannelTest, TransferKeyEventForConsumed, Function | SmallTest | Level2)
192 {
193     auto keyEvent = MMI::KeyEvent::Create();
194     ASSERT_NE(keyEvent, nullptr);
195 
196     bool isConsumed = false;
197     auto res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
198     EXPECT_EQ(res, WSError::WS_OK);
199     isConsumed = true;
200     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
201     EXPECT_EQ(res, WSError::WS_OK);
202 
203     GTEST_LOG_(INFO) << "Test uiExtension key event with modal usage";
204     windowEventChannel_->SetIsUIExtension(true);
205     windowEventChannel_->SetUIExtensionUsage(UIExtensionUsage::MODAL);
206     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
207     ASSERT_EQ(res, WSError::WS_OK);
208 
209     GTEST_LOG_(INFO) << "Test single uiExtension key event with constrained embedded usage";
210     windowEventChannel_->SetUIExtensionUsage(UIExtensionUsage::CONSTRAINED_EMBEDDED);
211     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_BACK);
212     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
213     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
214         ASSERT_EQ(res, WSError::WS_ERROR_INVALID_PERMISSION);
215     } else {
216         ASSERT_EQ(res, WSError::WS_OK);
217     }
218 
219     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
220     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
221     ASSERT_EQ(res, WSError::WS_OK);
222 
223     GTEST_LOG_(INFO) << "Test combined uiExtension key event with constrained embedded usage";
224     auto keyItemTab = MMI::KeyEvent::KeyItem();
225     keyItemTab.SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
226     keyItemTab.SetPressed(true);
227     auto keyItemTest = MMI::KeyEvent::KeyItem();
228     keyItemTest.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_RIGHT);
229     keyItemTest.SetPressed(true);
230     keyEvent->AddPressedKeyItems(keyItemTest);
231     keyEvent->AddPressedKeyItems(keyItemTab);
232     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
233     ASSERT_EQ(res, WSError::WS_OK);
234 
235     keyEvent->Reset();
236     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
237     keyItemTest.SetKeyCode(MMI::KeyEvent::KEYCODE_ALT_LEFT);
238     keyEvent->AddPressedKeyItems(keyItemTest);
239     keyEvent->AddPressedKeyItems(keyItemTab);
240     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
241     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
242         ASSERT_EQ(res, WSError::WS_ERROR_INVALID_PERMISSION);
243     } else {
244         ASSERT_EQ(res, WSError::WS_OK);
245     }
246 }
247 
248 /**
249  * @tc.name: TransferKeyEventForConsumed02
250  * @tc.desc: normal function TransferKeyEventForConsumed02
251  * @tc.type: FUNC
252  */
253 HWTEST_F(WindowEventChannelTest, TransferKeyEventForConsumed02, Function | SmallTest | Level2)
254 {
255     auto keyEvent = MMI::KeyEvent::Create();
256     ASSERT_NE(keyEvent, nullptr);
257 
258     bool isConsumed = true;
259     windowEventChannel_->SetIsUIExtension(true);
260     windowEventChannel_->SetUIExtensionUsage(UIExtensionUsage::CONSTRAINED_EMBEDDED);
261 
262     auto keyItemTab = MMI::KeyEvent::KeyItem();
263     keyItemTab.SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
264     keyItemTab.SetPressed(true);
265     auto keyItemTest = MMI::KeyEvent::KeyItem();
266     keyItemTest.SetKeyCode(MMI::KeyEvent::KEYCODE_ALT_LEFT);
267     keyItemTest.SetPressed(true);
268 
269     keyEvent->Reset();
270     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
271     keyEvent->AddPressedKeyItems(keyItemTest);
272     keyEvent->AddPressedKeyItems(keyItemTab);
273 
274     auto res = windowEventChannel_->TransferKeyEventForConsumed(nullptr, isConsumed, false);
275     EXPECT_EQ(res, WSError::WS_ERROR_NULLPTR);
276 
277     windowEventChannel_->isUIExtension_ = false;
278     res = windowEventChannel_->TransferKeyEventForConsumed(keyEvent, isConsumed, true);
279     EXPECT_EQ(res, WSError::WS_OK);
280 
281     sptr<WindowEventChannel> windowEventChannel = new (std::nothrow) WindowEventChannel(sessionStage);
282     ASSERT_NE(nullptr, windowEventChannel);
283     windowEventChannel->sessionStage_ = nullptr;
284     res = windowEventChannel->TransferKeyEventForConsumed(keyEvent, isConsumed, false);
285     EXPECT_EQ(res, WSError::WS_ERROR_NULLPTR);
286 }
287 
288 /**
289  * @tc.name: TransferKeyEventForConsumedAsync01
290  * @tc.desc: normal function TransferKeyEventForConsumedAsync01
291  * @tc.type: FUNC
292  */
293 HWTEST_F(WindowEventChannelTest, TransferKeyEventForConsumedAsync01, Function | SmallTest | Level2)
294 {
295     auto keyEvent = MMI::KeyEvent::Create();
296     ASSERT_NE(keyEvent, nullptr);
297     bool isPreImeEvent = false;
298 
299     sptr<ISessionStage> sessionStage = new SessionStageMocker();
300     sptr<WindowEventChannel> windowEventChannel = new WindowEventChannel(sessionStage);
301     ASSERT_NE(windowEventChannel, nullptr);
302     auto res = windowEventChannel->TransferKeyEventForConsumedAsync(keyEvent, isPreImeEvent, nullptr);
303     ASSERT_EQ(res, WSError::WS_OK);
304 }
305 
306 /**
307  * @tc.name: TransferKeyEventForConsumedAsync02
308  * @tc.desc: normal function TransferKeyEventForConsumedAsync02
309  * @tc.type: FUNC
310  */
311 HWTEST_F(WindowEventChannelTest, TransferKeyEventForConsumedAsync02, Function | SmallTest | Level2)
312 {
313     auto keyEvent = MMI::KeyEvent::Create();
314     ASSERT_NE(keyEvent, nullptr);
315     bool isPreImeEvent = false;
316 
317     sptr<ISessionStage> sessionStage = new SessionStageMocker();
318     sptr<WindowEventChannel> windowEventChannel = new WindowEventChannel(sessionStage);
319     ASSERT_NE(windowEventChannel, nullptr);
320     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
321     auto res = windowEventChannel->TransferKeyEventForConsumedAsync(keyEvent, isPreImeEvent, iRemoteObjectMocker);
322     ASSERT_EQ(res, WSError::WS_OK);
323 }
324 
325 /**
326  * @tc.name: WindowEventChannelListenerProxyOnTransferKeyEventForConsumed
327  * @tc.desc: normal function WindowEventChannelListenerProxyOnTransferKeyEventForConsumed
328  * @tc.type: FUNC
329  */
330 HWTEST_F(WindowEventChannelTest, WindowEventChannelListenerProxyOnTransferKeyEventForConsumed,
331     Function | SmallTest | Level2)
332 {
333     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
334     WindowEventChannelListenerProxy listenerProxy(iRemoteObjectMocker);
335     listenerProxy.OnTransferKeyEventForConsumed(100, true, true, WSError::WS_OK);
336 }
337 
338 /**
339  * @tc.name: TransferFocusActiveEvent
340  * @tc.desc: normal function TransferFocusActiveEvent
341  * @tc.type: FUNC
342  */
343 HWTEST_F(WindowEventChannelTest, TransferFocusActiveEvent, Function | SmallTest | Level2)
344 {
345     bool isFocusActive = false;
346     windowEventChannel_->sessionStage_ = nullptr;
347     auto res = windowEventChannel_->TransferFocusActiveEvent(isFocusActive);
348     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
349 }
350 
351 /**
352  * @tc.name: PrintKeyEvent
353  * @tc.desc: normal function PrintKeyEvent
354  * @tc.type: FUNC
355  */
356 HWTEST_F(WindowEventChannelTest, PrintKeyEvent, Function | SmallTest | Level2)
357 {
358     std::shared_ptr<MMI::KeyEvent> keyEvent = MMI::KeyEvent::Create();
359     ASSERT_NE(keyEvent, nullptr);
360     ASSERT_NE(windowEventChannel_, nullptr);
361     windowEventChannel_->PrintKeyEvent(keyEvent);
362     windowEventChannel_->sessionStage_ = nullptr;
363     windowEventChannel_->PrintKeyEvent(keyEvent);
364     windowEventChannel_->PrintKeyEvent(nullptr);
365 
366     auto keyItemTab = MMI::KeyEvent::KeyItem();
367     keyItemTab.SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
368     keyItemTab.SetPressed(true);
369     auto keyItemTest = MMI::KeyEvent::KeyItem();
370     keyItemTest.SetKeyCode(MMI::KeyEvent::KEYCODE_ALT_LEFT);
371     keyItemTest.SetPressed(true);
372     keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_TAB);
373     keyEvent->AddPressedKeyItems(keyItemTab);
374     keyEvent->AddPressedKeyItems(keyItemTest);
375     windowEventChannel_->PrintKeyEvent(keyEvent);
376 }
377 
378 /**
379  * @tc.name: PrintPointerEvent
380  * @tc.desc: normal function PrintPointerEvent
381  * @tc.type: FUNC
382  */
383 HWTEST_F(WindowEventChannelTest, PrintPointerEvent, Function | SmallTest | Level2)
384 {
385     auto pointerEvent = MMI::PointerEvent::Create();
386     ASSERT_TRUE((windowEventChannel_ != nullptr));
387     windowEventChannel_->PrintPointerEvent(pointerEvent);
388     windowEventChannel_->PrintPointerEvent(nullptr);
389 
390     pointerEvent->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
391     windowEventChannel_->PrintPointerEvent(pointerEvent);
392 
393     auto pointerItem0 = MMI::PointerEvent::PointerItem();
394     pointerItem0.SetPointerId(0);
395     auto pointerItem1 = MMI::PointerEvent::PointerItem();
396     pointerItem1.SetPointerId(1);
397 
398     pointerEvent->AddPointerItem(pointerItem0);
399     pointerEvent->AddPointerItem(pointerItem1);
400     windowEventChannel_->PrintPointerEvent(pointerEvent);
401 }
402 
403 /**
404  * @tc.name: TransferFocusState
405  * @tc.desc: normal function TransferFocusState
406  * @tc.type: FUNC
407  */
408 HWTEST_F(WindowEventChannelTest, TransferFocusState, Function | SmallTest | Level2)
409 {
410     bool focusState = false;
411     windowEventChannel_->sessionStage_ = nullptr;
412     ASSERT_TRUE((windowEventChannel_ != nullptr));
413     auto res = windowEventChannel_->TransferFocusState(focusState);
414     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
415 }
416 
417 /**
418  * @tc.name: TransferAccessibilityHoverEvent01
419  * @tc.desc: normal function TransferAccessibilityHoverEvent01
420  * @tc.type: FUNC
421  */
422 HWTEST_F(WindowEventChannelTest, TransferAccessibilityHoverEvent01, Function | SmallTest | Level2)
423 {
424     WLOGFI("TransferAccessibilityHoverEvent01 begin");
425     auto res = TransferAccessibilityHoverEvent(true);
426     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
427     WLOGFI("TransferAccessibilityHoverEvent01 end");
428 }
429 
430 /**
431  * @tc.name: TransferAccessibilityHoverEvent02
432  * @tc.desc: normal function TransferAccessibilityHoverEvent02
433  * @tc.type: FUNC
434  */
435 HWTEST_F(WindowEventChannelTest, TransferAccessibilityHoverEvent02, Function | SmallTest | Level2)
436 {
437     WLOGFI("TransferAccessibilityHoverEvent02 begin");
438     auto res = TransferAccessibilityHoverEvent(false);
439     ASSERT_EQ(res, WSError::WS_OK);
440     WLOGFI("TransferAccessibilityHoverEvent02 end");
441 }
442 
443 /**
444  * @tc.name: TransferAccessibilityChildTreeRegister01
445  * @tc.desc: normal function TransferAccessibilityChildTreeRegister01
446  * @tc.type: FUNC
447  */
448 HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeRegister01, Function | SmallTest | Level2)
449 {
450     WLOGFI("TransferAccessibilityChildTreeRegister01 begin");
451     auto res = TransferAccessibilityChildTreeRegister(true);
452     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
453     WLOGFI("TransferAccessibilityChildTreeRegister01 end");
454 }
455 
456 /**
457  * @tc.name: TransferAccessibilityChildTreeRegister02
458  * @tc.desc: normal function TransferAccessibilityChildTreeRegister02
459  * @tc.type: FUNC
460  */
461 HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeRegister02, Function | SmallTest | Level2)
462 {
463     WLOGFI("TransferAccessibilityChildTreeRegister02 begin");
464     auto res = TransferAccessibilityChildTreeRegister(false);
465     ASSERT_EQ(res, WSError::WS_OK);
466     WLOGFI("TransferAccessibilityChildTreeRegister02 end");
467 }
468 
469 /**
470  * @tc.name: TransferAccessibilityChildTreeUnregister01
471  * @tc.desc: normal function TransferAccessibilityChildTreeUnregister01
472  * @tc.type: FUNC
473  */
474 HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeUnregister01, Function | SmallTest | Level2)
475 {
476     WLOGFI("TransferAccessibilityChildTreeUnregister01 begin");
477     auto res = TransferAccessibilityChildTreeUnregister(true);
478     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
479     WLOGFI("TransferAccessibilityChildTreeUnregister01 end");
480 }
481 
482 /**
483  * @tc.name: TransferAccessibilityChildTreeUnregister02
484  * @tc.desc: normal function TransferAccessibilityChildTreeUnregister02
485  * @tc.type: FUNC
486  */
487 HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeUnregister02, Function | SmallTest | Level2)
488 {
489     WLOGFI("TransferAccessibilityChildTreeUnregister02 begin");
490     auto res = TransferAccessibilityChildTreeUnregister(false);
491     ASSERT_EQ(res, WSError::WS_OK);
492     WLOGFI("TransferAccessibilityChildTreeUnregister02 end");
493 }
494 
495 /**
496  * @tc.name: TransferAccessibilityDumpChildInfo02
497  * @tc.desc: normal function TransferAccessibilityDumpChildInfo02
498  * @tc.type: FUNC
499  */
500 HWTEST_F(WindowEventChannelTest, TransferAccessibilityDumpChildInfo02, Function | SmallTest | Level2)
501 {
502     WLOGFI("TransferAccessibilityDumpChildInfo02 begin");
503     auto res = TransferAccessibilityDumpChildInfo(false);
504     ASSERT_EQ(res, WSError::WS_OK);
505     WLOGFI("TransferAccessibilityDumpChildInfo02 end");
506 }
507 
508 /**
509  * @tc.name: PrintInfoPointerEvent
510  * @tc.desc: normal function PrintInfoPointerEvent
511  * @tc.type: FUNC
512  */
513 HWTEST_F(WindowEventChannelTest, PrintInfoPointerEvent, Function | SmallTest | Level2)
514 {
515     auto pointerEvent = MMI::PointerEvent::Create();
516     ASSERT_NE(pointerEvent, nullptr);
517     ASSERT_NE(windowEventChannel_, nullptr);
518     windowEventChannel_->PrintInfoPointerEvent(nullptr);
519 
520     auto pointerItem0 = MMI::PointerEvent::PointerItem();
521     pointerItem0.SetPointerId(0);
522     auto pointerItem1 = MMI::PointerEvent::PointerItem();
523     pointerItem1.SetPointerId(1);
524     pointerEvent->AddPointerItem(pointerItem0);
525     pointerEvent->AddPointerItem(pointerItem1);
526 
527     windowEventChannel_->PrintPointerEvent(pointerEvent);
528 }
529 }
530 }
531