2 * Copyright (c) 2017 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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali/devel-api/animation/path-constrainer.h>
23 #include <dali/devel-api/object/handle-devel.h>
24 #include <dali-test-suite-utils.h>
27 using namespace Dali::Internal;
32 static void SetupPath( Dali::Path& path)
34 path.AddPoint(Vector3( 30.0, 80.0, 0.0));
35 path.AddPoint(Vector3( 70.0, 120.0, 0.0));
36 path.AddPoint(Vector3(100.0, 100.0, 0.0));
38 //Control points for first segment
39 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
40 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
42 //Control points for second segment
43 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0) );
44 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0) );
47 static void SetupPathConstrainer( Dali::PathConstrainer& PathConstrainer)
49 PathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f,0.0f,0.0f) );
51 Dali::Property::Array points;
53 points[0] = Vector3( 30.0, 80.0, 0.0);
54 points[1] = Vector3( 70.0, 120.0, 0.0);
55 points[2] = Vector3(100.0, 100.0, 0.0);
56 PathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points );
59 points[0] = Vector3( 39.0, 90.0, 0.0);
60 points[1] = Vector3( 56.0, 119.0, 0.0);
61 points[2] = Vector3( 78.0, 120.0, 0.0);
62 points[3] = Vector3( 93.0, 104.0, 0.0);
63 PathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points );
66 static void SetupLinearConstrainerUniformProgress( Dali::LinearConstrainer& linearConstrainer)
68 Dali::Property::Array points;
73 linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
76 static void SetupLinearConstrainerNonUniformProgress( Dali::LinearConstrainer& linearConstrainer)
78 Dali::Property::Array points;
83 linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
88 linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points );
91 } // anonymous namespace
93 //PathConstrainer test cases
94 int UtcPathConstrainerApply(void)
96 TestApplication application;
98 Dali::Actor actor = Dali::Actor::New();
100 // Register a float property
101 Property::Index index = actor.RegisterProperty( "t", 0.0f );
103 Dali::Stage::GetCurrent().Add(actor);
106 Dali::Path path = Dali::Path::New();
109 //Create a PathConstrainer
110 Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
111 SetupPathConstrainer( pathConstrainer );
113 //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
114 Vector2 range( 0.0f, 1.0f );
115 pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
117 //Create an animation to animate the custom property
118 float durationSeconds(1.0f);
119 Dali::Animation animation = Dali::Animation::New(durationSeconds);
120 animation.AnimateTo(Dali::Property(actor,index),1.0f);
123 application.SendNotification();
124 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
126 Vector3 position, tangent;
127 path.Sample(0.2f, position, tangent );
128 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
130 application.SendNotification();
131 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
132 path.Sample(0.4f, position, tangent );
133 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
135 application.SendNotification();
136 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
137 path.Sample(0.6f, position, tangent );
138 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
140 application.SendNotification();
141 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
142 path.Sample(0.8f, position, tangent );
143 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
145 application.SendNotification();
146 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
147 path.Sample(1.0f, position, tangent );
148 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
150 application.SendNotification();
151 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* beyond the animation duration*/);
152 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
157 int UtcPathConstrainerApplyRange(void)
159 TestApplication application;
161 Dali::Actor actor = Dali::Actor::New();
163 // Register a float property
164 Property::Index index = actor.RegisterProperty( "t", 0.0f );
165 Dali::Stage::GetCurrent().Add(actor);
168 Dali::Path path = Dali::Path::New();
171 //Create a PathConstrainer
172 Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
173 SetupPathConstrainer( pathConstrainer );
175 //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
176 Vector2 range( 100.0f, 300.0f );
177 pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
180 //Create an animation to animate the custom property
181 float durationSeconds(1.0f);
182 Dali::Animation animation = Dali::Animation::New(durationSeconds);
183 animation.AnimateTo(Dali::Property(actor,index),400.0f);
186 application.SendNotification();
187 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
190 Vector3 position, tangent;
192 actor.GetProperty(index).Get(tValue);
193 float currentCursor = ( tValue - range.x ) / (range.y-range.x);
194 path.Sample(currentCursor, position, tangent );
195 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
197 application.SendNotification();
198 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
199 actor.GetProperty(index).Get(tValue);
200 currentCursor = ( tValue - range.x ) / (range.y-range.x);
201 path.Sample(currentCursor, position, tangent );
202 path.Sample(0.5, position, tangent );
203 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
205 application.SendNotification();
206 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
207 DevelHandle::GetCurrentProperty( actor, index ).Get( tValue );
208 currentCursor = ( tValue - range.x ) / (range.y-range.x);
209 path.Sample(currentCursor, position, tangent );
210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
212 application.SendNotification();
213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
214 DevelHandle::GetCurrentProperty( actor, index ).Get( tValue );
215 currentCursor = ( tValue - range.x ) / (range.y-range.x);
216 path.Sample(currentCursor, position, tangent );
217 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
219 application.SendNotification();
220 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
221 DevelHandle::GetCurrentProperty( actor, index ).Get( tValue );
222 currentCursor = ( tValue - range.x ) / (range.y-range.x);
223 path.Sample(currentCursor, position, tangent );
224 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
229 int UtcPathConstrainerDestroy(void)
231 TestApplication application;
233 Dali::Actor actor = Dali::Actor::New();
235 // Register a float property
236 Property::Index index = actor.RegisterProperty( "t", 0.0f );
237 Dali::Stage::GetCurrent().Add(actor);
241 Dali::Path path = Dali::Path::New();
244 //Create a PathConstrainer
245 Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
246 SetupPathConstrainer( pathConstrainer );
248 //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
249 Vector2 range( 0.0f, 1.0f );
250 pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
252 //Test that the constraint is correctly applied
253 actor.SetProperty(index,0.5f);
254 application.SendNotification();
255 application.Render(static_cast<unsigned int>(1.0f));
257 Vector3 position, tangent;
258 path.Sample(0.5f, position, tangent );
259 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
263 //PathConstrainer has been destroyed. Constraint in the actor should have been removed
264 actor.SetProperty(index,0.75f);
265 application.SendNotification();
266 application.Render(static_cast<unsigned int>(1.0f));
268 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
273 int UtcPathConstrainerRemove(void)
275 TestApplication application;
277 Dali::Actor actor = Dali::Actor::New();
279 // Register a float property
280 Property::Index index = actor.RegisterProperty( "t", 0.0f );
281 Dali::Stage::GetCurrent().Add(actor);
284 Dali::Path path = Dali::Path::New();
287 //Create a PathConstrainer
288 Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
289 SetupPathConstrainer( pathConstrainer );
291 //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
292 Vector2 range( 0.0f, 1.0f );
293 pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
295 //Test that the constraint is correctly applied
296 actor.SetProperty(index,0.5f);
297 application.SendNotification();
298 application.Render(static_cast<unsigned int>(1.0f));
300 Vector3 position, tangent;
301 path.Sample(0.5f, position, tangent );
302 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
305 pathConstrainer.Remove( actor );
306 actor.SetProperty(index,0.75f);
307 application.SendNotification();
308 application.Render(static_cast<unsigned int>(1.0f));
310 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
315 int UtcPathConstrainerProperties(void)
317 TestApplication application;
318 Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
320 pathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3( 1.0f,0.0f,0.0f ) );
321 DALI_TEST_EQUALS( pathConstrainer.GetProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION );
322 DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( pathConstrainer, Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION );
324 Dali::Property::Array points;
326 points[0] = Vector3( 30.0, 80.0, 0.0);
327 points[1] = Vector3( 70.0, 120.0, 0.0);
328 points[2] = Vector3(100.0, 100.0, 0.0);
329 pathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points );
332 Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::POINTS );
333 Property::Array* array = value.GetArray();
334 DALI_TEST_CHECK( array );
336 const unsigned int noOfPoints = points.Size();
337 for( unsigned int i = 0; i < noOfPoints; ++i )
339 DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
344 Property::Value value = DevelHandle::GetCurrentProperty( pathConstrainer, Dali::PathConstrainer::Property::POINTS );
345 Property::Array* array = value.GetArray();
346 DALI_TEST_CHECK( array );
348 const unsigned int noOfPoints = points.Size();
349 for( unsigned int i = 0; i < noOfPoints; ++i )
351 DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
356 points[0] = Vector3( 39.0, 90.0, 0.0);
357 points[1] = Vector3( 56.0, 119.0, 0.0);
358 points[2] = Vector3( 78.0, 120.0, 0.0);
359 points[3] = Vector3( 93.0, 104.0, 0.0);
360 pathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points );
363 Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS );
364 Property::Array* array = value.GetArray();
365 DALI_TEST_CHECK( array );
367 const unsigned int noOfPoints = points.Size();
368 for( unsigned int i = 0; i < noOfPoints; ++i )
370 DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
375 Property::Value value = DevelHandle::GetCurrentProperty( pathConstrainer, Dali::PathConstrainer::Property::CONTROL_POINTS );
376 Property::Array* array = value.GetArray();
377 DALI_TEST_CHECK( array );
379 const unsigned int noOfPoints = points.Size();
380 for( unsigned int i = 0; i < noOfPoints; ++i )
382 DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
389 //LinearConstrainer test cases
390 int UtcLinearConstrainerDownCast(void)
392 TestApplication application;
393 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
395 BaseHandle handle( linearConstrainer );
396 Dali::LinearConstrainer linearConstrainer2 = Dali::LinearConstrainer::DownCast( handle );
397 DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION );
400 Dali:: LinearConstrainer linearConstrainer3 = Dali::LinearConstrainer::DownCast( handle2 );
401 DALI_TEST_EQUALS( (bool)linearConstrainer3, false, TEST_LOCATION );
406 int UtcLinearConstrainerCopyConstructor(void)
408 TestApplication application;
409 Dali::LinearConstrainer linearConstrainer;
410 DALI_TEST_EQUALS( (bool)linearConstrainer, false, TEST_LOCATION );
412 linearConstrainer = Dali::LinearConstrainer::New();
413 DALI_TEST_EQUALS( (bool)linearConstrainer, true, TEST_LOCATION );
415 // call the copy constructor
416 Dali::LinearConstrainer linearConstrainer2( linearConstrainer );
417 DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION );
422 int UtcLinearConstrainerApply(void)
424 TestApplication application;
426 Dali::Actor actor = Dali::Actor::New();
428 // Register a float property
429 Property::Index index = actor.RegisterProperty( "t", 0.0f );
431 Dali::Stage::GetCurrent().Add(actor);
434 //Create a LinearConstrainer without specifying progress for values
435 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
436 SetupLinearConstrainerUniformProgress( linearConstrainer );
438 //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
439 Vector2 range( 0.0f, 1.0f );
440 linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
442 //Create an animation to animate the custom property
443 float durationSeconds(1.0f);
444 Dali::Animation animation = Dali::Animation::New(durationSeconds);
445 animation.AnimateTo(Dali::Property(actor,index),1.0f);
448 application.SendNotification();
449 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
451 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.5f, TEST_LOCATION );
453 application.SendNotification();
454 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
455 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f, TEST_LOCATION );
457 application.SendNotification();
458 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
459 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.5f, TEST_LOCATION );
461 application.SendNotification();
462 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
463 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
465 application.SendNotification();
466 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
467 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
469 //Setup a LinearConstrainer specifying the progress for each value
470 linearConstrainer.Remove(actor);
471 SetupLinearConstrainerNonUniformProgress( linearConstrainer );
472 linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
474 actor.SetProperty(index,0.0f);
476 application.SendNotification();
477 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
479 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f, TEST_LOCATION );
481 application.SendNotification();
482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
483 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 2.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION );
485 application.SendNotification();
486 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
487 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION );
489 application.SendNotification();
490 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
491 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
493 application.SendNotification();
494 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
495 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
500 int UtcLinearConstrainerApplyRange(void)
502 TestApplication application;
504 Dali::Actor actor = Dali::Actor::New();
506 // Register a float property
507 Property::Index index = actor.RegisterProperty( "t", 100.0f );
508 Dali::Stage::GetCurrent().Add(actor);
510 //Create a LinearConstrainer
511 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
512 SetupLinearConstrainerUniformProgress( linearConstrainer );
514 //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
515 Vector2 range( 100.0f, 300.0f );
516 linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
519 //Create an animation to animate the custom property
520 float durationSeconds(1.0f);
521 Dali::Animation animation = Dali::Animation::New(durationSeconds);
522 animation.AnimateTo(Dali::Property(actor,index),300.0f);
525 application.SendNotification();
526 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
528 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.5f, TEST_LOCATION );
530 application.SendNotification();
531 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
532 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f, TEST_LOCATION );
534 application.SendNotification();
535 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
536 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.5f, TEST_LOCATION );
538 application.SendNotification();
539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
540 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
542 application.SendNotification();
543 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
544 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
549 int UtcLinearConstrainerDestroy(void)
551 TestApplication application;
553 Dali::Actor actor = Dali::Actor::New();
555 // Register a float property
556 Property::Index index = actor.RegisterProperty( "t", 0.0f );
557 Dali::Stage::GetCurrent().Add(actor);
560 //Create a LinearConstrainer
561 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
562 SetupLinearConstrainerUniformProgress( linearConstrainer );
564 //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
565 Vector2 range( 0.0f, 1.0f );
566 linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
568 //Test that the constraint is correctly applied
569 actor.SetProperty(index,0.5f);
570 application.SendNotification();
571 application.Render(static_cast<unsigned int>(1.0f));
573 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f, TEST_LOCATION );
577 //LinearConstrainer has been destroyed. Constraint in the actor should have been removed
578 actor.SetProperty(index,0.75f);
579 application.SendNotification();
580 application.Render(static_cast<unsigned int>(1.0f));
582 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
587 int UtcLinearConstrainerRemove(void)
589 TestApplication application;
591 Dali::Actor actor = Dali::Actor::New();
593 // Register a float property
594 Property::Index index = actor.RegisterProperty( "t", 0.0f );
595 Dali::Stage::GetCurrent().Add(actor);
597 //Create a LinearConstrainer
598 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
599 SetupLinearConstrainerUniformProgress( linearConstrainer );
601 //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
602 Vector2 range( 0.0f, 1.0f );
603 linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
605 //Test that the constraint is correctly applied
606 actor.SetProperty(index,0.5f);
607 application.SendNotification();
608 application.Render(static_cast<unsigned int>(1.0f));
610 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 1.0f, TEST_LOCATION );
613 linearConstrainer.Remove( actor );
614 actor.SetProperty(index,0.75f);
615 application.SendNotification();
616 application.Render(static_cast<unsigned int>(1.0f));
618 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 0.0f, TEST_LOCATION );
623 int UtcLinearConstrainerProperties(void)
625 TestApplication application;
627 Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
629 Dali::Property::Array points;
634 linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
637 Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE );
638 Property::Array* array = value.GetArray();
639 DALI_TEST_CHECK( array );
641 const unsigned int noOfPoints = points.Size();
642 for( unsigned int i = 0; i < noOfPoints; ++i )
644 DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
649 Property::Value value = DevelHandle::GetCurrentProperty( linearConstrainer, Dali::LinearConstrainer::Property::VALUE );
650 Property::Array* array = value.GetArray();
651 DALI_TEST_CHECK( array );
653 const unsigned int noOfPoints = points.Size();
654 for( unsigned int i = 0; i < noOfPoints; ++i )
656 DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
663 linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points );
666 Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::PROGRESS );
667 Property::Array* array = value.GetArray();
668 DALI_TEST_CHECK( array );
670 const unsigned int noOfPoints = points.Size();
671 for( unsigned int i = 0; i < noOfPoints; ++i )
673 DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
678 Property::Value value = DevelHandle::GetCurrentProperty( linearConstrainer, Dali::LinearConstrainer::Property::PROGRESS );
679 Property::Array* array = value.GetArray();
680 DALI_TEST_CHECK( array );
682 const unsigned int noOfPoints = points.Size();
683 for( unsigned int i = 0; i < noOfPoints; ++i )
685 DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );