1 /*
2  * Copyright (c) 2022 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 <cstdlib>
17 #include <cstring>
18 #include <memory>
19 #include <string.h>
20 #include <securec.h>
21 #include "gtest/gtest.h"
22 #include "gtest/hwext/gtest-tag.h"
23 #include "common/rs_vector4.h"
24 #include "modifier/rs_render_modifier.h"
25 #include "pipeline/rs_recording_canvas.h"
26 
27 #include "message_parcel.h"
28 #include "property/rs_properties.h"
29 
30 using namespace testing;
31 using namespace testing::ext;
32 
33 namespace OHOS::Rosen {
34 class RSRenderModifierTest : public testing::Test {
35 public:
36     constexpr static float floatData[] = {
37         0.0f, 485.44f, 2.0f,
38         std::numeric_limits<float>::max(), std::numeric_limits<float>::min(),
39         };
40     Color colorData[3] = { Color(255, 0, 0), Color(0, 255, 0), Color(0, 0, 255)};
41     PropertyId id = 100;
42     static void SetUpTestCase();
43     static void TearDownTestCase();
44     void SetUp() override;
45     void TearDown() override;
46 };
47 
SetUpTestCase()48 void RSRenderModifierTest::SetUpTestCase() {}
TearDownTestCase()49 void RSRenderModifierTest::TearDownTestCase() {}
SetUp()50 void RSRenderModifierTest::SetUp() {}
TearDown()51 void RSRenderModifierTest::TearDown() {}
52 
53 /**
54  * @tc.name: RSGeometryTransRenderModifier
55  * @tc.desc:
56  * @tc.type:FUNC
57  */
58 HWTEST_F(RSRenderModifierTest, RSGeometryTransRenderModifier, TestSize.Level1)
59 {
60     auto prop = std::make_shared<RSRenderProperty<Drawing::Matrix>>();
61     auto modifier = std::make_shared<RSGeometryTransRenderModifier>(prop);
62     RSProperties properties;
63     RSModifierContext context(properties);
64     auto rsRenderPropertyBase = std::make_shared<RSRenderProperty<Drawing::Matrix>>();
65     ASSERT_TRUE(modifier != nullptr);
66     modifier->Apply(context);
67     modifier->Update(rsRenderPropertyBase, false);
68     ASSERT_TRUE(modifier->GetProperty() == prop);
69     ASSERT_TRUE(modifier->GetPropertyId() == 0);
70     modifier->SetType(RSModifierType::BOUNDS);
71     ASSERT_TRUE(modifier->GetType() == RSModifierType::BOUNDS);
72 
73     MessageParcel parcel;
74     ASSERT_TRUE(modifier->Marshalling(parcel));
75     ASSERT_TRUE(RSGeometryTransRenderModifier::Unmarshalling(parcel) != nullptr);
76 }
77 
78 /**
79  * @tc.name: LifeCycle001
80  * @tc.desc:
81  * @tc.type:FUNC
82  */
83 HWTEST_F(RSRenderModifierTest, LifeCycle001, TestSize.Level1)
84 {
85     auto prop = std::make_shared<RSRenderProperty<float>>();
86     auto modifier = std::make_shared<RSAlphaRenderModifier>(prop);
87     ASSERT_TRUE(modifier != nullptr);
88     ASSERT_TRUE(modifier->GetProperty() == prop);
89     ASSERT_TRUE(modifier->GetPropertyId() == 0);
90 
91     auto prop2 = std::make_shared<RSRenderProperty<float>>(floatData[0], id);
92     auto modifier2 = std::make_shared<RSAlphaRenderModifier>(prop2);
93     ASSERT_TRUE(modifier2 != nullptr);
94     ASSERT_EQ(modifier2->GetPropertyId(), id);
95 }
96 
97 /**
98  * @tc.name: Modifier001
99  * @tc.desc:
100  * @tc.type:FUNC
101  */
102 HWTEST_F(RSRenderModifierTest, Modifier001, TestSize.Level1)
103 {
104     auto prop = std::make_shared<RSRenderProperty<float>>(floatData[0], id);
105     auto modifier = std::make_shared<RSAlphaRenderModifier>(prop);
106     ASSERT_TRUE(prop != nullptr);
107     ASSERT_EQ(modifier->GetProperty(), prop);
108 
109     auto prop1 = std::make_shared<RSRenderProperty<float>>(floatData[1], id);
110     modifier->Update(prop1, false);
111     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<float>>(modifier->GetProperty())->Get(), floatData[1]);
112 
113     auto prop2 = std::make_shared<RSRenderProperty<float>>(floatData[2], id);
114     modifier->Update(prop2, true);
115     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<float>>(modifier->GetProperty())->Get(),
116         floatData[1] + floatData[2]);
117 }
118 
119 /**
120  * @tc.name: DrawCmdListModifier001
121  * @tc.desc:
122  * @tc.type:FUNC
123  */
124 HWTEST_F(RSRenderModifierTest, DrawCmdListModifier001, TestSize.Level1)
125 {
126     ExtendRecordingCanvas canvas(100, 100);
127     canvas.Translate(15.f, 15.f);
128 
129     auto prop = std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>(canvas.GetDrawCmdList(), id);
130     auto modifier = std::make_shared<RSDrawCmdListRenderModifier>(prop);
131 
132     MessageParcel parcel;
133     ASSERT_TRUE(modifier->Marshalling(parcel));
134     ASSERT_TRUE(RSDrawCmdListRenderModifier::Unmarshalling(parcel) != nullptr);
135 
136     canvas.Scale(2.f, 2.f);
137     modifier->Update(nullptr, false);
138     auto prop1 = std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>(canvas.GetDrawCmdList(), id);
139     modifier->Update(prop1, true);
140 
141     ASSERT_TRUE(modifier->Marshalling(parcel));
142     ASSERT_TRUE(RSDrawCmdListRenderModifier::Unmarshalling(parcel) != nullptr);
143 
144     MessageParcel parcel1;
145     char* buffer = static_cast<char *>(malloc(parcel1.GetMaxCapacity()));
146     memset_s(buffer, parcel1.GetMaxCapacity(), 0, parcel1.GetMaxCapacity());
147     ASSERT_TRUE(parcel1.WriteUnpadBuffer(buffer, parcel1.GetMaxCapacity()));
148     bool ret = false;
149     while (!ret) {
150         ret = (modifier->Marshalling(parcel) && (RSDrawCmdListRenderModifier::Unmarshalling(parcel) != nullptr));
151         parcel1.SetMaxCapacity(parcel1.GetMaxCapacity() + 1);
152     }
153     free(buffer);
154     ASSERT_TRUE(ret);
155 }
156 
157 /**
158  * @tc.name: RSParticlesRenderModifier001
159  * @tc.desc:Update
160  * @tc.type:FUNC
161  */
162 HWTEST_F(RSRenderModifierTest, RSParticlesRenderModifier002, TestSize.Level1)
163 {
164     auto prop = std::make_shared<RSRenderProperty<RSRenderParticleVector>>();
165     bool isDelta = false;
166     auto property = std::make_shared<RSRenderProperty<RSRenderParticleVector>>();
167     auto RSPRM = std::make_shared<RSParticlesRenderModifier>(property);
168     RSPRM->Update(prop, isDelta);
169     ASSERT_NE(nullptr, RSPRM->property_);
170 }
171 
172 /**
173  * @tc.name: RSEnvForegroundColorRenderModifier002
174  * @tc.desc:Update
175  * @tc.type:FUNC
176  */
177 HWTEST_F(RSRenderModifierTest, RSEnvForegroundColorRenderModifier002, TestSize.Level1)
178 {
179     auto prop = std::make_shared<RSRenderAnimatableProperty<Color>>();
180     bool isDelta = false;
181     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
182     auto RSEFC = std::make_shared<RSEnvForegroundColorRenderModifier>(property);
183     RSEFC->Update(prop, isDelta);
184     ASSERT_NE(nullptr, RSEFC->property_);
185 }
186 
187 /**
188  * @tc.name: RSEnvForegroundColorStrategyRenderModifier001
189  * @tc.desc:Apply
190  * @tc.type:FUNC
191  */
192 HWTEST_F(RSRenderModifierTest, RSEnvForegroundColorStrategyRenderModifier001, TestSize.Level1)
193 {
194     auto prop = std::make_shared<RSRenderAnimatableProperty<Color>>();
195     bool isDelta = false;
196     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
197     auto RSEFCS = std::make_shared<RSEnvForegroundColorRenderModifier>(property);
198     RSEFCS->Update(prop, isDelta);
199     ASSERT_NE(nullptr, RSEFCS->property_);
200 }
201 
202 /**
203  * @tc.name: Apply
204  * @tc.desc: Test Apply and Update and Marshalling
205  * @tc.type: FUNC
206  * @tc.require: issueI9QIQO
207  */
208 HWTEST_F(RSRenderModifierTest, Apply, TestSize.Level1)
209 {
210     ExtendRecordingCanvas canvas(100, 100);
211     canvas.Translate(15.f, 15.f);
212     auto prop = std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>(canvas.GetDrawCmdList(), id);
213     auto modifier = std::make_shared<RSDrawCmdListRenderModifier>(prop);
214     RSProperties properties;
215     RSModifierContext context(properties);
216     modifier->Apply(context);
217     RSPaintFilterCanvas paintFilterCanvas(&canvas);
218     context.canvas_ = &paintFilterCanvas;
219     modifier->Apply(context);
220     ASSERT_NE(nullptr, context.canvas_);
221 
222     modifier->Update(prop, true);
223     ASSERT_NE(modifier->GetProperty(), nullptr);
224 
225     Parcel parcel;
226     ASSERT_TRUE(modifier->Marshalling(parcel));
227 }
228 
229 /**
230  * @tc.name: RSEnvForegroundColorRenderModifier001
231  * @tc.desc: Test Apply and Marshalling
232  * @tc.type:FUNC
233  * @tc.require: issueI9QIQO
234  */
235 HWTEST_F(RSRenderModifierTest, RSEnvForegroundColorRenderModifier001, TestSize.Level1)
236 {
237     auto prop = std::make_shared<RSRenderAnimatableProperty<Color>>();
238     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
239     auto modifier = std::make_shared<RSEnvForegroundColorRenderModifier>(property);
240     RSProperties properties;
241     ExtendRecordingCanvas canvas(100, 100);
242     RSPaintFilterCanvas paintFilterCanvas(&canvas);
243     RSModifierContext context(properties, &paintFilterCanvas);
244     modifier->Apply(context);
245     ASSERT_NE(nullptr, context.canvas_);
246 
247     Parcel parcel;
248     ASSERT_TRUE(modifier->Marshalling(parcel));
249 }
250 
251 /**
252  * @tc.name: RSEnvForegroundColorStrategyRenderModifier001
253  * @tc.desc: test Apply and Marshalling and CalculateInvertColor and GetInvertBackgroundColor and Update
254  * @tc.type:FUNC
255  * @tc.require: issueI9QIQO
256  */
257 HWTEST_F(RSRenderModifierTest, RSEnvForegroundColorStrategyRenderModifier002, TestSize.Level1)
258 {
259     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
260     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
261     RSProperties properties;
262     RSModifierContext context(properties);
263     modifier->Apply(context);
264     ASSERT_EQ(nullptr, context.canvas_);
265 
266     ForegroundColorStrategyType type = ForegroundColorStrategyType::INVERT_BACKGROUNDCOLOR;
267     auto modifierTwo = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
268 
269     auto renderProperty =
270         std::static_pointer_cast<RSRenderProperty<ForegroundColorStrategyType>>(modifierTwo->property_);
271     renderProperty->stagingValue_ = type;
272     ExtendRecordingCanvas canvas(100, 100);
273     Drawing::Surface surface;
274     RSPaintFilterCanvas paintFilterCanvas(&canvas);
275     paintFilterCanvas.surface_ = &surface;
276     RSModifierContext contextArgs(properties, &paintFilterCanvas);
277     ASSERT_NE(nullptr, contextArgs.canvas_);
278     modifierTwo->Apply(contextArgs);
279     ASSERT_NE(nullptr, contextArgs.canvas_);
280 
281     Parcel parcel;
282     ASSERT_TRUE(modifier->Marshalling(parcel));
283 
284     ASSERT_EQ(modifier->CalculateInvertColor(Color()).alpha_, 0.f);
285 
286     modifier->GetInvertBackgroundColor(contextArgs);
287     properties.SetClipToBounds(true);
288     ASSERT_EQ(modifier->GetInvertBackgroundColor(contextArgs).alpha_, 0.f);
289 
290     std::shared_ptr<RSRenderPropertyBase> propTwo;
291     modifier->Update(propTwo, true);
292     ASSERT_EQ(propTwo, nullptr);
293 }
294 
295 /**
296  * @tc.name: CanvasNull
297  * @tc.desc: Test Apply
298  * @tc.type:FUNC
299  * @tc.require: issueI9QIQO
300  */
301 HWTEST_F(RSRenderModifierTest, CanvasNull, TestSize.Level1)
302 {
303     ExtendRecordingCanvas canvas(100, 100);
304     canvas.Translate(15.f, 15.f);
305     auto prop = std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>(canvas.GetDrawCmdList(), id);
306     auto modifier = std::make_shared<RSDrawCmdListRenderModifier>(prop);
307     RSProperties properties;
308     RSModifierContext context(properties);
309     context.canvas_ = nullptr;
310     modifier->Apply(context);
311     bool ret = false;
312     ASSERT_EQ(ret, false);
313 }
314 
315 /**
316  * @tc.name: CanvasNotNull
317  * @tc.desc: Test Apply
318  * @tc.type:FUNC
319  * @tc.require: issueI9QIQO
320  */
321 HWTEST_F(RSRenderModifierTest, CanvasNotNull, TestSize.Level1)
322 {
323     ExtendRecordingCanvas canvas(100, 100);
324     canvas.Translate(15.f, 15.f);
325     auto prop = std::make_shared<RSRenderProperty<Drawing::DrawCmdListPtr>>(canvas.GetDrawCmdList(), id);
326     auto modifier = std::make_shared<RSDrawCmdListRenderModifier>(prop);
327     RSProperties properties;
328     RSModifierContext context(properties);
329     Drawing::Canvas* canvas1 = new Drawing::Canvas();
330     context.canvas_ = new RSPaintFilterCanvas(canvas1);
331     modifier->Apply(context);
332 
333     bool ret = true;
334     ASSERT_EQ(ret, true);
335 }
336 
337 /**
338  * @tc.name: Marshalling
339  * @tc.desc: Test Marshalling
340  * @tc.type:FUNC
341  * @tc.require: issueI9QIQO
342  */
343 HWTEST_F(RSRenderModifierTest, Marshalling, TestSize.Level1)
344 {
345     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
346     auto RSEFC = std::make_shared<RSEnvForegroundColorRenderModifier>(property);
347     Parcel parcel;
348     bool ret = RSEFC->Marshalling(parcel);
349     ASSERT_TRUE(ret == true);
350 }
351 
352 /**
353  * @tc.name: Apply001
354  * @tc.desc: Test Apply
355  * @tc.type:FUNC
356  * @tc.require: issueI9QIQO
357  */
358 HWTEST_F(RSRenderModifierTest, Apply001, TestSize.Level1)
359 {
360     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
361     auto RSEFC = std::make_shared<RSEnvForegroundColorRenderModifier>(property);
362     ExtendRecordingCanvas canvas(100, 100);
363     RSPaintFilterCanvas paintFilterCanvas(&canvas);
364     RSProperties properties;
365     RSModifierContext contextArgs(properties, &paintFilterCanvas);
366     RSEFC->Apply(contextArgs);
367     bool ret = true;
368     ASSERT_TRUE(ret == true);
369 }
370 
371 /**
372  * @tc.name: Marshalling001
373  * @tc.desc: Test Marshalling
374  * @tc.type:FUNC
375  * @tc.require: issueI9QIQO
376  */
377 HWTEST_F(RSRenderModifierTest, Marshalling001, TestSize.Level1)
378 {
379     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
380     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
381     Parcel parcel;
382     bool ret = modifier->Marshalling(parcel);
383     ASSERT_TRUE(ret == true);
384 }
385 
386 /**
387  * @tc.name: Apply002
388  * @tc.desc: Test Marshalling
389  * @tc.type:FUNC
390  * @tc.require: issueI9QIQO
391  */
392 HWTEST_F(RSRenderModifierTest, Apply002, TestSize.Level1)
393 {
394     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
395     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
396     RSProperties properties;
397     RSModifierContext context(properties);
398     modifier->Apply(context);
399     bool ret = true;
400     ASSERT_TRUE(ret == true);
401 }
402 
403 /**
404  * @tc.name: GetInvertBackgroundColor
405  * @tc.desc: Test GetInvertBackgroundColor
406  * @tc.type:FUNC
407  * @tc.require: issueI9QIQO
408  */
409 HWTEST_F(RSRenderModifierTest, GetInvertBackgroundColor, TestSize.Level1)
410 {
411     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
412     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
413     RSProperties properties;
414     RSModifierContext context(properties);
415     ExtendRecordingCanvas canvas(100, 100);
416     Drawing::Surface surface;
417     RSPaintFilterCanvas paintFilterCanvas(&canvas);
418     paintFilterCanvas.surface_ = &surface;
419     RSModifierContext contextArgs(properties, &paintFilterCanvas);
420     RSColor color;
421     color.SetAlpha(0xff);
422     contextArgs.properties_.SetBackgroundColor(color);
423     modifier->GetInvertBackgroundColor(contextArgs);
424     bool ret = true;
425     ASSERT_TRUE(ret == true);
426 }
427 
428 /**
429  * @tc.name: Update001
430  * @tc.desc: Test Update
431  * @tc.type:FUNC
432  * @tc.require: issueI9QIQO
433  */
434 HWTEST_F(RSRenderModifierTest, Update001, TestSize.Level1)
435 {
436     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
437     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
438     RSProperties properties;
439     RSModifierContext context(properties);
440     const std::shared_ptr<RSRenderPropertyBase> prop;
441     bool isDelta = false;
442     modifier->Update(prop, isDelta);
443     bool ret = true;
444     ASSERT_TRUE(ret == true);
445 }
446 
447 /**
448  * @tc.name: Apply003
449  * @tc.desc: Test Apply
450  * @tc.type:FUNC
451  * @tc.require: issueI9QIQO
452  */
453 HWTEST_F(RSRenderModifierTest, Apply003, TestSize.Level1)
454 {
455     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
456     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
457     RSProperties properties;
458     RSModifierContext context(properties);
459     auto test = std::make_shared<RSRenderProperty<ForegroundColorStrategyType>>();
460     modifier->property_ = test;
461     modifier->Apply(context);
462     bool ret = true;
463     ASSERT_TRUE(ret == true);
464 }
465 
466 /**
467  * @tc.name: CalculateInvertColor
468  * @tc.desc: Test CalculateInvertColor
469  * @tc.type:FUNC
470  * @tc.require: issueI9QIQO
471  */
472 HWTEST_F(RSRenderModifierTest, CalculateInvertColor, TestSize.Level1)
473 {
474     auto property = std::make_shared<RSRenderAnimatableProperty<Color>>();
475     auto modifier = std::make_shared<RSEnvForegroundColorStrategyRenderModifier>(property);
476     RSProperties properties;
477     RSModifierContext context(properties);
478     Color backgroundColor;
479     modifier->CalculateInvertColor(backgroundColor);
480     bool ret = true;
481     ASSERT_TRUE(ret == true);
482 }
483 
484 /**
485  * @tc.name: RSCustomClipToFrameRenderModifier001
486  * @tc.desc: Test Apply and Marshalling
487  * @tc.type:FUNC
488  * @tc.require: issueI9QIQO
489  */
490 HWTEST_F(RSRenderModifierTest, RSCustomClipToFrameRenderModifier001, TestSize.Level1)
491 {
492     auto property = std::make_shared<RSRenderAnimatableProperty<Vector4f>>();
493     auto modifier = std::make_shared<RSCustomClipToFrameRenderModifier>(property);
494     RSProperties properties;
495     ExtendRecordingCanvas canvas(100, 100);
496     RSPaintFilterCanvas paintFilterCanvas(&canvas);
497     RSModifierContext context(properties, &paintFilterCanvas);
498     modifier->Apply(context);
499     ASSERT_NE(nullptr, context.canvas_);
500 
501     Parcel parcel;
502     ASSERT_TRUE(modifier->Marshalling(parcel));
503 }
504 
505 /**
506  * @tc.name: RSCustomClipToFrameRenderModifier002
507  * @tc.desc:Update
508  * @tc.type:FUNC
509  */
510 HWTEST_F(RSRenderModifierTest, RSCustomClipToFrameRenderModifier002, TestSize.Level1)
511 {
512     auto prop = std::make_shared<RSRenderAnimatableProperty<Vector4f>>();
513     bool isDelta = false;
514     auto property = std::make_shared<RSRenderAnimatableProperty<Vector4f>>();
515     auto RSEFC = std::make_shared<RSCustomClipToFrameRenderModifier>(property);
516     RSEFC->Update(prop, isDelta);
517     ASSERT_NE(nullptr, RSEFC->property_);
518 }
519 
520 /**
521  * @tc.name: RSBehindWindowFilterRadiusRenderModifier001
522  * @tc.desc: Test Marshalling and Update
523  * @tc.type: FUNC
524  * @tc.require: issueIB0UQV
525  */
526 HWTEST_F(RSRenderModifierTest, RSBehindWindowFilterRadiusRenderModifier001, TestSize.Level1)
527 {
528     auto prop = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[0], id);
529     ASSERT_TRUE(prop != nullptr);
530     auto modifier = std::make_shared<RSBehindWindowFilterRadiusRenderModifier>(prop);
531     ASSERT_EQ(modifier->GetProperty(), prop);
532 
533     auto prop1 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[1], id);
534     modifier->Update(prop1, false);
535     ASSERT_EQ(std::static_pointer_cast<RSRenderAnimatableProperty<float>>(modifier->GetProperty())->Get(),
536         floatData[1]);
537     auto prop2 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[2], id);
538     modifier->Update(prop2, true);
539     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<float>>(modifier->GetProperty())->Get(),
540         floatData[1] + floatData[2]);
541     Parcel parcel;
542     ASSERT_TRUE(modifier->Marshalling(parcel));
543 }
544 
545 /**
546  * @tc.name: RSBehindWindowFilterSaturationRenderModifier001
547  * @tc.desc: Test Marshalling and Update
548  * @tc.type: FUNC
549  * @tc.require: issueIB0UQV
550  */
551 HWTEST_F(RSRenderModifierTest, RSBehindWindowFilterSaturationRenderModifier001, TestSize.Level1)
552 {
553     auto prop = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[0], id);
554     ASSERT_TRUE(prop != nullptr);
555     auto modifier = std::make_shared<RSBehindWindowFilterSaturationRenderModifier>(prop);
556     ASSERT_EQ(modifier->GetProperty(), prop);
557 
558     auto prop1 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[1], id);
559     modifier->Update(prop1, false);
560     ASSERT_EQ(std::static_pointer_cast<RSRenderAnimatableProperty<float>>(modifier->GetProperty())->Get(),
561         floatData[1]);
562     auto prop2 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[2], id);
563     modifier->Update(prop2, true);
564     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<float>>(modifier->GetProperty())->Get(),
565         floatData[1] + floatData[2]);
566     Parcel parcel;
567     ASSERT_TRUE(modifier->Marshalling(parcel));
568 }
569 
570 /**
571  * @tc.name: RSBehindWindowFilterBrightnessRenderModifier001
572  * @tc.desc: Test Marshalling and Update
573  * @tc.type: FUNC
574  * @tc.require: issueIB0UQV
575  */
576 HWTEST_F(RSRenderModifierTest, RSBehindWindowFilterBrightnessRenderModifier001, TestSize.Level1)
577 {
578     auto prop = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[0], id);
579     ASSERT_TRUE(prop != nullptr);
580     auto modifier = std::make_shared<RSBehindWindowFilterBrightnessRenderModifier>(prop);
581     ASSERT_EQ(modifier->GetProperty(), prop);
582 
583     auto prop1 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[1], id);
584     modifier->Update(prop1, false);
585     ASSERT_EQ(std::static_pointer_cast<RSRenderAnimatableProperty<float>>(modifier->GetProperty())->Get(),
586         floatData[1]);
587     auto prop2 = std::make_shared<RSRenderAnimatableProperty<float>>(floatData[2], id);
588     modifier->Update(prop2, true);
589     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<float>>(modifier->GetProperty())->Get(),
590         floatData[1] + floatData[2]);
591     Parcel parcel;
592     ASSERT_TRUE(modifier->Marshalling(parcel));
593 }
594 
595 /**
596  * @tc.name: RSBehindWindowFilterMaskColorRenderModifier001
597  * @tc.desc: Test Marshalling and Update
598  * @tc.type: FUNC
599  * @tc.require: issueIB0UQV
600  */
601 HWTEST_F(RSRenderModifierTest, RSBehindWindowFilterMaskColorRenderModifier001, TestSize.Level1)
602 {
603     auto prop = std::make_shared<RSRenderAnimatableProperty<Color>>(colorData[0], id);
604     ASSERT_TRUE(prop != nullptr);
605     auto modifier = std::make_shared<RSBehindWindowFilterMaskColorRenderModifier>(prop);
606     ASSERT_EQ(modifier->GetProperty(), prop);
607 
608     auto prop1 = std::make_shared<RSRenderAnimatableProperty<Color>>(colorData[1], id);
609     modifier->Update(prop1, false);
610     ASSERT_EQ(std::static_pointer_cast<RSRenderAnimatableProperty<Color>>(modifier->GetProperty())->Get(),
611         colorData[1]);
612     auto prop2 = std::make_shared<RSRenderAnimatableProperty<Color>>(colorData[2], id);
613     modifier->Update(prop2, true);
614     ASSERT_EQ(std::static_pointer_cast<RSRenderProperty<Color>>(modifier->GetProperty())->Get(),
615         colorData[1] + colorData[2]);
616     Parcel parcel;
617     ASSERT_TRUE(modifier->Marshalling(parcel));
618 }
619 }
620