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, Hardware
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include "common/rs_obj_abs_geometry.h"
19 #include "drawable/rs_property_drawable_foreground.h"
20 #include "drawable/rs_property_drawable_background.h"
21 #include "offscreen_render/rs_offscreen_render_thread.h"
22 #include "params/rs_render_params.h"
23 #include "pipeline/rs_context.h"
24 #include "pipeline/rs_canvas_render_node.h"
25 #include "pipeline/rs_dirty_region_manager.h"
26 #include "pipeline/rs_display_render_node.h"
27 #include "pipeline/rs_render_node.h"
28 #include "pipeline/rs_render_thread_visitor.h"
29 #include "pipeline/rs_root_render_node.h"
30 #include "pipeline/rs_surface_render_node.h"
31 #include "skia_adapter/skia_canvas.h"
32 
33 using namespace testing;
34 using namespace testing::ext;
35 
36 namespace OHOS {
37 namespace Rosen {
38 
39 class RSRenderNodeTest2 : public testing::Test {
40 public:
41     constexpr static float floatData[] = {
42         0.0f,
43         485.44f,
44         -34.4f,
45         std::numeric_limits<float>::max(),
46         std::numeric_limits<float>::min(),
47     };
48     static void SetUpTestCase();
49     static void TearDownTestCase();
50     void SetUp() override;
51     void TearDown() override;
52     static inline NodeId id;
53     static inline std::weak_ptr<RSContext> context = {};
54     static inline RSPaintFilterCanvas* canvas_;
55     static inline Drawing::Canvas drawingCanvas_;
56 };
57 
SetUpTestCase()58 void RSRenderNodeTest2::SetUpTestCase()
59 {
60     canvas_ = new RSPaintFilterCanvas(&drawingCanvas_);
61 }
TearDownTestCase()62 void RSRenderNodeTest2::TearDownTestCase()
63 {
64     delete canvas_;
65     canvas_ = nullptr;
66 }
SetUp()67 void RSRenderNodeTest2::SetUp() {}
TearDown()68 void RSRenderNodeTest2::TearDown() {}
69 /**
70  * @tc.name: Process
71  * @tc.desc: test
72  * @tc.type: FUNC
73  * @tc.require: issueI9V3BK
74  */
75 HWTEST_F(RSRenderNodeTest2, Process, TestSize.Level1)
76 {
77     RSRenderNode node(id, context);
78     std::shared_ptr<RSNodeVisitor> visitor = nullptr;
79     node.Process(visitor);
80     visitor = std::make_shared<RSRenderThreadVisitor>();
81     node.Process(visitor);
82     ASSERT_TRUE(true);
83 }
84 
85 /**
86  * @tc.name: SendCommandFromRT
87  * @tc.desc: test
88  * @tc.type: FUNC
89  * @tc.require: issueI9V3BK
90  */
91 HWTEST_F(RSRenderNodeTest2, SendCommandFromRT, TestSize.Level1)
92 {
93     RSRenderNode node(id, context);
94     std::unique_ptr<RSCommand> command;
95     NodeId nodeId = 0;
96     node.SendCommandFromRT(command, nodeId);
97     ASSERT_TRUE(true);
98 }
99 
100 /**
101  * @tc.name: InternalRemoveSelfFromDisappearingChildren
102  * @tc.desc: test
103  * @tc.type: FUNC
104  * @tc.require: issueI9V3BK
105  */
106 HWTEST_F(RSRenderNodeTest2, InternalRemoveSelfFromDisappearingChildren, TestSize.Level1)
107 {
108     RSRenderNode node(id, context);
109     node.InternalRemoveSelfFromDisappearingChildren();
110     ASSERT_TRUE(true);
111 }
112 
113 /**
114  * @tc.name: DestroyRSRenderNode
115  * @tc.desc: test
116  * @tc.type: FUNC
117  * @tc.require: issueI9V3BK
118  */
119 HWTEST_F(RSRenderNodeTest2, DestroyRSRenderNode, TestSize.Level1)
120 {
121     RSRenderNode node(id, context);
122     node.appPid_ = 1;
123     ASSERT_TRUE(true);
124 }
125 
126 /**
127  * @tc.name: FallbackAnimationsToRoot
128  * @tc.desc: test
129  * @tc.type: FUNC
130  * @tc.require: issueI9V3BK
131  */
132 HWTEST_F(RSRenderNodeTest2, FallbackAnimationsToRoot, TestSize.Level1)
133 {
134     RSRenderNode node(id, context);
135     node.FallbackAnimationsToRoot();
136     node.FallbackAnimationsToRoot();
137     node.animationManager_.animations_.clear();
138     node.FallbackAnimationsToRoot();
139     ASSERT_TRUE(true);
140 }
141 
142 /**
143  * @tc.name: ActivateDisplaySync
144  * @tc.desc: test
145  * @tc.type: FUNC
146  * @tc.require: issueI9V3BK
147  */
148 HWTEST_F(RSRenderNodeTest2, ActivateDisplaySync, TestSize.Level1)
149 {
150     RSRenderNode node(id, context);
151     node.ActivateDisplaySync();
152     node.displaySync_ = std::make_shared<RSRenderDisplaySync>(id);
153     node.ActivateDisplaySync();
154     ASSERT_TRUE(true);
155 }
156 
157 /**
158  * @tc.name: UpdateDisplaySyncRange
159  * @tc.desc: test
160  * @tc.type: FUNC
161  * @tc.require: issueI9V3BK
162  */
163 HWTEST_F(RSRenderNodeTest2, UpdateDisplaySyncRange, TestSize.Level1)
164 {
165     RSRenderNode node(id, context);
166     node.UpdateDisplaySyncRange();
167     node.displaySync_ = std::make_shared<RSRenderDisplaySync>(1);
168     node.UpdateDisplaySyncRange();
169     ASSERT_TRUE(true);
170 }
171 
172 /**
173  * @tc.name: Animate
174  * @tc.desc: test
175  * @tc.type: FUNC
176  * @tc.require: issueI9V3BK
177  */
178 HWTEST_F(RSRenderNodeTest2, Animate, TestSize.Level1)
179 {
180     RSRenderNode node(id, context);
181     int64_t timestamp = 4;
182     int64_t period = 2;
183     bool isDisplaySyncEnabled = true;
184     node.Animate(timestamp, period, isDisplaySyncEnabled);
185     node.displaySync_ = std::make_shared<RSRenderDisplaySync>(1);
186     node.Animate(timestamp, period, isDisplaySyncEnabled);
187     auto context_shared = std::make_shared<RSContext>();
188     std::weak_ptr<RSContext> context2 = context_shared;
189     RSRenderNode node2(id, context2);
190     node2.Animate(timestamp, period, isDisplaySyncEnabled);
191     RSSurfaceRenderNode node3(id, context2);
192     node3.Animate(timestamp, period, isDisplaySyncEnabled);
193     ASSERT_TRUE(true);
194 }
195 
196 /**
197  * @tc.name: IsClipBound
198  * @tc.desc: test
199  * @tc.type: FUNC
200  * @tc.require: issueI9V3BK
201  */
202 HWTEST_F(RSRenderNodeTest2, IsClipBound, TestSize.Level1)
203 {
204     RSRenderNode node(id, context);
205     node.IsClipBound();
206     ASSERT_TRUE(true);
207 }
208 
209 /**
210  * @tc.name: GetRenderContent
211  * @tc.desc: test
212  * @tc.type: FUNC
213  * @tc.require: issueI9V3BK
214  */
215 HWTEST_F(RSRenderNodeTest2, GetRenderContent, TestSize.Level1)
216 {
217     RSRenderNode node(id, context);
218     ASSERT_NE(node.GetRenderContent(), nullptr);
219 }
220 
221 /**
222  * @tc.name: GetStagingRenderParams
223  * @tc.desc: test
224  * @tc.type: FUNC
225  * @tc.require: issueI9V3BK
226  */
227 HWTEST_F(RSRenderNodeTest2, GetStagingRenderParams, TestSize.Level1)
228 {
229     RSRenderNode node(id, context);
230     ASSERT_EQ(node.GetStagingRenderParams(), nullptr);
231 }
232 
233 /**
234  * @tc.name: CollectAndUpdateLocalShadowRect
235  * @tc.desc: test
236  * @tc.type: FUNC
237  * @tc.require: issueI9V3BK
238  */
239 HWTEST_F(RSRenderNodeTest2, CollectAndUpdateLocalShadowRect, TestSize.Level1)
240 {
241     RSRenderNode node(id, context);
242     node.CollectAndUpdateLocalShadowRect();
243     RSDrawableSlot slot = RSDrawableSlot::SHADOW;
244     node.dirtySlots_.insert(slot);
245     node.CollectAndUpdateLocalShadowRect();
246     ASSERT_TRUE(true);
247 }
248 
249 /**
250  * @tc.name: CollectAndUpdateLocalOutlineRect
251  * @tc.desc: test
252  * @tc.type: FUNC
253  * @tc.require: issueI9V3BK
254  */
255 HWTEST_F(RSRenderNodeTest2, CollectAndUpdateLocalOutlineRect, TestSize.Level1)
256 {
257     RSRenderNode node(id, context);
258     node.CollectAndUpdateLocalOutlineRect();
259     RSDrawableSlot slot = RSDrawableSlot::OUTLINE;
260     node.dirtySlots_.insert(slot);
261     node.CollectAndUpdateLocalOutlineRect();
262     ASSERT_TRUE(true);
263 }
264 
265 /**
266  * @tc.name: CollectAndUpdateLocalPixelStretchRect
267  * @tc.desc: test
268  * @tc.type: FUNC
269  * @tc.require: issueI9V3BK
270  */
271 HWTEST_F(RSRenderNodeTest2, CollectAndUpdateLocalPixelStretchRect, TestSize.Level1)
272 {
273     RSRenderNode node(id, context);
274     node.CollectAndUpdateLocalPixelStretchRect();
275     RSDrawableSlot slot = RSDrawableSlot::PIXEL_STRETCH;
276     node.dirtySlots_.insert(slot);
277     node.CollectAndUpdateLocalPixelStretchRect();
278     ASSERT_TRUE(true);
279 }
280 
281 /**
282  * @tc.name: UpdateBufferDirtyRegion
283  * @tc.desc: test
284  * @tc.type: FUNC
285  * @tc.require: issueI9V3BK
286  */
287 HWTEST_F(RSRenderNodeTest2, UpdateBufferDirtyRegion, TestSize.Level1)
288 {
289     RSRenderNode node(id, context);
290     node.UpdateBufferDirtyRegion();
291     RectI dirtyRect{0, 0, 1000, 1000};
292     RectI drawRegion{0, 0, 1000, 1000};
293     node.UpdateBufferDirtyRegion(dirtyRect, drawRegion);
294     ASSERT_TRUE(true);
295 }
296 
297 /**
298  * @tc.name: UpdateSelfDrawRect
299  * @tc.desc: test
300  * @tc.type: FUNC
301  * @tc.require: issueI9V3BK
302  */
303 HWTEST_F(RSRenderNodeTest2, UpdateSelfDrawRect, TestSize.Level1)
304 {
305     RSRenderNode node(id, context);
306     node.UpdateSelfDrawRect();
307     ASSERT_TRUE(true);
308 }
309 
310 /**
311  * @tc.name: GetSelfDrawRect
312  * @tc.desc: test
313  * @tc.type: FUNC
314  * @tc.require: issueI9V3BK
315  */
316 HWTEST_F(RSRenderNodeTest2, GetDrawRect, TestSize.Level1)
317 {
318     RSRenderNode node(id, context);
319     ASSERT_EQ(node.GetSelfDrawRect(), node.selfDrawRect_);
320     ASSERT_EQ(node.GetAbsDrawRect(), node.absDrawRect_);
321 }
322 
323 /**
324  * @tc.name: CheckAndUpdateGeoTrans001
325  * @tc.desc: test
326  * @tc.type: FUNC
327  * @tc.require: issueI9V3BK
328  */
329 HWTEST_F(RSRenderNodeTest2, CheckAndUpdateGeoTrans001, TestSize.Level1)
330 {
331     RSRenderNode node(id, context);
332     std::shared_ptr<RSObjAbsGeometry> geoPtr = std::make_shared<RSObjAbsGeometry>();
333     ASSERT_EQ(node.CheckAndUpdateGeoTrans(geoPtr), false);
334 }
335 
336 /**
337  * @tc.name: CheckAndUpdateGeoTrans002
338  * @tc.desc: test
339  * @tc.type: FUNC
340  * @tc.require: issueI9V3BK
341  */
342 HWTEST_F(RSRenderNodeTest2, CheckAndUpdateGeoTrans002, TestSize.Level1)
343 {
344     RSRenderNode node(id, context);
345     std::shared_ptr<RSObjAbsGeometry> geoPtr = std::make_shared<RSObjAbsGeometry>();
346     Drawing::Matrix matrix;
347     PropertyId id = 1;
348     std::shared_ptr<RSRenderProperty<Drawing::Matrix>> property =
349         std::make_shared<RSRenderProperty<Drawing::Matrix>>(matrix, id);
350     std::list<std::shared_ptr<RSRenderModifier>> list { std::make_shared<RSGeometryTransRenderModifier>(property) };
351     std::map<RSModifierType, std::list<std::shared_ptr<RSRenderModifier>>> map;
352     map[RSModifierType::GEOMETRYTRANS] = list;
353     node.renderContent_->drawCmdModifiers_ = map;
354     ASSERT_EQ(node.CheckAndUpdateGeoTrans(geoPtr), true);
355 }
356 
357 /**
358  * @tc.name: UpdateAbsDirtyRegion001
359  * @tc.desc: test
360  * @tc.type: FUNC
361  * @tc.require: issueI9V3BK
362  */
363 HWTEST_F(RSRenderNodeTest2, UpdateAbsDirtyRegion001, TestSize.Level1)
364 {
365     RSRenderNode node(id, context);
366     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
367     RectI clipRect{0, 0, 1000, 1000};
368     node.UpdateAbsDirtyRegion(*rsDirtyManager, clipRect);
369     ASSERT_TRUE(true);
370 }
371 
372 /**
373  * @tc.name: UpdateAbsDirtyRegion002
374  * @tc.desc: test
375  * @tc.type: FUNC
376  * @tc.require: issueI9V3BK
377  */
378 HWTEST_F(RSRenderNodeTest2, UpdateAbsDirtyRegion002, TestSize.Level1)
379 {
380     RSRenderNode node(id, context);
381     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
382     RectI clipRect{0, 0, 1000, 1000};
383     node.isSelfDrawingNode_ = true;
384     node.absDrawRect_ = {1, 2, 3, 4};
385     node.oldAbsDrawRect_ = {2, 2, 3, 4};
386     node.UpdateAbsDirtyRegion(*rsDirtyManager, clipRect);
387     ASSERT_TRUE(true);
388 }
389 
390 /**
391  * @tc.name: UpdateAbsDirtyRegion003
392  * @tc.desc: test
393  * @tc.type: FUNC
394  * @tc.require: issueI9V3BK
395  */
396 HWTEST_F(RSRenderNodeTest2, UpdateAbsDirtyRegion003, TestSize.Level1)
397 {
398     RSRenderNode node(id, context);
399     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
400     RectI clipRect{0, 0, 1000, 1000};
401     node.isSelfDrawingNode_ = true;
402     node.absDrawRect_ = {1, 2, 3, 4};
403     node.oldAbsDrawRect_ = {2, 2, 3, 4};
404     node.shouldPaint_ = false;
405     node.isLastVisible_ = true;
406     node.UpdateAbsDirtyRegion(*rsDirtyManager, clipRect);
407     ASSERT_TRUE(true);
408 }
409 
410 /**
411  * @tc.name: UpdateAbsDirtyRegion004
412  * @tc.desc: test
413  * @tc.type: FUNC
414  * @tc.require: issueI9V3BK
415  */
416 HWTEST_F(RSRenderNodeTest2, UpdateAbsDirtyRegion004, TestSize.Level1)
417 {
418     RSRenderNode node(id, context);
419     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
420     RectI clipRect{0, 0, 1000, 1000};
421     node.isSelfDrawingNode_ = true;
422     node.absDrawRect_ = {1, 2, 3, 4};
423     node.oldAbsDrawRect_ = {2, 2, 3, 4};
424     node.shouldPaint_ = true;
425     node.isLastVisible_ = true;
426     node.UpdateAbsDirtyRegion(*rsDirtyManager, clipRect);
427     ASSERT_TRUE(true);
428 }
429 
430 /**
431  * @tc.name: UpdateDrawRectAndDirtyRegion001
432  * @tc.desc: test
433  * @tc.type: FUNC
434  * @tc.require: issueI9V3BK
435  */
436 HWTEST_F(RSRenderNodeTest2, UpdateDrawRectAndDirtyRegion001, TestSize.Level1)
437 {
438     RSRenderNode node(id, context);
439     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
440     RectI clipRect{0, 0, 1000, 1000};
441     Drawing::Matrix matrix;
442     node.SetDirty();
443     ASSERT_EQ(node.UpdateDrawRectAndDirtyRegion(*rsDirtyManager, false, clipRect, matrix), true);
444 }
445 
446 /**
447  * @tc.name: UpdateDrawRectAndDirtyRegion002
448  * @tc.desc: test
449  * @tc.type: FUNC
450  * @tc.require: issueI9V3BK
451  */
452 HWTEST_F(RSRenderNodeTest2, UpdateDrawRectAndDirtyRegion002, TestSize.Level1)
453 {
454     RSRenderNode node(id, context);
455     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
456     RectI clipRect{0, 0, 1000, 1000};
457     Drawing::Matrix matrix;
458     node.SetDirty();
459     auto& properties = node.GetMutableRenderProperties();
460     properties.clipToBounds_ = true;
461     properties.clipToFrame_ = true;
462     properties.geoDirty_ = true;
463     node.dirtyStatus_ = RSRenderNode::NodeDirty::DIRTY;
464     node.isSelfDrawingNode_ = true;
465     node.srcOrClipedAbsDrawRectChangeFlag_ = true;
466     node.shouldPaint_ = true;
467     node.isLastVisible_ = true;
468     ASSERT_EQ(node.UpdateDrawRectAndDirtyRegion(*rsDirtyManager, false, clipRect, matrix), true);
469 }
470 
471 /**
472  * @tc.name: UpdateDrawRect001
473  * @tc.desc: test
474  * @tc.type: FUNC
475  * @tc.require: issueI9V3BK
476  */
477 HWTEST_F(RSRenderNodeTest2, UpdateDrawRect001, TestSize.Level1)
478 {
479     RSRenderNode node(id, context);
480     RectI clipRect{0, 0, 1000, 1000};
481     Drawing::Matrix matrix;
482     RSRenderNode parentNode(id + 1, context);
483     bool accumGeoDirty = true;
484     node.UpdateDrawRect(accumGeoDirty, clipRect, matrix);
485     ASSERT_TRUE(true);
486 }
487 
488 /**
489  * @tc.name: UpdateDrawRect002
490  * @tc.desc: test
491  * @tc.type: FUNC
492  * @tc.require: issueI9V3BK
493  */
494 HWTEST_F(RSRenderNodeTest2, UpdateDrawRect002, TestSize.Level1)
495 {
496     RSRenderNode node(id, context);
497     RectI clipRect{0, 0, 1000, 1000};
498     Drawing::Matrix matrix;
499     auto& properties = node.GetMutableRenderProperties();
500     properties.sandbox_ = std::make_unique<Sandbox>();
501     bool accumGeoDirty = true;
502     node.UpdateDrawRect(accumGeoDirty, clipRect, matrix);
503     ASSERT_TRUE(true);
504 }
505 
506 /**
507  * @tc.name: UpdateDirtyRegionInfoForDFX001
508  * @tc.desc: test
509  * @tc.type: FUNC
510  * @tc.require: issueI9V3BK
511  */
512 HWTEST_F(RSRenderNodeTest2, UpdateDirtyRegionInfoForDFX001, TestSize.Level1)
513 {
514     RSRenderNode node(id, context);
515     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
516     auto& properties = node.GetMutableRenderProperties();
517     properties.drawRegion_ = std::make_shared<RectF>();
518     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
519     node.UpdateDirtyRegionInfoForDFX(*rsDirtyManager);
520     ASSERT_TRUE(true);
521 }
522 
523 /**
524  * @tc.name: UpdateDirtyRegionInfoForDFX002
525  * @tc.desc: test
526  * @tc.type: FUNC
527  * @tc.require: issueI9V3BK
528  */
529 HWTEST_F(RSRenderNodeTest2, UpdateDirtyRegionInfoForDFX002, TestSize.Level1)
530 {
531     RSRenderNode node(id, context);
532     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
533     node.UpdateDirtyRegionInfoForDFX(*rsDirtyManager);
534     ASSERT_TRUE(true);
535 }
536 
537 /**
538  * @tc.name: Update001
539  * @tc.desc: test
540  * @tc.type: FUNC
541  * @tc.require: issueI9V3BK
542  */
543 HWTEST_F(RSRenderNodeTest2, Update001, TestSize.Level1)
544 {
545     RSRenderNode node(id, context);
546     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
547     std::shared_ptr<RSRenderNode> parentNode;
548     RectI clipRect{0, 0, 1000, 1000};
549     node.shouldPaint_ = false;
550     node.isLastVisible_ = false;
551     bool parentDirty = true;
552     ASSERT_EQ(node.Update(*rsDirtyManager, parentNode, parentDirty, clipRect), false);
553 }
554 
555 /**
556  * @tc.name: Update002
557  * @tc.desc: test
558  * @tc.type: FUNC
559  * @tc.require: issueI9V3BK
560  */
561 HWTEST_F(RSRenderNodeTest2, Update002, TestSize.Level1)
562 {
563     RSRenderNode node(id, context);
564     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
565     std::shared_ptr<RSRenderNode> parentNode;
566     RectI clipRect{0, 0, 1000, 1000};
567     node.shouldPaint_ = true;
568     node.isLastVisible_ = false;
569     node.SetDirty();
570     Drawing::Matrix matrix;
571     PropertyId id = 1;
572     std::shared_ptr<RSRenderProperty<Drawing::Matrix>> property =
573         std::make_shared<RSRenderProperty<Drawing::Matrix>>(matrix, id);
574     std::list<std::shared_ptr<RSRenderModifier>> list { std::make_shared<RSGeometryTransRenderModifier>(property) };
575     std::map<RSModifierType, std::list<std::shared_ptr<RSRenderModifier>>> map;
576     map[RSModifierType::GEOMETRYTRANS] = list;
577     node.renderContent_->drawCmdModifiers_ = map;
578     bool parentDirty = true;
579     ASSERT_EQ(node.Update(*rsDirtyManager, parentNode, parentDirty, clipRect), true);
580 }
581 
582 /**
583  * @tc.name: GetMutableRenderProperties
584  * @tc.desc: test
585  * @tc.type: FUNC
586  * @tc.require: issueI9V3BK
587  */
588 HWTEST_F(RSRenderNodeTest2, GetMutableRenderProperties, TestSize.Level1)
589 {
590     RSRenderNode node(id, context);
591     node.GetMutableRenderProperties();
592     ASSERT_TRUE(true);
593 }
594 
595 /**
596  * @tc.name: GetMutableRenderProperties001
597  * @tc.desc: test
598  * @tc.type: FUNC
599  * @tc.require: issueI9V3BK
600  */
601 HWTEST_F(RSRenderNodeTest2, UpdateBufferDirtyRegion001, TestSize.Level1)
602 {
603     RSRenderNode node(id, context);
604     RectI dirtyRect{0, 0, 1000, 1000};
605     RectI drawRegion{0, 0, 1000, 1000};
606     ASSERT_EQ(node.UpdateBufferDirtyRegion(dirtyRect, drawRegion), false);
607 }
608 
609 /**
610  * @tc.name: IsSelfDrawingNode
611  * @tc.desc: test
612  * @tc.type: FUNC
613  * @tc.require: issueI9V3BK
614  */
615 HWTEST_F(RSRenderNodeTest2, IsSelfDrawingNodeAndDirty, TestSize.Level1)
616 {
617     RSRenderNode node(id, context);
618     node.IsSelfDrawingNode();
619     node.IsDirty();
620     ASSERT_TRUE(true);
621 }
622 
623 /**
624  * @tc.name: SubTreeDirty
625  * @tc.desc: test
626  * @tc.type: FUNC
627  * @tc.require: issueI9V3BK
628  */
629 HWTEST_F(RSRenderNodeTest2, SubTreeDirty, TestSize.Level1)
630 {
631     RSRenderNode node(id, context);
632     bool val = true;
633     node.SetSubTreeDirty(val);
634     ASSERT_TRUE(node.isSubTreeDirty_);
635     node.IsSubTreeDirty();
636     ASSERT_TRUE(true);
637 }
638 
639 /**
640  * @tc.name: SetParentSubTreeDirty
641  * @tc.desc: test
642  * @tc.type: FUNC
643  * @tc.require: issueI9V3BK
644  */
645 HWTEST_F(RSRenderNodeTest2, SetParentSubTreeDirty, TestSize.Level1)
646 {
647     RSRenderNode node(id, context);
648     node.SetParentSubTreeDirty();
649     ASSERT_TRUE(true);
650 }
651 
652 /**
653  * @tc.name: IsContentDirty
654  * @tc.desc: test
655  * @tc.type: FUNC
656  * @tc.require: issueI9V3BK
657  */
658 HWTEST_F(RSRenderNodeTest2, IsContentDirty, TestSize.Level1)
659 {
660     RSRenderNode node(id, context);
661     node.IsContentDirty();
662     ASSERT_TRUE(true);
663 }
664 
665 /**
666  * @tc.name: MapAndUpdateChildrenRect001
667  * @tc.desc: test
668  * @tc.type: FUNC
669  * @tc.require: issueI9V3BK
670  */
671 HWTEST_F(RSRenderNodeTest2, MapAndUpdateChildrenRect001, TestSize.Level1)
672 {
673     RSRenderNode node(id, context);
674     node.shouldPaint_ = true;
675     node.MapAndUpdateChildrenRect();
676     ASSERT_TRUE(true);
677 }
678 
679 /**
680  * @tc.name: MapAndUpdateChildrenRect002
681  * @tc.desc: test
682  * @tc.type: FUNC
683  * @tc.require: issueI9V3BK
684  */
685 HWTEST_F(RSRenderNodeTest2, MapAndUpdateChildrenRect002, TestSize.Level1)
686 {
687     RSRenderNode node(id, context);
688     node.shouldPaint_ = false;
689     auto& properties = node.GetMutableRenderProperties();
690     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
691     node.selfDrawRect_ = {0, 0, 1000, 1000};
692     node.MapAndUpdateChildrenRect();
693     ASSERT_TRUE(true);
694 }
695 
696 /**
697  * @tc.name: MapAndUpdateChildrenRect003
698  * @tc.desc: test
699  * @tc.type: FUNC
700  * @tc.require: issueI9V3BK
701  */
702 HWTEST_F(RSRenderNodeTest2, MapAndUpdateChildrenRect003, TestSize.Level1)
703 {
704     std::shared_ptr<RSRenderNode> nodeTest = std::make_shared<RSRenderNode>(0);
705     std::shared_ptr<RSSurfaceRenderNode> surfaceNode = std::make_shared<RSSurfaceRenderNode>(1);
706 
707     surfaceNode->shouldPaint_ = true;
708     auto& properties = nodeTest->GetMutableRenderProperties();
709     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
710     properties.SetClipToFrame(true);
711     surfaceNode->selfDrawRect_ = {0, 0, 1000, 1100};
712     surfaceNode->childrenRect_ = {0, 0, 1000, 1000};
713     nodeTest->selfDrawRect_ = {0, 0, 1000, 800};
714     surfaceNode->parent_ = nodeTest;
715     surfaceNode->MapAndUpdateChildrenRect();
716     ASSERT_TRUE(true);
717 }
718 
719 /**
720  * @tc.name: MapAndUpdateChildrenRect004
721  * @tc.desc: test
722  * @tc.type: FUNC
723  * @tc.require: issueI9V3BK
724  */
725 HWTEST_F(RSRenderNodeTest2, MapAndUpdateChildrenRect004, TestSize.Level1)
726 {
727     std::shared_ptr<RSRenderNode> nodeTest = std::make_shared<RSRenderNode>(0);
728     std::shared_ptr<RSSurfaceRenderNode> surfaceNode = std::make_shared<RSSurfaceRenderNode>(1);
729 
730     surfaceNode->shouldPaint_ = true;
731     auto& properties = nodeTest->GetMutableRenderProperties();
732     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
733     properties.SetClipToFrame(false);
734     surfaceNode->selfDrawRect_ = {0, 0, 1000, 1100};
735     surfaceNode->childrenRect_ = {0, 0, 1000, 1000};
736     nodeTest->selfDrawRect_ = {0, 0, 1000, 800};
737     surfaceNode->parent_ = nodeTest;
738     surfaceNode->MapAndUpdateChildrenRect();
739     ASSERT_TRUE(true);
740 }
741 /**
742  * @tc.name: MapAndUpdateChildrenRect005
743  * @tc.desc: test
744  * @tc.type: FUNC
745  * @tc.require: issueIAM93Q
746  */
747 HWTEST_F(RSRenderNodeTest2, MapAndUpdateChildrenRect005, TestSize.Level1)
748 {
749     std::shared_ptr<RSRenderNode> parentNode = std::make_shared<RSBaseRenderNode>(id, context);
750     std::shared_ptr<RSRenderNode> inNode = std::make_shared<RSBaseRenderNode>(id + 1, context);
751     std::shared_ptr<RSRenderNode> outNode = std::make_shared<RSBaseRenderNode>(id + 2, context);
752     auto sharedTransitionParam = std::make_shared<SharedTransitionParam>(inNode, outNode);
753     parentNode->GetRenderProperties().GetBoundsGeometry()->absMatrix_ = Drawing::Matrix();
754     inNode->parent_ = parentNode;
755     inNode->shouldPaint_ = true;
756     inNode->GetMutableRenderProperties().sandbox_ = std::make_unique<Sandbox>();
757     Vector2f vec2f(1.0f, 1.0f);
758     inNode->GetMutableRenderProperties().sandbox_->position_ = vec2f;
759     inNode->SetSharedTransitionParam(sharedTransitionParam);
760     inNode->selfDrawRect_ = {0, 0, 1000, 1000};
761     inNode->MapAndUpdateChildrenRect();
762     ASSERT_TRUE(true);
763 }
764 
765 /**
766  * @tc.name: IsFilterCacheValid001
767  * @tc.desc: test
768  * @tc.type: FUNC
769  * @tc.require: issueI9V3BK
770  */
771 HWTEST_F(RSRenderNodeTest2, IsFilterCacheValid001, TestSize.Level1)
772 {
773     RSRenderNode node(id, context);
774     node.shouldPaint_ = true;
775     node.IsFilterCacheValid();
776     ASSERT_TRUE(true);
777 }
778 
779 /**
780  * @tc.name: IsFilterCacheValid001
781  * @tc.desc: test
782  * @tc.type: FUNC
783  * @tc.require: issueI9V3BK
784  */
785 HWTEST_F(RSRenderNodeTest2, IsFilterCacheValid002, TestSize.Level1)
786 {
787     RSRenderNode node(id, context);
788     node.shouldPaint_ = true;
789     auto& properties = node.GetMutableRenderProperties();
790     properties.filter_ = std::make_shared<RSFilter>();
791     node.IsFilterCacheValid();
792     ASSERT_TRUE(true);
793 }
794 
795 /**
796  * @tc.name: IsAIBarFilterCacheValid
797  * @tc.desc: test
798  * @tc.type: FUNC
799  * @tc.require: issueI9V3BK
800  */
801 HWTEST_F(RSRenderNodeTest2, IsAIBarFilterCacheValid, TestSize.Level1)
802 {
803     RSRenderNode node(id, context);
804     ASSERT_EQ(node.IsAIBarFilterCacheValid(), false);
805 }
806 
807 /**
808  * @tc.name: GetFilterCachedRegionAndHasBlurFilter
809  * @tc.desc: test
810  * @tc.type: FUNC
811  * @tc.require: issueI9V3BK
812  */
813 HWTEST_F(RSRenderNodeTest2, GetFilterCachedRegionAndHasBlurFilter, TestSize.Level1)
814 {
815     RSRenderNode node(id, context);
816     node.GetFilterCachedRegion();
817     node.HasBlurFilter();
818     ASSERT_TRUE(true);
819 }
820 
821 /**
822  * @tc.name: UpdateLastFilterCacheRegion
823  * @tc.desc: test
824  * @tc.type: FUNC
825  * @tc.require: issueI9V3BK
826  */
827 HWTEST_F(RSRenderNodeTest2, UpdateLastFilterCacheRegion, TestSize.Level1)
828 {
829     RSRenderNode node(id, context);
830     node.UpdateLastFilterCacheRegion();
831     ASSERT_TRUE(true);
832 }
833 
834 /**
835  * @tc.name: GetAbsMatrixReverse001
836  * @tc.desc: test
837  * @tc.type: FUNC
838  * @tc.require: issueI9V3BK
839  */
840 HWTEST_F(RSRenderNodeTest2, GetAbsMatrixReverse001, TestSize.Level1)
841 {
842     RSRenderNode node(id, context);
843     auto& properties = node.GetMutableRenderProperties();
844     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
845     RSBaseRenderNode rootNode(id + 1, context);
846     auto& properties1 = node.GetMutableRenderProperties();
847     properties1.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
848     Drawing::Matrix absMatrix;
849     node.GetAbsMatrixReverse(rootNode, absMatrix);
850     ASSERT_TRUE(true);
851 }
852 
853 /**
854  * @tc.name: GetAbsMatrixReverse002
855  * @tc.desc: test
856  * @tc.type: FUNC
857  * @tc.require: issueI9V3BK
858  */
859 HWTEST_F(RSRenderNodeTest2, GetAbsMatrixReverse002, TestSize.Level1)
860 {
861     RSRenderNode node(id, context);
862     auto& properties = node.GetMutableRenderProperties();
863     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
864     RSBaseRenderNode rootNode(id + 1, context);
865     auto& properties1 = rootNode.GetMutableRenderProperties();
866     properties1.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
867     Drawing::Matrix absMatrix;
868     node.GetAbsMatrixReverse(rootNode, absMatrix);
869     ASSERT_TRUE(true);
870 }
871 
872 /**
873  * @tc.name: UpdateFilterRegionInSkippedSubTree001
874  * @tc.desc: test
875  * @tc.type: FUNC
876  * @tc.require: issueI9V3BK
877  */
878 HWTEST_F(RSRenderNodeTest2, UpdateFilterRegionInSkippedSubTree001, TestSize.Level1)
879 {
880     RSRenderNode node(id, context);
881     auto& properties = node.GetMutableRenderProperties();
882     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
883     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
884     RSBaseRenderNode subTreeRoot(id + 1, context);
885     auto& properties1 = subTreeRoot.GetMutableRenderProperties();
886     properties1.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
887     RectI filterRect{0, 0, 1000, 1000};
888     RectI clipRect{0, 0, 1000, 1000};
889     node.UpdateFilterRegionInSkippedSubTree(*rsDirtyManager, subTreeRoot, filterRect, clipRect);
890     ASSERT_TRUE(true);
891 }
892 
893 /**
894  * @tc.name: UpdateFilterRegionInSkippedSubTree002
895  * @tc.desc: test
896  * @tc.type: FUNC
897  * @tc.require: issueI9V3BK
898  */
899 HWTEST_F(RSRenderNodeTest2, UpdateFilterRegionInSkippedSubTree002, TestSize.Level1)
900 {
901     RSRenderNode node(id, context);
902     auto& properties = node.GetMutableRenderProperties();
903     properties.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
904     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
905     RSBaseRenderNode subTreeRoot(id + 1, context);
906     auto& properties1 = subTreeRoot.GetMutableRenderProperties();
907     properties1.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
908     RectI filterRect{0, 0, 1000, 1000};
909     node.lastFilterRegion_ = filterRect;
910     RectI clipRect{0, 0, 1000, 1000};
911     node.UpdateFilterRegionInSkippedSubTree(*rsDirtyManager, subTreeRoot, filterRect, clipRect);
912     ASSERT_TRUE(true);
913 }
914 
915 /**
916  * @tc.name: CheckBlurFilterCacheNeedForceClearOrSave
917  * @tc.desc: test
918  * @tc.type: FUNC
919  * @tc.require: issueI9V3BK
920  */
921 HWTEST_F(RSRenderNodeTest2, CheckBlurFilterCacheNeedForceClearOrSave, TestSize.Level1)
922 {
923     RSRenderNode node(id, context);
924     bool rotationChanged = true;
925     bool rotationStatusChanged = true;
926     auto& properties = node.GetMutableRenderProperties();
927     properties.backgroundFilter_ = std::make_shared<RSFilter>();
928     properties.filter_ = std::make_shared<RSFilter>();
929     node.CheckBlurFilterCacheNeedForceClearOrSave(rotationChanged, rotationStatusChanged);
930     rotationStatusChanged = false;
931     node.CheckBlurFilterCacheNeedForceClearOrSave(rotationChanged, rotationStatusChanged);
932     ASSERT_TRUE(true);
933 }
934 
935 /**
936  * @tc.name: IsForceClearOrUseFilterCache
937  * @tc.desc: test
938  * @tc.type: FUNC
939  * @tc.require: issueI9V3BK
940  */
941 HWTEST_F(RSRenderNodeTest2, IsForceClearOrUseFilterCache, TestSize.Level1)
942 {
943     RSRenderNode node(id, context);
944     std::shared_ptr<DrawableV2::RSFilterDrawable> filterDrawable = std::make_shared<DrawableV2::RSFilterDrawable>();
945     ASSERT_EQ(node.IsForceClearOrUseFilterCache(filterDrawable), false);
946 }
947 
948 /**
949  * @tc.name: MarkFilterStatusChanged
950  * @tc.desc: test
951  * @tc.type: FUNC
952  * @tc.require: issueI9V3BK
953  */
954 HWTEST_F(RSRenderNodeTest2, MarkFilterStatusChanged, TestSize.Level1)
955 {
956     RSRenderNode node(id, context);
957     bool isForeground = true;
958     bool isFilterRegionChanged = true;
959     node.MarkFilterStatusChanged(isForeground, isFilterRegionChanged);
960     isFilterRegionChanged = false;
961     node.MarkFilterStatusChanged(isForeground, isFilterRegionChanged);
962     isForeground = false;
963     node.MarkFilterStatusChanged(isForeground, isFilterRegionChanged);
964     isForeground = true;
965     node.MarkFilterStatusChanged(isForeground, isFilterRegionChanged);
966     ASSERT_TRUE(true);
967 }
968 
969 /**
970  * @tc.name: GetFilterDrawable
971  * @tc.desc: test
972  * @tc.type: FUNC
973  * @tc.require: issueI9V3BK
974  */
975 HWTEST_F(RSRenderNodeTest2, GetFilterDrawable, TestSize.Level1)
976 {
977     RSRenderNode node(id, context);
978     bool isForeground = true;
979     node.GetFilterDrawable(isForeground);
980     isForeground = false;
981     node.GetFilterDrawable(isForeground);
982     ASSERT_TRUE(true);
983 }
984 
985 /**
986  * @tc.name: UpdateFilterCacheWithBelowDirty
987  * @tc.desc: test
988  * @tc.type: FUNC
989  * @tc.require: issueI9V3BK
990  */
991 HWTEST_F(RSRenderNodeTest2, UpdateFilterCacheWithBelowDirty, TestSize.Level1)
992 {
993     RSRenderNode node(id, context);
994     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
995     bool isForeground = true;
996     node.UpdateFilterCacheWithBelowDirty(*rsDirtyManager, isForeground);
997     ASSERT_TRUE(true);
998 }
999 
1000 /**
1001  * @tc.name: UpdateFilterCacheWithSelfDirty
1002  * @tc.desc: test
1003  * @tc.type: FUNC
1004  * @tc.require: issueI9V3BK
1005  */
1006 HWTEST_F(RSRenderNodeTest2, UpdateFilterCacheWithSelfDirty, TestSize.Level1)
1007 {
1008     RSRenderNode node(id, context);
1009     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
1010     auto& properties = node.GetMutableRenderProperties();
1011     properties.backgroundFilter_ = std::make_shared<RSFilter>();
1012     properties.filter_ = std::make_shared<RSFilter>();
1013     node.UpdateFilterCacheWithSelfDirty();
1014     ASSERT_TRUE(true);
1015 }
1016 
1017 /**
1018  * @tc.name: UpdateFilterCacheWithSelfDirty002
1019  * @tc.desc: test
1020  * @tc.type: FUNC
1021  * @tc.require: issueIB0UQV
1022  */
1023 HWTEST_F(RSRenderNodeTest2, UpdateFilterCacheWithSelfDirty002, TestSize.Level1)
1024 {
1025     if (!RSProperties::FilterCacheEnabled) {
1026         return;
1027     }
1028     RSRenderNode node(id, context);
1029     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
1030     auto& properties = node.GetMutableRenderProperties();
1031     properties.needDrawBehindWindow_ = true;
1032     RectI inRegion(10, 10, 20, 20);
1033     RectI outRegion(90, 90, 110, 110);
1034     RectI lastRegion(0, 0, 100, 100);
1035     node.filterRegion_ = inRegion;
1036     node.lastFilterRegion_ = lastRegion;
1037     auto filterDrawable = std::static_pointer_cast<DrawableV2::RSBackgroundFilterDrawable>(
1038         DrawableV2::RSBackgroundFilterDrawable::OnGenerate(node));
1039     filterDrawable->stagingFilterRegionChanged_ = false;
1040     node.drawableVec_[static_cast<uint32_t>(RSDrawableSlot::BACKGROUND_FILTER)] = filterDrawable;
1041     node.UpdateFilterCacheWithSelfDirty();
1042     ASSERT_TRUE(filterDrawable->stagingFilterRegionChanged_);
1043     node.filterRegion_ = outRegion;
1044     node.UpdateFilterCacheWithSelfDirty();
1045     ASSERT_TRUE(filterDrawable->stagingFilterRegionChanged_);
1046 }
1047 
1048 /**
1049  * @tc.name: IsBackgroundInAppOrNodeSelfDirty
1050  * @tc.desc: test
1051  * @tc.type: FUNC
1052  * @tc.require: issueI9V3BK
1053  */
1054 HWTEST_F(RSRenderNodeTest2, IsBackgroundInAppOrNodeSelfDirty, TestSize.Level1)
1055 {
1056     RSRenderNode node(id, context);
1057     node.IsBackgroundInAppOrNodeSelfDirty();
1058     ASSERT_TRUE(true);
1059 }
1060 
1061 /**
1062  * @tc.name: UpdateDirtySlotsAndPendingNodes
1063  * @tc.desc: test
1064  * @tc.type: FUNC
1065  * @tc.require: issueI9V3BK
1066  */
1067 HWTEST_F(RSRenderNodeTest2, UpdateDirtySlotsAndPendingNodes, TestSize.Level1)
1068 {
1069     RSRenderNode node(id, context);
1070     RSDrawableSlot slot = RSDrawableSlot::SHADOW;
1071     node.UpdateDirtySlotsAndPendingNodes(slot);
1072     ASSERT_TRUE(true);
1073 }
1074 
1075 /**
1076  * @tc.name: PostPrepareForBlurFilterNode
1077  * @tc.desc: test
1078  * @tc.type: FUNC
1079  * @tc.require: issueI9V3BK
1080  */
1081 HWTEST_F(RSRenderNodeTest2, PostPrepareForBlurFilterNode, TestSize.Level1)
1082 {
1083     RSRenderNode node(id, context);
1084     bool needRequestNextVsync = true;
1085     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
1086     auto& properties = node.GetMutableRenderProperties();
1087     properties.backgroundFilter_ = std::make_shared<RSFilter>();
1088     properties.filter_ = std::make_shared<RSFilter>();
1089     node.PostPrepareForBlurFilterNode(*rsDirtyManager, needRequestNextVsync);
1090     ASSERT_TRUE(true);
1091 }
1092 
1093 /**
1094  * @tc.name: PostPrepareForBlurFilterNode002
1095  * @tc.desc: test
1096  * @tc.type: FUNC
1097  * @tc.require: issueIB0UQV
1098  */
1099 HWTEST_F(RSRenderNodeTest2, PostPrepareForBlurFilterNode002, TestSize.Level1)
1100 {
1101     if (!RSProperties::FilterCacheEnabled) {
1102         return;
1103     }
1104     RSRenderNode node(id, context);
1105     bool needRequestNextVsync = true;
1106     std::shared_ptr<RSDirtyRegionManager> rsDirtyManager = std::make_shared<RSDirtyRegionManager>();
1107     auto& properties = node.GetMutableRenderProperties();
1108     properties.needDrawBehindWindow_ = true;
1109     node.PostPrepareForBlurFilterNode(*rsDirtyManager, needRequestNextVsync);
1110     RSDrawableSlot slot = RSDrawableSlot::BACKGROUND_FILTER;
1111     node.drawableVec_[static_cast<uint32_t>(slot)] = std::make_shared<DrawableV2::RSFilterDrawable>();
1112     node.PostPrepareForBlurFilterNode(*rsDirtyManager, needRequestNextVsync);
1113     ASSERT_NE(node.GetFilterDrawable(false), nullptr);
1114 }
1115 
1116 /**
1117  * @tc.name: AddSubSurfaceNodeTest030
1118  * @tc.desc: AddSubSurfaceNode test
1119  * @tc.type: FUNC
1120  * @tc.require: issueIA5Y41
1121  */
1122 HWTEST_F(RSRenderNodeTest2, ClearCacheSurfaceInThreadTest030, TestSize.Level1)
1123 {
1124     std::shared_ptr<RSSurfaceRenderNode> nodeTest = std::make_shared<RSSurfaceRenderNode>(0);
1125     EXPECT_NE(nodeTest, nullptr);
1126     std::shared_ptr<RSSurfaceRenderNode> parent = std::make_shared<RSSurfaceRenderNode>(0);
1127     EXPECT_NE(parent, nullptr);
1128 
1129     nodeTest->nodeType_ = RSSurfaceNodeType::ABILITY_COMPONENT_NODE;
1130     nodeTest->AddSubSurfaceNode(parent);
1131 
1132     std::vector<std::weak_ptr<RSRenderNode>> subSurfaceNodesTest1;
1133     std::shared_ptr<RSSurfaceRenderNode> surfaceTest1 = std::make_shared<RSSurfaceRenderNode>(0);
1134     EXPECT_NE(surfaceTest1, nullptr);
1135     subSurfaceNodesTest1.emplace_back(surfaceTest1);
1136     parent->subSurfaceNodes_.emplace(0, subSurfaceNodesTest1);
1137     nodeTest->AddSubSurfaceNode(parent);
1138     parent->subSurfaceNodes_.clear();
1139 
1140     std::vector<std::weak_ptr<RSRenderNode>> subSurfaceNodesTest2;
1141     std::shared_ptr<RSSurfaceRenderNode> surfaceTest2 = std::make_shared<RSSurfaceRenderNode>(0);
1142     EXPECT_NE(surfaceTest2, nullptr);
1143     subSurfaceNodesTest2.emplace_back(surfaceTest2);
1144     nodeTest->subSurfaceNodes_.emplace(1, subSurfaceNodesTest2);
1145     nodeTest->AddSubSurfaceNode(parent);
1146     parent->subSurfaceNodes_.clear();
1147 
1148     parent->nodeType_ = RSSurfaceNodeType::ABILITY_COMPONENT_NODE;
1149     parent->subSurfaceNodes_.emplace(1, subSurfaceNodesTest1);
1150     nodeTest->AddSubSurfaceNode(parent);
1151 }
1152 
1153 /**
1154  * @tc.name: RemoveSubSurfaceNodeTest031
1155  * @tc.desc: RemoveSubSurfaceNode test
1156  * @tc.type: FUNC
1157  * @tc.require: issueIA5Y41
1158  */
1159 HWTEST_F(RSRenderNodeTest2, RemoveSubSurfaceNodeTest031, TestSize.Level1)
1160 {
1161     std::shared_ptr<RSRenderNode> nodeTest = std::make_shared<RSRenderNode>(0);
1162     EXPECT_NE(nodeTest, nullptr);
1163     std::shared_ptr<RSSurfaceRenderNode> parent = std::make_shared<RSSurfaceRenderNode>(1);
1164     EXPECT_NE(parent, nullptr);
1165     nodeTest->RemoveSubSurfaceNode(parent);
1166 
1167     std::vector<std::weak_ptr<RSRenderNode>> subSurfaceNodesTest1;
1168     std::shared_ptr<RSRenderNode> surfaceTest1 = std::make_shared<RSRenderNode>(0);
1169     EXPECT_NE(surfaceTest1, nullptr);
1170     subSurfaceNodesTest1.emplace_back(surfaceTest1);
1171     parent->subSurfaceNodes_.emplace(0, subSurfaceNodesTest1);
1172     nodeTest->RemoveSubSurfaceNode(parent);
1173     EXPECT_EQ(parent->subSurfaceNodes_.size(), 0);
1174 
1175     parent->nodeType_ = RSSurfaceNodeType::ABILITY_COMPONENT_NODE;
1176     parent->subSurfaceNodes_.emplace(0, subSurfaceNodesTest1);
1177     std::shared_ptr<RSRenderNode> parentTest = nullptr;
1178     parent->parent_ = parentTest;
1179     nodeTest->RemoveSubSurfaceNode(parent);
1180     EXPECT_EQ(parent->subSurfaceNodes_.size(), 0);
1181 
1182     std::vector<std::weak_ptr<RSRenderNode>> subSurfaceNodesTest2;
1183     std::shared_ptr<RSRenderNode> surfaceTest2 = std::make_shared<RSRenderNode>(0);
1184     EXPECT_NE(surfaceTest2, nullptr);
1185     subSurfaceNodesTest2.emplace_back(surfaceTest2);
1186     parent->subSurfaceNodes_.emplace(0, subSurfaceNodesTest1);
1187     parent->subSurfaceNodes_.emplace(1, subSurfaceNodesTest2);
1188     parentTest = std::make_shared<RSRenderNode>(0);
1189     parent->parent_ = parentTest;
1190     EXPECT_NE(parentTest, nullptr);
1191     nodeTest->RemoveSubSurfaceNode(parent);
1192     EXPECT_EQ(parent->subSurfaceNodes_.size(), 1);
1193 }
1194 
1195 /**
1196  * @tc.name: DumpSubClassNodeTest032
1197  * @tc.desc: DumpSubClassNode and DumpDrawCmdModifiers test
1198  * @tc.type: FUNC
1199  * @tc.require: issueIA61E9
1200  */
1201 HWTEST_F(RSRenderNodeTest2, DumpSubClassNodeTest032, TestSize.Level1)
1202 {
1203     std::shared_ptr<RSSurfaceRenderNode> nodeTest1 = std::make_shared<RSSurfaceRenderNode>(0);
1204     EXPECT_NE(nodeTest1, nullptr);
1205     std::string outTest3 = "";
1206     nodeTest1->DumpSubClassNode(outTest3);
1207     EXPECT_NE(outTest3, "");
1208 
1209     std::shared_ptr<RSRootRenderNode> nodeTest2 = std::make_shared<RSRootRenderNode>(0);
1210     EXPECT_NE(nodeTest2, nullptr);
1211     std::string outTest4 = "";
1212     nodeTest2->DumpSubClassNode(outTest4);
1213     EXPECT_NE(outTest4, "");
1214 
1215     RSDisplayNodeConfig config;
1216     std::shared_ptr<RSDisplayRenderNode> nodeTest3 = std::make_shared<RSDisplayRenderNode>(0, config);
1217     EXPECT_NE(nodeTest3, nullptr);
1218     std::string outTest5 = "";
1219     nodeTest3->DumpSubClassNode(outTest5);
1220     EXPECT_NE(outTest5, "");
1221 
1222     std::shared_ptr<RSRenderNode> nodeTest = std::make_shared<RSRenderNode>(0);
1223     EXPECT_NE(nodeTest, nullptr);
1224     std::string outTest6 = "";
1225     nodeTest->DumpDrawCmdModifiers(outTest6);
1226     EXPECT_EQ(outTest6, "");
1227     std::shared_ptr<RSRenderProperty<Drawing::DrawCmdListPtr>> propertyTest =
1228         std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>();
1229     EXPECT_NE(propertyTest, nullptr);
1230     std::shared_ptr<RSDrawCmdListRenderModifier> drawCmdModifiersTest =
1231         std::make_shared<RSDrawCmdListRenderModifier>(propertyTest);
1232     EXPECT_NE(drawCmdModifiersTest, nullptr);
1233     nodeTest->renderContent_->drawCmdModifiers_[RSModifierType::CHILDREN].emplace_back(drawCmdModifiersTest);
1234 }
1235 
1236 /**
1237  * @tc.name: ForceMergeSubTreeDirtyRegionTest033
1238  * @tc.desc: ForceMergeSubTreeDirtyRegion SubTreeSkipPrepare test
1239  * @tc.type: FUNC
1240  * @tc.require: issueIA61E9
1241  */
1242 HWTEST_F(RSRenderNodeTest2, ForceMergeSubTreeDirtyRegionTest033, TestSize.Level1)
1243 {
1244     std::shared_ptr<RSSurfaceRenderNode> nodeTest = std::make_shared<RSSurfaceRenderNode>(0);
1245     EXPECT_NE(nodeTest, nullptr);
1246 
1247     RSDirtyRegionManager dirtyManagerTest1;
1248     RectI clipRectTest1 = RectI { 0, 0, 1, 1 };
1249     nodeTest->lastFrameSubTreeSkipped_ = true;
1250     nodeTest->geoUpdateDelay_ = true;
1251     nodeTest->ForceMergeSubTreeDirtyRegion(dirtyManagerTest1, clipRectTest1);
1252     EXPECT_FALSE(nodeTest->lastFrameSubTreeSkipped_);
1253 
1254     RSDirtyRegionManager dirtyManagerTest2;
1255     RectI clipRectTest2 = RectI { 0, 0, 1, 1 };
1256     nodeTest->lastFrameHasChildrenOutOfRect_ = false;
1257     nodeTest->renderContent_->renderProperties_.boundsGeo_ = std::make_shared<RSObjAbsGeometry>();
1258     EXPECT_NE(nodeTest->renderContent_->renderProperties_.boundsGeo_, nullptr);
1259     nodeTest->hasChildrenOutOfRect_ = true;
1260     nodeTest->SubTreeSkipPrepare(dirtyManagerTest2, true, true, clipRectTest2);
1261 
1262     RSDirtyRegionManager dirtyManagerTest3;
1263     RectI clipRectTest3 = RectI { 0, 0, 1, 1 };
1264     nodeTest->srcOrClipedAbsDrawRectChangeFlag_ = true;
1265     nodeTest->hasChildrenOutOfRect_ = false;
1266     nodeTest->lastFrameHasChildrenOutOfRect_ = true;
1267     nodeTest->renderContent_->renderProperties_.boundsGeo_ = nullptr;
1268     nodeTest->SubTreeSkipPrepare(dirtyManagerTest3, false, true, clipRectTest3);
1269 }
1270 
1271 /**
1272  * @tc.name: IsSubTreeNeedPrepareTest034
1273  * @tc.desc: Prepare QuickPrepare IsSubTreeNeedPrepare IsUifirstArkTsCardNode test
1274  * @tc.type: FUNC
1275  * @tc.require: issueIA5Y41
1276  */
1277 HWTEST_F(RSRenderNodeTest2, IsSubTreeNeedPrepareTest034, TestSize.Level1)
1278 {
1279     std::shared_ptr<RSSurfaceRenderNode> nodeTest = std::make_shared<RSSurfaceRenderNode>(0);
1280     EXPECT_NE(nodeTest, nullptr);
1281 
1282     std::shared_ptr<RSNodeVisitor> visitor = nullptr;
1283     nodeTest->Prepare(visitor);
1284     nodeTest->QuickPrepare(visitor);
1285 
1286     nodeTest->shouldPaint_ = false;
1287     EXPECT_FALSE(nodeTest->IsSubTreeNeedPrepare(false, false));
1288     nodeTest->shouldPaint_ = true;
1289     EXPECT_FALSE(nodeTest->IsSubTreeNeedPrepare(false, true));
1290     nodeTest->isSubTreeDirty_ = true;
1291     EXPECT_TRUE(nodeTest->IsSubTreeNeedPrepare(false, false));
1292     nodeTest->isSubTreeDirty_ = false;
1293     nodeTest->childHasSharedTransition_ = true;
1294     EXPECT_TRUE(nodeTest->IsSubTreeNeedPrepare(false, false));
1295     nodeTest->childHasSharedTransition_ = false;
1296     nodeTest->childHasVisibleFilter_ = true;
1297     EXPECT_FALSE(nodeTest->IsSubTreeNeedPrepare(false, false));
1298 
1299     nodeTest->nodeGroupType_ = RSRenderNode::NONE;
1300     EXPECT_FALSE(nodeTest->IsUifirstArkTsCardNode());
1301     nodeTest->nodeGroupType_ = RSRenderNode::GROUPED_BY_ANIM;
1302     EXPECT_FALSE(nodeTest->IsUifirstArkTsCardNode());
1303 }
1304 
1305 /**
1306  * @tc.name: CollectAndUpdateLocalDistortionEffectRecttest
1307  * @tc.desc: CollectAndUpdateLocalDistortionEffectRect
1308  * @tc.type: FUNC
1309  * @tc.require: issueIAS8IM
1310  */
1311 HWTEST_F(RSRenderNodeTest2, CollectAndUpdateLocalDistortionEffectRecttest, TestSize.Level1)
1312 {
1313     RSRenderNode node(id, context);
1314     float width = 100.0f; // 100: set width of bounds
1315     float height = 100.0f; // 100: set height of bounds
1316     Vector4f bounds(0.0, 0.0, width, height);
1317     node.renderContent_->renderProperties_.SetBounds(bounds);
1318     node.CollectAndUpdateLocalDistortionEffectRect();
1319     EXPECT_FALSE(node.localDistortionEffectRect_.width_ > static_cast<int>(width));
1320 
1321     node.renderContent_->renderProperties_.SetDistortionK(0.5f); // 0.5 is k of value in distortion
1322     EXPECT_TRUE(node.renderContent_->renderProperties_.GetDistortionDirty());
1323     node.CollectAndUpdateLocalDistortionEffectRect();
1324     EXPECT_FALSE(node.renderContent_->renderProperties_.GetDistortionDirty());
1325 }
1326 
1327 /**
1328  * @tc.name: ChildrenBlurBehindWindowTest
1329  * @tc.desc: ChildrenBlurBehindWindowTest
1330  * @tc.type: FUNC
1331  * @tc.require: issueIB0UQV
1332  */
1333 HWTEST_F(RSRenderNodeTest2, ChildrenBlurBehindWindowTest, TestSize.Level1)
1334 {
1335     auto rsContext = std::make_shared<RSContext>();
1336     auto node = std::make_shared<RSRenderNode>(0, rsContext);
1337     NodeId idOne = 1;
1338     NodeId idTwo = 2;
1339     node->AddChildBlurBehindWindow(idOne);
1340     ASSERT_FALSE(node->NeedDrawBehindWindow());
1341     node->RemoveChildBlurBehindWindow(idTwo);
1342     ASSERT_FALSE(node->NeedDrawBehindWindow());
1343     node->RemoveChildBlurBehindWindow(idOne);
1344     ASSERT_FALSE(node->NeedDrawBehindWindow());
1345 }
1346 
1347 /**
1348  * @tc.name: ProcessBehindWindowOnTreeStateChangedTest
1349  * @tc.desc: ProcessBehindWindowOnTreeStateChangedTest
1350  * @tc.type: FUNC
1351  * @tc.require: issueIB0UQV
1352  */
1353 HWTEST_F(RSRenderNodeTest2, ProcessBehindWindowOnTreeStateChangedTest, TestSize.Level1)
1354 {
1355     auto rsContext = std::make_shared<RSContext>();
1356     auto node = std::make_shared<RSRenderNode>(0, rsContext);
1357     node->ProcessBehindWindowOnTreeStateChanged();
1358     auto rootNode = std::make_shared<RSRenderNode>(1);
1359     rsContext->nodeMap.renderNodeMap_[0][1] = rootNode;
1360     node->renderContent_->renderProperties_.SetUseEffect(true);
1361     node->renderContent_->renderProperties_.SetUseEffectType(1);
1362     node->isOnTheTree_ = true;
1363     node->ProcessBehindWindowOnTreeStateChanged();
1364     node->isOnTheTree_ = false;
1365     node->ProcessBehindWindowOnTreeStateChanged();
1366 }
1367 
1368 /**
1369  * @tc.name: ProcessBehindWindowAfterApplyModifiersTest
1370  * @tc.desc: ProcessBehindWindowAfterApplyModifiersTest
1371  * @tc.type: FUNC
1372  * @tc.require: issueIB0UQV
1373  */
1374 HWTEST_F(RSRenderNodeTest2, ProcessBehindWindowAfterApplyModifiersTest, TestSize.Level1)
1375 {
1376     auto rsContext = std::make_shared<RSContext>();
1377     auto node = std::make_shared<RSRenderNode>(0, rsContext);
1378     node->ProcessBehindWindowAfterApplyModifiers();
1379     auto rootNode = std::make_shared<RSRenderNode>(1);
1380     rsContext->nodeMap.renderNodeMap_[0][1] = rootNode;
1381     node->renderContent_->renderProperties_.SetUseEffect(false);
1382     node->ProcessBehindWindowAfterApplyModifiers();
1383     node->renderContent_->renderProperties_.SetUseEffect(true);
1384     node->renderContent_->renderProperties_.SetUseEffectType(1);
1385     node->ProcessBehindWindowAfterApplyModifiers();
1386 }
1387 } // namespace Rosen
1388 } // namespace OHOS