Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-VisualRenderer.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // EXTERNAL INCLUDES
19 #include <dali/devel-api/actors/actor-devel.h>
20 #include <dali/devel-api/common/capabilities.h>
21 #include <dali/devel-api/common/stage.h>
22 #include <dali/devel-api/rendering/renderer-devel.h>
23 #include <dali/integration-api/render-task-list-integ.h>
24 #include <dali/public-api/dali-core.h>
25 #include <cstdio>
26 #include <string>
27
28 // INTERNAL INCLUDES
29 #include <dali-test-suite-utils.h>
30 #include <mesh-builder.h>
31 #include <test-trace-call-stack.h>
32 #include "test-graphics-command-buffer.h"
33
34 using namespace Dali;
35
36 void visual_renderer_test_startup(void)
37 {
38   test_return_value = TET_UNDEF;
39 }
40
41 void visual_renderer_test_cleanup(void)
42 {
43   test_return_value = TET_PASS;
44 }
45
46 int UtcDaliVisualRendererNew01(void)
47 {
48   TestApplication application;
49
50   Geometry       geometry = CreateQuadGeometry();
51   Shader         shader   = CreateShader();
52   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
53
54   DALI_TEST_EQUALS((bool)renderer, true, TEST_LOCATION);
55   END_TEST;
56 }
57
58 int UtcDaliVisualRendererNew02(void)
59 {
60   TestApplication application;
61   VisualRenderer  renderer;
62   DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION);
63   END_TEST;
64 }
65
66 int UtcDaliVisualRendererCopyConstructor(void)
67 {
68   TestApplication application;
69
70   Geometry       geometry = CreateQuadGeometry();
71   Shader         shader   = CreateShader();
72   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
73
74   VisualRenderer rendererCopy(renderer);
75   DALI_TEST_EQUALS((bool)rendererCopy, true, TEST_LOCATION);
76
77   END_TEST;
78 }
79
80 int UtcDaliVisualRendererAssignmentOperator(void)
81 {
82   TestApplication application;
83
84   Geometry       geometry = CreateQuadGeometry();
85   Shader         shader   = CreateShader();
86   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
87
88   VisualRenderer renderer2;
89   DALI_TEST_EQUALS((bool)renderer2, false, TEST_LOCATION);
90
91   renderer2 = renderer;
92   DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION);
93   END_TEST;
94 }
95
96 int UtcDaliVisualRendererMoveConstructor(void)
97 {
98   TestApplication application;
99
100   Geometry       geometry = CreateQuadGeometry();
101   Shader         shader   = Shader::New("vertexSrc", "fragmentSrc");
102   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
103   DALI_TEST_CHECK(renderer);
104   DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
105   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), Vector3::ONE, TEST_LOCATION);
106
107   auto testColor = Vector3(1.0f, 0.0f, 1.0f);
108   renderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, testColor);
109   application.SendNotification();
110   application.Render();
111   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), testColor, TEST_LOCATION);
112
113   VisualRenderer move = std::move(renderer);
114   DALI_TEST_CHECK(move);
115   DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
116   DALI_TEST_EQUALS(move.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), testColor, TEST_LOCATION);
117   DALI_TEST_CHECK(!renderer);
118
119   END_TEST;
120 }
121
122 int UtcDaliVisualRendererMoveAssignment(void)
123 {
124   TestApplication application;
125
126   Geometry       geometry = CreateQuadGeometry();
127   Shader         shader   = Shader::New("vertexSrc", "fragmentSrc");
128   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
129   DALI_TEST_CHECK(renderer);
130   DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
131   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), Vector3::ONE, TEST_LOCATION);
132
133   renderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(1.0f, 0.0f, 1.0f));
134   application.SendNotification();
135   application.Render();
136   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), Vector3(1.0f, 0.0f, 1.0f), TEST_LOCATION);
137
138   VisualRenderer move;
139   move = std::move(renderer);
140   DALI_TEST_CHECK(move);
141   DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
142   DALI_TEST_EQUALS(move.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR), Vector3(1.0f, 0.0f, 1.0f), TEST_LOCATION);
143   DALI_TEST_CHECK(!renderer);
144
145   END_TEST;
146 }
147
148 int UtcDaliVisualRendererDownCast01(void)
149 {
150   TestApplication application;
151
152   Geometry       geometry = CreateQuadGeometry();
153   Shader         shader   = CreateShader();
154   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
155
156   BaseHandle     handle(renderer);
157   VisualRenderer renderer2 = VisualRenderer::DownCast(handle);
158   DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION);
159   END_TEST;
160 }
161
162 int UtcDaliVisualRendererDownCast02(void)
163 {
164   TestApplication application;
165
166   Handle         handle   = Handle::New(); // Create a custom object
167   VisualRenderer renderer = VisualRenderer::DownCast(handle);
168   DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION);
169   END_TEST;
170 }
171
172 // using a template to auto deduce the parameter types
173 template<typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
174 void TEST_RENDERER_PROPERTY(P1 renderer, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION)
175 {
176   DALI_TEST_EQUALS(renderer.GetPropertyName(enumName), stringName, LOCATION);
177   DALI_TEST_EQUALS(renderer.GetPropertyIndex(stringName), static_cast<Property::Index>(enumName), LOCATION);
178   DALI_TEST_EQUALS(renderer.GetPropertyType(enumName), type, LOCATION);
179   DALI_TEST_EQUALS(renderer.IsPropertyWritable(enumName), isWriteable, LOCATION);
180   DALI_TEST_EQUALS(renderer.IsPropertyAnimatable(enumName), isAnimateable, LOCATION);
181   DALI_TEST_EQUALS(renderer.IsPropertyAConstraintInput(enumName), isConstraintInput, LOCATION);
182 }
183
184 int UtcDaliVisualRendererDefaultProperties(void)
185 {
186   TestApplication application;
187   Geometry        geometry     = CreateQuadGeometry();
188   Shader          shader       = CreateShader();
189   VisualRenderer  renderer     = VisualRenderer::New(geometry, shader);
190   Renderer        baseRenderer = Renderer::New(geometry, shader);
191
192   DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 27, TEST_LOCATION);
193   DALI_TEST_EQUALS(renderer.GetPropertyCount(), 27 + 8, TEST_LOCATION);
194
195   TEST_RENDERER_PROPERTY(renderer, "transformOffset", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_OFFSET, TEST_LOCATION);
196   TEST_RENDERER_PROPERTY(renderer, "transformSize", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_SIZE, TEST_LOCATION);
197   TEST_RENDERER_PROPERTY(renderer, "transformOrigin", Property::VECTOR2, true, false, false, VisualRenderer::Property::TRANSFORM_ORIGIN, TEST_LOCATION);
198   TEST_RENDERER_PROPERTY(renderer, "transformAnchorPoint", Property::VECTOR2, true, false, false, VisualRenderer::Property::TRANSFORM_ANCHOR_POINT, TEST_LOCATION);
199   TEST_RENDERER_PROPERTY(renderer, "transformOffsetSizeMode", Property::VECTOR4, true, false, false, VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE, TEST_LOCATION);
200   TEST_RENDERER_PROPERTY(renderer, "extraSize", Property::VECTOR2, true, true, true, VisualRenderer::Property::EXTRA_SIZE, TEST_LOCATION);
201
202   TEST_RENDERER_PROPERTY(renderer, "visualMixColor", Property::VECTOR3, true, true, true, VisualRenderer::Property::VISUAL_MIX_COLOR, TEST_LOCATION);
203   TEST_RENDERER_PROPERTY(renderer, "preMultipliedAlpha", Property::FLOAT, true, false, false, VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, TEST_LOCATION);
204
205   END_TEST;
206 }
207
208 int UtcDaliVisualRendererAnimatedProperty01(void)
209 {
210   TestApplication application;
211
212   tet_infoline("Test that a visual renderer property can be animated");
213
214   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
215   Geometry       geometry = CreateQuadGeometry();
216   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
217
218   Actor actor = Actor::New();
219   actor.AddRenderer(renderer);
220   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
221   application.GetScene().Add(actor);
222
223   Property::Index colorIndex = VisualRenderer::Property::VISUAL_MIX_COLOR;
224   renderer.SetProperty(colorIndex, Vector3(1.0f, 1.0f, 1.0f));
225
226   application.SendNotification();
227   application.Render(0);
228   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(colorIndex), Vector3(1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
229
230   Animation animation = Animation::New(1.0f);
231   KeyFrames keyFrames = KeyFrames::New();
232   keyFrames.Add(0.0f, Vector3(1.0f, 0.0f, 1.0f));
233   keyFrames.Add(1.0f, Vector3(0.0f, 0.0f, 0.0f));
234   animation.AnimateBetween(Property(renderer, colorIndex), keyFrames);
235   animation.Play();
236
237   application.SendNotification();
238   application.Render(500);
239
240   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.5f, 0.f, 0.5f), TEST_LOCATION);
241
242   application.Render(400);
243   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.1f, 0.f, 0.1f), TEST_LOCATION);
244
245   application.Render(100);
246   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.f, 0.f, 0.f), TEST_LOCATION);
247   DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(colorIndex), Vector3(0.f, 0.f, 0.f), TEST_LOCATION);
248
249   // Can we test to see if the actor has stopped being drawn?
250   END_TEST;
251 }
252
253 int UtcDaliVisualRendererAnimatedProperty02(void)
254 {
255   TestApplication application;
256
257   tet_infoline("Test that a visual renderer property can be animated");
258
259   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
260   Geometry       geometry = CreateQuadGeometry();
261   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
262
263   Actor actor = Actor::New();
264   actor.AddRenderer(renderer);
265   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
266   application.GetScene().Add(actor);
267
268   Property::Index index = VisualRenderer::Property::TRANSFORM_OFFSET;
269   renderer.SetProperty(index, Vector2(1.0f, 0.0f));
270
271   application.SendNotification();
272   application.Render(0);
273   application.SendNotification();
274   application.Render(0);
275   DALI_TEST_EQUALS(renderer.GetProperty<Vector2>(index), Vector2(1.0f, 0.0f), 0.001f, TEST_LOCATION);
276
277   Animation animation = Animation::New(1.0f);
278   KeyFrames keyFrames = KeyFrames::New();
279   keyFrames.Add(0.0f, Vector2(1.0f, 0.0f));
280   keyFrames.Add(1.0f, Vector2(0.0f, 1.0f));
281   animation.AnimateBetween(Property(renderer, index), keyFrames);
282   animation.Play();
283
284   application.SendNotification();
285   application.Render(500);
286
287   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(0.5f, 0.5f), TEST_LOCATION);
288
289   application.Render(400);
290   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(0.1f, 0.9f), TEST_LOCATION);
291
292   application.Render(100);
293   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(0.f, 1.0f), TEST_LOCATION);
294   DALI_TEST_EQUALS(renderer.GetProperty<Vector2>(index), Vector2(0.f, 1.f), TEST_LOCATION);
295
296   END_TEST;
297 }
298
299 struct VisualProperties
300 {
301   VisualProperties() = default;
302
303   VisualProperties(Vector2 offset, Vector2 size, Vector2 origin, Vector2 pivot, Vector4 modes, Vector2 extraSize, Vector3 mixColor, float preMultipliedAlpha)
304   : mTransformOffset(offset),
305     mTransformSize(size),
306     mTransformOrigin(origin),
307     mTransformAnchorPoint(pivot),
308     mTransformOffsetSizeMode(modes),
309     mExtraSize(extraSize),
310     mMixColor(mixColor),
311     mPreMultipliedAlpha(preMultipliedAlpha)
312   {
313   }
314
315   Vector2 mTransformOffset{Vector2::ZERO};
316   Vector2 mTransformSize{Vector2::ONE};
317   Vector2 mTransformOrigin{Vector2::ZERO};
318   Vector2 mTransformAnchorPoint{Vector2::ZERO};
319   Vector4 mTransformOffsetSizeMode{Vector2::ZERO};
320   Vector2 mExtraSize{Vector2::ZERO};
321   Vector3 mMixColor{Vector3::ONE};
322   float   mPreMultipliedAlpha{0.0f};
323
324   static VisualProperties GetPropsAt(float alpha, const VisualProperties& start, const VisualProperties& end)
325   {
326     VisualProperties progress;
327     progress.mTransformOffset         = start.mTransformOffset + (end.mTransformOffset - start.mTransformOffset) * alpha;
328     progress.mTransformSize           = start.mTransformSize + (end.mTransformSize - start.mTransformSize) * alpha;
329     progress.mExtraSize               = start.mExtraSize + (end.mExtraSize - start.mExtraSize) * alpha;
330     progress.mMixColor                = start.mMixColor + (end.mMixColor - start.mMixColor) * alpha;
331     progress.mTransformOffsetSizeMode = end.mTransformOffsetSizeMode;
332     progress.mTransformOrigin         = end.mTransformOrigin;
333     progress.mTransformAnchorPoint    = end.mTransformAnchorPoint;
334     progress.mPreMultipliedAlpha      = end.mPreMultipliedAlpha;
335     return progress;
336   }
337 };
338
339 void PrintVisualProperties(const VisualProperties& props, const std::string& prefix)
340 {
341   tet_printf(
342     "%s: offset:(%5.3f, %5.3f)\n"
343     "%*c size:(%5.3f, %5.3f)\n"
344     "%*c origin:(%5.3f, %5.3f)\n"
345     "%*c anchorPoint:(%5.3f, %5.3f)\n"
346     "%*c offsetSizeMode:(%5.3f, %5.3f, %5.3f, %5.3f)\n"
347     "%*c extraSize:(%5.3f, %5.3f)\n"
348     "%*c mixColor:(%5.3f, %5.3f, %5.3f)\n"
349     "%*c preMultipliedAlpha:(%5.3f)\n",
350     prefix.c_str(),
351     props.mTransformOffset.x,
352     props.mTransformOffset.y,
353     prefix.length() + 1,
354     ' ',
355     props.mTransformSize.x,
356     props.mTransformSize.y,
357     prefix.length() + 1,
358     ' ',
359     props.mTransformOrigin.x,
360     props.mTransformOrigin.y,
361     prefix.length() + 1,
362     ' ',
363     props.mTransformAnchorPoint.x,
364     props.mTransformAnchorPoint.y,
365     prefix.length() + 1,
366     ' ',
367     props.mTransformOffsetSizeMode.x,
368     props.mTransformOffsetSizeMode.y,
369     props.mTransformOffsetSizeMode.z,
370     props.mTransformOffsetSizeMode.w,
371     prefix.length() + 1,
372     ' ',
373     props.mExtraSize.x,
374     props.mExtraSize.y,
375     prefix.length() + 1,
376     ' ',
377     props.mMixColor.x,
378     props.mMixColor.y,
379     props.mMixColor.z,
380     prefix.length() + 1,
381     ' ',
382     props.mPreMultipliedAlpha);
383 }
384
385 void SetVisualProperties(VisualRenderer renderer, VisualProperties props)
386 {
387   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET, props.mTransformOffset);
388   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_SIZE, props.mTransformSize);
389   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_ORIGIN, props.mTransformOrigin);
390   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_ANCHOR_POINT, props.mTransformAnchorPoint);
391   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE, props.mTransformOffsetSizeMode);
392   renderer.SetProperty(VisualRenderer::Property::EXTRA_SIZE, props.mExtraSize);
393   renderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, props.mMixColor);
394   renderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, props.mPreMultipliedAlpha);
395 }
396
397 void CheckEventVisualProperties(VisualRenderer renderer, VisualProperties expectedProps)
398 {
399   tet_infoline("CheckEventVisualProperties\n");
400
401   VisualProperties actualProps;
402   actualProps.mTransformOffset         = renderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
403   actualProps.mTransformSize           = renderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
404   actualProps.mTransformOrigin         = renderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_ORIGIN);
405   actualProps.mTransformAnchorPoint    = renderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_ANCHOR_POINT);
406   actualProps.mTransformOffsetSizeMode = renderer.GetProperty<Vector4>(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE);
407   actualProps.mExtraSize               = renderer.GetProperty<Vector2>(VisualRenderer::Property::EXTRA_SIZE);
408   actualProps.mMixColor                = renderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
409   actualProps.mPreMultipliedAlpha      = renderer.GetProperty<float>(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA);
410
411   PrintVisualProperties(actualProps, "Actual event props");
412
413   DALI_TEST_EQUALS(actualProps.mTransformOffset, expectedProps.mTransformOffset, TEST_LOCATION);
414   DALI_TEST_EQUALS(actualProps.mTransformSize, expectedProps.mTransformSize, TEST_LOCATION);
415   DALI_TEST_EQUALS(actualProps.mTransformOrigin, expectedProps.mTransformOrigin, TEST_LOCATION);
416   DALI_TEST_EQUALS(actualProps.mTransformAnchorPoint, expectedProps.mTransformAnchorPoint, TEST_LOCATION);
417   DALI_TEST_EQUALS(actualProps.mTransformOffsetSizeMode, expectedProps.mTransformOffsetSizeMode, TEST_LOCATION);
418   DALI_TEST_EQUALS(actualProps.mExtraSize, expectedProps.mExtraSize, TEST_LOCATION);
419   DALI_TEST_EQUALS(actualProps.mMixColor, expectedProps.mMixColor, TEST_LOCATION);
420   DALI_TEST_EQUALS(actualProps.mPreMultipliedAlpha, expectedProps.mPreMultipliedAlpha, TEST_LOCATION);
421 }
422
423 void CheckSceneGraphVisualProperties(VisualRenderer renderer, VisualProperties expectedProps)
424 {
425   tet_infoline("CheckSceneGraphVisualProperties\n");
426
427   VisualProperties actualProps;
428
429   actualProps.mTransformOffset         = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
430   actualProps.mTransformSize           = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
431   actualProps.mTransformOrigin         = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::TRANSFORM_ORIGIN);
432   actualProps.mTransformAnchorPoint    = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::TRANSFORM_ANCHOR_POINT);
433   actualProps.mTransformOffsetSizeMode = renderer.GetCurrentProperty<Vector4>(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE);
434   actualProps.mExtraSize               = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::EXTRA_SIZE);
435   actualProps.mMixColor                = renderer.GetCurrentProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
436   actualProps.mPreMultipliedAlpha      = renderer.GetProperty<float>(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA);
437
438   PrintVisualProperties(actualProps, "Actual update props");
439
440   DALI_TEST_EQUALS(actualProps.mTransformOffset, expectedProps.mTransformOffset, TEST_LOCATION);
441   DALI_TEST_EQUALS(actualProps.mTransformSize, expectedProps.mTransformSize, TEST_LOCATION);
442   DALI_TEST_EQUALS(actualProps.mTransformOrigin, expectedProps.mTransformOrigin, TEST_LOCATION);
443   DALI_TEST_EQUALS(actualProps.mTransformAnchorPoint, expectedProps.mTransformAnchorPoint, TEST_LOCATION);
444   DALI_TEST_EQUALS(actualProps.mTransformOffsetSizeMode, expectedProps.mTransformOffsetSizeMode, TEST_LOCATION);
445   DALI_TEST_EQUALS(actualProps.mExtraSize, expectedProps.mExtraSize, TEST_LOCATION);
446   DALI_TEST_EQUALS(actualProps.mMixColor, expectedProps.mMixColor, TEST_LOCATION);
447   DALI_TEST_EQUALS(actualProps.mPreMultipliedAlpha, expectedProps.mPreMultipliedAlpha, TEST_LOCATION);
448 }
449
450 void CheckUniforms(VisualRenderer renderer, VisualProperties props, std::vector<UniformData>& uniforms, TraceCallStack& callStack, TestGlAbstraction& gl)
451 {
452   tet_infoline("CheckUniforms\n");
453
454   TraceCallStack::NamedParams params;
455
456   tet_printf("Callback trace: \n%s\n", callStack.GetTraceString().c_str());
457
458   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[0].name, params));
459   DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[0].name.c_str(), props.mTransformOffset));
460
461   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[1].name, params));
462   DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[1].name.c_str(), props.mTransformSize));
463
464   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[2].name, params));
465   DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[2].name.c_str(), props.mTransformOrigin));
466
467   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[3].name, params));
468   DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[3].name.c_str(), props.mTransformAnchorPoint));
469
470   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[4].name, params));
471   DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[4].name.c_str(), props.mTransformOffsetSizeMode));
472
473   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[5].name, params));
474   DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[5].name.c_str(), props.mExtraSize));
475
476   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[6].name, params));
477   DALI_TEST_CHECK(gl.GetUniformValue<Vector3>(uniforms[6].name.c_str(), props.mMixColor));
478
479   DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[7].name, params));
480   DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[7].name.c_str(), props.mPreMultipliedAlpha));
481 }
482
483 int UtcDaliVisualRendererAnimatedProperty03(void)
484 {
485   TestApplication    application;
486   TestGlAbstraction& gl        = application.GetGlAbstraction();
487   TraceCallStack&    callStack = gl.GetSetUniformTrace();
488   gl.EnableSetUniformCallTrace(true);
489
490   tet_infoline("Test that a visual renderer property can be animated and that the uniforms are set");
491
492   std::vector<UniformData> customUniforms{{"offset", Property::VECTOR2},
493                                           {"size", Property::VECTOR2},
494                                           {"origin", Property::VECTOR2},
495                                           {"anchorPoint", Property::VECTOR2},
496                                           {"offsetSizeMode", Property::VECTOR4},
497                                           {"extraSize", Property::VECTOR2},
498                                           {"mixColor", Property::VECTOR3},
499                                           {"preMultipliedAlpha", Property::FLOAT}};
500
501   application.GetGraphicsController().AddCustomUniforms(customUniforms);
502
503   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
504   Geometry       geometry = CreateQuadGeometry();
505   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
506
507   Actor actor = Actor::New();
508   actor.AddRenderer(renderer);
509   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
510   application.GetScene().Add(actor);
511
512   VisualProperties props{Vector2(10.f, 10.f), Vector2(200.f, 100.f), Vector2(0.5f, 0.5f), Vector2(0.5f, 0.5f), Vector4::ZERO, Vector2(0.0f, 0.0f), Vector3(Color::SEA_GREEN), 0.0f};
513   VisualProperties targetProps{Vector2(40.f, 40.f), Vector2(100.f, 200.f), Vector2(0.5f, 0.5f), Vector2(0.5f, 0.5f), Vector4::ZERO, Vector2(25.0f, 25.0f), Vector3(Color::MEDIUM_PURPLE), 0.0f};
514
515   SetVisualProperties(renderer, props);
516   CheckEventVisualProperties(renderer, props);
517   application.SendNotification();
518   application.Render(0);
519   CheckSceneGraphVisualProperties(renderer, props);
520   CheckUniforms(renderer, props, customUniforms, callStack, gl);
521
522   // Set up a 1 second anim.
523   Animation animation = Animation::New(1.0f);
524
525   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_OFFSET), targetProps.mTransformOffset);
526   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_SIZE), targetProps.mTransformSize);
527   animation.AnimateTo(Property(renderer, VisualRenderer::Property::EXTRA_SIZE), targetProps.mExtraSize);
528   animation.AnimateTo(Property(renderer, VisualRenderer::Property::VISUAL_MIX_COLOR), targetProps.mMixColor);
529   animation.Play();
530
531   CheckEventVisualProperties(renderer, targetProps);
532
533   for(int i = 0; i <= 10; ++i)
534   {
535     tet_printf("\n###########  Animation progress: %d%%\n\n", i * 10);
536     VisualProperties propsProgress = VisualProperties::GetPropsAt(0.1f * i, props, targetProps);
537     PrintVisualProperties(propsProgress, "Expected values");
538
539     callStack.Reset();
540     application.SendNotification();
541     application.Render((i == 0 ? 0 : 100));
542
543     CheckEventVisualProperties(renderer, targetProps);
544
545     CheckSceneGraphVisualProperties(renderer, propsProgress);
546     CheckUniforms(renderer, propsProgress, customUniforms, callStack, gl);
547   }
548
549   // Ensure animation finishes
550   application.SendNotification();
551   application.Render(100);
552   CheckSceneGraphVisualProperties(renderer, targetProps);
553   CheckUniforms(renderer, targetProps, customUniforms, callStack, gl);
554
555   END_TEST;
556 }
557
558 int UtcDaliVisualRendererAnimatedProperty04(void)
559 {
560   TestApplication application;
561
562   tet_infoline("Test that a visual renderer property can't be animated");
563
564   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
565   Geometry       geometry = CreateQuadGeometry();
566   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
567
568   Actor actor = Actor::New();
569   actor.AddRenderer(renderer);
570   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
571   application.GetScene().Add(actor);
572
573   Property::Index index = VisualRenderer::Property::TRANSFORM_ANCHOR_POINT;
574   renderer.SetProperty(index, Vector2(AnchorPoint::TOP_RIGHT));
575
576   application.SendNotification();
577   application.Render(0);
578   DALI_TEST_EQUALS(renderer.GetProperty<Vector2>(index), Vector2(AnchorPoint::TOP_RIGHT), 0.001f, TEST_LOCATION);
579
580   Animation animation = Animation::New(1.0f);
581   KeyFrames keyFrames = KeyFrames::New();
582   keyFrames.Add(0.0f, Vector2::ZERO);
583   keyFrames.Add(1.0f, Vector2(10.0f, 10.0f));
584   try
585   {
586     animation.AnimateBetween(Property(renderer, index), keyFrames);
587     tet_result(TET_FAIL);
588   }
589   catch(DaliException& e)
590   {
591     DALI_TEST_ASSERT(e, "baseProperty && \"Property is not animatable\"", TEST_LOCATION);
592   }
593
594   END_TEST;
595 }
596
597 int UtcDaliVisualRendererAnimatedProperty05(void)
598 {
599   TestApplication application;
600
601   tet_infoline("Test that a visual renderer property can't be animated");
602
603   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
604   Geometry       geometry = CreateQuadGeometry();
605   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
606
607   Actor actor = Actor::New();
608   actor.AddRenderer(renderer);
609   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
610   application.GetScene().Add(actor);
611
612   Property::Index index = VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA;
613   renderer.SetProperty(index, 1.0f);
614
615   application.SendNotification();
616   application.Render(0);
617   DALI_TEST_EQUALS(renderer.GetProperty<float>(index), 1.0f, 0.001f, TEST_LOCATION);
618
619   Animation animation = Animation::New(1.0f);
620   KeyFrames keyFrames = KeyFrames::New();
621   keyFrames.Add(0.0f, 0.5f);
622   keyFrames.Add(1.0f, 1.0f);
623   try
624   {
625     animation.AnimateBetween(Property(renderer, index), keyFrames);
626     tet_result(TET_FAIL);
627   }
628   catch(DaliException& e)
629   {
630     DALI_TEST_ASSERT(e, "baseProperty && \"Property is not animatable\"", TEST_LOCATION);
631   }
632
633   DALI_TEST_EQUALS(renderer.GetProperty<float>(index), 1.0f, 0.0001f, TEST_LOCATION);
634   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(index), 1.0f, 0.0001f, TEST_LOCATION);
635
636   END_TEST;
637 }
638
639 int UtcDaliVisualRendererAnimatedProperty06(void)
640 {
641   TestApplication application;
642
643   tet_infoline("Test that a parent renderer property can still be animated");
644
645   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
646   Geometry       geometry = CreateQuadGeometry();
647   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
648
649   Actor actor = Actor::New();
650   actor.AddRenderer(renderer);
651   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
652   application.GetScene().Add(actor);
653
654   Property::Index index = DevelRenderer::Property::OPACITY;
655   renderer.SetProperty(index, 1.0f);
656
657   application.SendNotification();
658   application.Render(0);
659   DALI_TEST_EQUALS(renderer.GetProperty<float>(index), 1.0f, 0.001f, TEST_LOCATION);
660   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 1.0f, 0.0001f, TEST_LOCATION);
661
662   Animation animation = Animation::New(1.0f);
663   KeyFrames keyFrames = KeyFrames::New();
664   keyFrames.Add(0.0f, float(0.5f));
665   keyFrames.Add(1.0f, float(0.0f));
666   animation.AnimateBetween(Property(renderer, index), keyFrames);
667   animation.Play();
668
669   application.SendNotification();
670
671   // Test that the event side properties are set to target value of 0
672   DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
673
674   application.Render(500);
675
676   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(index), 0.25f, 0.0001f, TEST_LOCATION);
677   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 0.25f, 0.0001f, TEST_LOCATION);
678
679   // Test that the event side properties are set to target value 0f 0
680   DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
681
682   // Complete the animation
683   application.Render(500);
684
685   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(index), 0.0f, 0.0001f, TEST_LOCATION);
686   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
687   DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
688   END_TEST;
689 }
690
691 int UtcDaliVisualRendererPartialUpdate(void)
692 {
693   TestApplication application(
694     TestApplication::DEFAULT_SURFACE_WIDTH,
695     TestApplication::DEFAULT_SURFACE_HEIGHT,
696     TestApplication::DEFAULT_HORIZONTAL_DPI,
697     TestApplication::DEFAULT_VERTICAL_DPI,
698     true,
699     true);
700
701   tet_infoline("Test that partial update works well when we set visual renderer's animated properties");
702
703   const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
704
705   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
706   Geometry       geometry = CreateQuadGeometry();
707   VisualRenderer renderer = VisualRenderer::New(geometry, shader);
708
709   Actor actor = Actor::New();
710   actor.AddRenderer(renderer);
711   actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
712   actor[Actor::Property::POSITION]     = Vector3(64.0f, 64.0f, 0.0f);
713   actor[Actor::Property::SIZE]         = Vector3(64.0f, 64.0f, 0.0f);
714   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
715   application.GetScene().Add(actor);
716
717   application.SendNotification();
718
719   std::vector<Rect<int>> damagedRects;
720
721   // Actor added, damaged rect is added size of actor
722   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
723   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
724
725   // Aligned by 16
726   Rect<int> clippingRect = Rect<int>(64, 672, 80, 80); // in screen coordinates
727   DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
728
729   application.RenderWithPartialUpdate(damagedRects, clippingRect);
730   DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
731   DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
732   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
733   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
734
735   damagedRects.clear();
736   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
737   application.RenderWithPartialUpdate(damagedRects, clippingRect);
738
739   // Ensure the damaged rect is empty
740   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
741
742   // Set clippingRect as full surface now. TODO : Set valid rect if we can.
743   clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
744
745   Property::Index index = VisualRenderer::Property::TRANSFORM_SIZE;
746   renderer.SetProperty(index, Vector2(2.0f, 0.5f));
747
748   // Now current actor show as 128x32 rectangle, with center position (96, 96).
749   // So, rectangle's top left position is (32, 80), and bottom right position is (160, 112).
750   // NOTE : VisualTransform's anchor point is not relative with actor's anchor point
751
752   application.SendNotification();
753   damagedRects.clear();
754   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
755   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
756   // Aligned by 16
757   // Note, this damagedRect is combine of previous rect and current rect
758   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(32, 672, 144, 80), damagedRects[0], TEST_LOCATION);
759
760   application.RenderWithPartialUpdate(damagedRects, clippingRect);
761
762   application.SendNotification();
763   damagedRects.clear();
764   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
765   application.RenderWithPartialUpdate(damagedRects, clippingRect);
766
767   // Update dummy property to damangeRect buffer aging
768   actor.SetProperty(Actor::Property::COLOR, Color::RED);
769
770   application.SendNotification();
771   damagedRects.clear();
772   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
773   application.RenderWithPartialUpdate(damagedRects, clippingRect);
774   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
775
776   // Update dummy property to damangeRect buffer aging
777   actor.SetProperty(Actor::Property::COLOR, Color::BLUE);
778
779   application.SendNotification();
780   damagedRects.clear();
781   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
782   application.RenderWithPartialUpdate(damagedRects, clippingRect);
783   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
784
785   // Aligned by 16
786   // Note, this damagedRect don't contain previous rect now.
787   // Current rectangle's top left position is (32, 80), and bottom right position is (160, 112).
788   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(32, 688, 144, 48), damagedRects[0], TEST_LOCATION);
789
790   application.SendNotification();
791   damagedRects.clear();
792   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
793   application.RenderWithPartialUpdate(damagedRects, clippingRect);
794
795   application.SendNotification();
796   damagedRects.clear();
797   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
798   application.RenderWithPartialUpdate(damagedRects, clippingRect);
799
800   application.SendNotification();
801   damagedRects.clear();
802   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
803   application.RenderWithPartialUpdate(damagedRects, clippingRect);
804
805   // 3 frame spended after change actor property. Ensure the damaged rect is empty
806   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
807
808   DALI_TEST_EQUALS(renderer.GetProperty<Vector2>(index), Vector2(2.0f, 0.5f), 0.001f, TEST_LOCATION);
809
810   // Make flickered animation from Vector2(2.0f, 0.5f) --> Vector2(1.0f, 1.0f) --> Vector2(0.5f, 2.0f)
811   // After finish the animation,actor show as 32x128 rectangle, with center position (96, 96).
812   // So, rectangle's top left position is (80, 32), and bottom right position is (112, 160).
813   Animation animation = Animation::New(1.0f);
814   KeyFrames keyFrames = KeyFrames::New();
815   keyFrames.Add(0.0f, Vector2(2.0f, 0.5f));
816   keyFrames.Add(0.299f, Vector2(2.0f, 0.5f));
817   keyFrames.Add(0.301f, Vector2(1.0f, 1.0f));
818   keyFrames.Add(0.699f, Vector2(1.0f, 1.0f));
819   keyFrames.Add(0.701f, Vector2(0.5f, 2.0f));
820   keyFrames.Add(1.0f, Vector2(0.5f, 2.0f));
821   animation.AnimateBetween(Property(renderer, index), keyFrames);
822   animation.Play();
823
824   application.SendNotification();
825   damagedRects.clear();
826   application.PreRenderWithPartialUpdate(200, nullptr, damagedRects); // 200 ms
827   application.RenderWithPartialUpdate(damagedRects, clippingRect);
828
829   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(2.0f, 0.5f), TEST_LOCATION);
830
831   // 302 ~ 600. TransformSize become Vector2(1.0f, 1.0f)
832   application.SendNotification();
833   damagedRects.clear();
834   application.PreRenderWithPartialUpdate(102, nullptr, damagedRects); // 302 ms
835   application.RenderWithPartialUpdate(damagedRects, clippingRect);
836
837   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(1.0f, 1.0f), TEST_LOCATION);
838
839   // Update dummy property to damangeRect buffer aging
840   actor.SetProperty(Actor::Property::COLOR, Color::RED);
841
842   application.SendNotification();
843   damagedRects.clear();
844   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 318 ms
845   application.RenderWithPartialUpdate(damagedRects, clippingRect);
846
847   // Update dummy property to damangeRect buffer aging
848   actor.SetProperty(Actor::Property::COLOR, Color::GREEN);
849
850   application.SendNotification();
851   damagedRects.clear();
852   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 334 ms
853   application.RenderWithPartialUpdate(damagedRects, clippingRect);
854
855   // Update dummy property to damangeRect buffer aging
856   actor.SetProperty(Actor::Property::COLOR, Color::RED);
857
858   application.SendNotification();
859   damagedRects.clear();
860   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 350 ms
861   application.RenderWithPartialUpdate(damagedRects, clippingRect);
862
863   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
864   // Aligned by 16
865   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 80, 80), damagedRects[0], TEST_LOCATION);
866
867   application.SendNotification();
868   damagedRects.clear();
869   application.PreRenderWithPartialUpdate(250, nullptr, damagedRects); // 600 ms
870   application.RenderWithPartialUpdate(damagedRects, clippingRect);
871
872   // 702 ~ 1000. TransformSize become Vector2(0.5f, 2.0f)
873   damagedRects.clear();
874   application.PreRenderWithPartialUpdate(102, nullptr, damagedRects); // 702 ms
875   application.RenderWithPartialUpdate(damagedRects, clippingRect);
876
877   DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector2>(index), Vector2(0.5f, 2.0f), TEST_LOCATION);
878
879   // Update dummy property to damangeRect buffer aging
880   actor.SetProperty(Actor::Property::COLOR, Color::GREEN);
881
882   application.SendNotification();
883   damagedRects.clear();
884   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 718 ms
885   application.RenderWithPartialUpdate(damagedRects, clippingRect);
886
887   // Update dummy property to damangeRect buffer aging
888   actor.SetProperty(Actor::Property::COLOR, Color::BLUE);
889
890   application.SendNotification();
891   damagedRects.clear();
892   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 734 ms
893   application.RenderWithPartialUpdate(damagedRects, clippingRect);
894
895   // Update dummy property to damangeRect buffer aging
896   actor.SetProperty(Actor::Property::COLOR, Color::RED);
897
898   application.SendNotification();
899   damagedRects.clear();
900   application.PreRenderWithPartialUpdate(16, nullptr, damagedRects); // 750 ms
901   application.RenderWithPartialUpdate(damagedRects, clippingRect);
902
903   DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
904   // Aligned by 16
905   DALI_TEST_EQUALS<Rect<int>>(Rect<int>(80, 640, 48, 144), damagedRects[0], TEST_LOCATION);
906
907   application.SendNotification();
908   damagedRects.clear();
909   application.PreRenderWithPartialUpdate(52, nullptr, damagedRects); // 1002 ms. animation finished.
910   application.RenderWithPartialUpdate(damagedRects, clippingRect);
911
912   // Check finished value bake.
913   DALI_TEST_EQUALS(renderer.GetProperty<Vector2>(index), Vector2(0.5f, 2.0f), TEST_LOCATION);
914
915   END_TEST;
916 }