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