• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "test/unittest/core/pipeline/pipeline_context_test_ng.h"
17 // Add the following two macro definitions to test the private and protected method.
18 #define private public
19 #define protected public
20 
21 #include "adapter/ohos/osal/thp_extra_manager_impl.h"
22 #include "core/accessibility/accessibility_manager_ng.h"
23 #include "core/components_ng/pattern/container_modal/container_modal_pattern.h"
24 #include "core/components_ng/pattern/navigation/navigation_pattern.h"
25 #include "core/components_ng/pattern/navrouter/navdestination_group_node.h"
26 #include "core/components_ng/pattern/stage/page_pattern.h"
27 #include "core/components_ng/pattern/text_field/text_field_manager.h"
28 #include "core/event/axis_event.h"
29 #include "core/event/mouse_event.h"
30 #include "test/mock/core/common/mock_window.h"
31 
32 using namespace testing;
33 using namespace testing::ext;
34 
35 namespace OHOS::Ace {
36 namespace NG {
37 
38 /**
39  * @tc.name: PipelineContextTestNg130
40  * @tc.desc: Test the function FlushMouseEventVoluntarily.
41  * @tc.type: FUNC
42  */
43 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg130, TestSize.Level1)
44 {
45     /**
46      * @tc.steps1: initialize parameters and create MouseEvent.
47      * @tc.expected: Create MouseEvent, then initialize pipeline.
48      */
49     ASSERT_NE(context_, nullptr);
50     context_->SetRootSize(1.0f, 800, 1600);
51     MouseEvent event;
52     event.x = 12.345f;
53     event.y = 12.345f;
54     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(event);
55     context_->lastMouseEvent_->action = MouseAction::WINDOW_LEAVE;
56     context_->SetupRootElement();
57     EXPECT_NE(context_->rootNode_, nullptr);
58     context_->SetEventManager(AceType::MakeRefPtr<EventManager>());
59     context_->viewScale_ = DEFAULT_DOUBLE2;
60 
61     /**
62      * @tc.steps2: Call the function FlushMouseEventVoluntarily.
63      * @tc.expected: Test isNeedFlushMouseEvent_ is Changed to REJECT.
64      */
65     context_->FlushMouseEventVoluntarily();
66     EXPECT_NE(context_->eventManager_, nullptr);
67     context_->isNeedFlushMouseEvent_ = MockFlushEventType::REJECT;
68     context_->FlushMouseEventVoluntarily();
69     EXPECT_NE(context_->eventManager_, nullptr);
70 }
71 
72 /**
73  * @tc.name: PipelineContextTestNg131
74  * @tc.desc: Test the function FlushUITaskWithSingleDirtyNode.
75  * @tc.type: FUNC
76  */
77 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg131, TestSize.Level1)
78 {
79     /**
80      * @tc.steps1: initialize parameters.
81      * @tc.expected: initialize pipeline.
82      */
83     ASSERT_NE(context_, nullptr);
84     context_->SetRootSize(1.0f, 800, 1600);
85     frameNodeId_ = ElementRegister::GetInstance()->MakeUniqueId();
86     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
87     EXPECT_NE(frameNode_1, nullptr);
88     auto layoutProperty = AceType::MakeRefPtr<LayoutProperty>();
89     frameNode_1->SetLayoutProperty(layoutProperty);
90 
91     /**
92      * @tc.steps2: Call the function FlushUITaskWithSingleDirtyNode.
93      * @tc.expected: Test the reaction of the function at different Rect.
94      */
95     context_->FlushUITaskWithSingleDirtyNode(frameNode_1);
96     NG::RectF testRect = { 10.0f, 10.0f, 10.0f, 10.0f };
97     layoutProperty->SetLayoutRect(testRect);
98     context_->FlushUITaskWithSingleDirtyNode(frameNode_1);
99     EXPECT_NE(frameNode_1->GetLayoutProperty(), nullptr);
100 }
101 
102 /**
103  * @tc.name: PipelineContextTestNg132
104  * @tc.desc: Test the function FlushUITaskWithSingleDirtyNode.
105  * @tc.type: FUNC
106  */
107 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg132, TestSize.Level1)
108 {
109     /**
110      * @tc.steps1: initialize parameters.
111      * @tc.expected: initialize pipeline, SafeAreaManager, TextFieldManagerNG.
112      */
113     ASSERT_NE(context_, nullptr);
114     context_->SetRootSize(1.0f, 800, 1600);
115     auto safeAreaManager = AceType::MakeRefPtr<SafeAreaManager>();
116     context_->safeAreaManager_ = safeAreaManager;
117     auto textFieldManager = AceType::MakeRefPtr<TextFieldManagerNG>();
118     textFieldManager->SetHeight(20);
119     context_->SetTextFieldManager(textFieldManager);
120 
121     /**
122      * @tc.steps2: Call the function DoKeyboardAvoidFunc.
123      * @tc.expected: Test the stability of this function.
124      */
125     context_->DoKeyboardAvoidFunc(400.0f, 0.0, 400.0f, false);
126     EXPECT_NE(context_->textFieldManager_, nullptr);
127 }
128 
129 /**
130  * @tc.name: PipelineContextTestNg133
131  * @tc.desc: Test the function SetIsFocusActive.
132  * @tc.type: FUNC
133  */
134 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg133, TestSize.Level1)
135 {
136     /**
137      * @tc.steps1: initialize parameters.
138      * @tc.expected: initialize pipeline, properties.
139      */
140     ASSERT_NE(context_, nullptr);
141     context_->SetRootSize(1.0f, 800, 1600);
142     context_->SetupRootElement();
143     EXPECT_NE(context_->rootNode_, nullptr);
144     SystemProperties::focusCanBeActive_.store(true);
145     auto focusManager = context_->GetOrCreateFocusManager();
146     ASSERT_NE(focusManager, nullptr);
147     focusManager->isFocusActive_ = false;
148 
149     /**
150      * @tc.steps2: Call the function SetIsFocusActive.
151      * @tc.expected: Test the stability of this function.
152      */
153     context_->SetIsFocusActive(false, FocusActiveReason::USE_API);
154     EXPECT_FALSE(context_->GetIsFocusActive());
155 }
156 
157 /**
158  * @tc.name: PipelineContextTestNg134
159  * @tc.desc: Test the function SetHostParentOffsetToWindow.
160  * @tc.type: FUNC
161  */
162 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg134, TestSize.Level1)
163 {
164     /**
165      * @tc.steps1: initialize parameters.
166      * @tc.expected: initialize pipeline, offfset.
167      */
168     ASSERT_NE(context_, nullptr);
169     context_->SetRootSize(1.0f, 800, 1600);
170     context_->SetupRootElement();
171     EXPECT_NE(context_->rootNode_, nullptr);
172     Offset offfset(1.0, 1.0);
173 
174     /**
175      * @tc.steps2: Call the function SetHostParentOffsetToWindow.
176      * @tc.expected: Test the stability of this function.
177      */
178     context_->SetHostParentOffsetToWindow(Offset(offfset.GetX(), offfset.GetY()));
179     EXPECT_EQ(context_->lastHostParentOffsetToWindow_, offfset);
180 }
181 
182 /**
183  * @tc.name: PipelineContextTestNg135
184  * @tc.desc: Test the function GetResponseRegion.
185  * @tc.type: FUNC
186  */
187 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg135, TestSize.Level1)
188 {
189     /**
190      * @tc.steps1: initialize parameters.
191      * @tc.expected: initialize pipeline, frame node.
192      */
193     ASSERT_NE(context_, nullptr);
194     context_->SetRootSize(1.0f, 800, 1600);
195     context_->SetupRootElement();
196     EXPECT_NE(context_->rootNode_, nullptr);
197     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
198     EXPECT_NE(frameNode_1, nullptr);
199 
200     /**
201      * @tc.steps2: Call the function GetResponseRegion.
202      * @tc.expected: Test the stability of this function.
203      */
204     std::string result = context_->GetResponseRegion(frameNode_1);
205     EXPECT_TRUE(result.empty());
206 }
207 
208 /**
209  * @tc.name: PipelineContextTestNg136
210  * @tc.desc: Test the function SetWindowContainerColor.
211  * @tc.type: FUNC
212  */
213 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg136, TestSize.Level1)
214 {
215     /**
216      * @tc.steps1: initialize parameters.
217      * @tc.expected: initialize pipeline.
218      */
219     ASSERT_NE(context_, nullptr);
220     context_->SetupRootElement();
221 
222     /**
223      * @tc.steps2: Call the function SetWindowContainerColor.
224      * @tc.expected: Test if this function is available.
225      */
226     context_->SetWindowContainerColor(Color::BLUE, Color::BLACK);
227     EXPECT_NE(context_->rootNode_, nullptr);
228     auto containerNode = AceType::DynamicCast<FrameNode>(context_->rootNode_->GetChildren().front());
229     EXPECT_NE(containerNode, nullptr);
230     auto containerPattern = containerNode->GetPattern<ContainerModalPattern>();
231     EXPECT_NE(containerPattern, nullptr);
232     EXPECT_EQ(containerPattern->activeColor_, Color::BLUE);
233 
234     /**
235      * @tc.steps3: Call the function GetContainerControlButtonVisible.
236      * @tc.expected: Test if this function is available.
237      */
238     bool isControlButtonVisible = context_->GetContainerControlButtonVisible();
239     EXPECT_FALSE(isControlButtonVisible);
240 
241     /**
242      * @tc.steps4: Call the function GetContainerCustomTitleVisible.
243      * @tc.expected: Test if this function is available.
244      */
245     bool isCustomTitleVisible = context_->GetContainerCustomTitleVisible();
246     EXPECT_FALSE(isCustomTitleVisible);
247 
248     /**
249      * @tc.steps4: Call the function GetContainerFloatingTitleVisible.
250      * @tc.expected: Test if this function is available.
251      */
252     bool isFloatingTitleVisible = context_->GetContainerFloatingTitleVisible();
253     EXPECT_FALSE(isFloatingTitleVisible);
254 }
255 
256 /**
257  * @tc.name: PipelineContextTestNg137
258  * @tc.desc: Test the function OnMouseMoveEventForAxisEvent.
259  * @tc.type: FUNC
260  */
261 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg137, TestSize.Level1)
262 {
263     /**
264      * @tc.steps1: initialize parameters.
265      * @tc.expected: initialize pipeline, mouse event, frame node, event manager.
266      */
267     ASSERT_NE(context_, nullptr);
268     context_->SetupRootElement();
269     EXPECT_NE(context_->rootNode_, nullptr);
270     MouseEvent mouseEvent1;
271     mouseEvent1.x = 100.0f;
272     mouseEvent1.y = 200.0f;
273     mouseEvent1.action = MouseAction::MOVE;
274     mouseEvent1.button = MouseButton::NONE_BUTTON;
275     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
276     EXPECT_NE(frameNode_1, nullptr);
277 
278     /**
279      * @tc.steps2: Call the function SetEventManager.
280      * @tc.expected: Test if this function is available.
281      */
282     context_->SetEventManager(AceType::MakeRefPtr<EventManager>());
283     context_->accessibilityManagerNG_ = AceType::MakeRefPtr<AccessibilityManagerNG>();
284 
285     /**
286      * @tc.steps3: Call the function OnMouseMoveEventForAxisEvent.
287      * @tc.expected: Test if this function is available.
288      */
289     context_->OnMouseMoveEventForAxisEvent(mouseEvent1, frameNode_1);
290     EXPECT_NE(context_->eventManager_, nullptr);
291     AxisEvent axisEvent;
292 
293     /**
294      * @tc.steps4: Call the function DispatchAxisEventToDragDropManager.
295      * @tc.expected: Test if this function is available.
296      */
297     axisEvent.action = AxisAction::BEGIN;
298     axisEvent.isRotationEvent = false;
299     SerializedGesture etsSerializedGesture;
300     ASSERT_NE(context_->dragDropManager_, nullptr);
301     context_->DispatchAxisEventToDragDropManager(axisEvent, frameNode_1, etsSerializedGesture);
302 
303     /**
304      * @tc.steps5: Call the function DispatchAxisEventToDragDropManager.
305      * @tc.expected: Test the stability of this function.
306      */
307     context_->dragDropManager_ = nullptr;
308     context_->isBeforeDragHandleAxis_ = true;
309     axisEvent.action = AxisAction::END;
310     context_->DispatchAxisEventToDragDropManager(axisEvent, frameNode_1, etsSerializedGesture);
311     EXPECT_FALSE(context_->isBeforeDragHandleAxis_);
312 }
313 
314 /**
315  * @tc.name: PipelineContextTestNg138
316  * @tc.desc: Test the function UpdateLastMoveEvent.
317  * @tc.type: FUNC
318  */
319 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg138, TestSize.Level1)
320 {
321     /**
322      * @tc.steps1: initialize parameters.
323      * @tc.expected: initialize pipeline, mouse event.
324      */
325     ASSERT_NE(context_, nullptr);
326     MouseEvent mouseEvent;
327     mouseEvent.x = 0.1f;
328     mouseEvent.y = 0.1f;
329     mouseEvent.button = MouseButton::NONE_BUTTON;
330     mouseEvent.action = MouseAction::MOVE;
331     mouseEvent.sourceType = SourceType::MOUSE;
332     mouseEvent.touchEventId = 101;
333 
334     /**
335      * @tc.steps2: Call the function UpdateLastMoveEvent.
336      * @tc.expected: Test if this function is available.
337      */
338     context_->UpdateLastMoveEvent(mouseEvent);
339     ASSERT_NE(context_->lastMouseEvent_, nullptr);
340     EXPECT_EQ(context_->lastMouseEvent_->x, 0.1f);
341     EXPECT_EQ(context_->lastMouseEvent_->y, 0.1f);
342     EXPECT_EQ(context_->lastMouseEvent_->button, MouseButton::NONE_BUTTON);
343     EXPECT_EQ(context_->lastMouseEvent_->action, MouseAction::MOVE);
344     EXPECT_EQ(context_->lastMouseEvent_->sourceType, SourceType::MOUSE);
345     EXPECT_EQ(context_->lastMouseEvent_->touchEventId, 101);
346 }
347 
348 /**
349  * @tc.name: PipelineContextTestNg139
350  * @tc.desc: Test the function OnMouseMoveEventForAxisEvent.
351  * @tc.type: FUNC
352  */
353 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg139, TestSize.Level1)
354 {
355     /**
356      * @tc.steps1: initialize parameters.
357      * @tc.expected: initialize pipeline, touch event.
358      */
359     ASSERT_NE(context_, nullptr);
360     context_->SetEventManager(AceType::MakeRefPtr<EventManager>());
361     TouchEvent touchEvent;
362     touchEvent.sourceTool = SourceTool::PEN;
363     touchEvent.type = TouchType::DOWN;
364     touchEvent.force = 0.1f;
365 
366     /**
367      * @tc.steps2: Call the function HandlePenHoverOut.
368      * @tc.expected: Test if this function is available.
369      */
370     context_->HandlePenHoverOut(touchEvent);
371 
372     /**
373      * @tc.steps3: Call the function OnPenHoverEvent.
374      * @tc.expected: Test if this function is available.
375      */
376     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
377     EXPECT_NE(frameNode_1, nullptr);
378     context_->OnPenHoverEvent(touchEvent, frameNode_1);
379 
380     /**
381      * @tc.steps4: Call the function OnAccessibilityHoverEvent.
382      * @tc.expected: Test if this function is available.
383      */
384     context_->accessibilityManagerNG_ = AceType::MakeRefPtr<AccessibilityManagerNG>();
385     context_->OnAccessibilityHoverEvent(touchEvent, frameNode_1);
386 
387     /**
388      * @tc.steps5: Call the function CompensateTouchMoveEvent.
389      * @tc.expected: Test if this function is available.
390      */
391     touchEvent.type = TouchType::UP;
392     context_->CompensateTouchMoveEvent(touchEvent);
393     context_->touchEvents_.push_back(touchEvent);
394     context_->CompensateTouchMoveEventFromUnhandledEvents(touchEvent);
395     ASSERT_NE(context_->eventManager_, nullptr);
396 }
397 
398 /**
399  * @tc.name: PipelineContextTestNg140
400  * @tc.desc: Test the function OnMouseMoveEventForAxisEvent.
401  * @tc.type: FUNC
402  */
403 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg140, TestSize.Level1)
404 {
405     /**
406      * @tc.steps1: Call the function SetIsFocusActive.
407      * @tc.expected: Test the stability of this function with different parameters passed in.
408      */
409     ASSERT_NE(context_, nullptr);
410     auto focusManager = context_->GetOrCreateFocusManager();
411     ASSERT_NE(focusManager, nullptr);
412     context_->SetIsFocusActive(false, FocusActiveReason::USE_API, false);
413     EXPECT_FALSE(focusManager->autoFocusInactive_);
414     context_->SetIsFocusActive(false, FocusActiveReason::USE_API, true);
415     EXPECT_TRUE(focusManager->autoFocusInactive_);
416     auto result_1 = context_->SetIsFocusActive(false, FocusActiveReason::POINTER_EVENT, false);
417     EXPECT_FALSE(result_1);
418 
419     /**
420      * @tc.steps2: Call the function OnCaretPositionChangeOrKeyboardHeightChange.
421      * @tc.expected: Test the stability of this function.
422      */
423     auto safeAreaManager = AceType::MakeRefPtr<SafeAreaManager>();
424     context_->safeAreaManager_ = safeAreaManager;
425     auto textFieldManager = AceType::MakeRefPtr<TextFieldManagerNG>();
426     textFieldManager->SetHeight(20);
427     textFieldManager->SetUsingCustomKeyboardAvoid(false);
428     context_->SetTextFieldManager(textFieldManager);
429     context_->OnCaretPositionChangeOrKeyboardHeightChange(400.0f, 0.1f, 0.1f, nullptr, true);
430     ASSERT_NE(context_->textFieldManager_, nullptr);
431 }
432 
433 /**
434  * @tc.name: PipelineContextTestNg141
435  * @tc.desc: Test the function FlushPendingDeleteCustomNode.
436  * @tc.type: FUNC
437  */
438 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg141, TestSize.Level1)
439 {
440     /**
441      * @tc.steps1: initialize parameters.
442      */
443     ASSERT_NE(context_, nullptr);
444     RefPtr<CustomNode> customNode =
445         CustomNode::CreateCustomNode(ElementRegister::GetInstance()->MakeUniqueId(), "test");
446 
447     /**
448      * @tc.steps2: add pending delete customNode and call FlushPendingDeleteCustomNode function.
449      * @tc.expected: pendingDeleteCustomNode_.size() is 0.
450      */
451     context_->AddPendingDeleteCustomNode(customNode);
452     context_->FlushPendingDeleteCustomNode();
453     EXPECT_EQ(context_->pendingDeleteCustomNode_.size(), 0);
454 
455     /**
456      * @tc.steps3: executeFireOnAppear is true and call FlushPendingDeleteCustomNode function.
457      * @tc.expected: pendingDeleteCustomNode_.size() is 0.
458      */
459     customNode->executeFireOnAppear_ = true;
460     context_->AddPendingDeleteCustomNode(customNode);
461     context_->FlushPendingDeleteCustomNode();
462     EXPECT_EQ(context_->pendingDeleteCustomNode_.size(), 0);
463 }
464 
465 /**
466  * @tc.name: PipelineContextTestNg142
467  * @tc.desc: Test the function FlushFreezeNode.
468  * @tc.type: FUNC
469  */
470 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg142, TestSize.Level1)
471 {
472     /**
473      * @tc.steps1: initialize parameters and call FlushFreezeNode function.
474      * @tc.expected: dirtyFreezeNode_.size() is 0.
475      */
476     ASSERT_NE(context_, nullptr);
477     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
478     FrameNode* frameNode = static_cast<FrameNode*>(Referenced::RawPtr(frameNode_1));
479     context_->AddDirtyFreezeNode(frameNode);
480     context_->FlushFreezeNode();
481     EXPECT_EQ(context_->dirtyFreezeNode_.size(), 0);
482 }
483 
484 /**
485  * @tc.name: PipelineContextTestNg143
486  * @tc.desc: Test the function FlushDragEvents.
487  * @tc.type: FUNC
488  */
489 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg143, TestSize.Level1)
490 {
491     /**
492      * @tc.steps1: initialize parameters.
493      */
494     ASSERT_NE(context_, nullptr);
495     DragPointerEvent pointerEvent;
496     auto frameNode_1 = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
497     context_->dragEvents_[frameNode_1].emplace_back(pointerEvent);
498 
499     /**
500      * @tc.steps2: dragDropManager is not null and call FlushDragEvents function.
501      * @tc.expected: dragEvents_.size() is 0.
502      */
503     auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
504     dragDropManager->SetDragFwkShow(false);
505     context_->dragDropManager_ = dragDropManager;
506     context_->FlushDragEvents();
507     EXPECT_EQ(context_->dragEvents_.size(), 0);
508 
509     /**
510      * @tc.steps3: dragDropManager is null and call FlushDragEvents function.
511      * @tc.expected: dragEvents_.size() is 0.
512      */
513     context_->dragDropManager_ = nullptr;
514     context_->FlushDragEvents();
515     EXPECT_EQ(context_->dragEvents_.size(), 0);
516 }
517 
518 /**
519  * @tc.name: PipelineContextTestNg144
520  * @tc.desc: Test the function FlushDragEvents.
521  * @tc.type: FUNC
522  */
523 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg144, TestSize.Level1)
524 {
525     /**
526      * @tc.steps1: initialize parameters.
527      */
528     ASSERT_NE(context_, nullptr);
529     RefPtr<DragDropManager> manager = AceType::MakeRefPtr<DragDropManager>();
530     std::string extraInfo = "test";
531     RefPtr<FrameNode> node = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
532     std::list<DragPointerEvent> pointerEventList;
533     DragPointerEvent pointerEvent;
534     TimeStamp time = std::chrono::high_resolution_clock::now();
535 
536     /**
537      * @tc.steps2: call FlushDragEvents function.
538      * @tc.expected: historyPointsEventById_.size() is 0.
539      */
540     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
541     EXPECT_EQ(context_->historyPointsEventById_.size(), 0);
542 
543     /**
544      * @tc.steps3: pointerEvent.action is PULL_MOVE and call FlushDragEvents function.
545      * @tc.expected: historyPointsEventById_.size() is 0.
546      */
547     pointerEvent.action = PointerAction::PULL_MOVE;
548     pointerEventList.push_back(pointerEvent);
549     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
550     EXPECT_EQ(context_->historyPointsEventById_.size(), 0);
551 
552     /**
553      * @tc.steps4: pointerEvent.time is not default and call FlushDragEvents function.
554      * @tc.expected: historyPointsEventById_.size() is 1.
555      */
556     pointerEvent.pointerId = 1;
557     pointerEvent.time = time;
558     pointerEventList.push_back(pointerEvent);
559     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
560     EXPECT_EQ(context_->dragEvents_.size(), 0);
561     EXPECT_EQ(context_->historyPointsEventById_.size(), 1);
562 
563     /**
564      * @tc.steps5: pointerEvent.x is 100 and call FlushDragEvents function.
565      * @tc.expected: historyPointsEventById_.size() is 2.
566      */
567     pointerEvent.pointerId = 2;
568     pointerEvent.x = 100.0f;
569     pointerEventList.push_back(pointerEvent);
570     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
571     EXPECT_EQ(context_->dragEvents_.size(), 0);
572     EXPECT_EQ(context_->historyPointsEventById_.size(), 2);
573 
574     /**
575      * @tc.steps6: pointerEvent.y is 100 and call FlushDragEvents function.
576      * @tc.expected: historyPointsEventById_.size() is 3.
577      */
578     pointerEvent.pointerId = 3;
579     pointerEvent.x = 100.0f;
580     pointerEvent.y = 100.0f;
581     pointerEventList.push_back(pointerEvent);
582     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
583     EXPECT_EQ(context_->historyPointsEventById_.size(), 3);
584 
585     /**
586      * @tc.steps7: focusWindowId is 10 and call FlushDragEvents function.
587      * @tc.expected: historyPointsEventById_.size() is 3.
588      */
589     context_->SetFocusWindowId(0);
590     context_->FlushDragEvents(manager, extraInfo, node, pointerEventList);
591     EXPECT_EQ(context_->historyPointsEventById_.size(), 3);
592 }
593 
594 /**
595  * @tc.name: PipelineContextTestNg145
596  * @tc.desc: Test the function FlushMouseEventVoluntarily.
597  * @tc.type: FUNC
598  */
599 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg145, TestSize.Level1)
600 {
601     /**
602      * @tc.steps1: initialize parameters.
603      */
604     ASSERT_NE(context_, nullptr);
605     context_->lastMouseEvent_ = nullptr;
606     context_->SetupRootElement();
607     EXPECT_NE(context_->rootNode_, nullptr);
608     context_->SetEventManager(AceType::MakeRefPtr<EventManager>());
609 
610     /**
611      * @tc.steps2: call FlushMouseEventVoluntarily function.
612      * @tc.expected: eventManager is not null.
613      */
614     context_->FlushMouseEventVoluntarily();
615     EXPECT_NE(context_->eventManager_, nullptr);
616 
617     /**
618      * @tc.steps3: lastMouseEvent_->action is NONE and call FlushMouseEventVoluntarily function.
619      * @tc.expected: eventManager is not null.
620      */
621     context_->lastMouseEvent_ = std::make_unique<MouseEvent>();
622     context_->lastMouseEvent_->action = MouseAction::NONE;
623     context_->FlushMouseEventVoluntarily();
624     EXPECT_NE(context_->eventManager_, nullptr);
625 
626     /**
627      * @tc.steps4: isNeedFlushMouseEvent_ is REJECT and call FlushMouseEventVoluntarily function.
628      * @tc.expected: eventManager is not null.
629      */
630     context_->isNeedFlushMouseEvent_ = MockFlushEventType::REJECT;
631     context_->FlushMouseEventVoluntarily();
632     EXPECT_NE(context_->eventManager_, nullptr);
633 
634     /**
635      * @tc.steps5: isNeedFlushMouseEvent_ is NONE and call FlushMouseEventVoluntarily function.
636      * @tc.expected: eventManager is not null.
637      */
638     context_->isNeedFlushMouseEvent_ = MockFlushEventType::NONE;
639     context_->FlushMouseEventVoluntarily();
640     EXPECT_NE(context_->eventManager_, nullptr);
641 }
642 
643 /**
644  * @tc.name: PipelineContextTestNg146
645  * @tc.desc: Test the function FlushRequestFocus.
646  * @tc.type: FUNC
647  */
648 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg146, TestSize.Level1)
649 {
650     /**
651      * @tc.steps1: initialize parameters.
652      */
653     ASSERT_NE(context_, nullptr);
654     auto node = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
655     RefPtr<EventHub> eventHub = AceType::MakeRefPtr<EventHub>();
656     auto focusHub = AceType::MakeRefPtr<FocusHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
657     focusHub->focusable_ = false;
658     node->focusHub_ = focusHub;
659     context_->dirtyRequestFocusNode_ = node;
660 
661     /**
662      * @tc.steps2: call FlushRequestFocus function.
663      * @tc.expected: dirtyRequestFocusNode_.Upgrade() is null.
664      */
665     context_->FlushRequestFocus();
666     EXPECT_EQ(context_->dirtyRequestFocusNode_.Upgrade(), nullptr);
667 
668     /**
669      * @tc.steps3: focusHub->currentFocus_ is true and call FlushRequestFocus function.
670      * @tc.expected: dirtyRequestFocusNode_.Upgrade() is null.
671      */
672     focusHub->currentFocus_ = true;
673     context_->dirtyRequestFocusNode_ = node;
674     context_->FlushRequestFocus();
675     EXPECT_EQ(context_->dirtyRequestFocusNode_.Upgrade(), nullptr);
676 
677     /**
678      * @tc.steps4: node->focusHub_ is null and call FlushRequestFocus function.
679      * @tc.expected: dirtyRequestFocusNode_.Upgrade() is null.
680      */
681     node->focusHub_ = nullptr;
682     context_->dirtyRequestFocusNode_ = node;
683     context_->FlushRequestFocus();
684     EXPECT_EQ(context_->dirtyRequestFocusNode_.Upgrade(), nullptr);
685 }
686 
687 /**
688  * @tc.name: PipelineContextTestNg147
689  * @tc.desc: Test the function FlushFocusView.
690  * @tc.type: FUNC
691  */
692 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg147, TestSize.Level1)
693 {
694     /**
695      * @tc.steps1: initialize parameters and call FlushFocusView function.
696      * @tc.expected: lastFocusView is invalid.
697      */
698     ASSERT_NE(context_, nullptr);
699     auto pagePattern = AceType::MakeRefPtr<PagePattern>(AceType::MakeRefPtr<PageInfo>());
700     auto pageNode = FrameNode::CreateFrameNode(V2::PAGE_ETS_TAG, -1, pagePattern);
701     auto pageFocusHub = pageNode->GetOrCreateFocusHub();
702     auto pageFocusView = AceType::WeakClaim<PagePattern>(AceType::RawPtr<PagePattern>(pagePattern));
703     context_->GetOrCreateFocusManager()->lastFocusView_ = pageFocusView;
704     context_->FlushFocusView();
705     EXPECT_FALSE(context_->GetFocusManager()->lastFocusView_.Invalid());
706 }
707 
708 /**
709  * @tc.name: PipelineContextTestNg148
710  * @tc.desc: Test the function FlushFocusScroll.
711  * @tc.type: FUNC
712  */
713 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg148, TestSize.Level1)
714 {
715     /**
716      * @tc.steps1: initialize parameters.
717      */
718     ASSERT_NE(context_, nullptr);
719     auto node = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
720     RefPtr<EventHub> eventHub = AceType::MakeRefPtr<EventHub>();
721     eventHub->AttachHost(node);
722     auto focusHub = AceType::MakeRefPtr<FocusHub>(AceType::WeakClaim(AceType::RawPtr(eventHub)));
723     context_->focusManager_->SetLastFocusStateNode(focusHub);
724 
725     /**
726      * @tc.steps2: isNeedTriggerScroll_ is default and call FlushRequestFocus function.
727      * @tc.expected: isNeedTriggerScroll_ is false.
728      */
729     context_->FlushFocusScroll();
730     EXPECT_FALSE(context_->focusManager_->GetNeedTriggerScroll());
731 
732     /**
733      * @tc.steps3: call FlushRequestFocus function.
734      * @tc.expected: isNeedTriggerScroll_ is false.
735      */
736     context_->FlushFocusScroll();
737     EXPECT_FALSE(context_->focusManager_->GetNeedTriggerScroll());
738 }
739 
740 /**
741  * @tc.name: PipelineContextTestNg149
742  * @tc.desc: Test the function FlushPipelineImmediately.
743  * @tc.type: FUNC
744  */
745 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg149, TestSize.Level1)
746 {
747     /**
748      * @tc.steps1: initialize parameters and call FlushPipelineImmediately function.
749      * @tc.expected: isRebuildFinished_ is true.
750      */
751     ASSERT_NE(context_, nullptr);
752     context_->taskScheduler_->SetIsLayouting(true);
753     context_->FlushPipelineImmediately();
754     EXPECT_TRUE(context_->isRebuildFinished_);
755 }
756 
757 /**
758  * @tc.name: PipelineContextTestNg150
759  * @tc.desc: Test DumpFocus.
760  * @tc.type: FUNC
761  */
762 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg150, TestSize.Level1)
763 {
764     /**
765      * @tc.steps1: Call the function DumpFocus.
766      * @tc.expected: Test the result of calling the function when the parameter is set to true.
767      */
768     ASSERT_NE(context_, nullptr);
769     context_->SetupRootElement();
770     ASSERT_NE(context_->rootNode_, nullptr);
771     bool hasJson = true;
772     context_->DumpFocus(hasJson);
773     EXPECT_NE(context_->rootNode_->GetFocusHub(), nullptr);
774 }
775 
776 /**
777  * @tc.name: PipelineContextTestNg151
778  * @tc.desc: Test DumpData.
779  * @tc.type: FUNC
780  */
781 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg151, TestSize.Level1)
782 {
783     /**
784      * @tc.steps1: Call the function DumpData.
785      * @tc.expected: Test that there is no "-" in the elements of the parameter params.
786      */
787     ASSERT_NE(context_, nullptr);
788     std::vector<std::string> params;
789     params.push_back("test");
790     frameNodeId_ = ElementRegister::GetInstance()->MakeUniqueId();
791     frameNode_ = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
792     bool hasJson = true;
793     context_->DumpData(frameNode_, params, hasJson);
794     EXPECT_TRUE(params[0].find("-") == std::string::npos);
795 
796     /**
797      * @tc.steps2: Call the function DumpData.
798      * @tc.expected: Test that there is a "-" in the elements of the parameter params.
799      */
800     params.clear();
801     params.push_back("test-test");
802     context_->DumpData(frameNode_, params, hasJson);
803     EXPECT_FALSE(params[0].find("-") == std::string::npos);
804 }
805 
806 /**
807  * @tc.name: PipelineContextTestNg152
808  * @tc.desc: Test OnDumpInfo.
809  * @tc.type: FUNC
810  */
811 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg152, TestSize.Level1)
812 {
813     /**
814      * @tc.steps1: Call the function OnDumpInfo.
815      * @tc.expected: Test that the member window_ is empty.
816      */
817     ASSERT_NE(context_, nullptr);
818     std::vector<std::string> params;
819     params.push_back("test");
820     params.push_back("1");
821     context_->window_ = nullptr;
822     auto ret = context_->OnDumpInfo(params);
823     EXPECT_TRUE(ret);
824     auto window = std::make_shared<MockWindow>();
825     context_->window_ = window;
826     EXPECT_CALL(*window, RequestFrame()).Times(AnyNumber());
827 }
828 
829 /**
830  * @tc.name: PipelineContextTestNg153
831  * @tc.desc: Test OnDumpRecorderStart.
832  * @tc.type: FUNC
833  */
834 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg153, TestSize.Level1)
835 {
836     /**
837      * @tc.steps1: Call the function OnDumpRecorderStart.
838      * @tc.expected: Test the second element of the parameter params is greater than 0.
839      */
840     ASSERT_NE(context_, nullptr);
841     std::vector<std::string> params;
842     params.push_back("test");
843     params.push_back("1");
844     context_->OnDumpRecorderStart(params);
845     EXPECT_EQ(params.size(), 2);
846 
847     /**
848      * @tc.steps2: Call the function OnDumpRecorderStart.
849      * @tc.expected: Test the second element of the parameter params is equal to 0.
850      */
851     params.clear();
852     params.push_back("test");
853     params.push_back("0");
854     context_->OnDumpRecorderStart(params);
855     EXPECT_GT(params.size(), 0);
856 }
857 
858 /**
859  * @tc.name: PipelineContextTestNg154
860  * @tc.desc: Test FlushMouseEventForHover.
861  * @tc.type: FUNC
862  */
863 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg154, TestSize.Level1)
864 {
865     /**
866      * @tc.steps1: Call the function FlushMouseEventForHover.
867      * @tc.expected: Test the stability of the function under various member conditions.
868      */
869     ASSERT_NE(context_, nullptr);
870     MouseEvent mouseEvent;
871     mouseEvent.sourceType = SourceType::MOUSE;
872     mouseEvent.action = MouseAction::MOVE;
873     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(mouseEvent);
874     context_->lastMouseEvent_->pointerEvent = nullptr;
875     context_->lastSourceType_ = SourceType::NONE;
876     context_->lastMouseEvent_->isMockWindowTransFlag = true;
877     context_->SetIsTransFlag(true);
878     context_->FlushMouseEventForHover();
879     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
880 
881     context_->lastMouseEvent_->action = MouseAction::WINDOW_ENTER;
882     context_->lastMouseEvent_->isMockWindowTransFlag = false;
883     context_->windowSizeChangeReason_ = WindowSizeChangeReason::MAXIMIZE;
884     context_->FlushMouseEventForHover();
885     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
886 
887     context_->lastMouseEvent_->action = MouseAction::WINDOW_LEAVE;
888     context_->FlushMouseEventForHover();
889 
890     context_->lastMouseEvent_->action = MouseAction::MOVE;
891     context_->lastMouseEvent_->isMockWindowTransFlag = false;
892     context_->windowSizeChangeReason_ = WindowSizeChangeReason::RECOVER;
893     context_->FlushMouseEventForHover();
894     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
895 
896     context_->lastMouseEvent_->isMockWindowTransFlag = false;
897     context_->windowSizeChangeReason_ = WindowSizeChangeReason::DRAG;
898     context_->FlushMouseEventForHover();
899     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
900 
901     context_->lastMouseEvent_->isMockWindowTransFlag = false;
902     context_->windowSizeChangeReason_ = WindowSizeChangeReason::MOVE;
903     context_->FlushMouseEventForHover();
904     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
905 
906     context_->lastMouseEvent_->isMockWindowTransFlag = true;
907     context_->windowSizeChangeReason_ = WindowSizeChangeReason::MAXIMIZE;
908     context_->FlushMouseEventForHover();
909     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
910 
911     context_->lastMouseEvent_->isMockWindowTransFlag = true;
912     context_->windowSizeChangeReason_ = WindowSizeChangeReason::DRAG;
913     context_->FlushMouseEventForHover();
914     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
915 
916     context_->lastMouseEvent_->isMockWindowTransFlag = true;
917     context_->windowSizeChangeReason_ = WindowSizeChangeReason::MOVE;
918     context_->FlushMouseEventForHover();
919     EXPECT_FALSE(context_->lastMouseEvent_->pointerEvent);
920 }
921 
922 /**
923  * @tc.name: PipelineContextTestNg155
924  * @tc.desc: Test FlushMouseEventInVsync.
925  * @tc.type: FUNC
926  */
927 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg155, TestSize.Level1)
928 {
929     /**
930      * @tc.steps1: Call the function FlushMouseEventInVsync.
931      * @tc.expected: Test the member mouseEvents_ is empty.
932      */
933     ASSERT_NE(context_, nullptr);
934     MouseEvent mouseEvent;
935     mouseEvent.sourceType = SourceType::MOUSE;
936     mouseEvent.action = MouseAction::MOVE;
937     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(mouseEvent);
938     context_->FlushMouseEventInVsync();
939     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
940     int32_t frameNodeId = 1;
941     auto frameNode = AceType::MakeRefPtr<FrameNode>(TEST_TAG, frameNodeId, AceType::MakeRefPtr<Pattern>());
942     std::list<MouseEvent> mouseEvents;
943     mouseEvents.push_back(mouseEvent);
944     context_->mouseEvents_[frameNode] = mouseEvents;
945 
946     /**
947      * @tc.steps2: Call the function FlushMouseEventInVsync.
948      * @tc.expected: Test the stability of the function under various member conditions.
949      */
950     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(mouseEvent);
951     context_->mouseEvents_.clear();
952     context_->lastMouseEvent_->mockFlushEvent = false;
953     context_->FlushMouseEventInVsync();
954     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
955 
956     context_->mouseEvents_.clear();
957     context_->lastMouseEvent_->mockFlushEvent = true;
958     context_->FlushMouseEventInVsync();
959     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
960 
961     context_->mouseEvents_[frameNode] = mouseEvents;
962     context_->lastMouseEvent_->mockFlushEvent = true;
963     context_->FlushMouseEventInVsync();
964     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
965 
966     context_->isTransFlag_ = false;
967     context_->lastMouseEvent_->mockFlushEvent = false;
968     context_->FlushMouseEventInVsync();
969     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
970 
971     context_->isTransFlag_ = false;
972     context_->lastMouseEvent_->mockFlushEvent = true;
973     context_->FlushMouseEventInVsync();
974     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
975 
976     context_->isTransFlag_ = false;
977     context_->mouseEvents_.clear();
978     context_->lastMouseEvent_->mockFlushEvent = false;
979     context_->FlushMouseEventInVsync();
980     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
981 
982     context_->isTransFlag_ = false;
983     context_->mouseEvents_.clear();
984     context_->lastMouseEvent_->mockFlushEvent = true;
985     context_->FlushMouseEventInVsync();
986     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
987 
988     context_->lastMouseEvent_ = nullptr;
989     context_->FlushMouseEventInVsync();
990     EXPECT_EQ(context_->isNeedFlushMouseEvent_, MockFlushEventType::NONE);
991 }
992 
993 /**
994  * @tc.name: PipelineContextTestNg156
995  * @tc.desc: Test SetDisplayWindowRectInfo.
996  * @tc.type: FUNC
997  */
998 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg156, TestSize.Level1)
999 {
1000     /**
1001      * @tc.steps1: Call the function SetDisplayWindowRectInfo.
1002      * @tc.expected: Test setting the member displayWindowRectInfo_ under various conditions.
1003      */
1004     ASSERT_NE(context_, nullptr);
1005     MouseEvent mouseEvent;
1006     mouseEvent.sourceType = SourceType::MOUSE;
1007     mouseEvent.action = MouseAction::MOVE;
1008     Rect displayWindowRectInfo(100.0, 100.0, 0.0, 0.0);
1009     context_->displayWindowRectInfo_.SetRect(50.0, 50.0, 0.0, 0.0);
1010     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(mouseEvent);
1011     context_->lastMouseEvent_->x = 10;
1012     context_->lastMouseEvent_->y = 10;
1013     context_->SetDisplayWindowRectInfo(displayWindowRectInfo);
1014     EXPECT_NE(context_->lastMouseEvent_->x, 10);
1015 
1016     context_->displayWindowRectInfo_.SetRect(100.0, 50.0, 0.0, 0.0);
1017     context_->SetDisplayWindowRectInfo(displayWindowRectInfo);
1018     EXPECT_NE(context_->lastMouseEvent_->x, 10);
1019 
1020     context_->displayWindowRectInfo_.SetRect(50.0, 100.0, 0.0, 0.0);
1021     context_->lastMouseEvent_ = nullptr;
1022     context_->SetDisplayWindowRectInfo(displayWindowRectInfo);
1023     EXPECT_FALSE(context_->lastMouseEvent_);
1024 
1025     context_->displayWindowRectInfo_.SetRect(100.0, 100.0, 0.0, 0.0);
1026     context_->SetDisplayWindowRectInfo(displayWindowRectInfo);
1027     EXPECT_FALSE(context_->lastMouseEvent_);
1028 }
1029 
1030 /**
1031  * @tc.name: PipelineContextTestNg157
1032  * @tc.desc: Test ScopedLayout.
1033  * @tc.type: FUNC
1034  */
1035 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg157, TestSize.Level1)
1036 {
1037     /**
1038      * @tc.steps1: Call the function ScopedLayout.
1039      * @tc.expected: Test the constructor and destructor of ScopedLayout.
1040      */
1041     ASSERT_NE(context_, nullptr);
1042     PipelineContext* pipeline = new PipelineContext();
1043     ScopedLayout scopedLayout(pipeline);
1044     PipelineContext* pipeline2 = nullptr;
1045     ScopedLayout scopedLayout2(pipeline2);
1046     EXPECT_EQ(scopedLayout.pipeline_, pipeline);
1047 }
1048 
1049 /**
1050  * @tc.name: PipelineContextTestNg158
1051  * @tc.desc: Test FlushModifierAnimation.
1052  * @tc.type: FUNC
1053  */
1054 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg158, TestSize.Level1)
1055 {
1056     /**
1057      * @tc.steps1: Call the function FlushModifierAnimation.
1058      * @tc.expected: Test the parameter is less than the member variable.
1059      */
1060     ASSERT_NE(context_, nullptr);
1061     uint64_t nanoTimestamp = 0;
1062     context_->animationTimeStamp_ = context_->AdjustVsyncTimeStamp(nanoTimestamp) + 1;
1063     EXPECT_TRUE(context_->FlushModifierAnimation(nanoTimestamp));
1064 }
1065 
1066 /**
1067  * @tc.name: PipelineContextTestNg159
1068  * @tc.desc: Test CatchInteractiveAnimations.
1069  * @tc.type: FUNC
1070  */
1071 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg159, TestSize.Level1)
1072 {
1073     /**
1074      * @tc.steps1: Call the function CatchInteractiveAnimations.
1075      * @tc.expected: Test the isInteractive_ member of navigationMgr_ is true.
1076      */
1077     ASSERT_NE(context_, nullptr);
__anona68bd69b0102() 1078     auto animationCallback = []() -> void {
1079         return;
1080     };
1081     context_->navigationMgr_->isInteractive_ = true;
1082     EXPECT_FALSE(context_->CatchInteractiveAnimations(animationCallback));
1083 
1084     /**
1085      * @tc.steps2: Call the function CatchInteractiveAnimations.
1086      * @tc.expected: Test the isInteractive_ member of navigationMgr_ is false.
1087      */
1088     context_->navigationMgr_->isInteractive_ = false;
1089     EXPECT_FALSE(context_->CatchInteractiveAnimations(animationCallback));
1090 }
1091 
1092 /**
1093  * @tc.name: PipelineContextTestNg160
1094  * @tc.desc: Test NotifyResponseRegionChanged.
1095  * @tc.type: FUNC
1096  */
1097 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg160, TestSize.Level1)
1098 {
1099     /**
1100      * @tc.steps1: Call the function NotifyResponseRegionChanged.
1101      * @tc.expected: Test the member thpExtraMgr_ is not nullptr.
1102      */
1103     ASSERT_NE(context_, nullptr);
1104     RefPtr<FrameNode> rootNode = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1105     context_->thpExtraMgr_ = AceType::MakeRefPtr<NG::THPExtraManagerImpl>();
1106     context_->NotifyResponseRegionChanged(rootNode);
1107     EXPECT_TRUE(context_->thpExtraMgr_);
1108 
1109     /**
1110      * @tc.steps2: Call the function NotifyResponseRegionChanged.
1111      * @tc.expected: Test the member thpExtraMgr_ is nullptr.
1112      */
1113     context_->thpExtraMgr_.Reset();
1114     context_->NotifyResponseRegionChanged(rootNode);
1115     EXPECT_FALSE(context_->thpExtraMgr_);
1116 }
1117 
1118 /**
1119  * @tc.name: PipelineContextTestNgDisableNotifyResponseRegionChanged
1120  * @tc.desc: Test DisableNotifyResponseRegionChanged.
1121  * @tc.type: FUNC
1122  */
1123 HWTEST_F(PipelineContextTestNg, PipelineContextTestNgDisableNotifyResponseRegionChanged, TestSize.Level1)
1124 {
1125     /**
1126      * @tc.steps1: Call the function NotifyResponseRegionChanged.
1127      * @tc.expected: Test the member thpExtraMgr_ is not nullptr.
1128      */
1129     ASSERT_NE(context_, nullptr);
1130     RefPtr<FrameNode> rootNode = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1131     context_->thpExtraMgr_ = AceType::MakeRefPtr<NG::THPExtraManagerImpl>();
1132     context_->NotifyResponseRegionChanged(rootNode);
1133     EXPECT_TRUE(context_->thpExtraMgr_);
1134 
1135     /**
1136      * @tc.steps2: Call the function DisableNotifyResponseRegionChanged.
1137      * @tc.expected: Test the member thpExtraMgr_ is nullptr.
1138      */
1139     context_->thpExtraMgr_.Reset();
1140     context_->DisableNotifyResponseRegionChanged();
1141     EXPECT_FALSE(context_->thpExtraMgr_);
1142 }
1143 
1144 /**
1145  * @tc.name: PipelineContextTestNg161
1146  * @tc.desc: Test StartFoldStatusDelayTask.
1147  * @tc.type: FUNC
1148  */
1149 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg161, TestSize.Level1)
1150 {
1151     /**
1152      * @tc.steps1: Call the function StartFoldStatusDelayTask.
1153      * @tc.expected: Test the member foldStatusDelayTask_ is not nullptr.
1154      */
1155     ASSERT_NE(context_, nullptr);
1156     FoldStatus foldStatus = FoldStatus::EXPAND;
__anona68bd69b0202() 1157     std::function<void()> callback = []() {};
1158     CancelableCallback<void()> foldStatusDelayTask(std::move(callback));
1159     context_->foldStatusDelayTask_ = foldStatusDelayTask;
1160     context_->StartFoldStatusDelayTask(foldStatus);
1161     EXPECT_TRUE(foldStatusDelayTask);
1162 }
1163 
1164 /**
1165  * @tc.name: PipelineContextTestNg162
1166  * @tc.desc: Test RemoveChangedFrameNode.
1167  * @tc.type: FUNC
1168  */
1169 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg162, TestSize.Level1)
1170 {
1171     /**
1172      * @tc.steps1: Call the function RemoveChangedFrameNode.
1173      * @tc.expected: Test the member changedNodes_ is not empty.
1174      */
1175     ASSERT_NE(context_, nullptr);
1176     int32_t nodeId = 1;
1177     RefPtr<FrameNode> rootNode1 = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1178     RefPtr<FrameNode> rootNode2 = AceType::MakeRefPtr<FrameNode>("test2", 2, AceType::MakeRefPtr<Pattern>());
1179     RefPtr<FrameNode> rootNode3 = AceType::MakeRefPtr<FrameNode>("test3", 3, AceType::MakeRefPtr<Pattern>());
1180     context_->changedNodes_.push_back(rootNode1);
1181     context_->changedNodes_.push_back(rootNode2);
1182     context_->changedNodes_.push_back(rootNode3);
1183     context_->RemoveChangedFrameNode(nodeId);
1184     EXPECT_FALSE(context_->changedNodes_.empty());
1185 }
1186 
1187 /**
1188  * @tc.name: PipelineContextTestNg163
1189  * @tc.desc: Test AddChangedFrameNode.
1190  * @tc.type: FUNC
1191  */
1192 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg163, TestSize.Level1)
1193 {
1194     /**
1195      * @tc.steps1: Call the function AddChangedFrameNode.
1196      * @tc.expected: Test the member changeInfoListeners_ is not empty and setting the node in changedNodes_.
1197      */
1198     ASSERT_NE(context_, nullptr);
1199     context_->changedNodes_.clear();
1200     RefPtr<FrameNode> rootNode1 = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1201     RefPtr<FrameNode> rootNode2 = AceType::MakeRefPtr<FrameNode>("test2", 2, AceType::MakeRefPtr<Pattern>());
1202     RefPtr<FrameNode> rootNode3 = AceType::MakeRefPtr<FrameNode>("test3", 3, AceType::MakeRefPtr<Pattern>());
1203     WeakPtr<FrameNode> weakNode1 = AceType::WeakClaim(AceType::RawPtr(rootNode3));
1204     context_->changeInfoListeners_.push_back(rootNode1);
1205     context_->changedNodes_.push_back(rootNode1);
1206     context_->changedNodes_.push_back(rootNode2);
1207     EXPECT_TRUE(context_->AddChangedFrameNode(weakNode1));
1208     EXPECT_TRUE(context_->AddChangedFrameNode(weakNode1));
1209 }
1210 
1211 /**
1212  * @tc.name: PipelineContextTestNg164
1213  * @tc.desc: Test FlushFrameCallback.
1214  * @tc.type: FUNC
1215  */
1216 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg164, TestSize.Level1)
1217 {
1218     /**
1219      * @tc.steps1: Call the function FlushFrameCallback.
1220      * @tc.expected: Test the member frameCallbackFuncs_ is empty.
1221      */
1222     ASSERT_NE(context_, nullptr);
1223     uint64_t nanoTimestamp = 1;
__anona68bd69b0302(uint64_t nanoTimestamp) 1224     FrameCallbackFunc callback = [](uint64_t nanoTimestamp) {
1225         return;
1226     };
1227     context_->frameCallbackFuncs_.push_back(callback);
1228     context_->FlushFrameCallback(nanoTimestamp, 0);
1229     EXPECT_TRUE(context_->frameCallbackFuncs_.empty());
1230     /**
1231      * @tc.steps2: Call the function FlushFrameCallback with UINT64_MAX as framecount .
1232      * @tc.expected: frameCallbackFuncs_ size is 1.
1233      */
1234     context_->frameCallbackFuncs_.push_back(callback);
1235     context_->FlushFrameCallback(nanoTimestamp, UINT64_MAX);
1236     EXPECT_EQ(context_->frameCallbackFuncs_.size(), 1);
1237     context_->frameCallbackFuncs_.clear();
1238 }
1239 
1240 /**
1241  * @tc.name: PipelineContextTestNg165
1242  * @tc.desc: Test FlushFrameCallbackFromCAPI.
1243  * @tc.type: FUNC
1244  */
1245 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg165, TestSize.Level1)
1246 {
1247     /**
1248      * @tc.steps1: Call the function FlushFrameCallbackFromCAPI.
1249      * @tc.expected: Test the member frameCallbackFuncsFromCAPI_ is not empty.
1250      */
1251     ASSERT_NE(context_, nullptr);
1252     uint64_t nanoTimestamp = 1;
1253     uint64_t frameCount = 1;
__anona68bd69b0402(uint64_t nanoTimestamp, uint32_t frameCount) 1254     FrameCallbackFuncFromCAPI frameCallback = [](uint64_t nanoTimestamp, uint32_t frameCount) {
1255         return;
1256     };
1257     context_->frameCallbackFuncsFromCAPI_.push_back(frameCallback);
1258     context_->FlushFrameCallbackFromCAPI(nanoTimestamp, frameCount);
1259     EXPECT_TRUE(context_->frameCallbackFuncsFromCAPI_.empty());
1260     /**
1261      * @tc.steps2: Call the function FlushFrameCallbackFromCAPI with UINT64_MAX as framecount .
1262      * @tc.expected: frameCallbackFuncsFromCAPI_ size is 1.
1263      */
1264     context_->frameCallbackFuncsFromCAPI_.push_back(frameCallback);
1265     context_->FlushFrameCallbackFromCAPI(nanoTimestamp, UINT64_MAX);
1266     EXPECT_EQ(context_->frameCallbackFuncsFromCAPI_.size(), 1);
1267     context_->frameCallbackFuncsFromCAPI_.clear();
1268 }
1269 
1270 /**
1271  * @tc.name: PipelineContextTestNg166
1272  * @tc.desc: Test IsContainerModalVisible.
1273  * @tc.type: FUNC
1274  */
1275 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg166, TestSize.Level1)
1276 {
1277     /**
1278      * @tc.steps1: Call the function IsContainerModalVisible.
1279      * @tc.expected: Test the member windowModal_ is not equal to CONTAINER_MODAL.
1280      */
1281     ASSERT_NE(context_, nullptr);
1282     context_->windowModal_ = WindowModal::DIALOG_MODAL;
1283     EXPECT_FALSE(context_->IsContainerModalVisible());
1284 }
1285 
1286 /**
1287  * @tc.name: PipelineContextTestNg167
1288  * @tc.desc: Test StopWindowAnimation.
1289  * @tc.type: FUNC
1290  */
1291 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg167, TestSize.Level1)
1292 {
1293     /**
1294      * @tc.steps1: Call the function StopWindowAnimation.
1295      * @tc.expected: Test the member taskScheduler_ is empty.
1296      */
1297     ASSERT_NE(context_, nullptr);
1298     context_->StopWindowAnimation();
1299     EXPECT_FALSE(context_->isWindowAnimation_);
1300 
1301     /**
1302      * @tc.steps2: Call the function StopWindowAnimation.
1303      * @tc.expected: Test the member taskScheduler_ is not empty.
1304      */
1305     using PredictTask = std::function<void(int64_t, bool)>;
__anona68bd69b0502(uint64_t value, bool flag) 1306     PredictTask task = [](uint64_t value, bool flag) {
1307         return;
1308     };
1309     context_->taskScheduler_->AddPredictTask(std::move(task));
1310     context_->StopWindowAnimation();
1311     EXPECT_FALSE(context_->isWindowAnimation_);
1312 }
1313 
1314 /**
1315  * @tc.name: PipelineContextTestNg168
1316  * @tc.desc: Test GetWindowPaintRectWithoutMeasureAndLayout.
1317  * @tc.type: FUNC
1318  */
1319 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg168, TestSize.Level1)
1320 {
1321     /**
1322      * @tc.steps1: Call the function GetWindowPaintRectWithoutMeasureAndLayout.
1323      * @tc.expected: Test the member windowModal_ is not equal to CONTAINER_MODAL.
1324      */
1325     ASSERT_NE(context_, nullptr);
1326     RectInt rect;
1327     context_->windowModal_ = WindowModal::DIALOG_MODAL;
1328     context_->GetWindowPaintRectWithoutMeasureAndLayout(rect);
1329     EXPECT_TRUE(context_->rootNode_);
1330 
1331     /**
1332      * @tc.steps2: Call the function GetWindowPaintRectWithoutMeasureAndLayout.
1333      * @tc.expected: Test the member windowModal_ is equal to CONTAINER_MODAL.
1334      */
1335     context_->windowModal_ = WindowModal::CONTAINER_MODAL;
1336     context_->GetWindowPaintRectWithoutMeasureAndLayout(rect);
1337     EXPECT_TRUE(context_->rootNode_);
1338 }
1339 
1340 /**
1341  * @tc.name: PipelineContextTestNg169
1342  * @tc.desc: Test DoKeyboardAvoidAnimate.
1343  * @tc.type: FUNC
1344  */
1345 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg169, TestSize.Level1)
1346 {
1347     /**
1348      * @tc.steps1: Call the function DoKeyboardAvoidAnimate.
1349      * @tc.expected: Test the member isDoKeyboardAvoidAnimate_ is false.
1350      */
1351     ASSERT_NE(context_, nullptr);
1352     KeyboardAnimationConfig keyboardAnimationConfig;
1353     float keyboardHeight = 0.0;
1354     context_->isDoKeyboardAvoidAnimate_ = false;
__anona68bd69b0602() 1355     std::function<void()> func = []() {
1356         context_->isDoKeyboardAvoidAnimate_ = true;
1357         return;
1358     };
1359     context_->DoKeyboardAvoidAnimate(keyboardAnimationConfig, keyboardHeight, func);
1360     EXPECT_TRUE(context_->isDoKeyboardAvoidAnimate_);
1361 }
1362 
1363 /**
1364  * @tc.name: PipelineContextTestNg170
1365  * @tc.desc: Test the function OnDrawCompleted.
1366  * @tc.type: FUNC
1367  */
1368 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg170, TestSize.Level1)
1369 {
1370     /**
1371      * @tc.steps1: initialize parameters and call OnDrawCompleted function.
1372      * @tc.expected: weakFrontend_.Upgrade() is null.
1373      */
1374     ASSERT_NE(context_, nullptr);
1375     context_->OnDrawCompleted(TEST_TAG);
1376     EXPECT_EQ(context_->weakFrontend_.Upgrade(), nullptr);
1377 }
1378 
1379 /**
1380  * @tc.name: PipelineContextTestNg171
1381  * @tc.desc: Test the function StartWindowSizeChangeAnimate.
1382  * @tc.type: FUNC
1383  */
1384 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg171, TestSize.Level1)
1385 {
1386     /**
1387      * @tc.steps1: initialize parameters and call OnDrawCompleted function.
1388      * @tc.expected: designWidthScale_ is equal to DEFAULT_DOUBLE1.
1389      */
1390     ASSERT_NE(context_, nullptr);
1391     WindowSizeChangeReason type = WindowSizeChangeReason::FULL_TO_SPLIT;
1392     context_->StartWindowSizeChangeAnimate(DEFAULT_INT3, DEFAULT_INT3, type);
1393     EXPECT_EQ(context_->designWidthScale_, DEFAULT_DOUBLE1);
1394 
1395     /**
1396      * @tc.steps2: type is MAXIMIZE_TO_SPLIT and call OnDrawCompleted function.
1397      * @tc.expected: designWidthScale_ is equal to DEFAULT_DOUBLE1.
1398      */
1399     type = WindowSizeChangeReason::MAXIMIZE_TO_SPLIT;
1400     context_->StartWindowSizeChangeAnimate(DEFAULT_INT3, DEFAULT_INT3, type);
1401     EXPECT_EQ(context_->designWidthScale_, DEFAULT_DOUBLE1);
1402 
1403     /**
1404      * @tc.steps3: type is ROTATION and call OnDrawCompleted function.
1405      * @tc.expected: designWidthScale_ is equal to DEFAULT_DOUBLE1.
1406      */
1407     type = WindowSizeChangeReason::ROTATION;
1408     context_->SetTextFieldManager(nullptr);
1409     context_->StartWindowSizeChangeAnimate(DEFAULT_INT3, DEFAULT_INT3, type);
1410     EXPECT_EQ(context_->designWidthScale_, DEFAULT_DOUBLE1);
1411 }
1412 
1413 /**
1414  * @tc.name: PipelineContextTestNg172
1415  * @tc.desc: Test the function UpdateSystemSafeArea.
1416  * @tc.type: FUNC
1417  */
1418 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg172, TestSize.Level1)
1419 {
1420     /**
1421      * @tc.steps1: initialize parameters.
1422      */
1423     ASSERT_NE(context_, nullptr);
1424     SafeAreaInsets::Inset left { 0, 1 };
1425     SafeAreaInsets::Inset top { 0, 2 };
1426     SafeAreaInsets::Inset right { 0, 3 };
1427     SafeAreaInsets::Inset bottom { 0, 4 };
1428     SafeAreaInsets safeAreaInsets(left, top, right, bottom);
1429     bool checkSceneBoardWindow = true;
1430 
1431     /**
1432      * @tc.steps2: call UpdateSystemSafeArea function.
1433      * @tc.expected: scbSystemSafeArea_ is equal to safeAreaInsets.
1434      */
1435     context_->UpdateSystemSafeArea(safeAreaInsets, checkSceneBoardWindow);
1436     EXPECT_EQ(context_->safeAreaManager_->scbSystemSafeArea_, safeAreaInsets);
1437 
1438     /**
1439      * @tc.steps3: call UpdateCutoutSafeArea function.
1440      * @tc.expected: scbCutoutSafeArea_ is not equal to safeAreaInsets.
1441      */
1442     context_->UpdateCutoutSafeArea(safeAreaInsets, checkSceneBoardWindow);
1443     EXPECT_NE(context_->safeAreaManager_->scbCutoutSafeArea_, safeAreaInsets);
1444 
1445     /**
1446      * @tc.steps4: call UpdateNavSafeArea function.
1447      * @tc.expected: scbNavSafeArea_ is equal to safeAreaInsets.
1448      */
1449     context_->UpdateNavSafeArea(safeAreaInsets, checkSceneBoardWindow);
1450     EXPECT_EQ(context_->safeAreaManager_->scbNavSafeArea_, safeAreaInsets);
1451 }
1452 
1453 /**
1454  * @tc.name: PipelineContextTestNg173
1455  * @tc.desc: Test the function UpdateCutoutSafeArea.
1456  * @tc.type: FUNC
1457  */
1458 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg173, TestSize.Level1)
1459 {
1460     /**
1461      * @tc.steps1: initialize parameters.
1462      */
1463     ASSERT_NE(context_, nullptr);
1464     SafeAreaInsets::Inset left { 0, 0 };
1465     SafeAreaInsets::Inset top { 0, 0 };
1466     SafeAreaInsets::Inset right { 0, 0 };
1467     SafeAreaInsets::Inset bottom { 0, 0 };
1468     SafeAreaInsets safeAreaInsets(left, top, right, bottom);
1469 
1470     /**
1471      * @tc.steps2: minPlatformVersion_ is 10 and call UpdateCutoutSafeArea function.
1472      * @tc.expected: cutoutSafeArea_ is equal to safeAreaInsets.
1473      */
1474     context_->SetMinPlatformVersion(10);
1475     context_->UpdateCutoutSafeArea(safeAreaInsets);
1476     EXPECT_EQ(context_->safeAreaManager_->cutoutSafeArea_, safeAreaInsets);
1477 
1478     /**
1479      * @tc.steps3: minPlatformVersion_ is 10 and call UpdateNavSafeArea function.
1480      * @tc.expected: navSafeArea_ is equal to safeAreaInsets.
1481      */
1482     context_->UpdateNavSafeArea(safeAreaInsets);
1483     EXPECT_EQ(context_->safeAreaManager_->navSafeArea_, safeAreaInsets);
1484 }
1485 
1486 /**
1487  * @tc.name: PipelineContextTestNg174
1488  * @tc.desc: Test the function SetEnableKeyBoardAvoidMode.
1489  * @tc.type: FUNC
1490  */
1491 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg174, TestSize.Level1)
1492 {
1493     /**
1494      * @tc.steps1: initialize parameters and call SetEnableKeyBoardAvoidMode function.
1495      * @tc.expected: keyboardSafeAreaEnabled_ is false.
1496      */
1497     ASSERT_NE(context_, nullptr);
1498     KeyBoardAvoidMode keyBoardAvoidMode = KeyBoardAvoidMode::OFFSET;
1499     context_->SetEnableKeyBoardAvoidMode(keyBoardAvoidMode);
1500     EXPECT_FALSE(context_->GetSafeAreaManager()->KeyboardSafeAreaEnabled());
1501 
1502     /**
1503      * @tc.steps2: call SetEnableKeyBoardAvoidMode function.
1504      * @tc.expected: isFullScreen_ is false.
1505      */
1506     context_->SetIsLayoutFullScreen(false);
1507     EXPECT_FALSE(context_->GetSafeAreaManager()->isFullScreen_);
1508 
1509     /**
1510      * @tc.steps3: call SetIsNeedAvoidWindow function.
1511      * @tc.expected: isNeedAvoidWindow_ is false.
1512      */
1513     context_->SetIsNeedAvoidWindow(false);
1514     EXPECT_FALSE(context_->GetSafeAreaManager()->isNeedAvoidWindow_);
1515 }
1516 
1517 /**
1518  * @tc.name: PipelineContextTestNg175
1519  * @tc.desc: Test the function DetachNode.
1520  * @tc.type: FUNC
1521  */
1522 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg175, TestSize.Level1)
1523 {
1524     /**
1525      * @tc.steps1: initialize parameters and call DetachNode function.
1526      * @tc.expected: focusNode_ is not equal to frameNode_.
1527      */
1528     ASSERT_NE(context_, nullptr);
1529     context_->focusNode_ = frameNode_;
1530     frameNode_->SetPrivacySensitive(true);
1531     context_->DetachNode(frameNode_);
1532     EXPECT_NE(context_->focusNode_, frameNode_);
1533 }
1534 
1535 /**
1536  * @tc.name: PipelineContextTestNg176
1537  * @tc.desc: Test the function MarkDirtyOverlay.
1538  * @tc.type: FUNC
1539  */
1540 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg176, TestSize.Level1)
1541 {
1542     /**
1543      * @tc.steps1: initialize parameters and call MarkDirtyOverlay function.
1544      * @tc.expected: rootNode_->GetChildren().size() is 1.
1545      */
1546     ASSERT_NE(context_, nullptr);
1547     RefPtr<FrameNode> child = FrameNode::CreateFrameNode(V2::POPUP_ETS_TAG, 0, AceType::MakeRefPtr<Pattern>());
1548     context_->rootNode_->children_.clear();
1549     context_->rootNode_->AddChild(child);
1550     context_->MarkDirtyOverlay();
1551     EXPECT_EQ(context_->rootNode_->GetChildren().size(), 1);
1552 }
1553 
1554 /**
1555  * @tc.name: PipelineContextTestNg177
1556  * @tc.desc: Test the function FlushDirtyPropertyNodesWhenExist.
1557  * @tc.type: FUNC
1558  */
1559 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg177, TestSize.Level1)
1560 {
1561     /**
1562      * @tc.steps1: initialize parameters and call FlushDirtyPropertyNodesWhenExist function.
1563      * @tc.expected: dirtyPropertyNodes_.size() is 0.
1564      */
1565     ASSERT_NE(context_, nullptr);
1566     context_->FlushDirtyPropertyNodesWhenExist();
1567     EXPECT_EQ(context_->dirtyPropertyNodes_.size(), 0);
1568 
1569     /**
1570      * @tc.steps2: dirtyPropertyNodes_ is not null and call FlushDirtyPropertyNodesWhenExist function.
1571      * @tc.expected: dirtyPropertyNodes_.size() is 0.
1572      */
1573     context_->dirtyPropertyNodes_.emplace(frameNode_);
1574     context_->taskScheduler_->SetIsLayouting(false);
1575     context_->FlushDirtyPropertyNodesWhenExist();
1576     EXPECT_EQ(context_->dirtyPropertyNodes_.size(), 0);
1577 }
1578 
1579 /**
1580  * @tc.name: PipelineContextTestNg178
1581  * @tc.desc: Test the function CalcAvoidOffset.
1582  * @tc.type: FUNC
1583  */
1584 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg178, TestSize.Level1)
1585 {
1586     /**
1587      * @tc.steps1: initialize parameters and call CalcAvoidOffset function.
1588      * @tc.expected: result is 0.0f.
1589      */
1590     ASSERT_NE(context_, nullptr);
1591     float keyboardHeight = 0.0f;
1592     float positionY = 0.0f;
1593     float height = 0.0f;
1594     SizeF rootSize(100.0f, 100.0f);
1595     float result = context_->CalcAvoidOffset(keyboardHeight, positionY, height, rootSize);
1596     EXPECT_EQ(result, 0.0f);
1597 
1598     /**
1599      * @tc.steps2: positionY is 10.0f and call CalcAvoidOffset function.
1600      * @tc.expected: result is -20.0f.
1601      */
1602     positionY = 10.0f;
1603     height = 10.0f;
1604     keyboardHeight = 100.0f;
1605     result = context_->CalcAvoidOffset(keyboardHeight, positionY, height, rootSize);
1606     EXPECT_EQ(result, -20.0f);
1607 
1608     /**
1609      * @tc.steps3: positionY is 100.0f and call CalcAvoidOffset function.
1610      * @tc.expected: result is 0.0f.
1611      */
1612     positionY = 100.0f;
1613     height = 20.0f;
1614     keyboardHeight = -100.0f;
1615     result = context_->CalcAvoidOffset(keyboardHeight, positionY, height, rootSize);
1616     EXPECT_EQ(result, 0.0f);
1617 
1618     /**
1619      * @tc.steps4: positionY is 80.0f and call CalcAvoidOffset function.
1620      * @tc.expected: result is 0.0f.
1621      */
1622     positionY = 80.0f;
1623     height = -100.0f;
1624     result = context_->CalcAvoidOffset(keyboardHeight, positionY, height, rootSize);
1625     EXPECT_EQ(result, 0.0f);
1626 }
1627 
1628 /**
1629  * @tc.name: PipelineContextTestNg179
1630  * @tc.desc: Test the function FindNavigationNodeToHandleBack.
1631  * @tc.type: FUNC
1632  */
1633 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg179, TestSize.Level1)
1634 {
1635     /**
1636      * @tc.steps1: initialize parameters.
1637      */
1638     ASSERT_NE(context_, nullptr);
1639     auto nodeId = ElementRegister::GetInstance()->MakeUniqueId();
1640     auto navigationStack = AceType::MakeRefPtr<NavigationStack>();
1641     auto node = NavigationGroupNode::GetOrCreateGroupNode(
__anona68bd69b0702() 1642         TEST_TAG, nodeId, []() { return AceType::MakeRefPtr<NavigationPattern>(); });
1643     node->GetPattern<NavigationPattern>()->SetNavigationStack(std::move(navigationStack));
1644     auto childNode1 = NavigationGroupNode::GetOrCreateGroupNode(
__anona68bd69b0802() 1645         TEST_TAG, 0, []() { return AceType::MakeRefPtr<NavigationPattern>(); });
1646     auto childNode2 = NavigationGroupNode::GetOrCreateGroupNode(
__anona68bd69b0902() 1647         V2::NAVIGATION_VIEW_ETS_TAG, 1, []() { return AceType::MakeRefPtr<NavigationPattern>(); });
1648     childNode1->isActive_ = true;
1649     childNode2->isActive_ = true;
1650     node->AddChild(childNode1);
1651     node->AddChild(childNode2);
1652     node->AddChild(nullptr);
1653     bool isEntry = false;
1654 
1655     /**
1656      * @tc.steps2: call CalcAvoidOffset function.
1657      * @tc.expected: result is null.
1658      */
1659     RefPtr<FrameNode> result = context_->FindNavigationNodeToHandleBack(node, isEntry);
1660     EXPECT_EQ(result, nullptr);
1661 
1662     /**
1663      * @tc.steps3: isEntry is true and call CalcAvoidOffset function.
1664      * @tc.expected: result is null.
1665      */
1666     isEntry = true;
1667     childNode1->GetPattern<NavigationPattern>()->SetNavigationStack(std::move(navigationStack));
1668     childNode2->GetPattern<NavigationPattern>()->SetNavigationStack(std::move(navigationStack));
1669     result = context_->FindNavigationNodeToHandleBack(node, isEntry);
1670     EXPECT_EQ(result, nullptr);
1671 }
1672 
1673 /**
1674  * @tc.name: PipelineContextTestNg180
1675  * @tc.desc: Test the function OnDumpInfo.
1676  * @tc.type: FUNC
1677  */
1678 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg180, TestSize.Level1)
1679 {
1680     /**
1681      * @tc.steps1: initialize parameters and call OnDumpInfo function.
1682      * @tc.expected: result is true.
1683      */
1684     ASSERT_NE(context_, nullptr);
1685     std::vector<std::string> params;
1686     params.push_back("test");
1687     params.push_back("dcDepth_");
1688     params.push_back("dcDepth_10");
1689     context_->SetIsDynamicRender(true);
1690     bool result = context_->OnDumpInfo(params);
1691     EXPECT_TRUE(result);
1692 }
1693 
1694 /**
1695  * @tc.name: PipelineContextTestNg181
1696  * @tc.desc: Test the function HandleSpecialContainerNode.
1697  * @tc.type: FUNC
1698  */
1699 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg181, TestSize.Level1)
1700 {
1701     /**
1702      * @tc.steps1: containerDeleteFlag_ is true and call HandleSpecialContainerNode function.
1703      * @tc.expected: positionZNodes_ is null.
1704      */
1705     ASSERT_NE(context_, nullptr);
1706     SystemProperties::containerDeleteFlag_ = true;
1707     context_->HandleSpecialContainerNode();
1708     EXPECT_EQ(context_->GetPositionZNodes().size(), 0);
1709 
1710     /**
1711      * @tc.steps2: initialize parameters and call HandleSpecialContainerNode function.
1712      * @tc.expected: element is false and positionZNodes_ is null.
1713      */
1714     RefPtr<FrameNode> parentNode = FrameNode::CreateFrameNode("parent", 0, AceType::MakeRefPtr<Pattern>());
1715     RefPtr<FrameNode> frameNode1 = FrameNode::CreateFrameNode("test1", 1, AceType::MakeRefPtr<Pattern>());
1716     RefPtr<FrameNode> frameNode2 = FrameNode::CreateFrameNode("test2", 2, AceType::MakeRefPtr<Pattern>());
1717     RefPtr<FrameNode> overlayNode = FrameNode::CreateFrameNode("overlayNode", 3, AceType::MakeRefPtr<Pattern>());
1718     RefPtr<FrameNode> focusPaintNode = FrameNode::CreateFrameNode("overlayNode", 4, AceType::MakeRefPtr<Pattern>());
1719     auto element = ElementRegister::GetInstance()->AddReferenced(1, frameNode1);
1720     element = ElementRegister::GetInstance()->AddReferenced(2, frameNode2);
1721     EXPECT_FALSE(element);
1722     frameNode2->SetParent(parentNode);
1723     context_->AddPositionZNode(-1);
1724     context_->AddPositionZNode(1);
1725     context_->AddPositionZNode(2);
1726     context_->HandleSpecialContainerNode();
1727     EXPECT_EQ(context_->GetPositionZNodes().size(), 0);
1728 
1729     /**
1730      * @tc.steps3: overlayNode and focusPaintNode are not null, call HandleSpecialContainerNode function.
1731      * @tc.expected: element is false and positionZNodes_ is null.
1732      */
1733     context_->AddPositionZNode(2);
1734     parentNode->SetOverlayNode(overlayNode);
1735     parentNode->SetFocusPaintNode(focusPaintNode);
1736     parentNode->renderContext_ = nullptr;
1737     context_->HandleSpecialContainerNode();
1738     EXPECT_EQ(context_->GetPositionZNodes().size(), 0);
1739 
1740     /**
1741      * @tc.steps4: renderContext_ is null and call HandleSpecialContainerNode function.
1742      * @tc.expected: element is false and positionZNodes_ is null.
1743      */
1744     context_->AddPositionZNode(2);
1745     overlayNode->renderContext_ = nullptr;
1746     focusPaintNode->renderContext_ = nullptr;
1747     context_->HandleSpecialContainerNode();
1748     EXPECT_EQ(context_->GetPositionZNodes().size(), 0);
1749 }
1750 
1751 /**
1752  * @tc.name: PipelineContextTestNg182
1753  * @tc.desc: Test the function FlushMessages.
1754  * @tc.type: FUNC
1755  */
1756 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg182, TestSize.Level1)
1757 {
1758     /**
1759      * @tc.steps1: isFreezeFlushMessage_ is true and call FlushMessages function.
1760      * @tc.expected: isFreezeFlushMessage_ is false.
1761      */
1762     ASSERT_NE(context_, nullptr);
1763     context_->SetIsFreezeFlushMessage(true);
1764     context_->FlushMessages();
1765     EXPECT_FALSE(context_->IsFreezeFlushMessage());
1766 
1767     /**
1768      * @tc.steps2: navigationMgr_ is null and call FlushMessages function.
1769      * @tc.expected: isFreezeFlushMessage_ is false.
1770      */
1771     context_->navigationMgr_ = nullptr;
1772     context_->FlushMessages();
1773     EXPECT_FALSE(context_->IsFreezeFlushMessage());
1774 }
1775 
1776 /**
1777  * @tc.name: PipelineContextTestNg183
1778  * @tc.desc: Test the function FlushUITaskWithSingleDirtyNode.
1779  * @tc.type: FUNC
1780  */
1781 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg183, TestSize.Level1)
1782 {
1783     /**
1784      * @tc.steps1: initialize parameters and call FlushUITaskWithSingleDirtyNode function.
1785      * @tc.expected: singleDirtyNodesToFlush_.size() is 1.
1786      */
1787     RefPtr<FrameNode> node = FrameNode::CreateFrameNode("node", 0, AceType::MakeRefPtr<Pattern>());
1788     context_->taskScheduler_->SetIsLayouting(true);
1789     context_->FlushUITaskWithSingleDirtyNode(node);
1790     context_->FlushAfterLayoutCallbackInImplicitAnimationTask();
1791     EXPECT_EQ(context_->taskScheduler_->singleDirtyNodesToFlush_.size(), 1);
1792 }
1793 
1794 /**
1795  * @tc.name: PipelineContextTestNg184
1796  * @tc.desc: Test the function FlushFocus.
1797  * @tc.type: FUNC
1798  */
1799 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg184, TestSize.Level1)
1800 {
1801     /**
1802      * @tc.steps1: add dirty focus and call FlushFocus function.
1803      * @tc.expected: The dirtyFocusNode_ is changed to nullptr.
1804      */
1805     ASSERT_NE(context_, nullptr);
1806     context_->AddDirtyFocus(frameNode_);
1807     context_->FlushFocus();
1808     EXPECT_EQ(context_->dirtyFocusScope_.Upgrade(), nullptr);
1809 
1810     /**
1811      * @tc.steps2: set focus type to SCOPE and call FlushFocus function.
1812      * @tc.expected: The dirtyFocusNode_ is changed to nullptr.
1813      */
1814     auto eventHub = frameNode_->GetOrCreateEventHub<EventHub>();
1815     ASSERT_NE(eventHub, nullptr);
1816     auto focusHub = eventHub->GetOrCreateFocusHub();
1817     ASSERT_NE(focusHub, nullptr);
1818     focusHub->SetFocusType(FocusType::SCOPE);
1819     context_->AddDirtyFocus(frameNode_);
1820     context_->FlushFocus();
1821     EXPECT_EQ(context_->dirtyFocusNode_.Upgrade(), nullptr);
1822 }
1823 
1824 /**
1825  * @tc.name: PipelineContextTestNg185
1826  * @tc.desc: Test the function FlushFocusWithNode.
1827  * @tc.type: FUNC
1828  */
1829 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg185, TestSize.Level1)
1830 {
1831     /**
1832      * @tc.steps1: initialize parameters and call FlushFocusWithNode function.
1833      * @tc.expected: singleDirtyNodesToFlush_.size() is 1.
1834      */
1835     ASSERT_NE(context_, nullptr);
1836     RefPtr<FrameNode> focusNode = FrameNode::CreateFrameNode("focusNode", 0, AceType::MakeRefPtr<Pattern>());
1837     bool isScope = true;
1838     context_->FlushFocusWithNode(focusNode, isScope);
1839     EXPECT_EQ(context_->dirtyFocusNode_.Upgrade(), nullptr);
1840 }
1841 
1842 /**
1843  * @tc.name: PipelineContextTestNg186
1844  * @tc.desc: Test the function FlushFrameRate.
1845  * @tc.type: FUNC
1846  */
1847 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg186, TestSize.Level1)
1848 {
1849     /**
1850      * @tc.steps1: initialize parameters and call FlushFrameRate function.
1851      * @tc.expected: lastAnimatorExpectedFrameRate_ is -1.
1852      */
1853     ASSERT_NE(context_, nullptr);
1854     context_->lastAnimatorExpectedFrameRate_ = 0;
1855     context_->FlushFrameRate();
1856     EXPECT_EQ(context_->lastAnimatorExpectedFrameRate_, -1);
1857 
1858     /**
1859      * @tc.steps2: isRateChanged_ is true and call FlushFrameRate function.
1860      * @tc.expected: isRateChanged_ is true is false and lastAnimatorExpectedFrameRate_ is -1.
1861      */
1862     context_->frameRateManager_->SetIsRateChanged(true);
1863     context_->FlushFrameRate();
1864     EXPECT_EQ(context_->lastAnimatorExpectedFrameRate_, -1);
1865     EXPECT_FALSE(context_->frameRateManager_->IsRateChanged());
1866 }
1867 
1868 /**
1869  * @tc.name: PipelineContextTestNg187
1870  * @tc.desc: Test the function StartWindowSizeChangeAnimate.
1871  * @tc.type: FUNC
1872  */
1873 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg187, TestSize.Level1)
1874 {
1875     /**
1876      * @tc.steps1: type is FULL_TO_SPLIT and call StartWindowSizeChangeAnimate function.
1877      * @tc.expected: designWidthScale_ not change.
1878      */
1879     ASSERT_NE(context_, nullptr);
1880     int32_t width = 0;
1881     int32_t height = 0;
1882     WindowSizeChangeReason type = WindowSizeChangeReason::FULL_TO_SPLIT;
1883     context_->StartWindowSizeChangeAnimate(width, height, type);
1884     EXPECT_EQ(context_->designWidthScale_, 1);
1885 
1886     /**
1887      * @tc.steps2: type is MAXIMIZE_TO_SPLIT and call StartWindowSizeChangeAnimate function.
1888      * @tc.expected: designWidthScale_ not change.
1889      */
1890     type = WindowSizeChangeReason::MAXIMIZE_TO_SPLIT;
1891     context_->StartWindowSizeChangeAnimate(width, height, type);
1892     EXPECT_EQ(context_->designWidthScale_, 1);
1893 }
1894 
1895 /**
1896  * @tc.name: PipelineContextTestNg188
1897  * @tc.desc: Test the function PostKeyboardAvoidTask.
1898  * @tc.type: FUNC
1899  */
1900 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg188, TestSize.Level1)
1901 {
1902     /**
1903      * @tc.steps1: initialize parameters and call PostKeyboardAvoidTask function.
1904      * @tc.expected: laterAvoid is false.
1905      */
1906     ASSERT_NE(context_, nullptr);
1907     auto manager = AceType::MakeRefPtr<TextFieldManagerNG>();
1908     manager->SetLaterAvoid(true);
1909     context_->textFieldManager_ = manager;
1910     context_->PostKeyboardAvoidTask();
1911     EXPECT_FALSE(manager->GetLaterAvoid());
1912 
1913     /**
1914      * @tc.steps2: usingCustomKeyboardAvoid_ is true and call PostKeyboardAvoidTask function.
1915      * @tc.expected: laterAvoid is true.
1916      */
1917     manager->SetLaterAvoid(true);
1918     manager->SetUsingCustomKeyboardAvoid(true);
1919     context_->textFieldManager_ = manager;
1920     context_->PostKeyboardAvoidTask();
1921     EXPECT_TRUE(manager->GetLaterAvoid());
1922 }
1923 
1924 /**
1925  * @tc.name: PipelineContextTestNg189
1926  * @tc.desc: Test CompensatePointerMoveEventFromUnhandledEvents.
1927  * @tc.type: FUNC
1928  */
1929 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg189, TestSize.Level1)
1930 {
1931     /**
1932      * @tc.steps1: initialize parameters.
1933      */
1934     ASSERT_NE(context_, nullptr);
1935     DragPointerEvent event;
1936     event.pointerEventId = 1;
1937     RefPtr<FrameNode> rootNode = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1938     DragPointerEvent PointerEvent1;
1939     PointerEvent1.pointerEventId = 2;
1940     DragPointerEvent PointerEvent2;
1941     PointerEvent2.pointerEventId = 3;
1942     std::list<DragPointerEvent> dragEvents;
1943     dragEvents.push_back(PointerEvent1);
1944     dragEvents.push_back(PointerEvent2);
1945     context_->dragEvents_[rootNode] = dragEvents;
1946 
1947     /**
1948      * @tc.steps2: Call the function CompensatePointerMoveEventFromUnhandledEvents.
1949      * @tc.expected: Test the member dragEvents_ is not empty and The result is false.
1950      */
1951     EXPECT_FALSE(context_->CompensatePointerMoveEventFromUnhandledEvents(event, rootNode));
1952 
1953     /**
1954      * @tc.steps3: Call the function CompensatePointerMoveEventFromUnhandledEvents.
1955      * @tc.expected: Test The parameter rootNode2 is not in dragEvents_ and The result is false.
1956      */
1957     RefPtr<FrameNode> rootNode2 = AceType::MakeRefPtr<FrameNode>("test1", 1, AceType::MakeRefPtr<Pattern>());
1958     EXPECT_FALSE(context_->CompensatePointerMoveEventFromUnhandledEvents(event, rootNode2));
1959 
1960     /**
1961      * @tc.steps4: Push the event into dragEvents_.
1962      * @tc.expected: The result is TRUE.
1963      */
1964     context_->dragEvents_[rootNode].push_back(event);
1965     EXPECT_TRUE(context_->CompensatePointerMoveEventFromUnhandledEvents(event, rootNode));
1966 }
1967 
1968 /**
1969  * @tc.name: PipelineContextTestNg190
1970  * @tc.desc: Test AddFrameCallback.
1971  * @tc.type: FUNC
1972  */
1973 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg190, TestSize.Level1)
1974 {
1975     /**
1976      * @tc.steps1: initialize parameters.let delayMillis is equal to 0;
1977      */
1978     ASSERT_NE(context_, nullptr);
1979     int64_t delayMillis = 0;
1980     FrameCallbackFunc frameCallbackFunc2 = nullptr;
1981     IdleCallbackFunc idleCallbackFunc2 = nullptr;
1982 
1983     /**
1984      * @tc.steps2:
1985      * Test the parameters frameCallbackFunc and idleCallbackFunc are nullptr, and delayMillis is equal to 0.
1986      * @tc.expected: The member frameCallbackFuncs_ is empty
1987      */
1988     context_->AddFrameCallback(std::move(frameCallbackFunc2), std::move(idleCallbackFunc2), delayMillis);
1989     EXPECT_TRUE(context_->frameCallbackFuncs_.empty());
__anona68bd69b0a02(uint64_t nanoTimestamp) 1990     FrameCallbackFunc frameCallbackFunc = [](uint64_t nanoTimestamp) {
1991         return;
1992     };
__anona68bd69b0b02(uint64_t nanoTimestamp, uint32_t frameCount) 1993     IdleCallbackFunc idleCallbackFunc = [](uint64_t nanoTimestamp, uint32_t frameCount) {
1994         return;
1995     };
1996 
1997     /**
1998      * @tc.steps3:
1999      * Test the parameters frameCallbackFunc and idleCallbackFunc are not nullptr, and delayMillis is equal to 0.
2000      * @tc.expected: The member frameCallbackFuncs_ is not empty
2001      */
2002     context_->AddFrameCallback(std::move(frameCallbackFunc), std::move(idleCallbackFunc), delayMillis);
2003     EXPECT_FALSE(context_->frameCallbackFuncs_.empty());
2004 
2005     /**
2006      * @tc.steps4:
2007      * Test the parameters frameCallbackFunc and idleCallbackFunc are nullptr, and delayMillis is granter than 0.
2008      * @tc.expected: The member frameCallbackFuncs_ is empty
2009      */
2010     delayMillis = 1;
2011     context_->frameCallbackFuncs_.clear();
2012     context_->AddFrameCallback(std::move(frameCallbackFunc2), std::move(idleCallbackFunc2), delayMillis);
2013     EXPECT_TRUE(context_->frameCallbackFuncs_.empty());
2014 
2015     /**
2016      * @tc.steps5:
2017      * Test the parameters frameCallbackFunc and idleCallbackFunc are not nullptr, and delayMillis is granter than 0.
2018      * @tc.expected: The member frameCallbackFuncs_ is not empty
2019      */
2020     context_->frameCallbackFuncs_.clear();
2021     context_->AddFrameCallback(std::move(frameCallbackFunc), std::move(idleCallbackFunc), delayMillis);
2022     EXPECT_FALSE(context_->frameCallbackFuncs_.empty());
2023 }
2024 
2025 /**
2026  * @tc.name: PipelineContextTestNg191
2027  * @tc.desc: Test AddCAPIFrameCallback.
2028  * @tc.type: FUNC
2029  */
2030 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg191, TestSize.Level1)
2031 {
2032     /**
2033      * @tc.steps1: initialize parameters.
2034      */
2035     ASSERT_NE(context_, nullptr);
__anona68bd69b0c02(uint64_t nanoTimestamp, uint32_t frameCount) 2036     FrameCallbackFuncFromCAPI frameCallbackFuncFromCAPI = [](uint64_t nanoTimestamp, uint32_t frameCount) {
2037         return;
2038     };
2039 
2040     /**
2041      * @tc.steps2:
2042      * Test the parameters frameCallbackFuncFromCAPI is not nullptr.
2043      * @tc.expected: The member frameCallbackFuncFromCAPI is not empty
2044      */
2045     context_->AddCAPIFrameCallback(std::move(frameCallbackFuncFromCAPI));
2046     EXPECT_FALSE(context_->frameCallbackFuncsFromCAPI_.empty());
2047 
2048     /**
2049      * @tc.steps3:
2050      * Test the parameters frameCallbackFuncFromCAPI is nullptr.
2051      * @tc.expected: The member frameCallbackFuncFromCAPI is empty
2052      */
2053     frameCallbackFuncFromCAPI = nullptr;
2054     context_->frameCallbackFuncsFromCAPI_.clear();
2055     context_->AddCAPIFrameCallback(std::move(frameCallbackFuncFromCAPI));
2056     EXPECT_TRUE(context_->frameCallbackFuncsFromCAPI_.empty());
2057 }
2058 
2059 /**
2060  * @tc.name: PipelineContextTestNg192
2061  * @tc.desc: Test TriggerIdleCallback.
2062  * @tc.type: FUNC
2063  */
2064 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg192, TestSize.Level1)
2065 {
2066     /**
2067      * @tc.steps1: initialize parameters.
2068      */
2069     ASSERT_NE(context_, nullptr);
__anona68bd69b0d02(uint64_t nanoTimestamp, uint32_t frameCount) 2070     IdleCallbackFunc callback = [](uint64_t nanoTimestamp, uint32_t frameCount) {
2071         return;
2072     };
2073     /**
2074      * @tc.steps2:
2075      * Test the parameters deadline is near to currentTime.
2076      * @tc.expected: The member idleCallbackFuncs_ is not empty
2077      */
2078     context_->idleCallbackFuncs_.push_back(callback);
2079     int64_t deadline = GetSysTimestamp();
2080     context_->TriggerIdleCallback(deadline);
2081     EXPECT_FALSE(context_->idleCallbackFuncs_.empty());
2082 
2083     /**
2084      * @tc.steps3:
2085      * Test current time is less than the minimum idle time.
2086      * @tc.expected: The member idleCallbackFuncs_ is not empty
2087      */
2088     context_->idleCallbackFuncs_.push_back(callback);
2089     deadline = GetSysTimestamp() + 10000;
2090     context_->TriggerIdleCallback(deadline);
2091     EXPECT_TRUE(context_->idleCallbackFuncs_.empty());
2092 }
2093 
2094 /**
2095  * @tc.name: PipelineContextTestNg193
2096  * @tc.desc: Test EnableContainerModalGesture.
2097  * @tc.type: FUNC
2098  */
2099 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg193, TestSize.Level1)
2100 {
2101     /**
2102      * @tc.steps1: initialize parameters.
2103      */
2104     ASSERT_NE(context_, nullptr);
2105     bool isEnable = 0;
2106     RefPtr<UINode> node = AceType::MakeRefPtr<FrameNode>("test", -1, AceType::MakeRefPtr<Pattern>());
2107     context_->rootNode_->children_.push_front(node);
2108 
2109     /**
2110      * @tc.steps2:
2111      * Call function EnableContainerModalGesture.
2112      * @tc.expected: children.front() is not nullptr
2113      */
2114     context_->EnableContainerModalGesture(isEnable);
2115     EXPECT_TRUE(AceType::DynamicCast<FrameNode>(context_->rootNode_->GetChildren().front()));
2116 
2117     context_->rootNode_->children_.clear();
2118     node.Reset();
2119     context_->rootNode_->children_.push_front(node);
2120 
2121     /**
2122      * @tc.steps3:
2123      * Call function EnableContainerModalGesture.
2124      * @tc.expected: children.front() is nullptr
2125      */
2126     context_->EnableContainerModalGesture(isEnable);
2127     EXPECT_FALSE(AceType::DynamicCast<FrameNode>(context_->rootNode_->GetChildren().front()));
2128 
2129     context_->rootNode_->children_.clear();
2130 
2131     /**
2132      * @tc.steps4:
2133      * Call function EnableContainerModalGesture.
2134      * @tc.expected: children is empty
2135      */
2136     context_->EnableContainerModalGesture(isEnable);
2137     EXPECT_TRUE(context_->rootNode_->GetChildren().empty());
2138 }
2139 
2140 /**
2141  * @tc.name: PipelineContextTestNg194
2142  * @tc.desc: Test SetCursor.
2143  * @tc.type: FUNC
2144  */
2145 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg194, TestSize.Level1)
2146 {
2147     /**
2148      * @tc.steps1: initialize parameters.let delayMillis is less than 0;
2149      * @tc.expected: The isUserSetCursor_ is false
2150      */
2151     ASSERT_NE(context_, nullptr);
2152     int32_t cursorValue = -1;
2153     context_->SetCursor(cursorValue);
2154     EXPECT_FALSE(context_->eventManager_->GetMouseStyleManager()->userSetCursor_);
2155 
2156     /**
2157      * @tc.steps2: let delayMillis is greater than RUNNING;
2158      * @tc.expected: The isUserSetCursor_ is false
2159      */
2160     cursorValue = static_cast<int32_t>(MouseFormat::ALIAS);
2161     context_->SetCursor(cursorValue);
2162     EXPECT_FALSE(context_->eventManager_->GetMouseStyleManager()->userSetCursor_);
2163 
2164     /**
2165      * @tc.steps3: let delayMillis is greater than 0 and less than RUNNING;
2166      * @tc.expected: The isUserSetCursor_ is true
2167      */
2168     cursorValue = 10;
2169     context_->SetCursor(cursorValue);
2170     EXPECT_TRUE(context_->eventManager_->GetMouseStyleManager()->userSetCursor_);
2171 }
2172 
2173 /**
2174  * @tc.name: PipelineContextTestNg195
2175  * @tc.desc: Test FlushWindowActivateChangedCallback.
2176  * @tc.type: FUNC
2177  */
2178 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg195, TestSize.Level1)
2179 {
2180     /**
2181      * @tc.steps1: Call function FlushWindowActivateChangedCallback;
2182      * @tc.expected: The onWindowActivateChangedCallbacks_ is empty
2183      */
2184     ASSERT_NE(context_, nullptr);
2185     bool isActivate = false;
2186     context_->onWindowActivateChangedCallbacks_.clear();
2187     context_->FlushWindowActivateChangedCallback(isActivate);
2188     EXPECT_TRUE(context_->onWindowActivateChangedCallbacks_.empty());
2189 
2190     /**
2191      * @tc.steps2: Call function FlushWindowActivateChangedCallback;
2192      * @tc.expected: The onWindowActivateChangedCallbacks_ is empty
2193      */
2194     context_->onWindowActivateChangedCallbacks_.insert(10);
2195     context_->FlushWindowActivateChangedCallback(isActivate);
2196     EXPECT_TRUE(context_->onWindowActivateChangedCallbacks_.empty());
2197 
2198     /**
2199      * @tc.steps3: Call function FlushWindowActivateChangedCallback;
2200      * @tc.expected: The onWindowActivateChangedCallbacks_ is not empty
2201      */
2202     context_->onWindowActivateChangedCallbacks_.insert(10);
2203     ElementIdType elmtId = 10;
2204     RefPtr<FrameNode> rootNode = AceType::MakeRefPtr<FrameNode>("test3", 3, AceType::MakeRefPtr<Pattern>());
2205     WeakPtr<FrameNode> referenced = AceType::WeakClaim(AceType::RawPtr(rootNode));
2206     ElementRegister::GetInstance()->AddReferenced(elmtId, referenced);
2207     context_->FlushWindowActivateChangedCallback(isActivate);
2208     EXPECT_TRUE(!context_->onWindowActivateChangedCallbacks_.empty());
2209 
2210     /**
2211      * @tc.steps4: Call function FlushWindowActivateChangedCallback;
2212      * @tc.expected: The onWindowActivateChangedCallbacks_ is not empty
2213      */
2214     isActivate = true;
2215     context_->FlushWindowActivateChangedCallback(isActivate);
2216     EXPECT_TRUE(!context_->onWindowActivateChangedCallbacks_.empty());
2217 }
2218 
2219 /**
2220  * @tc.name: PipelineContextTestNg196
2221  * @tc.desc: Test SetIsWindowSizeDragging.
2222  * @tc.type: FUNC
2223  */
2224 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg196, TestSize.Level1)
2225 {
2226     /**
2227      * @tc.steps1: Call function SetIsWindowSizeDragging;
2228      * @tc.expected: The isWindowSizeDragging_ is true
2229      */
2230     ASSERT_NE(context_, nullptr);
2231     bool isDragging = true;
2232     context_->SetIsWindowSizeDragging(isDragging);
2233     EXPECT_TRUE(context_->isWindowSizeDragging_);
2234 
2235     /**
2236      * @tc.steps2: Call function SetIsWindowSizeDragging;
2237      * @tc.expected: The isWindowSizeDragging_ is false and onWindowSizeDragEndCallbacks_ is empty
2238      */
2239     isDragging = false;
2240     std::function<void()> callback = nullptr;
2241     context_->onWindowSizeDragEndCallbacks_.clear();
2242     context_->AddWindowSizeDragEndCallback(std::move(callback));
2243     context_->SetIsWindowSizeDragging(isDragging);
2244     EXPECT_FALSE(context_->isWindowSizeDragging_);
2245 
2246     /**
2247      * @tc.steps3: Call function SetIsWindowSizeDragging;
2248      * @tc.expected: The isWindowSizeDragging_ is false and onWindowSizeDragEndCallbacks_ is not empty
2249      */
__anona68bd69b0e02() 2250     callback = []() {
2251         return;
2252     };
2253     context_->onWindowSizeDragEndCallbacks_.clear();
2254     context_->AddWindowSizeDragEndCallback(std::move(callback));
2255     isDragging = false;
2256     context_->SetIsWindowSizeDragging(isDragging);
2257     EXPECT_FALSE(context_->isWindowSizeDragging_);
2258 }
2259 
2260 /**
2261  * @tc.name: PipelineContextTestNg198
2262  * @tc.desc: Test UpdateFormLinkInfos.
2263  * @tc.type: FUNC
2264  */
2265 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg198, TestSize.Level1)
2266 {
2267     /**
2268      * @tc.steps1: Call function UpdateFormLinkInfos;
2269      * @tc.expected: The formLinkInfoUpdateHandler_ is nullptr
2270      */
2271     ASSERT_NE(context_, nullptr);
2272     context_->UpdateFormLinkInfos();
2273     EXPECT_EQ(context_->formLinkInfoUpdateHandler_, nullptr);
2274 
2275     /**
2276      * @tc.steps2: Call function UpdateFormLinkInfos;
2277      * @tc.expected: The formLinkInfoMap_ is empty
2278      */
2279     std::string info = "test";
2280     context_->formLinkInfoMap_[1] = info;
2281     context_->UpdateFormLinkInfos();
2282     EXPECT_FALSE(context_->formLinkInfoMap_.empty());
2283 
2284     /**
2285      * @tc.steps3: Call function UpdateFormLinkInfos;
2286      * @tc.expected: The formLinkInfoUpdateHandler_ is not nullptr
2287      */
2288     std::function<void(const std::vector<std::string>&)>
__anona68bd69b0f02(const std::vector<std::string> hander) 2289         formLinkInfoUpdateHandler = [](const std::vector<std::string> hander) {
2290         return;
2291     };
2292     context_->SetFormLinkInfoUpdateHandler(std::move(formLinkInfoUpdateHandler));
2293     context_->UpdateFormLinkInfos();
2294     EXPECT_NE(context_->formLinkInfoUpdateHandler_, nullptr);
2295 
2296     /**
2297      * @tc.steps4: Call function UpdateFormLinkInfos;
2298      * @tc.expected: The formLinkInfoMap_ is not empty
2299      */
2300     context_->formLinkInfoMap_.clear();
2301     context_->UpdateFormLinkInfos();
2302     EXPECT_TRUE(context_->formLinkInfoMap_.empty());
2303 }
2304 
2305 /**
2306  * @tc.name: PipelineContextTestNg199
2307  * @tc.desc: Test ContainerModalUnFocus.
2308  * @tc.type: FUNC
2309  */
2310 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg199, TestSize.Level1)
2311 {
2312     /**
2313      * @tc.steps1: Call function RequireSummary;
2314      * @tc.expected: The windowModal_ is not equal to CONTAINER_MODAL
2315      */
2316     ASSERT_NE(context_, nullptr);
2317     context_->windowModal_ = WindowModal::DIALOG_MODAL;
2318     context_->ContainerModalUnFocus();
2319     EXPECT_TRUE(context_->windowModal_ != WindowModal::CONTAINER_MODAL);
2320 }
2321 
2322 /**
2323  * @tc.name: PipelineContextTestNg300
2324  * @tc.desc: Test the function NotifyColorModeChange.
2325  * @tc.type: FUNC
2326  */
2327 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg300, TestSize.Level1)
2328 {
2329     /**
2330      * @tc.steps1: Call Function NotifyColorModeChange.
2331      * @tc.expected: rootNode_->isDarkMode_ is false.
2332      */
2333     ASSERT_NE(context_, nullptr);
2334     uint32_t colorMode = static_cast<uint32_t>(ColorMode::LIGHT);
2335     context_->rootNode_->isDarkMode_ = false;
2336     context_->NotifyColorModeChange(colorMode);
2337     EXPECT_FALSE(context_->rootNode_->isDarkMode_);
2338 
2339     context_->stageManager_->stageNode_->renderContext_ = nullptr;
2340     context_->NotifyColorModeChange(colorMode);
2341     EXPECT_FALSE(context_->stageManager_->stageNode_->HasPositionProp());
2342 
2343     context_->stageManager_->stageNode_ = nullptr;
2344     context_->NotifyColorModeChange(colorMode);
2345     EXPECT_EQ(context_->stageManager_->GetStageNode(), nullptr);
2346 
2347     context_->stageManager_ = nullptr;
2348     context_->NotifyColorModeChange(colorMode);
2349     EXPECT_EQ(context_->GetStageManager(), nullptr);
2350 
2351     context_->rootNode_ = nullptr;
2352     context_->NotifyColorModeChange(colorMode);
2353     EXPECT_EQ(context_->GetRootElement(), nullptr);
2354     context_->rootNode_ = frameNode_;
2355 }
2356 
2357 /* @tc.name: PipelineContextTestNg301
2358  * @tc.desc: Test SetBackgroundColorModeUpdated.
2359  * @tc.type: FUNC
2360  */
2361 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg301, TestSize.Level1)
2362 {
2363     /**
2364      * @tc.steps1: check context_.
2365      * @tc.expected: context_ is nullptr.
2366      */
2367     ASSERT_NE(context_, nullptr);
2368 
2369     /**
2370      * @tc.steps2: SetBackgroundColorModeUpdated true.
2371      * @tc.expected: backgroundColorModeUpdated_ is true.
2372      */
2373     context_->SetBackgroundColorModeUpdated(true);
2374     EXPECT_TRUE(context_->backgroundColorModeUpdated_);
2375 
2376     /**
2377      * @tc.steps3: SetBackgroundColorModeUpdated false.
2378      * @tc.expected: backgroundColorModeUpdated_ is false.
2379      */
2380     context_->SetBackgroundColorModeUpdated(false);
2381     EXPECT_FALSE(context_->backgroundColorModeUpdated_);
2382 }
2383 
2384 /**
2385  * @tc.name: PipelineContextTestNg303
2386  * @tc.desc: Test the function OnMouseMoveEventForAxisEvent.
2387  * @tc.type: FUNC
2388  */
2389 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg303, TestSize.Level1)
2390 {
2391     /**
2392      * @tc.steps1: initialize parameters.
2393      * @tc.expected: initialize pipeline, touch event.
2394      */
2395     ASSERT_NE(context_, nullptr);
2396     context_->SetEventManager(AceType::MakeRefPtr<EventManager>());
2397     TouchEvent touchEventOne;
2398     touchEventOne.id = 0;
2399     touchEventOne.type = TouchType::MOVE;
2400     TouchEvent touchEventTwo;
2401     touchEventTwo.id = 1;
2402     touchEventTwo.type = TouchType::MOVE;
2403 
2404     /**
2405      * @tc.steps2: Call the function CompensateTouchMoveEventBeforeDown.
2406      * @tc.expected: Test if this function is available and the events is consumed.
2407      */
2408     context_->CompensateTouchMoveEventBeforeDown();
2409     context_->touchEvents_.push_back(touchEventOne);
2410     context_->touchEvents_.push_back(touchEventTwo);
2411     context_->CompensateTouchMoveEventBeforeDown();
2412     EXPECT_TRUE(context_->touchEvents_.empty());
2413 }
2414 
2415 /**
2416  * @tc.name: PipelineContextTestNg400
2417  * @tc.desc: Test the function RegisterAttachedNode.
2418  * @tc.type: FUNC
2419  */
2420 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg400, TestSize.Level1)
2421 {
2422     ASSERT_NE(context_, nullptr);
2423     context_->SetupRootElement();
2424 
2425     RefPtr<UINode> node = AceType::MakeRefPtr<FrameNode>("test", -1, AceType::MakeRefPtr<Pattern>());
2426     context_->RegisterAttachedNode(AceType::RawPtr(node));
2427     auto& attachedNodeSet = context_->attachedNodeSet_;
2428     bool found = false;
2429     for (const auto& uiNode : attachedNodeSet) {
2430         auto illegalNode = uiNode.Upgrade();
2431         if (illegalNode && illegalNode == node) {
2432             found = true;
2433             break;
2434         }
2435     }
2436     EXPECT_TRUE(found);
2437 }
2438 
2439 /**
2440  * @tc.name: PipelineContextTestNg401
2441  * @tc.desc: Test the function RemoveAttachedNode.
2442  * @tc.type: FUNC
2443  */
2444 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg401, TestSize.Level1)
2445 {
2446     ASSERT_NE(context_, nullptr);
2447     context_->SetupRootElement();
2448 
2449     RefPtr<UINode> node = AceType::MakeRefPtr<FrameNode>("test", -1, AceType::MakeRefPtr<Pattern>());
2450     context_->RegisterAttachedNode(AceType::RawPtr(node));
2451 
2452     auto& attachedNodeSet = context_->attachedNodeSet_;
2453     auto AttachedNum = attachedNodeSet.size();
2454     context_->RemoveAttachedNode(AceType::RawPtr(node));
2455     EXPECT_EQ(AttachedNum, attachedNodeSet.size() + 1);
2456 }
2457 
2458 /**
2459  * @tc.name: PipelineContextTestNg402
2460  * @tc.desc: Test the function detaching node.
2461  * @tc.type: FUNC
2462  */
2463 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg402, TestSize.Level1)
2464 {
2465     ASSERT_NE(context_, nullptr);
2466     context_->SetupRootElement();
2467 
2468     RefPtr<UINode> node = AceType::MakeRefPtr<FrameNode>("test", -1, AceType::MakeRefPtr<Pattern>());
2469     node->AttachContext(AceType::RawPtr(context_), false);
2470     EXPECT_TRUE(context_->attachedNodeSet_.count(AceType::WeakClaim(AceType::RawPtr(node))));
2471     node->DetachContext(false);
2472     EXPECT_FALSE(context_->attachedNodeSet_.count(AceType::WeakClaim(AceType::RawPtr(node))));
2473 }
2474 
2475 /**
2476  * @tc.name: PipelineContextTestNg300
2477  * @tc.desc: Test the function NotifyColorModeChange.
2478  * @tc.type: FUNC
2479  */
2480 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg403, TestSize.Level1)
2481 {
2482     /**
2483      * @tc.steps1: Call Function NotifyColorModeChange.
2484      * @tc.expected: context_->instanceId_ == Container::CurrentIdSafely().
2485      */
2486     ASSERT_NE(context_, nullptr);
2487     uint32_t colorMode = static_cast<uint32_t>(ColorMode::LIGHT);
2488     context_->rootNode_->isDarkMode_ = false;
2489     context_->NotifyColorModeChange(colorMode);
2490     EXPECT_EQ(context_->instanceId_, Container::CurrentIdSafely());
2491 }
2492 
2493 /**
2494  * @tc.name: PipelineContextTestNg404
2495  * @tc.desc: Test the function NotifyColorModeChange.
2496  * @tc.type: FUNC
2497  */
2498 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg404, TestSize.Level1)
2499 {
2500     ASSERT_NE(context_, nullptr);
2501     context_->SetupRootElement();
2502     auto node = FrameNode::GetOrCreateFrameNode(TEST_TAG, frameNodeId_, nullptr);
2503     ASSERT_NE(node, nullptr);
2504     MouseEvent mouseEvent;
2505     mouseEvent.action = MouseAction::HOVER;
2506     context_->DispatchMouseToTouchEvent(mouseEvent, node);
2507     EXPECT_TRUE(context_->eventManager_->touchTestResults_.empty());
2508 }
2509 
2510 /**
2511  * @tc.name: PipelineContextTestNg405
2512  * @tc.desc: Test the function isNeedCallbackAreaChange.
2513  * @tc.type: FUNC
2514  */
2515 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg405, TestSize.Level1)
2516 {
2517     /**
2518      * @tc.steps1: Call function OnShow;
2519      * @tc.expected: isNeedCallbackAreaChange_ is true
2520      */
2521     ASSERT_NE(context_, nullptr);
2522     context_->OnShow();
2523     EXPECT_TRUE(context_->isNeedCallbackAreaChange_);
2524     /**
2525      * @tc.steps2: Call function OnHide;
2526      * @tc.expected: isNeedCallbackAreaChange_ is false
2527      */
2528     context_->OnHide();
2529     EXPECT_TRUE(context_->isNeedCallbackAreaChange_);
2530 }
2531 
2532 /**
2533  * @tc.name: PipelineContextTestNg406
2534  * @tc.desc: Test ContainerModalUnFocus.
2535  * @tc.type: FUNC
2536  */
2537 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg406, TestSize.Level1)
2538 {
2539     /**
2540      * @tc.steps1: Call function RequireSummary;
2541      * @tc.expected: The windowModal_ is not equal to CONTAINER_MODAL
2542      */
2543     ASSERT_NE(context_, nullptr);
2544     context_->windowModal_ = WindowModal::DIALOG_MODAL;
2545     context_->ContainerModalUnFocus();
2546     EXPECT_TRUE(context_->windowModal_ != WindowModal::CONTAINER_MODAL);
2547 }
2548 
2549 /**
2550  * @tc.name: PipelineContextTestNg407
2551  * @tc.desc: Test OnDumpInfo.
2552  * @tc.type: FUNC
2553  */
2554 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg407, TestSize.Level1)
2555 {
2556     /**
2557      * @tc.steps1: Call the function OnDumpInfo.
2558      * @tc.expected: Test that the member window_ is empty.
2559      */
2560     ASSERT_NE(context_, nullptr);
2561     std::vector<std::string> params;
2562     params.push_back("-simplify");
2563     params.push_back("-compname");
2564     params.push_back("test");
2565     auto ret = context_->OnDumpInfo(params);
2566     EXPECT_TRUE(ret);
2567 }
2568 
2569 /**
2570  * @tc.name: FlushMouseEventForHover001
2571  * @tc.desc: Test FlushMouseEventForHover.
2572  * @tc.type: FUNC
2573  */
2574 HWTEST_F(PipelineContextTestNg, FlushMouseEventForHover001, TestSize.Level1)
2575 {
2576     /**
2577      * @tc.steps1: Construction input parameter, call FlushMouseEventForHover.
2578      * @tc.expected: The value of button is correct.
2579      */
2580     ASSERT_NE(context_, nullptr);
2581     context_->isTransFlag_ = true;
2582     MouseEvent mouseEvent;
2583     mouseEvent.sourceType = SourceType::MOUSE;
2584     mouseEvent.action = MouseAction::MOVE;
2585     context_->lastMouseEvent_ = std::make_unique<MouseEvent>(mouseEvent);
2586     context_->lastSourceType_ = SourceType::MOUSE;
2587     context_->lastMouseEvent_->button = MouseButton::NONE_BUTTON;
2588     context_->FlushMouseEventForHover();
2589     EXPECT_EQ(context_->lastMouseEvent_->button, MouseButton::NONE_BUTTON);
2590     context_->lastMouseEvent_->button = MouseButton::LEFT_BUTTON;
2591     context_->FlushMouseEventForHover();
2592     EXPECT_EQ(context_->lastMouseEvent_->button, MouseButton::LEFT_BUTTON);
2593 }
2594 
2595 /**
2596  * @tc.name: ConsumeTouchEventsInterpolationTest001
2597  * @tc.desc: Test ConsumeTouchEventsInterpolation.
2598  * @tc.type: FUNC
2599  */
2600 HWTEST_F(PipelineContextTestNg, ConsumeTouchEventsInterpolationTest001, TestSize.Level1)
2601 {
2602     /**
2603      * @tc.steps1: Create consumeTouchEventsInterpolation testcase.
2604      */
2605     std::unordered_set<int32_t> ids = { 1, 2, 3 };
2606     std::map<int32_t, int32_t> timestampToIds = { { 1, 0 }, { 2, 1 }, { 3, 2 }, { 4, 3 } };
2607     std::unordered_map<int32_t, TouchEvent> newIdTouchPoints;
2608     TouchEvent touchEventBefore = TouchEvent();
2609     touchEventBefore.time = TimeStamp(std::chrono::nanoseconds(BEFORE_VSYNC_TIME));
2610     TouchEvent touchEventAfter = TouchEvent();
2611     touchEventAfter.time = TimeStamp(std::chrono::nanoseconds(AFTER_VSYNC_TIME));
2612     std::unordered_map<int, TouchEvent> idToTouchPoints = { { 2, touchEventBefore }, { 3, touchEventAfter } };
2613     ASSERT_NE(context_, nullptr);
2614     context_->resampleTimeStamp_ = DEFAULT_VSYNC_TIME;
2615     context_->historyPointsById_.clear();
2616     context_->ConsumeTouchEventsInterpolation(ids, timestampToIds, newIdTouchPoints, idToTouchPoints);
2617     EXPECT_EQ(context_->historyPointsById_.size(), 1);
2618 }
2619 
2620 /**
2621  * @tc.name: PipelineContextTestNg500
2622  * @tc.desc: Test OnDumpInfo.
2623  * @tc.type: FUNC
2624  */
2625 HWTEST_F(PipelineContextTestNg, PipelineContextTestNg500, TestSize.Level1)
2626 {
2627     ASSERT_NE(context_, nullptr);
2628     std::vector<std::string> params;
2629     params.push_back("-simplify");
2630     params.push_back("-compname");
2631     params.push_back("test");
2632     auto ret = context_->OnDumpInfo(params);
2633     EXPECT_TRUE(ret);
2634 }
2635 } // namespace NG
2636 } // namespace OHOS::Ace
2637