2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
21 #include <dali-toolkit/public-api/transition/fade-transition.h>
22 #include <dali-toolkit/public-api/transition/slide-transition.h>
23 #include <dali-toolkit/public-api/transition/transition-base.h>
24 #include <dali-toolkit/public-api/transition/transition-set.h>
25 #include <dali-toolkit/public-api/transition/transition.h>
26 #include <dali/devel-api/actors/actor-devel.h>
31 using namespace Dali::Toolkit;
34 const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
38 // Functor to test whether a Finish signal is emitted
39 struct TransitionFinishCheck
41 TransitionFinishCheck(bool& signalReceived)
42 : mSignalReceived(signalReceived)
46 void operator()(TransitionSet& transitionSet)
48 mSignalReceived = true;
53 mSignalReceived = false;
56 void CheckSignalReceived()
60 tet_printf("Expected Finish signal was not received\n");
69 void CheckSignalNotReceived()
73 tet_printf("Unexpected Finish signal was received\n");
82 bool& mSignalReceived; // owned by individual tests
85 int UtcDaliTransitionSetGetProperty01(void)
87 ToolkitTestApplication application;
88 tet_infoline(" UtcDaliTransitionSetGetProperty01");
90 Control control1 = Control::New();
91 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
92 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
93 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
94 Property::Map controlProperty1;
95 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
96 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
97 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
98 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
99 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
100 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
101 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
103 Control control2 = Control::New();
104 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
105 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
106 control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
107 Property::Map controlProperty2;
108 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
109 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
110 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
111 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
112 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
113 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
114 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
116 application.GetScene().Add(control1);
117 application.GetScene().Add(control2);
119 application.SendNotification();
120 application.Render(20);
122 Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f, -0.1f));
123 TimePeriod timePeriod = transition.GetTimePeriod();
124 DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
125 DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
127 transition.SetTimePeriod(TimePeriod(0.5f, 1.0f));
128 timePeriod = transition.GetTimePeriod();
129 DALI_TEST_EQUALS(1.0f, timePeriod.durationSeconds, TEST_LOCATION);
130 DALI_TEST_EQUALS(0.5f, timePeriod.delaySeconds, TEST_LOCATION);
132 DALI_TEST_EQUALS(Dali::AlphaFunction::DEFAULT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
133 transition.SetAlphaFunction(Dali::AlphaFunction::EASE_IN_OUT);
134 DALI_TEST_EQUALS(Dali::AlphaFunction::EASE_IN_OUT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
136 TransitionSet transitionSet = TransitionSet::New();
137 transitionSet.AddTransition(transition);
139 DALI_TEST_EQUALS(1, transitionSet.GetTransitionCount(), TEST_LOCATION);
140 DALI_TEST_EQUALS(transition, transitionSet.GetTransitionAt(0), TEST_LOCATION);
145 int UtcDaliTransitionSetGetProperty02(void)
147 ToolkitTestApplication application;
148 tet_infoline(" UtcDaliTransitionSetGetProperty02");
150 Control control1 = Control::New();
151 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
152 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
153 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
154 Property::Map controlProperty1;
155 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
156 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
157 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(50.0f, 30.0f, 40.0f, 20.0f));
158 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
159 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
160 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
161 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
163 Control control2 = Control::New();
164 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
165 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
166 control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
167 Property::Map controlProperty2;
168 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
169 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
170 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(32.f, 54.0f, 24.0f, 42.0f));
171 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
172 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
173 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
174 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
176 application.GetScene().Add(control1);
177 application.GetScene().Add(control2);
179 application.SendNotification();
180 application.Render(20);
182 Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f));
183 TimePeriod timePeriod = transition.GetTimePeriod();
184 DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
185 DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
187 transition.SetTimePeriod(TimePeriod(0.5f, 1.0f));
188 timePeriod = transition.GetTimePeriod();
189 DALI_TEST_EQUALS(1.0f, timePeriod.durationSeconds, TEST_LOCATION);
190 DALI_TEST_EQUALS(0.5f, timePeriod.delaySeconds, TEST_LOCATION);
192 DALI_TEST_EQUALS(Dali::AlphaFunction::DEFAULT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
193 transition.SetAlphaFunction(Dali::AlphaFunction::EASE_IN_OUT);
194 DALI_TEST_EQUALS(Dali::AlphaFunction::EASE_IN_OUT, transition.GetAlphaFunction().GetBuiltinFunction(), TEST_LOCATION);
196 TransitionSet transitionSet = TransitionSet::New();
197 transitionSet.AddTransition(transition);
199 DALI_TEST_EQUALS(1, transitionSet.GetTransitionCount(), TEST_LOCATION);
200 DALI_TEST_EQUALS(transition, transitionSet.GetTransitionAt(0), TEST_LOCATION);
205 int UtcDaliTransitionBetweenControlPair(void)
207 ToolkitTestApplication application;
208 tet_infoline(" UtcDaliTransitionBetweenControlPair");
210 Vector3 destinationPosition(50, 50, 0);
211 Vector3 destinationSize(120, 120, 0);
212 Vector3 destinationScale(2, 1, 0);
213 Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
214 float destinationOpacity(0.8f);
215 float destinationRadius(50.f);
216 float destinationBorderlineWidth(80.0f);
217 Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
218 float destinationBorderlineOffset(-1.0f);
219 Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
221 Control control1 = Control::New();
222 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
223 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
224 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
225 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
226 control1.SetProperty(Actor::Property::SCALE, Vector3(1, 2, 0));
227 control1.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 1.0f, 1.0f, 0.5f));
228 control1.SetProperty(Actor::Property::OPACITY, 0.5f);
229 Property::Map controlProperty1;
230 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
231 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
232 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
233 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 60.f);
234 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
235 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
236 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
238 Control control2 = Control::New();
239 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
240 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
241 control2.SetProperty(Actor::Property::POSITION, destinationPosition);
242 control2.SetProperty(Actor::Property::SIZE, destinationSize);
243 control2.SetProperty(Actor::Property::SCALE, destinationScale);
244 control2.SetProperty(Actor::Property::COLOR, destinationColor);
245 control2.SetProperty(Actor::Property::OPACITY, destinationOpacity);
246 Property::Map controlProperty2;
247 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
248 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
249 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
250 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
251 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
252 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
253 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
255 DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
256 Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
257 Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
258 DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
259 float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
260 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
261 Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
262 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
263 float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
264 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
266 application.GetScene().Add(control1);
267 application.GetScene().Add(control2);
269 application.SendNotification();
270 application.Render(20);
272 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
273 TransitionSet transitionSet = TransitionSet::New();
274 transitionSet.AddTransition(transition);
275 transitionSet.Play();
277 bool signalReceived(false);
278 TransitionFinishCheck finishCheck(signalReceived);
279 transitionSet.FinishedSignal().Connect(&application, finishCheck);
281 application.SendNotification();
282 application.Render(50);
284 // We didn't expect the animation to finish yet
285 application.SendNotification();
286 finishCheck.CheckSignalNotReceived();
288 DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
289 DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
290 Dali::Renderer renderer = control2.GetRendererAt(0);
291 Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
292 cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
293 DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
294 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
295 borderlineWidth = renderer.GetCurrentProperty<float>(index);
296 DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
297 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
298 borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
299 DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
300 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
301 borderlineOffset = renderer.GetCurrentProperty<float>(index);
302 DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
304 application.SendNotification();
305 application.Render(700);
307 // We did expect the animation to finish
308 application.SendNotification();
309 finishCheck.CheckSignalReceived();
311 application.SendNotification();
312 application.Render(20);
314 DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
315 DALI_TEST_EQUALS(destinationSize, control2.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
316 DALI_TEST_EQUALS(destinationScale, control2.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
317 DALI_TEST_EQUALS(destinationColor, control2.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
318 DALI_TEST_EQUALS(destinationOpacity, control2.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
319 DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
320 renderer = control2.GetRendererAt(0);
321 index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
322 cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
323 DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
324 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
325 borderlineWidth = renderer.GetCurrentProperty<float>(index);
326 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
327 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
328 borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
329 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
330 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
331 borderlineOffset = renderer.GetCurrentProperty<float>(index);
332 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
337 int UtcDaliTransitionBetweenControlPair2(void)
339 ToolkitTestApplication application;
340 tet_infoline(" UtcDaliTransitionBetweenControlPair2 - source target will be transitioned.");
342 Vector3 sourcePosition(100, 200, 0);
343 Vector3 sourceSize(150, 150, 0);
344 Vector3 sourceScale(1, 2, 0);
345 Vector4 sourceColor(1.0f, 1.0f, 1.0f, 0.5f);
346 float sourceOpacity(0.5f);
347 float sourceRadius(30.f);
348 float sourceBorderlineWidth(60.0f);
349 Vector4 sourceBorderlineColor(1.0f, 0.0f, 0.0f, 1.0f);
350 float sourceBorderlineOffset(1.f);
351 Vector4 sourceRadiusV4 = Vector4(sourceRadius, sourceRadius, sourceRadius, sourceRadius);
353 Vector3 destinationPosition(50, 50, 0);
354 Vector3 destinationSize(120, 120, 0);
355 Vector3 destinationScale(2, 1, 0);
356 Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
357 float destinationOpacity(0.8f);
358 float destinationRadius(50.f);
359 float destinationBorderlineWidth(80.0f);
360 Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
361 float destinationBorderlineOffset(-1.0f);
362 Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
364 Control control1 = Control::New();
365 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
366 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
367 control1.SetProperty(Actor::Property::POSITION, sourcePosition);
368 control1.SetProperty(Actor::Property::SIZE, sourceSize);
369 control1.SetProperty(Actor::Property::SCALE, sourceScale);
370 control1.SetProperty(Actor::Property::COLOR, sourceColor);
371 control1.SetProperty(Actor::Property::OPACITY, sourceOpacity);
372 Property::Map controlProperty1;
373 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
374 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
375 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceRadius);
376 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
377 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
378 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
379 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
381 Control control2 = Control::New();
382 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
383 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::CENTER);
384 control2.SetProperty(Actor::Property::POSITION, destinationPosition);
385 control2.SetProperty(Actor::Property::SIZE, destinationSize);
386 control2.SetProperty(Actor::Property::SCALE, destinationScale);
387 control2.SetProperty(Actor::Property::COLOR, destinationColor);
388 control2.SetProperty(Actor::Property::OPACITY, destinationOpacity);
389 Property::Map controlProperty2;
390 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
391 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
392 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
393 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
394 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
395 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
396 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
398 DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
399 Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
400 Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
401 DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
402 float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
403 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
404 Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
405 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
406 float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
407 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
409 application.GetScene().Add(control1);
410 application.GetScene().Add(control2);
412 application.SendNotification();
413 application.Render(20);
415 Transition transition = Transition::New(control1, control2, false, TimePeriod(0.5f));
416 TransitionSet transitionSet = TransitionSet::New();
417 transitionSet.AddTransition(transition);
418 transitionSet.Play();
420 bool signalReceived(false);
421 TransitionFinishCheck finishCheck(signalReceived);
422 transitionSet.FinishedSignal().Connect(&application, finishCheck);
424 application.SendNotification();
425 application.Render(50);
427 // We didn't expect the animation to finish yet
428 application.SendNotification();
429 finishCheck.CheckSignalNotReceived();
431 DALI_TEST_NOT_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
432 DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
434 Dali::Renderer renderer = control1.GetRendererAt(0);
435 Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
436 cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
437 DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
439 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
440 borderlineWidth = renderer.GetCurrentProperty<float>(index);
441 DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
443 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
444 borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
445 DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
447 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
448 borderlineOffset = renderer.GetCurrentProperty<float>(index);
449 DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
451 application.SendNotification();
452 application.Render(700);
454 // We did expect the animation to finish
455 application.SendNotification();
456 finishCheck.CheckSignalReceived();
458 // After the transition is finished,
459 // every current and renderer propeties of control1 are equal to destination properties.
460 DALI_TEST_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
461 DALI_TEST_EQUALS(destinationSize, control1.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
462 DALI_TEST_EQUALS(destinationScale, control1.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
463 DALI_TEST_EQUALS(destinationColor, control1.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
464 DALI_TEST_EQUALS(destinationOpacity, control1.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
466 DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
467 renderer = control1.GetRendererAt(0);
468 index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
469 cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
470 DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
472 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
473 borderlineWidth = renderer.GetCurrentProperty<float>(index);
474 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
476 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
477 borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
478 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
480 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
481 borderlineOffset = renderer.GetCurrentProperty<float>(index);
482 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
484 // every actor properties of control1 are returned to the source properties.
485 DALI_TEST_EQUALS(sourcePosition, control1.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
486 DALI_TEST_EQUALS(sourceSize, control1.GetProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
487 DALI_TEST_EQUALS(sourceScale, control1.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
488 DALI_TEST_EQUALS(sourceColor, control1.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
489 DALI_TEST_EQUALS(sourceOpacity, control1.GetProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
491 application.SendNotification();
492 application.Render(20);
494 // after next update, renderer properties are returned to the source properties.
495 DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
496 renderer = control1.GetRendererAt(0);
497 index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
498 cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
499 DALI_TEST_EQUALS(sourceRadiusV4, cornerRadius, TEST_LOCATION);
501 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
502 borderlineWidth = renderer.GetCurrentProperty<float>(index);
503 DALI_TEST_EQUALS(sourceBorderlineWidth, borderlineWidth, TEST_LOCATION);
505 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
506 borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
507 DALI_TEST_EQUALS(sourceBorderlineColor, borderlineColor, TEST_LOCATION);
509 index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
510 borderlineOffset = renderer.GetCurrentProperty<float>(index);
511 DALI_TEST_EQUALS(sourceBorderlineOffset, borderlineOffset, TEST_LOCATION);
516 int UtcDaliTransitionBetweenControlPairWithoutEmptySourceBackground(void)
518 ToolkitTestApplication application;
519 tet_infoline(" UtcDaliTransitionBetweenControlPair");
521 Vector4 destinationRadius(50.f, 30.f, 40.f, 0.f);
522 float destinationBorderlineWidth(40.f);
523 Vector4 destinationBorderlineColor(1.0f, 0.5f, 0.2f, 0.8f);
524 float destinationBorderlineOffset(1.f);
526 Control control1 = Control::New();
527 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
528 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
529 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
531 Control control2 = Control::New();
532 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
533 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
534 control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
535 Property::Map controlProperty2;
536 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
537 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
538 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
539 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
540 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
541 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
542 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
544 Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
545 Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
546 DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
547 float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
548 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
549 Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
550 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
551 float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
552 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
554 application.GetScene().Add(control1);
555 application.GetScene().Add(control2);
557 application.SendNotification();
558 application.Render(20);
560 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
561 TransitionSet transitionSet = TransitionSet::New();
562 transitionSet.AddTransition(transition);
563 transitionSet.Play();
565 bool signalReceived(false);
566 TransitionFinishCheck finishCheck(signalReceived);
567 transitionSet.FinishedSignal().Connect(&application, finishCheck);
569 application.SendNotification();
570 application.Render(50);
572 // We didn't expect the animation to finish yet
573 application.SendNotification();
574 finishCheck.CheckSignalNotReceived();
576 backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
577 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
578 DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
579 borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
580 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
581 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
582 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
583 borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
584 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
586 application.SendNotification();
587 application.Render(700);
589 // We did expect the animation to finish
590 application.SendNotification();
591 finishCheck.CheckSignalReceived();
593 application.SendNotification();
594 application.Render(20);
596 backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
597 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
598 DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
599 borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
600 DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
601 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
602 DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
603 borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
604 DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
609 int UtcDaliTransitionBetweenImageViewPair(void)
611 ToolkitTestApplication application;
612 tet_infoline(" UtcDaliTransitionBetweenControlPair");
614 Vector3 destinationPosition(50, 50, 0);
616 ImageView control1 = ImageView::New();
617 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
618 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
619 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
620 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
621 Property::Map controlProperty1;
622 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
623 controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
624 controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
625 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
626 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
627 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
628 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
629 control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
631 ImageView control2 = ImageView::New();
632 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
633 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
634 control2.SetProperty(Actor::Property::POSITION, destinationPosition);
635 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
636 Property::Map controlProperty2;
637 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
638 controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
639 controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
640 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
641 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
642 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
643 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
644 control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
646 DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
648 application.GetScene().Add(control1);
649 application.GetScene().Add(control2);
651 application.SendNotification();
652 application.Render(20);
654 Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
655 Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
657 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
658 TransitionSet transitionSet = TransitionSet::New();
659 transitionSet.AddTransition(transition);
660 transitionSet.Play();
662 bool signalReceived(false);
663 TransitionFinishCheck finishCheck(signalReceived);
664 transitionSet.FinishedSignal().Connect(&application, finishCheck);
666 application.SendNotification();
667 application.Render(400);
669 // We didn't expect the animation to finish yet
670 application.SendNotification();
671 finishCheck.CheckSignalNotReceived();
673 // control2 moved about 80%
674 Vector3 currentPosition = control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
675 Vector3 expectedPosition_0_7 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.7;
676 Vector3 expectedPosition_0_9 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.9;
677 DALI_TEST_CHECK(currentPosition.x <= expectedPosition_0_7.x && currentPosition.x >= expectedPosition_0_9.x);
678 DALI_TEST_CHECK(currentPosition.y <= expectedPosition_0_7.y && currentPosition.y >= expectedPosition_0_9.y);
680 application.SendNotification();
681 application.Render(200);
683 // We did expect the animation to finish
684 application.SendNotification();
685 finishCheck.CheckSignalReceived();
687 DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
689 application.SendNotification();
690 application.Render(20);
692 DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
697 int UtcDaliTransitionBetweenImageViewPairWithDelay(void)
699 ToolkitTestApplication application;
700 tet_infoline(" UtcDaliTransitionBetweenControlPair");
702 Vector3 destinationPosition(50, 50, 0);
704 ImageView control1 = ImageView::New();
705 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
706 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
707 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
708 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
709 Property::Map controlProperty1;
710 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
711 controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
712 controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
713 controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
714 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
715 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
716 controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
717 control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
719 ImageView control2 = ImageView::New();
720 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
721 control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_LEFT);
722 control2.SetProperty(Actor::Property::POSITION, destinationPosition);
723 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
724 Property::Map controlProperty2;
725 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
726 controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
727 controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
728 controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
729 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
730 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
731 controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
732 control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
734 DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
736 application.GetScene().Add(control1);
737 application.GetScene().Add(control2);
739 application.SendNotification();
740 application.Render(20);
742 Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
743 Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
745 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f, 0.5f));
746 TransitionSet transitionSet = TransitionSet::New();
747 transitionSet.AddTransition(transition);
748 transitionSet.Play();
750 bool signalReceived(false);
751 TransitionFinishCheck finishCheck(signalReceived);
752 transitionSet.FinishedSignal().Connect(&application, finishCheck);
754 application.SendNotification();
755 application.Render(400);
757 // We didn't expect the animation to finish yet
758 application.SendNotification();
759 finishCheck.CheckSignalNotReceived();
761 DALI_TEST_EQUALS(startWorldPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
763 application.SendNotification();
764 application.Render(400);
766 // We didn't expect the animation to finish yet
767 application.SendNotification();
768 finishCheck.CheckSignalNotReceived();
770 // control2 moved about 60% (800ms)
771 Vector3 currentPosition = control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
772 Vector3 expectedPosition_0_5 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.5;
773 Vector3 expectedPosition_0_7 = startWorldPosition + (finishWorldPosition - startWorldPosition) * 0.7;
774 DALI_TEST_CHECK(currentPosition.x <= expectedPosition_0_5.x && currentPosition.x >= expectedPosition_0_7.x);
775 DALI_TEST_CHECK(currentPosition.y <= expectedPosition_0_5.y && currentPosition.y >= expectedPosition_0_7.y);
777 application.SendNotification();
778 application.Render(400);
780 // We did expect the animation to finish
781 application.SendNotification();
782 finishCheck.CheckSignalReceived();
784 DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
786 application.SendNotification();
787 application.Render(20);
789 DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
794 int UtcDaliTransitionBetweenControlPairWithTree(void)
796 ToolkitTestApplication application;
797 tet_infoline(" UtcDaliTransitionBetweenControlPairWithTree");
799 Vector3 destinationPosition(50, 50, 0);
800 Vector3 destinationWorldPosition(-130, -290, 0);
802 Control control1 = Control::New();
803 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
804 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
805 Property::Map controlProperty1;
806 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
807 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
808 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
810 Control control2 = Control::New();
811 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
812 control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
813 control2.SetProperty(Actor::Property::POSITION, destinationPosition);
814 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
815 Property::Map controlProperty2;
816 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
817 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
818 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
820 Control control3 = Control::New();
821 control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
822 control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
823 control3.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
824 control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
825 Property::Map controlProperty3;
826 controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
827 controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
828 control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
830 application.GetScene().Add(control1);
831 application.GetScene().Add(control2);
832 control2.Add(control3);
834 application.SendNotification();
835 application.Render(20);
837 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
838 TransitionSet transitionSet = TransitionSet::New();
839 transitionSet.AddTransition(transition);
840 transitionSet.Play();
842 bool signalReceived(false);
843 TransitionFinishCheck finishCheck(signalReceived);
844 transitionSet.FinishedSignal().Connect(&application, finishCheck);
846 application.SendNotification();
847 application.Render(600);
849 // We didn't expect the animation to finish yet
850 application.SendNotification();
851 finishCheck.CheckSignalReceived();
853 application.SendNotification();
854 application.Render(20);
856 DALI_TEST_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
857 DALI_TEST_EQUALS(destinationWorldPosition, control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
862 int UtcDaliTransitionBetweenControlPairWithTreeWithChild(void)
864 ToolkitTestApplication application;
865 tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithChild");
867 Vector3 destinationWorldPosition(-80, -240, 0);
869 Control control1 = Control::New();
870 control1.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
871 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
872 Property::Map controlProperty1;
873 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
874 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
875 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
877 Control control2 = Control::New();
878 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
879 control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
880 control2.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
881 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
882 Property::Map controlProperty2;
883 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
884 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
885 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
887 Control control3 = Control::New();
888 control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
889 control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
890 control3.SetProperty(Actor::Property::POSITION, Vector3(50, 50, 0));
891 control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
892 Property::Map controlProperty3;
893 controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
894 controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
895 control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
897 application.GetScene().Add(control1);
898 application.GetScene().Add(control2);
899 control2.Add(control3);
901 application.SendNotification();
902 application.Render(20);
904 Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
905 transition.TransitionWithChild(true);
906 TransitionSet transitionSet = TransitionSet::New();
907 transitionSet.AddTransition(transition);
908 transitionSet.Play();
910 bool signalReceived(false);
911 TransitionFinishCheck finishCheck(signalReceived);
912 transitionSet.FinishedSignal().Connect(&application, finishCheck);
914 application.SendNotification();
915 application.Render(600);
917 // We didn't expect the animation to finish yet
918 application.SendNotification();
919 finishCheck.CheckSignalReceived();
921 application.SendNotification();
922 application.Render(20);
924 DALI_TEST_EQUALS(destinationWorldPosition, control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
929 int UtcDaliTransitionBetweenControlPairWithTreeWithoutPositionInheritance(void)
931 ToolkitTestApplication application;
932 tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutPositionInheritance");
934 Vector3 sourcePosition(50, 50, 0);
935 Vector3 destinationPosition(100, 100, 0);
937 Control control1 = Control::New();
938 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
939 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
940 control1.SetProperty(Actor::Property::POSITION, sourcePosition);
941 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
942 Property::Map controlProperty1;
943 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
944 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
945 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
947 Control control2 = Control::New();
948 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
949 control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
950 control2.SetProperty(Actor::Property::POSITION, Vector3(150, 150, 0));
951 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
952 Property::Map controlProperty2;
953 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
954 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
955 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
957 Control control3 = Control::New();
958 control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
959 control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
960 control3.SetProperty(Actor::Property::POSITION, destinationPosition);
961 control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
962 Property::Map controlProperty3;
963 controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
964 controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
965 control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
967 application.GetScene().Add(control1);
968 application.GetScene().Add(control2);
969 control2.Add(control3);
971 application.SendNotification();
972 application.Render(20);
974 Transition transition;
975 TransitionSet transitionSet;
976 bool signalReceived(false);
977 TransitionFinishCheck finishCheck(signalReceived);
979 // not inherit Position.
980 control3.SetProperty(Actor::Property::INHERIT_POSITION, false);
981 control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, true);
982 control3.SetProperty(Actor::Property::INHERIT_SCALE, true);
984 transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
985 transitionSet = TransitionSet::New();
986 transitionSet.AddTransition(transition);
987 transitionSet.Play();
988 transitionSet.FinishedSignal().Connect(&application, finishCheck);
990 application.SendNotification();
991 application.Render(300);
993 Vector3 currentPosition = control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
994 DALI_TEST_CHECK(currentPosition.x <= destinationPosition.x && currentPosition.x >= sourcePosition.x);
995 DALI_TEST_CHECK(currentPosition.y <= destinationPosition.y && currentPosition.y >= sourcePosition.y);
996 DALI_TEST_CHECK(currentPosition.z <= destinationPosition.z && currentPosition.z >= sourcePosition.z);
998 application.SendNotification();
999 application.Render(300);
1001 // We didn't expect the animation to finish yet
1002 application.SendNotification();
1003 finishCheck.CheckSignalReceived();
1005 application.SendNotification();
1006 application.Render(20);
1008 DALI_TEST_EQUALS(destinationPosition, control3.GetProperty<Vector3>(Actor::Property::WORLD_POSITION), TEST_LOCATION);
1012 int UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance(void)
1014 ToolkitTestApplication application;
1015 tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance");
1017 Radian sourceAngle(1.0f);
1018 Radian destinationAngle(2.0f);
1019 Quaternion sourceOrientation(sourceAngle, Vector3::XAXIS);
1020 Quaternion destinationOrientation(destinationAngle, Vector3::XAXIS);
1022 Control control1 = Control::New();
1023 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1024 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1025 control1.SetProperty(Actor::Property::ORIENTATION, sourceOrientation);
1026 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1027 Property::Map controlProperty1;
1028 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1029 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1030 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
1032 Control control2 = Control::New();
1033 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1034 control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1035 control2.SetProperty(Actor::Property::ORIENTATION, Quaternion(Radian(2.0f), Vector3::XAXIS));
1036 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1037 Property::Map controlProperty2;
1038 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1039 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1040 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
1042 Control control3 = Control::New();
1043 control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1044 control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1045 control3.SetProperty(Actor::Property::ORIENTATION, destinationOrientation);
1046 control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1047 Property::Map controlProperty3;
1048 controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1049 controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1050 control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
1052 // not inherit Orientation.
1053 control3.SetProperty(Actor::Property::INHERIT_POSITION, true);
1054 control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
1055 control3.SetProperty(Actor::Property::INHERIT_SCALE, true);
1057 Vector3 currentAxis;
1058 Radian currentRadian;
1060 application.GetScene().Add(control1);
1061 application.GetScene().Add(control2);
1062 control2.Add(control3);
1064 application.SendNotification();
1065 application.Render(20);
1067 Quaternion currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1068 DALI_TEST_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1070 Transition transition;
1071 TransitionSet transitionSet;
1072 bool signalReceived(false);
1073 TransitionFinishCheck finishCheck(signalReceived);
1075 transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
1076 transitionSet = TransitionSet::New();
1077 transitionSet.AddTransition(transition);
1078 transitionSet.Play();
1079 transitionSet.FinishedSignal().Connect(&application, finishCheck);
1081 application.SendNotification();
1082 application.Render(300);
1084 currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1085 DALI_TEST_NOT_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1087 application.SendNotification();
1088 application.Render(300);
1090 // We didn't expect the animation to finish yet
1091 application.SendNotification();
1092 finishCheck.CheckSignalReceived();
1094 application.SendNotification();
1095 application.Render(20);
1097 currentOrientation = control3.GetProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION);
1098 DALI_TEST_EQUALS(currentOrientation, destinationOrientation, 0.0001f, TEST_LOCATION);
1103 int UtcDaliTransitionBetweenControlPairWithTreeWithoutScaleInheritance(void)
1105 ToolkitTestApplication application;
1106 tet_infoline(" UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance");
1108 Vector3 sourceScale(1, 1, 1);
1109 Vector3 destinationScale(2, 2, 1);
1111 Control control1 = Control::New();
1112 control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1113 control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1114 control1.SetProperty(Actor::Property::SCALE, sourceScale);
1115 control1.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1116 Property::Map controlProperty1;
1117 controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1118 controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1119 control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
1121 Control control2 = Control::New();
1122 control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1123 control2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1124 control2.SetProperty(Actor::Property::SCALE, Vector3(3, 3, 1));
1125 control2.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1126 Property::Map controlProperty2;
1127 controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1128 controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1129 control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
1131 Control control3 = Control::New();
1132 control3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1133 control3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1134 control3.SetProperty(Actor::Property::SCALE, destinationScale);
1135 control3.SetProperty(Actor::Property::SIZE, Vector3(120, 120, 0));
1136 Property::Map controlProperty3;
1137 controlProperty3.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1138 controlProperty3.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1139 control3.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty3);
1141 // not inherit Orientation.
1142 control3.SetProperty(Actor::Property::INHERIT_POSITION, true);
1143 control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, true);
1144 control3.SetProperty(Actor::Property::INHERIT_SCALE, false);
1146 application.GetScene().Add(control1);
1147 application.GetScene().Add(control2);
1148 control2.Add(control3);
1150 application.SendNotification();
1151 application.Render(20);
1153 Vector3 currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1154 DALI_TEST_EQUALS(currentScale, destinationScale, 0.0001f, TEST_LOCATION);
1156 Transition transition;
1157 TransitionSet transitionSet;
1158 bool signalReceived(false);
1159 TransitionFinishCheck finishCheck(signalReceived);
1161 transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
1162 transitionSet = TransitionSet::New();
1163 transitionSet.AddTransition(transition);
1164 transitionSet.Play();
1165 transitionSet.FinishedSignal().Connect(&application, finishCheck);
1167 application.SendNotification();
1168 application.Render(300);
1170 currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1171 DALI_TEST_CHECK(currentScale.x <= destinationScale.x && currentScale.x >= sourceScale.x);
1172 DALI_TEST_CHECK(currentScale.y <= destinationScale.y && currentScale.y >= sourceScale.y);
1173 DALI_TEST_CHECK(currentScale.z <= destinationScale.z && currentScale.z >= sourceScale.z);
1175 application.SendNotification();
1176 application.Render(300);
1178 // We didn't expect the animation to finish yet
1179 application.SendNotification();
1180 finishCheck.CheckSignalReceived();
1182 application.SendNotification();
1183 application.Render(20);
1185 currentScale = control3.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
1186 DALI_TEST_EQUALS(currentScale, destinationScale, 0.0001f, TEST_LOCATION);
1191 int UtcDaliMultipleTransitionAppearing(void)
1193 ToolkitTestApplication application;
1194 tet_infoline("UtcDaliMultipleTransitionAppearing");
1196 Control control = Control::New();
1197 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1198 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1199 control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
1200 control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
1201 Property::Map controlProperty;
1202 controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
1203 controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
1204 control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
1206 application.GetScene().Add(control);
1208 application.SendNotification();
1209 application.Render(20);
1211 DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
1213 TransitionSet transitionSet = TransitionSet::New();
1214 FadeTransition fade = FadeTransition::New(control, 0.5, TimePeriod(1.0f, 1.0f));
1215 fade.SetAppearingTransition(true); // set fade in
1216 transitionSet.AddTransition(fade);
1217 SlideTransition slide = SlideTransition::New(control, Dali::Toolkit::SlideTransitionDirection::BOTTOM, TimePeriod(0.5f, 1.0f));
1218 slide.SetAppearingTransition(true); // set slide
1219 transitionSet.AddTransition(slide);
1220 transitionSet.Play();
1222 bool signalReceived(false);
1223 TransitionFinishCheck finishCheck(signalReceived);
1224 transitionSet.FinishedSignal().Connect(&application, finishCheck);
1226 application.SendNotification();
1227 application.Render(300);
1229 float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1230 DALI_TEST_CHECK(currentOpacity == 0.0f);
1232 application.SendNotification();
1233 application.Render(400);
1235 currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1236 DALI_TEST_CHECK(currentOpacity == 0.5f);
1238 application.SendNotification();
1239 application.Render(500);
1241 currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1242 DALI_TEST_CHECK(currentOpacity > 0.5f && currentOpacity < 1.0f);
1244 application.SendNotification();
1245 application.Render(500);
1247 currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
1248 DALI_TEST_CHECK(currentOpacity > 0.5f && currentOpacity < 1.0f);
1250 // We didn't expect the animation to finish yet
1251 application.SendNotification();
1252 finishCheck.CheckSignalNotReceived();
1254 application.SendNotification();
1255 application.Render(500);
1257 // We did expect the animation to finish
1258 application.SendNotification();
1259 finishCheck.CheckSignalReceived();
1261 application.SendNotification();
1262 application.Render(20);
1264 DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);