• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include "test/unittest/core/base/frame_node_test_ng.h"
16 
17 #include "core/event/touch_event.h"
18 
19 using namespace testing;
20 using namespace testing::ext;
21 
22 namespace OHOS::Ace::NG {
23 namespace {} // namespace
24 
25 /**
26  * @tc.name: FrameNodeOnGenerateOneDepthVisibleFrameWithOffset01
27  * @tc.desc: Test the function OnGenerateOneDepthVisibleFrameWithOffset
28  * @tc.type: FUNC
29  */
30 HWTEST_F(FrameNodeTestNg, FrameNodeOnGenerateOneDepthVisibleFrameWithOffset01, TestSize.Level1)
31 {
32     /**
33      * @tc.steps: step1. create frameNode.
34      */
35     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
36     auto childNode = FrameNode::CreateFrameNode("childNode", 1, AceType::MakeRefPtr<Pattern>(), true);
37     frameNode->isLayoutNode_ = true;
38     frameNode->isActive_ = true;
39     frameNode->overlayNode_ = nullptr;
40     EXPECT_EQ(frameNode->overlayNode_, nullptr);
41     /**
42      * @tc.steps: step2. call the function OnGenerateOneDepthVisibleFrameWithOffset.
43      */
44     OffsetF Offset = { 0.0, 0.0 };
45     std::list<RefPtr<FrameNode>> children;
46     children.push_back(childNode);
47     frameNode->OnGenerateOneDepthVisibleFrameWithOffset(children, Offset);
48     frameNode->overlayNode_ = AceType::MakeRefPtr<FrameNode>("test", 1, AceType::MakeRefPtr<Pattern>());
49     frameNode->OnGenerateOneDepthVisibleFrameWithOffset(children, Offset);
50     EXPECT_NE(frameNode->overlayNode_, nullptr);
51     EXPECT_EQ(frameNode->overlayNode_->GetNodeName(), "");
52 }
53 
54 /**
55  * @tc.name: FrameNodeOnGenerateOneDepthVisibleFrameWithOffset02
56  * @tc.desc: Test the function OnGenerateOneDepthVisibleFrameWithOffset
57  * @tc.type: FUNC
58  */
59 HWTEST_F(FrameNodeTestNg, FrameNodeOnGenerateOneDepthVisibleFrameWithOffset02, TestSize.Level1)
60 {
61     /**
62      * @tc.steps: step1. create frameNode.
63      */
64     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
65     auto childNode = FrameNode::CreateFrameNode("childNode", 1, AceType::MakeRefPtr<Pattern>(), true);
66     frameNode->isLayoutNode_ = false;
67     frameNode->isActive_ = true;
68     frameNode->overlayNode_ = AceType::MakeRefPtr<FrameNode>("test", 1, AceType::MakeRefPtr<Pattern>());
69     EXPECT_NE(frameNode->overlayNode_, nullptr);
70     EXPECT_EQ(frameNode->overlayNode_->GetNodeName(), "");
71     /**
72      * @tc.steps: step2. call the function OnGenerateOneDepthVisibleFrameWithOffset.
73      */
74     auto layoutProperty = AceType::MakeRefPtr<LayoutProperty>();
75     layoutProperty->propVisibility_ = VisibleType::INVISIBLE;
76     OffsetF Offset = { 0.0, 0.0 };
77     std::list<RefPtr<FrameNode>> children;
78     children.push_back(childNode);
79     frameNode->SetLayoutProperty(layoutProperty);
80     frameNode->OnGenerateOneDepthVisibleFrameWithOffset(children, Offset);
81     EXPECT_EQ(frameNode->GetLayoutProperty(), layoutProperty);
82 }
83 
84 /**
85  * @tc.name: FrameNodeOnGenerateOneDepthVisibleFrameWithOffset03
86  * @tc.desc: Test the function OnGenerateOneDepthVisibleFrameWithOffset
87  * @tc.type: FUNC
88  */
89 HWTEST_F(FrameNodeTestNg, FrameNodeOnGenerateOneDepthVisibleFrameWithOffset03, TestSize.Level1)
90 {
91     /**
92      * @tc.steps: step1. create frameNode.
93      */
94     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
95     auto childNode = FrameNode::CreateFrameNode("childNode", 1, AceType::MakeRefPtr<Pattern>(), true);
96     frameNode->isLayoutNode_ = false;
97     frameNode->isActive_ = true;
98     frameNode->overlayNode_ = AceType::MakeRefPtr<FrameNode>("test", 1, AceType::MakeRefPtr<Pattern>());
99     EXPECT_NE(frameNode->overlayNode_, nullptr);
100     EXPECT_EQ(frameNode->overlayNode_->GetNodeName(), "");
101     /**
102      * @tc.steps: step2. call the function OnGenerateOneDepthVisibleFrameWithOffset.
103      */
104     auto layoutProperty = AceType::MakeRefPtr<LayoutProperty>();
105     layoutProperty->propVisibility_ = VisibleType::VISIBLE;
106     OffsetF Offset = { 0.0, 0.0 };
107     std::list<RefPtr<FrameNode>> children;
108     children.push_back(childNode);
109     frameNode->SetLayoutProperty(layoutProperty);
110     frameNode->OnGenerateOneDepthVisibleFrameWithOffset(children, Offset);
111     EXPECT_EQ(frameNode->layoutProperty_->propVisibility_, layoutProperty->propVisibility_);
112 }
113 
114 /**
115  * @tc.name: FrameNodeOnGenerateOneDepthVisibleFrameWithOffset04
116  * @tc.desc: Test the function OnGenerateOneDepthVisibleFrameWithOffset
117  * @tc.type: FUNC
118  */
119 HWTEST_F(FrameNodeTestNg, FrameNodeOnGenerateOneDepthVisibleFrameWithOffset04, TestSize.Level1)
120 {
121     /**
122      * @tc.steps: step1. create frameNode.
123      */
124     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
125     auto childNode = FrameNode::CreateFrameNode("childNode", 1, AceType::MakeRefPtr<Pattern>(), true);
126     frameNode->isLayoutNode_ = false;
127     frameNode->isActive_ = false;
128     frameNode->overlayNode_ = AceType::MakeRefPtr<FrameNode>("test", 1, AceType::MakeRefPtr<Pattern>());
129     EXPECT_NE(frameNode->overlayNode_, nullptr);
130     EXPECT_EQ(frameNode->overlayNode_->GetNodeName(), "");
131     /**
132      * @tc.steps: step2. call the function OnGenerateOneDepthVisibleFrameWithOffset.
133      */
134     auto layoutProperty = AceType::MakeRefPtr<LayoutProperty>();
135     layoutProperty->propVisibility_ = VisibleType::VISIBLE;
136     OffsetF Offset = { 0.0, 0.0 };
137     std::list<RefPtr<FrameNode>> children;
138     children.push_back(childNode);
139     frameNode->SetLayoutProperty(layoutProperty);
140     frameNode->OnGenerateOneDepthVisibleFrameWithOffset(children, Offset);
141     EXPECT_EQ(frameNode->GetLayoutProperty(), layoutProperty);
142 }
143 
144 /**
145  * @tc.name: FrameNodeIsOutOfTouchTestRegion01
146  * @tc.desc: Test the function IsOutOfTouchTestRegion
147  * @tc.type: FUNC
148  */
149 HWTEST_F(FrameNodeTestNg, FrameNodeIsOutOfTouchTestRegion01, TestSize.Level1)
150 {
151     /**
152      * @tc.steps: step1. create frameNode.
153      */
154     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
155     auto testNode = FrameNode::CreateFrameNode("testNode", 1, AceType::MakeRefPtr<Pattern>(), true);
156 
157     /**
158      * @tc.steps: step2. call the function IsOutOfTouchTestRegion.
159      */
160     NG::PointF point { 1.0, 1.0 };
161     frameNode->renderContext_->UpdateClipEdge(true);
162     TouchEvent touchEvent;
163     touchEvent.sourceType = static_cast<SourceType>(1);
164     EXPECT_TRUE(frameNode->IsOutOfTouchTestRegion(point, touchEvent));
165     testNode->renderContext_->UpdateClipEdge(false);
166     EXPECT_TRUE(testNode->IsOutOfTouchTestRegion(point, touchEvent));
167 }
168 
169 /**
170  * @tc.name: FrameNodeAddJudgeToTargetComponent01
171  * @tc.desc: Test the function AddJudgeToTargetComponent
172  * @tc.type: FUNC
173  */
174 HWTEST_F(FrameNodeTestNg, FrameNodeAddJudgeToTargetComponent01, TestSize.Level1)
175 {
176     /**
177      * @tc.steps: step1. create frameNode.
178      */
179     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
180 
181     /**
182      * @tc.steps: step2. call the function AddJudgeToTargetComponent.
183      */
184     auto gestureHub = frameNode->GetOrCreateGestureEventHub();
185     auto gestureJudgeFunc = [](const RefPtr<GestureInfo>& gestureInfo,
__anon4342872f0202(const RefPtr<GestureInfo>& gestureInfo, const std::shared_ptr<BaseGestureEvent>&) 186                                 const std::shared_ptr<BaseGestureEvent>&) -> GestureJudgeResult {
187         return GestureJudgeResult(1);
188     };
189     gestureHub->SetOnGestureJudgeNativeBegin(gestureJudgeFunc);
190     RefPtr<TargetComponent> targetComponent = AceType::MakeRefPtr<TargetComponent>();
191     frameNode->AddJudgeToTargetComponent(targetComponent);
192     EXPECT_NE(frameNode, nullptr);
193 }
194 
195 /**
196  * @tc.name: FrameNodeAddJudgeToTargetComponent02
197  * @tc.desc: Test the function AddJudgeToTargetComponent
198  * @tc.type: FUNC
199  */
200 HWTEST_F(FrameNodeTestNg, FrameNodeAddJudgeToTargetComponent02, TestSize.Level1)
201 {
202     /**
203      * @tc.steps: step1. create frameNode.
204      */
205     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
206 
207     /**
208      * @tc.steps: step2. call the function AddJudgeToTargetComponent.
209      */
210     frameNode->GetEventHub<EventHub>()->gestureEventHub_ = nullptr;
211     RefPtr<TargetComponent> targetComponent = AceType::MakeRefPtr<TargetComponent>();
212     frameNode->AddJudgeToTargetComponent(targetComponent);
213     EXPECT_NE(frameNode, nullptr);
214     EXPECT_EQ(frameNode->GetEventHub<EventHub>()->gestureEventHub_, nullptr);
215 }
216 
217 /**
218  * @tc.name: TriggerShouldParallelInnerWithTest01
219  * @tc.desc: Test the function TriggerShouldParallelInnerWith
220  * @tc.type: FUNC
221  */
222 HWTEST_F(FrameNodeTestNg, TriggerShouldParallelInnerWithTest01, TestSize.Level1)
223 {
224     /**
225      * @tc.steps: step1. create frameNode.
226      */
227     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
228     auto gestureHub = frameNode->GetEventHub<EventHub>()->GetOrCreateGestureEventHub();
229     ShouldBuiltInRecognizerParallelWithFunc shouldBuiltInRecognizerParallelWithFunc =
__anon4342872f0302(RefPtr<NGGestureRecognizer> target, std::vector<RefPtr<NGGestureRecognizer>> targets) 230         [](RefPtr<NGGestureRecognizer> target, std::vector<RefPtr<NGGestureRecognizer>> targets) {
231             return RefPtr<NGGestureRecognizer>();
232         };
233     gestureHub->SetShouldBuildinRecognizerParallelWithFunc(std::move(shouldBuiltInRecognizerParallelWithFunc));
234     ResponseLinkResult currentRecognizers;
235     ResponseLinkResult responseLinkRecognizers;
236     auto recognizer = AceType::MakeRefPtr<ClickRecognizer>();
237     recognizer->SetRecognizerType(GestureTypeName::PAN_GESTURE);
238     recognizer->GetGestureInfo()->SetIsSystemGesture(true);
239     currentRecognizers.emplace_back(recognizer);
240     responseLinkRecognizers.emplace_back(recognizer);
241     currentRecognizers.emplace_back(AceType::MakeRefPtr<ClickRecognizer>());
242 
243     auto recognizer1 = AceType::MakeRefPtr<ClickRecognizer>();
244     recognizer1->SetRecognizerType(GestureTypeName::UNKNOWN);
245     recognizer1->GetGestureInfo()->SetIsSystemGesture(true);
246     currentRecognizers.emplace_back(recognizer1);
247 
248     auto recognizer2 = AceType::MakeRefPtr<ClickRecognizer>();
249     recognizer2->SetRecognizerType(GestureTypeName::PAN_GESTURE);
250     recognizer2->GetGestureInfo()->SetIsSystemGesture(true);
251     TouchEvent touchEvent;
252     TouchEvent touchEvent1;
253     recognizer2->touchPoints_[touchEvent.id] = touchEvent;
254     recognizer2->touchPoints_[touchEvent1.id] = touchEvent1;
255     currentRecognizers.emplace_back(recognizer2);
256     /**
257      * @tc.steps: step2. call the function TriggerShouldParallelInnerWith.
258      */
259     frameNode->TriggerShouldParallelInnerWith(currentRecognizers, responseLinkRecognizers);
260     EXPECT_FALSE(recognizer->IsBridgeMode());
261 }
262 
263 /**
264  * @tc.name: OnSyncGeometryFrameFinishTest
265  * @tc.desc: Test the function OnSyncGeometryFrameFinish
266  * @tc.type: FUNC
267  */
268 HWTEST_F(FrameNodeTestNg, OnSyncGeometryFrameFinishTest, TestSize.Level1)
269 {
270     /**
271      * @tc.steps: step1. create frameNode.
272      */
273     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
274     RectF paintRect = { 10.0f, 10.0f, 10.0f, 10.0f };
275     /**
276      * @tc.steps: step2. call the function TriggerShouldParallelInnerWith.
277      */
278     frameNode->OnSyncGeometryFrameFinish(paintRect);
279     EXPECT_TRUE(frameNode->syncedFramePaintRect_.has_value());
280     frameNode->OnSyncGeometryFrameFinish(paintRect);
281     RectF paintRect1 = { 20.0f, 20.0f, 20.0f, 20.0f };
282     frameNode->OnSyncGeometryFrameFinish(paintRect1);
283     EXPECT_EQ(frameNode->syncedFramePaintRect_, paintRect1);
284 }
285 
286 /**
287  * @tc.name: IsContextTransparentTest001
288  * @tc.desc: Test the function IsContextTransparent
289  * @tc.type: FUNC
290  */
291 HWTEST_F(FrameNodeTestNg, IsContextTransparentTest001, TestSize.Level1)
292 {
293     /**
294      * @tc.steps: step1. create frameNode.
295      */
296     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
297 
298     /**
299      * @tc.steps: step2. call the function IsContextTransparent.
300      */
301     EXPECT_TRUE(frameNode->IsContextTransparent());
302     frameNode->GetRenderContext()->UpdateOpacity(0.0);
303     EXPECT_TRUE(frameNode->IsContextTransparent());
304     frameNode->GetRenderContext()->UpdateOpacity(10.0);
305     EXPECT_TRUE(frameNode->IsContextTransparent());
306     auto mockRenderContext = AceType::DynamicCast<MockRenderContext>(frameNode->GetRenderContext());
307     mockRenderContext->SetPaintRectWithTransform(RectF(10.0f, 10.0f, 10.0f, 0.0f));
308     EXPECT_TRUE(frameNode->IsContextTransparent());
309     mockRenderContext->SetPaintRectWithTransform(RectF(10.0f, 10.0f, 10.0f, 10.0f));
310     EXPECT_FALSE(frameNode->IsContextTransparent());
311     frameNode->layoutProperty_->propVisibility_ = VisibleType::INVISIBLE;
312     EXPECT_TRUE(frameNode->IsContextTransparent());
313 }
314 
315 /**
316  * @tc.name: IsContextTransparentTest002
317  * @tc.desc: Test the function IsContextTransparent
318  * @tc.type: FUNC
319  */
320 HWTEST_F(FrameNodeTestNg, IsContextTransparentTest002, TestSize.Level1)
321 {
322     /**
323      * @tc.steps: step1. create frameNode.
324      */
325     auto frameNode = FrameNode::CreateFrameNode("Flex", 1, AceType::MakeRefPtr<Pattern>(), true);
326     auto frameNode1 = FrameNode::CreateFrameNode("framenode", 2, AceType::MakeRefPtr<Pattern>(), true);
327     frameNode->AddChild(frameNode1);
328     /**
329      * @tc.steps: step2. call the function IsContextTransparent.
330      */
331     EXPECT_TRUE(frameNode->IsContextTransparent());
332     auto mockRenderContext = AceType::DynamicCast<MockRenderContext>(frameNode->GetRenderContext());
333     mockRenderContext->SetPaintRectWithTransform(RectF(10.0f, 10.0f, 10.0f, 0.0f));
334     auto mockRenderContext1 = AceType::DynamicCast<MockRenderContext>(frameNode1->GetRenderContext());
335     mockRenderContext1->SetPaintRectWithTransform(RectF(10.0f, 10.0f, 10.0f, 10.0f));
336     EXPECT_FALSE(frameNode->IsContextTransparent());
337     mockRenderContext->SetPaintRectWithTransform(RectF(10.0f, 10.0f, 10.0f, 10.0f));
338     EXPECT_FALSE(frameNode->IsContextTransparent());
339     frameNode->layoutProperty_->propVisibility_ = VisibleType::INVISIBLE;
340     EXPECT_FALSE(frameNode->IsContextTransparent());
341     frameNode->layoutProperty_->propVisibility_ = VisibleType::VISIBLE;
342     frameNode->GetRenderContext()->UpdateBackgroundColor(Color::BLUE);
343     EXPECT_FALSE(frameNode->IsContextTransparent());
344 }
345 
346 /**
347  * @tc.name: AddTouchEventAllFingersInfoTest
348  * @tc.desc: Test the function AddTouchEventAllFingersInfo
349  * @tc.type: FUNC
350  */
351 HWTEST_F(FrameNodeTestNg, AddTouchEventAllFingersInfoTest, TestSize.Level1)
352 {
353     /**
354      * @tc.steps: step1. create frameNode.
355      */
356     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
357     /**
358      * @tc.steps: step2. call the function AddTouchEventAllFingersInfoTest.
359      */
360     TouchEventInfo touchEventInfo("touch");
361     TouchEvent touchEvent;
362     TouchPoint touchPoint;
363     touchEvent.pointers.emplace_back(touchPoint);
364     TouchPoint touchPoint1;
365     touchPoint1.tiltX = 10.0;
366     touchPoint1.tiltY = 10.0;
367     touchEvent.pointers.emplace_back(touchPoint1);
368     frameNode->AddTouchEventAllFingersInfo(touchEventInfo, touchEvent);
369     EXPECT_EQ(touchEventInfo.touches_.size(), 2);
370 }
371 
372 /**
373  * @tc.name: TriggerOnTouchInterceptTest
374  * @tc.desc: Test the function TriggerOnTouchIntercept
375  * @tc.type: FUNC
376  */
377 HWTEST_F(FrameNodeTestNg, TriggerOnTouchInterceptTest, TestSize.Level1)
378 {
379     /**
380      * @tc.steps: step1. create frameNode.
381      */
382     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
383     /**
384      * @tc.steps: step2. call the function AddTouchEventAllFingersInfoTest.
385      */
386     auto gestureHub = frameNode->GetEventHub<EventHub>()->GetOrCreateGestureEventHub();
__anon4342872f0402(TouchEventInfo& touchEventInfo) 387     TouchInterceptFunc touchInterceptFunc = [](TouchEventInfo& touchEventInfo) { return HitTestMode::HTMBLOCK; };
388     gestureHub->SetOnTouchIntercept(std::move(touchInterceptFunc));
389     TouchEventInfo touchEventInfo("touch");
390     TouchEvent touchEvent;
391     EXPECT_EQ(frameNode->TriggerOnTouchIntercept(touchEvent), HitTestMode::HTMBLOCK);
392     touchEvent.tiltX = 10.0;
393     touchEvent.tiltY = 10.0;
394     EXPECT_EQ(frameNode->TriggerOnTouchIntercept(touchEvent), HitTestMode::HTMBLOCK);
395 }
396 
397 /**
398  * @tc.name: CalculateCachedTransformRelativeOffsetTest
399  * @tc.desc: Test the function CalculateCachedTransformRelativeOffset
400  * @tc.type: FUNC
401  */
402 HWTEST_F(FrameNodeTestNg, CalculateCachedTransformRelativeOffsetTest, TestSize.Level1)
403 {
404     /**
405      * @tc.steps: step1. create frameNode.
406      */
407     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
408     /**
409      * @tc.steps: step2. call the function CalculateCachedTransformRelativeOffset.
410      */
411     frameNode->CalculateCachedTransformRelativeOffset(0);
412     auto child = FrameNode::CreateFrameNode("child", 2, AceType::MakeRefPtr<Pattern>(), true);
413     frameNode->AddChild(child);
414     child->CalculateCachedTransformRelativeOffset(0);
415     frameNode->exposureProcessor_ = AceType::MakeRefPtr<Recorder::ExposureProcessor>("test", "0");
416     frameNode->RecordExposureInner();
417     EXPECT_EQ(child->CalculateCachedTransformRelativeOffset(0), OffsetF(0, 0));
418     EXPECT_EQ(child->CalculateCachedTransformRelativeOffset(10), OffsetF(0, 0));
419 }
420 
421 /**
422  * @tc.name: ProcessVisibleAreaChangeEventTest
423  * @tc.desc: Test the function ProcessVisibleAreaChangeEvent
424  * @tc.type: FUNC
425  */
426 HWTEST_F(FrameNodeTestNg, ProcessVisibleAreaChangeEventTest, TestSize.Level1)
427 {
428     /**
429      * @tc.steps: step1. create frameNode.
430      */
431     auto frameNode = FrameNode::CreateFrameNode("framenode", 1, AceType::MakeRefPtr<Pattern>(), true);
432     RectF visibleRect = { 10.0, 10.0, 10.0, 10.0 };
433     RectF frameRect = { 10.0, 10.0, 10.0, 10.0 };
434     std::vector<double> visibleAreaRatios = { 0.0, 0.0 };
435     VisibleCallbackInfo visibleAreaCallback;
436 
437     /**
438      * @tc.steps: step2. call the function ProcessVisibleAreaChangeEvent.
439      */
440     // !NearEqual
441     frameNode->ProcessVisibleAreaChangeEvent(visibleRect, frameRect, visibleAreaRatios, visibleAreaCallback, true);
442     // NearEqual
443     frameNode->ProcessVisibleAreaChangeEvent(visibleRect, frameRect, visibleAreaRatios, visibleAreaCallback, true);
444     EXPECT_EQ(frameNode->lastVisibleRatio_, 1.0);
445     // !NearEqual
446     frameNode->ProcessVisibleAreaChangeEvent(visibleRect, frameRect, visibleAreaRatios, visibleAreaCallback, false);
447     // NearEqual
448     frameNode->ProcessVisibleAreaChangeEvent(visibleRect, frameRect, visibleAreaRatios, visibleAreaCallback, false);
449     EXPECT_EQ(frameNode->lastInnerVisibleRatio_, 1.0);
450 }
451 } // namespace OHOS::Ace::NG