Support multiple transitions for a Control.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Transition.cpp
1 /*
2  * Copyright (c) 2021 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 #include <iostream>
19 #include <stdlib.h>
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
24 #include <dali-toolkit/public-api/transition/transition-set.h>
25 #include <dali-toolkit/public-api/transition/transition-base.h>
26 #include <dali-toolkit/public-api/transition/transition.h>
27 #include <dali-toolkit/public-api/transition/fade-transition.h>
28 #include <dali-toolkit/public-api/transition/slide-transition.h>
29
30 using namespace Dali;
31 using namespace Dali::Toolkit;
32 namespace
33 {
34
35 const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
36
37 }
38
39 // Functor to test whether a Finish signal is emitted
40 struct TransitionFinishCheck
41 {
42   TransitionFinishCheck(bool& signalReceived)
43   : mSignalReceived(signalReceived)
44   {
45   }
46
47   void operator()(TransitionSet& transitionSet)
48   {
49     mSignalReceived = true;
50   }
51
52   void Reset()
53   {
54     mSignalReceived = false;
55   }
56
57   void CheckSignalReceived()
58   {
59     if(!mSignalReceived)
60     {
61       tet_printf("Expected Finish signal was not received\n");
62       tet_result(TET_FAIL);
63     }
64     else
65     {
66       tet_result(TET_PASS);
67     }
68   }
69
70   void CheckSignalNotReceived()
71   {
72     if(mSignalReceived)
73     {
74       tet_printf("Unexpected Finish signal was received\n");
75       tet_result(TET_FAIL);
76     }
77     else
78     {
79       tet_result(TET_PASS);
80     }
81   }
82
83   bool& mSignalReceived; // owned by individual tests
84 };
85
86 int UtcDaliTransitionSetGetProperty01(void)
87 {
88   ToolkitTestApplication application;
89   tet_infoline(" UtcDaliTransitionSetGetProperty01");
90
91   Control control1 = Control::New();
92   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
93   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
94   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
95   Property::Map controlProperty1;
96   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
97   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
98   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
99   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
100   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
101   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
102   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
103
104   Control control2 = Control::New();
105   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
106   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
107   control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
108   Property::Map controlProperty2;
109   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
110   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
111   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
112   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
113   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
114   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
115   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
116
117   application.GetScene().Add(control1);
118   application.GetScene().Add(control2);
119
120   application.SendNotification();
121   application.Render(20);
122
123   Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f, -0.1f));
124   TimePeriod timePeriod = transition.GetTimePeriod();
125   DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
126   DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
127
128   transition.SetTimePeriod(TimePeriod(0.5f, 1.0f));
129   timePeriod = transition.GetTimePeriod();
130   DALI_TEST_EQUALS(1.0f, timePeriod.durationSeconds, TEST_LOCATION);
131   DALI_TEST_EQUALS(0.5f, timePeriod.delaySeconds, TEST_LOCATION);
132
133   DALI_TEST_EQUALS(Dali::AlphaFunction::DEFAULT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
134   transition.SetAlphaFunction(Dali::AlphaFunction::EASE_IN_OUT);
135   DALI_TEST_EQUALS(Dali::AlphaFunction::EASE_IN_OUT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
136
137   TransitionSet transitionSet = TransitionSet::New();
138   transitionSet.AddTransition(transition);
139
140   DALI_TEST_EQUALS(1, transitionSet.GetTransitionCount(), TEST_LOCATION);
141   DALI_TEST_EQUALS(transition, transitionSet.GetTransitionAt(0), TEST_LOCATION);
142
143   END_TEST;
144 }
145
146 int UtcDaliTransitionSetGetProperty02(void)
147 {
148   ToolkitTestApplication application;
149   tet_infoline(" UtcDaliTransitionSetGetProperty02");
150
151   Control control1 = Control::New();
152   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
153   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
154   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
155   Property::Map controlProperty1;
156   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
157   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
158   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(50.0f, 30.0f, 40.0f, 20.0f));
159   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
160   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
161   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
162   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
163
164   Control control2 = Control::New();
165   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
166   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
167   control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
168   Property::Map controlProperty2;
169   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
170   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
171   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(32.f, 54.0f, 24.0f, 42.0f));
172   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
173   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
174   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
175   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
176
177   application.GetScene().Add(control1);
178   application.GetScene().Add(control2);
179
180   application.SendNotification();
181   application.Render(20);
182
183   Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f));
184   TimePeriod timePeriod = transition.GetTimePeriod();
185   DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
186   DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
187
188   transition.SetTimePeriod(TimePeriod(0.5f, 1.0f));
189   timePeriod = transition.GetTimePeriod();
190   DALI_TEST_EQUALS(1.0f, timePeriod.durationSeconds, TEST_LOCATION);
191   DALI_TEST_EQUALS(0.5f, timePeriod.delaySeconds, TEST_LOCATION);
192
193   DALI_TEST_EQUALS(Dali::AlphaFunction::DEFAULT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
194   transition.SetAlphaFunction(Dali::AlphaFunction::EASE_IN_OUT);
195   DALI_TEST_EQUALS(Dali::AlphaFunction::EASE_IN_OUT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
196
197   TransitionSet transitionSet = TransitionSet::New();
198   transitionSet.AddTransition(transition);
199
200   DALI_TEST_EQUALS(1, transitionSet.GetTransitionCount(), TEST_LOCATION);
201   DALI_TEST_EQUALS(transition, transitionSet.GetTransitionAt(0), TEST_LOCATION);
202
203   END_TEST;
204 }
205
206 int UtcDaliTransitionBetweenControlPair(void)
207 {
208   ToolkitTestApplication application;
209   tet_infoline(" UtcDaliTransitionBetweenControlPair");
210
211   Vector3 destinationPosition(50, 50, 0);
212   Vector3 destinationSize(120, 120, 0);
213   Vector3 destinationScale(2, 1, 0);
214   Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
215   float destinationOpacity(0.8f);
216   float destinationRadius(50.f);
217   float destinationBorderlineWidth(80.0f);
218   Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
219   float destinationBorderlineOffset(-1.0f);
220   Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
221
222   Control control1 = Control::New();
223   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
224   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
225   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
226   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
227   control1.SetProperty(Actor::Property::SCALE, Vector3(1, 2, 0));
228   control1.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 1.0f, 1.0f, 0.5f));
229   control1.SetProperty(Actor::Property::OPACITY, 0.5f);
230   Property::Map controlProperty1;
231   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
232   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
233   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
234   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 60.f);
235   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
236   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
237   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
238
239   Control control2 = Control::New();
240   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
241   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
242   control2.SetProperty(Actor::Property::POSITION, destinationPosition);
243   control2.SetProperty(Actor::Property::SIZE, destinationSize);
244   control2.SetProperty(Actor::Property::SCALE, destinationScale);
245   control2.SetProperty(Actor::Property::COLOR, destinationColor);
246   control2.SetProperty(Actor::Property::OPACITY, destinationOpacity);
247   Property::Map controlProperty2;
248   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
249   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
250   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
251   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
252   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
253   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
254   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
255
256   DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
257   Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
258   Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
259   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
260   float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
261   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
262   Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
263   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
264   float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
265   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
266
267   application.GetScene().Add(control1);
268   application.GetScene().Add(control2);
269
270   application.SendNotification();
271   application.Render(20);
272
273   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
274   TransitionSet transitionSet = TransitionSet::New();
275   transitionSet.AddTransition(transition);
276   transitionSet.Play();
277
278   bool signalReceived(false);
279   TransitionFinishCheck finishCheck(signalReceived);
280   transitionSet.FinishedSignal().Connect(&application, finishCheck);
281
282   application.SendNotification();
283   application.Render(50);
284
285   // We didn't expect the animation to finish yet
286   application.SendNotification();
287   finishCheck.CheckSignalNotReceived();
288
289   DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
290   DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
291   Dali::Renderer renderer = control2.GetRendererAt(0);
292   Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
293   cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
294   DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
295   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
296   borderlineWidth = renderer.GetCurrentProperty<float>(index);
297   DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
298   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
299   borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
300   DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
301   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
302   borderlineOffset = renderer.GetCurrentProperty<float>(index);
303   DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
304
305   application.SendNotification();
306   application.Render(700);
307
308   // We did expect the animation to finish
309   application.SendNotification();
310   finishCheck.CheckSignalReceived();
311
312   application.SendNotification();
313   application.Render(20);
314
315   DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
316   DALI_TEST_EQUALS(destinationSize, control2.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
317   DALI_TEST_EQUALS(destinationScale, control2.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
318   DALI_TEST_EQUALS(destinationColor, control2.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
319   DALI_TEST_EQUALS(destinationOpacity, control2.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
320   DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
321   renderer = control2.GetRendererAt(0);
322   index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
323   cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
324   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
325   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
326   borderlineWidth = renderer.GetCurrentProperty<float>(index);
327   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
328   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
329   borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
330   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
331   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
332   borderlineOffset = renderer.GetCurrentProperty<float>(index);
333   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
334
335   END_TEST;
336 }
337
338 int UtcDaliTransitionBetweenControlPair2(void)
339 {
340   ToolkitTestApplication application;
341   tet_infoline(" UtcDaliTransitionBetweenControlPair2 - source target will be transitioned.");
342
343   Vector3 sourcePosition(100, 200, 0);
344   Vector3 sourceSize(150, 150, 0);
345   Vector3 sourceScale(1, 2, 0);
346   Vector4 sourceColor(1.0f, 1.0f, 1.0f, 0.5f);
347   float sourceOpacity(0.5f);
348   float sourceRadius(30.f);
349   float sourceBorderlineWidth(60.0f);
350   Vector4 sourceBorderlineColor(1.0f, 0.0f, 0.0f, 1.0f);
351   float sourceBorderlineOffset(1.f);
352   Vector4 sourceRadiusV4 = Vector4(sourceRadius, sourceRadius, sourceRadius, sourceRadius);
353
354   Vector3 destinationPosition(50, 50, 0);
355   Vector3 destinationSize(120, 120, 0);
356   Vector3 destinationScale(2, 1, 0);
357   Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
358   float destinationOpacity(0.8f);
359   float destinationRadius(50.f);
360   float destinationBorderlineWidth(80.0f);
361   Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
362   float destinationBorderlineOffset(-1.0f);
363   Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
364
365   Control control1 = Control::New();
366   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
367   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
368   control1.SetProperty(Actor::Property::POSITION, sourcePosition);
369   control1.SetProperty(Actor::Property::SIZE, sourceSize);
370   control1.SetProperty(Actor::Property::SCALE, sourceScale);
371   control1.SetProperty(Actor::Property::COLOR, sourceColor);
372   control1.SetProperty(Actor::Property::OPACITY, sourceOpacity);
373   Property::Map controlProperty1;
374   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
375   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
376   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceRadius);
377   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
378   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
379   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
380   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
381
382   Control control2 = Control::New();
383   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
384   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::CENTER);
385   control2.SetProperty(Actor::Property::POSITION, destinationPosition);
386   control2.SetProperty(Actor::Property::SIZE, destinationSize);
387   control2.SetProperty(Actor::Property::SCALE, destinationScale);
388   control2.SetProperty(Actor::Property::COLOR, destinationColor);
389   control2.SetProperty(Actor::Property::OPACITY, destinationOpacity);
390   Property::Map controlProperty2;
391   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
392   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
393   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
394   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
395   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
396   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
397   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
398
399   DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
400   Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
401   Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
402   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
403   float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
404   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
405   Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
406   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
407   float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
408   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
409
410   application.GetScene().Add(control1);
411   application.GetScene().Add(control2);
412
413   application.SendNotification();
414   application.Render(20);
415
416   Transition transition = Transition::New(control1, control2, false, TimePeriod(0.5f));
417   TransitionSet transitionSet = TransitionSet::New();
418   transitionSet.AddTransition(transition);
419   transitionSet.Play();
420
421   bool signalReceived(false);
422   TransitionFinishCheck finishCheck(signalReceived);
423   transitionSet.FinishedSignal().Connect(&application, finishCheck);
424
425   application.SendNotification();
426   application.Render(50);
427
428   // We didn't expect the animation to finish yet
429   application.SendNotification();
430   finishCheck.CheckSignalNotReceived();
431
432   DALI_TEST_NOT_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
433   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
434
435   Dali::Renderer renderer = control1.GetRendererAt(0);
436   Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
437   cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
438   DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
439
440   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
441   borderlineWidth = renderer.GetCurrentProperty<float>(index);
442   DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
443
444   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
445   borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
446   DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
447
448   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
449   borderlineOffset = renderer.GetCurrentProperty<float>(index);
450   DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
451
452   application.SendNotification();
453   application.Render(700);
454
455   // We did expect the animation to finish
456   application.SendNotification();
457   finishCheck.CheckSignalReceived();
458
459   // After the transition is finished,
460   // every current and renderer propeties of control1 are equal to destination properties.
461   DALI_TEST_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
462   DALI_TEST_EQUALS(destinationSize, control1.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
463   DALI_TEST_EQUALS(destinationScale, control1.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
464   DALI_TEST_EQUALS(destinationColor, control1.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
465   DALI_TEST_EQUALS(destinationOpacity, control1.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
466
467   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
468   renderer = control1.GetRendererAt(0);
469   index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
470   cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
471   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
472
473   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
474   borderlineWidth = renderer.GetCurrentProperty<float>(index);
475   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
476
477   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
478   borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
479   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
480
481   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
482   borderlineOffset = renderer.GetCurrentProperty<float>(index);
483   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
484
485   // every actor properties of control1 are returned to the source properties.
486   DALI_TEST_EQUALS(sourcePosition, control1.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
487   DALI_TEST_EQUALS(sourceSize, control1.GetProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
488   DALI_TEST_EQUALS(sourceScale, control1.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
489   DALI_TEST_EQUALS(sourceColor, control1.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
490   DALI_TEST_EQUALS(sourceOpacity, control1.GetProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
491
492   application.SendNotification();
493   application.Render(20);
494
495   // after next update, renderer properties are returned to the source properties.
496   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
497   renderer = control1.GetRendererAt(0);
498   index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
499   cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
500   DALI_TEST_EQUALS(sourceRadiusV4, cornerRadius, TEST_LOCATION);
501
502   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
503   borderlineWidth = renderer.GetCurrentProperty<float>(index);
504   DALI_TEST_EQUALS(sourceBorderlineWidth, borderlineWidth, TEST_LOCATION);
505
506   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
507   borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
508   DALI_TEST_EQUALS(sourceBorderlineColor, borderlineColor, TEST_LOCATION);
509
510   index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
511   borderlineOffset = renderer.GetCurrentProperty<float>(index);
512   DALI_TEST_EQUALS(sourceBorderlineOffset, borderlineOffset, TEST_LOCATION);
513
514   END_TEST;
515 }
516
517 int UtcDaliTransitionBetweenControlPairWithoutEmptySourceBackground(void)
518 {
519   ToolkitTestApplication application;
520   tet_infoline(" UtcDaliTransitionBetweenControlPair");
521
522   Vector4 destinationRadius(50.f, 30.f, 40.f, 0.f);
523   float   destinationBorderlineWidth(40.f);
524   Vector4 destinationBorderlineColor(1.0f, 0.5f, 0.2f, 0.8f);
525   float   destinationBorderlineOffset(1.f);
526
527   Control control1 = Control::New();
528   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
529   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
530   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
531
532   Control control2 = Control::New();
533   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
534   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
535   control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
536   Property::Map controlProperty2;
537   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
538   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
539   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
540   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
541   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
542   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
543   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
544
545   Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
546   Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
547   DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
548   float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
549   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
550   Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
551   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
552   float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
553   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
554
555   application.GetScene().Add(control1);
556   application.GetScene().Add(control2);
557
558   application.SendNotification();
559   application.Render(20);
560
561   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
562   TransitionSet transitionSet = TransitionSet::New();
563   transitionSet.AddTransition(transition);
564   transitionSet.Play();
565
566   bool signalReceived(false);
567   TransitionFinishCheck finishCheck(signalReceived);
568   transitionSet.FinishedSignal().Connect(&application, finishCheck);
569
570   application.SendNotification();
571   application.Render(50);
572
573   // We didn't expect the animation to finish yet
574   application.SendNotification();
575   finishCheck.CheckSignalNotReceived();
576
577   backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
578   cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
579   DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
580   borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
581   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
582   borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
583   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
584   borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
585   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
586
587   application.SendNotification();
588   application.Render(700);
589
590   // We did expect the animation to finish
591   application.SendNotification();
592   finishCheck.CheckSignalReceived();
593
594   application.SendNotification();
595   application.Render(20);
596
597   backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
598   cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
599   DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
600   borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
601   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
602   borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
603   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
604   borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
605   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
606
607   END_TEST;
608 }
609
610 int UtcDaliTransitionBetweenImageViewPair(void)
611 {
612   ToolkitTestApplication application;
613   tet_infoline(" UtcDaliTransitionBetweenControlPair");
614
615   Vector3 destinationPosition(50, 50, 0);
616
617   ImageView control1 = ImageView::New();
618   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
619   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
620   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
621   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
622   Property::Map controlProperty1;
623   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
624   controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
625   controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
626   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
627   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
628   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
629   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
630   control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
631
632   ImageView control2 = ImageView::New();
633   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
634   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
635   control2.SetProperty(Actor::Property::POSITION, destinationPosition);
636   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
637   Property::Map controlProperty2;
638   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
639   controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
640   controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
641   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
642   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
643   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
644   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
645   control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
646
647   DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
648
649   application.GetScene().Add(control1);
650   application.GetScene().Add(control2);
651
652   application.SendNotification();
653   application.Render(20);
654
655   Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
656   Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
657
658   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
659   TransitionSet transitionSet = TransitionSet::New();
660   transitionSet.AddTransition(transition);
661   transitionSet.Play();
662
663   bool signalReceived(false);
664   TransitionFinishCheck finishCheck(signalReceived);
665   transitionSet.FinishedSignal().Connect(&application, finishCheck);
666
667   application.SendNotification();
668   application.Render(400);
669
670   // We didn't expect the animation to finish yet
671   application.SendNotification();
672   finishCheck.CheckSignalNotReceived();
673
674   // control2 moved about 80%
675   Vector3 currentPosition = control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
676   Vector3 expectedPosition_0_7 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.7;
677   Vector3 expectedPosition_0_9 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.9;
678   DALI_TEST_CHECK(currentPosition.x <= expectedPosition_0_7.x && currentPosition.x >= expectedPosition_0_9.x);
679   DALI_TEST_CHECK(currentPosition.y <= expectedPosition_0_7.y && currentPosition.y >= expectedPosition_0_9.y);
680
681   application.SendNotification();
682   application.Render(200);
683
684   // We did expect the animation to finish
685   application.SendNotification();
686   finishCheck.CheckSignalReceived();
687
688   DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
689
690   application.SendNotification();
691   application.Render(20);
692
693   DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
694
695   END_TEST;
696 }
697
698 int UtcDaliTransitionBetweenImageViewPairWithDelay(void)
699 {
700   ToolkitTestApplication application;
701   tet_infoline(" UtcDaliTransitionBetweenControlPair");
702
703   Vector3 destinationPosition(50, 50, 0);
704
705   ImageView control1 = ImageView::New();
706   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
707   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
708   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
709   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
710   Property::Map controlProperty1;
711   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
712   controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
713   controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
714   controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
715   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
716   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
717   controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
718   control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
719
720   ImageView control2 = ImageView::New();
721   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
722   control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
723   control2.SetProperty(Actor::Property::POSITION, destinationPosition);
724   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
725   Property::Map controlProperty2;
726   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
727   controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
728   controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
729   controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
730   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
731   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
732   controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
733   control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
734
735   DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
736
737   application.GetScene().Add(control1);
738   application.GetScene().Add(control2);
739
740   application.SendNotification();
741   application.Render(20);
742
743   Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
744   Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
745
746   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f, 0.5f));
747   TransitionSet transitionSet = TransitionSet::New();
748   transitionSet.AddTransition(transition);
749   transitionSet.Play();
750
751   bool signalReceived(false);
752   TransitionFinishCheck finishCheck(signalReceived);
753   transitionSet.FinishedSignal().Connect(&application, finishCheck);
754
755   application.SendNotification();
756   application.Render(400);
757
758   // We didn't expect the animation to finish yet
759   application.SendNotification();
760   finishCheck.CheckSignalNotReceived();
761
762   DALI_TEST_EQUALS(startWorldPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
763
764   application.SendNotification();
765   application.Render(400);
766
767   // We didn't expect the animation to finish yet
768   application.SendNotification();
769   finishCheck.CheckSignalNotReceived();
770
771   // control2 moved about 60% (800ms)
772   Vector3 currentPosition = control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
773   Vector3 expectedPosition_0_5 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.5;
774   Vector3 expectedPosition_0_7 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.7;
775   DALI_TEST_CHECK(currentPosition.x <= expectedPosition_0_5.x && currentPosition.x >= expectedPosition_0_7.x);
776   DALI_TEST_CHECK(currentPosition.y <= expectedPosition_0_5.y && currentPosition.y >= expectedPosition_0_7.y);
777
778   application.SendNotification();
779   application.Render(400);
780
781   // We did expect the animation to finish
782   application.SendNotification();
783   finishCheck.CheckSignalReceived();
784
785   DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
786
787   application.SendNotification();
788   application.Render(20);
789
790   DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
791
792   END_TEST;
793 }
794
795 int UtcDaliTransitionBetweenControlPairWithTree(void)
796 {
797   ToolkitTestApplication application;
798   tet_infoline(" UtcDaliTransitionBetweenControlPairWithTree");
799
800   Vector3 destinationPosition(50, 50, 0);
801   Vector3 destinationWorldPosition(-130, -290, 0);
802
803   Control control1 = Control::New();
804   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
805   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
806   Property::Map controlProperty1;
807   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
808   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
809   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
810
811   Control control2 = Control::New();
812   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
813   control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
814   control2.SetProperty(Actor::Property::POSITION, destinationPosition);
815   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
816   Property::Map controlProperty2;
817   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
818   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
819   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
820
821   Control control3 = Control::New();
822   control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
823   control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
824   control3.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
825   control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
826   Property::Map controlProperty3;
827   controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
828   controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
829   control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
830
831   application.GetScene().Add(control1);
832   application.GetScene().Add(control2);
833   control2.Add(control3);
834
835   application.SendNotification();
836   application.Render(20);
837
838   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
839   TransitionSet transitionSet = TransitionSet::New();
840   transitionSet.AddTransition(transition);
841   transitionSet.Play();
842
843   bool signalReceived(false);
844   TransitionFinishCheck finishCheck(signalReceived);
845   transitionSet.FinishedSignal().Connect(&application, finishCheck);
846
847   application.SendNotification();
848   application.Render(600);
849
850   // We didn't expect the animation to finish yet
851   application.SendNotification();
852   finishCheck.CheckSignalReceived();
853
854   application.SendNotification();
855   application.Render(20);
856
857   DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
858   DALI_TEST_EQUALS(destinationWorldPosition, control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
859
860   END_TEST;
861 }
862
863 int UtcDaliTransitionBetweenControlPairWithTreeWithChild(void)
864 {
865   ToolkitTestApplication application;
866   tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithChild");
867
868   Vector3 destinationWorldPosition(-80, -240, 0);
869
870   Control control1 = Control::New();
871   control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
872   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
873   Property::Map controlProperty1;
874   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
875   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
876   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
877
878   Control control2 = Control::New();
879   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
880   control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
881   control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
882   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
883   Property::Map controlProperty2;
884   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
885   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
886   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
887
888   Control control3 = Control::New();
889   control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
890   control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
891   control3.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
892   control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
893   Property::Map controlProperty3;
894   controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
895   controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
896   control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
897
898   application.GetScene().Add(control1);
899   application.GetScene().Add(control2);
900   control2.Add(control3);
901
902   application.SendNotification();
903   application.Render(20);
904
905   Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
906   transition.TransitionWithChild(true);
907   TransitionSet transitionSet = TransitionSet::New();
908   transitionSet.AddTransition(transition);
909   transitionSet.Play();
910
911   bool signalReceived(false);
912   TransitionFinishCheck finishCheck(signalReceived);
913   transitionSet.FinishedSignal().Connect(&application, finishCheck);
914
915   application.SendNotification();
916   application.Render(600);
917
918   // We didn't expect the animation to finish yet
919   application.SendNotification();
920   finishCheck.CheckSignalReceived();
921
922   application.SendNotification();
923   application.Render(20);
924
925   DALI_TEST_EQUALS(destinationWorldPosition, control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
926
927   END_TEST;
928 }
929
930 int UtcDaliTransitionBetweenControlPairWithTreeWithoutPositionInheritance(void)
931 {
932   ToolkitTestApplication application;
933   tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutPositionInheritance");
934
935   Vector3 sourcePosition(50, 50, 0);
936   Vector3 destinationPosition(100, 100, 0);
937
938   Control control1 = Control::New();
939   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
940   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
941   control1.SetProperty(Actor::Property::POSITION, sourcePosition);
942   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
943   Property::Map controlProperty1;
944   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
945   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
946   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
947
948   Control control2 = Control::New();
949   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
950   control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
951   control2.SetProperty(Actor::Property::POSITION, Vector3(150, 150, 0));
952   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
953   Property::Map controlProperty2;
954   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
955   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
956   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
957
958   Control control3 = Control::New();
959   control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
960   control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
961   control3.SetProperty(Actor::Property::POSITION, destinationPosition);
962   control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
963   Property::Map controlProperty3;
964   controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
965   controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
966   control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
967
968   application.GetScene().Add(control1);
969   application.GetScene().Add(control2);
970   control2.Add(control3);
971
972   application.SendNotification();
973   application.Render(20);
974
975   Transition transition;
976   TransitionSet transitionSet;
977   bool signalReceived(false);
978   TransitionFinishCheck finishCheck(signalReceived);
979
980   // not inherit Position.
981   control3.SetProperty(Actor::Property::INHERIT_POSITION, false);
982   control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, true);
983   control3.SetProperty(Actor::Property::INHERIT_SCALE, true);
984
985   transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
986   transitionSet = TransitionSet::New();
987   transitionSet.AddTransition(transition);
988   transitionSet.Play();
989   transitionSet.FinishedSignal().Connect(&application, finishCheck);
990
991   application.SendNotification();
992   application.Render(300);
993
994   Vector3 currentPosition = control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
995   DALI_TEST_CHECK(currentPosition.x <= destinationPosition.x && currentPosition.x >= sourcePosition.x);
996   DALI_TEST_CHECK(currentPosition.y <= destinationPosition.y && currentPosition.y >= sourcePosition.y);
997   DALI_TEST_CHECK(currentPosition.z <= destinationPosition.z && currentPosition.z >= sourcePosition.z);
998
999   application.SendNotification();
1000   application.Render(300);
1001
1002   // We didn't expect the animation to finish yet
1003   application.SendNotification();
1004   finishCheck.CheckSignalReceived();
1005
1006   application.SendNotification();
1007   application.Render(20);
1008
1009   DALI_TEST_EQUALS(destinationPosition, control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
1010   END_TEST;
1011 }
1012
1013 int UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance(void)
1014 {
1015   ToolkitTestApplication application;
1016   tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance");
1017
1018   Radian sourceAngle(1.0f);
1019   Radian destinationAngle(2.0f);
1020   Quaternion sourceOrientation(sourceAngle, Vector3::XAXIS);
1021   Quaternion destinationOrientation(destinationAngle, Vector3::XAXIS);
1022
1023   Control control1 = Control::New();
1024   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1025   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1026   control1.SetProperty(Actor::Property::ORIENTATION, sourceOrientation);
1027   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1028   Property::Map controlProperty1;
1029   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1030   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1031   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
1032
1033   Control control2 = Control::New();
1034   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1035   control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1036   control2.SetProperty(Actor::Property::ORIENTATION, Quaternion(Radian(2.0f), Vector3::XAXIS));
1037   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1038   Property::Map controlProperty2;
1039   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1040   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1041   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
1042
1043   Control control3 = Control::New();
1044   control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1045   control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1046   control3.SetProperty(Actor::Property::ORIENTATION, destinationOrientation);
1047   control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1048   Property::Map controlProperty3;
1049   controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1050   controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1051   control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
1052
1053   // not inherit Orientation.
1054   control3.SetProperty(Actor::Property::INHERIT_POSITION, true);
1055   control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
1056   control3.SetProperty(Actor::Property::INHERIT_SCALE, true);
1057
1058   Vector3 currentAxis;
1059   Radian currentRadian;
1060
1061   application.GetScene().Add(control1);
1062   application.GetScene().Add(control2);
1063   control2.Add(control3);
1064
1065   application.SendNotification();
1066   application.Render(20);
1067
1068   Quaternion currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1069   DALI_TEST_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1070
1071   Transition transition;
1072   TransitionSet transitionSet;
1073   bool signalReceived(false);
1074   TransitionFinishCheck finishCheck(signalReceived);
1075
1076   transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
1077   transitionSet = TransitionSet::New();
1078   transitionSet.AddTransition(transition);
1079   transitionSet.Play();
1080   transitionSet.FinishedSignal().Connect(&application, finishCheck);
1081
1082   application.SendNotification();
1083   application.Render(300);
1084
1085   currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1086   DALI_TEST_NOT_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1087
1088   application.SendNotification();
1089   application.Render(300);
1090
1091   // We didn't expect the animation to finish yet
1092   application.SendNotification();
1093   finishCheck.CheckSignalReceived();
1094
1095   application.SendNotification();
1096   application.Render(20);
1097
1098   currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1099   DALI_TEST_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1100
1101   END_TEST;
1102 }
1103
1104 int UtcDaliTransitionBetweenControlPairWithTreeWithoutScaleInheritance(void)
1105 {
1106   ToolkitTestApplication application;
1107   tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance");
1108
1109   Vector3 sourceScale(1, 1, 1);
1110   Vector3 destinationScale(2, 2, 1);
1111
1112   Control control1 = Control::New();
1113   control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1114   control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1115   control1.SetProperty(Actor::Property::SCALE, sourceScale);
1116   control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1117   Property::Map controlProperty1;
1118   controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1119   controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1120   control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
1121
1122   Control control2 = Control::New();
1123   control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1124   control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1125   control2.SetProperty(Actor::Property::SCALE, Vector3(3, 3, 1));
1126   control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1127   Property::Map controlProperty2;
1128   controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1129   controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1130   control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
1131
1132   Control control3 = Control::New();
1133   control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1134   control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1135   control3.SetProperty(Actor::Property::SCALE, destinationScale);
1136   control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1137   Property::Map controlProperty3;
1138   controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1139   controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1140   control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
1141
1142   // not inherit Orientation.
1143   control3.SetProperty(Actor::Property::INHERIT_POSITION, true);
1144   control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, true);
1145   control3.SetProperty(Actor::Property::INHERIT_SCALE, false);
1146
1147   application.GetScene().Add(control1);
1148   application.GetScene().Add(control2);
1149   control2.Add(control3);
1150
1151   application.SendNotification();
1152   application.Render(20);
1153
1154   Vector3 currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1155   DALI_TEST_EQUALS(currentScale, destinationScale, 0.0001f, TEST_LOCATION);
1156
1157   Transition transition;
1158   TransitionSet transitionSet;
1159   bool signalReceived(false);
1160   TransitionFinishCheck finishCheck(signalReceived);
1161
1162   transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
1163   transitionSet = TransitionSet::New();
1164   transitionSet.AddTransition(transition);
1165   transitionSet.Play();
1166   transitionSet.FinishedSignal().Connect(&application, finishCheck);
1167
1168   application.SendNotification();
1169   application.Render(300);
1170
1171   currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1172   DALI_TEST_CHECK(currentScale.x <= destinationScale.x && currentScale.x >= sourceScale.x);
1173   DALI_TEST_CHECK(currentScale.y <= destinationScale.y && currentScale.y >= sourceScale.y);
1174   DALI_TEST_CHECK(currentScale.z <= destinationScale.z && currentScale.z >= sourceScale.z);
1175
1176   application.SendNotification();
1177   application.Render(300);
1178
1179   // We didn't expect the animation to finish yet
1180   application.SendNotification();
1181   finishCheck.CheckSignalReceived();
1182
1183   application.SendNotification();
1184   application.Render(20);
1185
1186   currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1187   DALI_TEST_EQUALS(currentScale, destinationScale, 0.0001f, TEST_LOCATION);
1188
1189   END_TEST;
1190 }
1191
1192
1193 int UtcDaliMultipleTransitionAppearing(void)
1194 {
1195   ToolkitTestApplication application;
1196   tet_infoline("UtcDaliMultipleTransitionAppearing");
1197
1198   Control control = Control::New();
1199   control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1200   control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1201   control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
1202   control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1203   Property::Map controlProperty;
1204   controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1205   controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1206   control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
1207
1208   application.GetScene().Add(control);
1209
1210   application.SendNotification();
1211   application.Render(20);
1212
1213   DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
1214
1215   TransitionSet transitionSet = TransitionSet::New();
1216   FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(1.0f, 1.0f));
1217   fade.SetAppearingTransition(true); // set fade in
1218   transitionSet.AddTransition(fade);
1219   SlideTransition slide = SlideTransition::New(control, Dali::Toolkit::SlideTransitionDirection::BOTTOM, TimePeriod(0.5f, 1.0f));
1220   slide.SetAppearingTransition(true); // set slide
1221   transitionSet.AddTransition(slide);
1222   transitionSet.Play();
1223
1224   bool signalReceived(false);
1225   TransitionFinishCheck finishCheck(signalReceived);
1226   transitionSet.FinishedSignal().Connect(&application, finishCheck);
1227
1228   application.SendNotification();
1229   application.Render(300);
1230
1231   float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1232   DALI_TEST_CHECK(currentOpacity == 0.0f);
1233
1234   application.SendNotification();
1235   application.Render(400);
1236
1237   currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1238   DALI_TEST_CHECK(currentOpacity == 0.5f);
1239
1240   application.SendNotification();
1241   application.Render(500);
1242
1243   currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1244   DALI_TEST_CHECK(currentOpacity > 0.5f && currentOpacity < 1.0f);
1245
1246   application.SendNotification();
1247   application.Render(500);
1248
1249   currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1250   DALI_TEST_CHECK(currentOpacity > 0.5f && currentOpacity < 1.0f);
1251
1252   // We didn't expect the animation to finish yet
1253   application.SendNotification();
1254   finishCheck.CheckSignalNotReceived();
1255
1256   application.SendNotification();
1257   application.Render(500);
1258
1259   // We did expect the animation to finish
1260   application.SendNotification();
1261   finishCheck.CheckSignalReceived();
1262
1263   application.SendNotification();
1264   application.Render(20);
1265
1266   DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
1267
1268   END_TEST;
1269 }