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-test-suite-utils.h>
19 #include <dali/public-api/dali-core.h>
20 #include <mesh-builder.h>
27 ///////////////////////////////////////////////////////////////////////////////
28 void utc_dali_constraint_startup(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_constraint_cleanup(void)
35 test_return_value = TET_PASS;
37 ///////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////
43 * A function to use for a constraint, no data collected.
46 void BasicFunction(T& /* current */, const PropertyInputContainer& /* inputs */)
51 * A functor which sets a given boolean when the functor is called.
54 struct BasicCalledFunctor
56 BasicCalledFunctor(bool& functorCalled)
57 : mCalled(functorCalled)
61 void operator()(T& /* current */, const PropertyInputContainer& /* inputs */)
70 * A functor which increments a given integer when the functor is called.
73 struct CalledCountFunctor
75 CalledCountFunctor(int& callCount)
76 : mCallCount(callCount)
80 void operator()(T& /* current */, const PropertyInputContainer& /* inputs */)
89 * A functor which sets the given value as the value required when the functor is called.
92 struct SetValueFunctor
94 SetValueFunctor(const T& value)
99 void operator()(T& current, const PropertyInputContainer& /* inputs */)
107 } // unnamed namespace
108 ///////////////////////////////////////////////////////////////////////////////
110 ///////////////////////////////////////////////////////////////////////////////
114 // void( *function )( T&, const PropertyInputContainer& ) )
115 ///////////////////////////////////////////////////////////////////////////////
116 namespace UtcDaliConstraintNewFunction
118 bool gConstraintFunctionCalled = false;
119 void ConstraintFunction(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
121 gConstraintFunctionCalled = true;
123 } // namespace UtcDaliConstraintNewFunction
125 int UtcDaliConstraintNewFunctionP(void)
127 // Ensure that we can create a constraint using a C function and that it is called.
129 TestApplication application;
130 UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false;
132 Actor actor = Actor::New();
133 application.GetScene().Add(actor);
135 application.SendNotification();
136 application.Render();
138 DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, false, TEST_LOCATION);
141 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction);
142 DALI_TEST_CHECK(constraint);
145 application.SendNotification();
146 application.Render();
148 DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, true, TEST_LOCATION);
153 int UtcDaliConstraintNewFunctionN(void)
155 // Create a constraint with an uninitialised handle
157 TestApplication application;
159 // Add a constraint with an uninitialised handle
162 Constraint constraint = Constraint::New<Vector3>(Actor(), Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction);
163 DALI_TEST_CHECK(false); // Should not reach here
167 DALI_TEST_CHECK(true); // Should assert!
173 // helper for next test
174 void StringConstraintFunction(std::string& /* current */, const PropertyInputContainer& /* inputs */)
178 int UtcDaliConstraintNewFunctionNonConstrainableTypeN(void)
180 // Ensure that we can create a constraint using a C function and that it is called.
182 TestApplication application;
183 UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false;
185 Actor actor = Actor::New();
186 application.GetScene().Add(actor);
188 application.SendNotification();
189 application.Render();
194 Constraint constraint = Constraint::New<std::string>(actor, Actor::Property::COLOR_MODE, &StringConstraintFunction);
195 DALI_TEST_CHECK(constraint);
197 tet_result(TET_FAIL);
199 catch(Dali::DaliException& e)
201 DALI_TEST_ASSERT(e, "Property not constrainable", TEST_LOCATION);
207 ///////////////////////////////////////////////////////////////////////////////
209 ///////////////////////////////////////////////////////////////////////////////
214 ///////////////////////////////////////////////////////////////////////////////
215 int UtcDaliConstraintNewFunctorP(void)
217 // Ensure that we can create a constraint using a functor and that it is called.
219 TestApplication application;
220 bool functorCalled = false;
222 Actor actor = Actor::New();
223 application.GetScene().Add(actor);
225 application.SendNotification();
226 application.Render();
228 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
231 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
232 DALI_TEST_CHECK(constraint);
235 application.SendNotification();
236 application.Render();
238 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
243 int UtcDaliConstraintNewFunctorN(void)
245 // Create a constraint with an uninitialised handle
247 TestApplication application;
248 bool functorCalled = false;
250 // Add a constraint with an uninitialised handle
253 Constraint constraint = Constraint::New<Vector3>(Actor(), Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
254 DALI_TEST_CHECK(false); // Should not reach here
258 DALI_TEST_CHECK(true); // Should assert!
264 ///////////////////////////////////////////////////////////////////////////////
266 ///////////////////////////////////////////////////////////////////////////////
271 // void ( T::*memberFunction ) ( P&, const PropertyInputContainer& ) )
272 ///////////////////////////////////////////////////////////////////////////////
273 namespace UtcDaliConstraintNewFunctorMember
277 Functor(bool& positionCalled, bool& scaleCalled)
278 : mPositionCalled(positionCalled),
279 mScaleCalled(scaleCalled)
283 void Position(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
285 mPositionCalled = true;
288 void Scale(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
293 bool& mPositionCalled;
296 } // namespace UtcDaliConstraintNewFunctorMember
298 int UtcDaliConstraintNewFunctorMemberP(void)
300 // Ensure that we can create a constraint using a functor and that it is called.
302 TestApplication application;
303 bool positionFunctorCalled = false;
304 bool sizeFunctorCalled = false;
306 Actor actor = Actor::New();
307 application.GetScene().Add(actor);
309 application.SendNotification();
310 application.Render();
312 DALI_TEST_EQUALS(positionFunctorCalled, false, TEST_LOCATION);
313 DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION);
315 // Add a constraint that calls Functor::Position
316 Constraint constraint = Constraint::New<Vector3>(
318 Actor::Property::POSITION,
319 UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
320 &UtcDaliConstraintNewFunctorMember::Functor::Position);
321 DALI_TEST_CHECK(constraint);
324 application.SendNotification();
325 application.Render();
327 DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION);
328 DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION);
330 // Add another constraint that calls Functor::Size
331 Constraint constraint2 = Constraint::New<Vector3>(
333 Actor::Property::SCALE,
334 UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
335 &UtcDaliConstraintNewFunctorMember::Functor::Scale);
336 DALI_TEST_CHECK(constraint2);
339 application.SendNotification();
340 application.Render();
342 DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION);
343 DALI_TEST_EQUALS(sizeFunctorCalled, true, TEST_LOCATION);
348 int UtcDaliConstraintNewFunctorMemberN(void)
350 // Create a constraint with an uninitialised handle
352 TestApplication application;
353 bool positionFunctorCalled = false;
354 bool sizeFunctorCalled = false;
356 // Add a constraint with an uninitialised handle
359 Constraint constraint = Constraint::New<Vector3>(
361 Actor::Property::POSITION,
362 UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
363 &UtcDaliConstraintNewFunctorMember::Functor::Position);
364 DALI_TEST_CHECK(false); // Should not reach here
366 catch(Dali::DaliException& e)
368 DALI_TEST_CHECK(true); // Should assert!
373 ///////////////////////////////////////////////////////////////////////////////
375 ///////////////////////////////////////////////////////////////////////////////
377 ///////////////////////////////////////////////////////////////////////////////
378 int UtcDaliConstraintCloneP(void)
380 // Ensure we can clone for another actor and it's called appropriately
382 TestApplication application;
385 Actor actor = Actor::New();
386 Actor clone = Actor::New();
388 Integration::Scene stage = application.GetScene();
392 application.SendNotification();
393 application.Render();
395 DALI_TEST_EQUALS(calledCount, 0, TEST_LOCATION);
397 // Add a constraint to actor
398 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, CalledCountFunctor<Vector3>(calledCount));
399 DALI_TEST_CHECK(constraint);
402 // Create a clone but don't apply
403 Constraint constraintClone = constraint.Clone(clone);
405 application.SendNotification();
406 application.Render();
408 DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION);
413 application.SendNotification();
414 application.Render();
416 DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION);
418 // Apply the clone constraint
419 constraintClone.Apply();
421 application.SendNotification();
422 application.Render();
424 // Should be called once for the new constraint clone and once for the original constraint
425 DALI_TEST_EQUALS(calledCount, 3, TEST_LOCATION);
430 // Change the position of both actors
431 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
432 clone.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
434 application.SendNotification();
435 application.Render();
437 // Functor should have been called twice
438 DALI_TEST_EQUALS(calledCount, 2, TEST_LOCATION);
443 int UtcDaliConstraintCloneN(void)
445 // Attempt to clone an uninitialised constraint should cause an assert
447 TestApplication application;
449 Constraint constraint;
453 Actor actor = Actor::New();
454 Constraint clone = constraint.Clone(actor);
455 DALI_TEST_CHECK(false);
459 DALI_TEST_CHECK(true);
465 namespace UtcDaliConstraintClone
467 void Function(Vector3& /* current */, const PropertyInputContainer& inputs)
469 DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION);
470 DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION);
471 DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION);
472 DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION);
474 } // namespace UtcDaliConstraintClone
476 int UtcDaliConstraintCloneCheckSourcesAndSetters(void)
478 // Ensure all sources, the tag and remove-action are cloned appropriately
480 TestApplication application;
482 Actor actor = Actor::New();
483 Actor clone = Actor::New();
485 Integration::Scene stage = application.GetScene();
489 application.SendNotification();
490 application.Render();
492 // Create a constraint, DON'T Apply it though
493 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintClone::Function);
494 constraint.AddSource(LocalSource(Actor::Property::SIZE));
495 constraint.AddSource(LocalSource(Actor::Property::ORIENTATION));
496 constraint.AddSource(LocalSource(Actor::Property::COLOR));
497 constraint.AddSource(LocalSource(Actor::Property::VISIBLE));
498 constraint.SetRemoveAction(Constraint::DISCARD);
499 constraint.SetTag(123);
501 // Clone the constraint & apply the clone
502 Constraint constraintClone = constraint.Clone(clone);
503 constraintClone.Apply();
505 application.SendNotification();
506 application.Render();
508 DALI_TEST_EQUALS(constraint.GetRemoveAction(), constraintClone.GetRemoveAction(), TEST_LOCATION);
509 DALI_TEST_EQUALS(constraint.GetTag(), constraintClone.GetTag(), TEST_LOCATION);
513 ///////////////////////////////////////////////////////////////////////////////
515 ///////////////////////////////////////////////////////////////////////////////
516 // Constraint::Constraint( const Constraint& )
517 // Constraint::operator=
518 ///////////////////////////////////////////////////////////////////////////////
519 int UtcDaliConstraintCopyAndAssignment(void)
521 // Ensure copy constructor & assignment operators work
523 TestApplication application;
525 Actor actor = Actor::New();
526 application.GetScene().Add(actor);
528 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
529 Constraint copied(constraint);
531 DALI_TEST_CHECK(constraint == copied);
532 DALI_TEST_CHECK(copied != assigned);
534 assigned = constraint;
535 DALI_TEST_CHECK(constraint == assigned);
539 ///////////////////////////////////////////////////////////////////////////////
541 int UtcDaliConstraintMoveConstructor(void)
543 // Ensure copy constructor & assignment operators work
545 TestApplication application;
547 Actor actor = Actor::New();
548 application.GetScene().Add(actor);
550 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
551 DALI_TEST_CHECK(constraint);
552 DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION);
553 DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
555 Constraint moved = std::move(constraint);
556 DALI_TEST_CHECK(moved);
557 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
558 DALI_TEST_CHECK(moved.GetTargetObject() == actor);
559 DALI_TEST_CHECK(!constraint);
564 int UtcDaliConstraintMoveAssignment(void)
566 // Ensure copy constructor & assignment operators work
568 TestApplication application;
570 Actor actor = Actor::New();
571 application.GetScene().Add(actor);
573 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
574 DALI_TEST_CHECK(constraint);
575 DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION);
576 DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
579 moved = std::move(constraint);
580 DALI_TEST_CHECK(moved);
581 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
582 DALI_TEST_CHECK(moved.GetTargetObject() == actor);
583 DALI_TEST_CHECK(!constraint);
588 ///////////////////////////////////////////////////////////////////////////////
589 // Constraint::DownCast
590 ///////////////////////////////////////////////////////////////////////////////
591 int UtcDaliConstraintDownCast(void)
593 // Ensure DownCast works as expected
595 TestApplication application;
597 Actor actor = Actor::New();
598 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
600 // Another BaseHandle type
601 Constraint downCast = Constraint::DownCast(actor);
602 DALI_TEST_CHECK(!downCast);
605 downCast = Constraint::DownCast(constraint);
606 DALI_TEST_CHECK(downCast);
608 // An empty constraint
609 downCast = Constraint::DownCast(Constraint());
610 DALI_TEST_CHECK(!downCast);
614 ///////////////////////////////////////////////////////////////////////////////
616 ///////////////////////////////////////////////////////////////////////////////
617 // Constraint::GetTargetObject
618 ///////////////////////////////////////////////////////////////////////////////
619 int UtcDaliConstraintGetTargetObjectP(void)
621 TestApplication application;
623 Actor actor = Actor::New();
624 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
625 DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
627 Actor actor2 = Actor::New();
628 DALI_TEST_CHECK(constraint.GetTargetObject() != actor2);
633 int UtcDaliConstraintGetTargetObjectN(void)
635 // Attempt to retrieve from uninitialised constraint
637 TestApplication application;
639 Constraint constraint;
642 Handle handle = constraint.GetTargetObject();
643 DALI_TEST_CHECK(false); // Should not reach here!
647 DALI_TEST_CHECK(true);
652 ///////////////////////////////////////////////////////////////////////////////
654 ///////////////////////////////////////////////////////////////////////////////
655 // Constraint::GetTargetProperty
656 ///////////////////////////////////////////////////////////////////////////////
657 int UtcDaliConstraintGetTargetPropertyP(void)
659 TestApplication application;
661 Actor actor = Actor::New();
662 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
663 DALI_TEST_EQUALS(constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
668 int UtcDaliConstraintGetTargetPropertyN(void)
670 // Attempt to retrieve from uninitialised constraint
672 TestApplication application;
674 Constraint constraint;
677 Property::Index propertyIndex = constraint.GetTargetProperty();
679 DALI_TEST_CHECK(false); // Should not reach here!
683 DALI_TEST_CHECK(true);
688 ///////////////////////////////////////////////////////////////////////////////
690 ///////////////////////////////////////////////////////////////////////////////
691 // Constraint::SetTag
692 // Constraint::GetTag
693 ///////////////////////////////////////////////////////////////////////////////
694 int UtcDaliConstraintTagP(void)
696 TestApplication application;
698 Actor actor = Actor::New();
699 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
700 DALI_TEST_EQUALS(constraint.GetTag(), 0u, TEST_LOCATION);
702 const unsigned int tag = 123;
703 constraint.SetTag(tag);
704 DALI_TEST_EQUALS(constraint.GetTag(), tag, TEST_LOCATION);
709 int UtcDaliConstraintSetTagN(void)
711 // Attempt to set from uninitialised constraint
713 TestApplication application;
715 Constraint constraint;
718 constraint.SetTag(123);
719 DALI_TEST_CHECK(false); // Should not reach here!
723 DALI_TEST_CHECK(true);
729 int UtcDaliConstraintGetTagN(void)
731 // Attempt to retrieve from uninitialised constraint
733 TestApplication application;
735 Constraint constraint;
738 int tag = constraint.GetTag();
740 DALI_TEST_CHECK(false); // Should not reach here!
744 DALI_TEST_CHECK(true);
750 ///////////////////////////////////////////////////////////////////////////////
752 ///////////////////////////////////////////////////////////////////////////////
753 // Constraint::SetRemoveAction
754 // Constraint::GetRemoveAction
755 ///////////////////////////////////////////////////////////////////////////////
756 int UtcDaliConstraintRemoveActionP(void)
758 TestApplication application;
760 Actor actor = Actor::New();
761 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
762 DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION);
764 constraint.SetRemoveAction(Constraint::DISCARD);
765 DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION);
767 constraint.SetRemoveAction(Constraint::BAKE);
768 DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION);
773 int UtcDaliConstraintSetRemoveActionN(void)
775 // Attempt to set from uninitialised constraint
777 TestApplication application;
779 Constraint constraint;
782 constraint.SetRemoveAction(Constraint::DISCARD);
783 DALI_TEST_CHECK(false); // Should not reach here!
787 DALI_TEST_CHECK(true);
793 int UtcDaliConstraintGetRemoveActionN(void)
795 // Attempt to retrieve from uninitialised constraint
797 TestApplication application;
799 Constraint constraint;
802 Constraint::RemoveAction removeAction = constraint.GetRemoveAction();
804 DALI_TEST_CHECK(false); // Should not reach here!
808 DALI_TEST_CHECK(true);
814 int UtcDaliConstraintBakeRemoveAction(void)
816 // Ensure value is baked when constraint is removed
818 TestApplication application;
820 Actor actor = Actor::New();
821 application.GetScene().Add(actor);
823 application.SendNotification();
824 application.Render();
826 // Should not equal position by default
827 Vector3 position(10.0f, 20.0f, 30.0f);
828 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
830 // Create a constraint that constrains to position
831 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, SetValueFunctor<Vector3>(position));
832 constraint.SetRemoveAction(Constraint::BAKE);
835 application.SendNotification();
836 application.Render();
838 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
840 // Remove the constraint, it should still be at position
843 application.SendNotification();
844 application.Render();
846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
851 int UtcDaliConstraintDiscardRemoveAction(void)
853 // Ensure value is baked when constraint is removed
855 TestApplication application;
857 Actor actor = Actor::New();
858 application.GetScene().Add(actor);
860 application.SendNotification();
861 application.Render();
863 // Get and store current position
864 Vector3 originalPosition = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
866 // Should not equal position by default
867 Vector3 position(10.0f, 20.0f, 30.0f);
868 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
870 // Create a constraint that constrains to position
871 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, SetValueFunctor<Vector3>(position));
872 constraint.SetRemoveAction(Constraint::DISCARD);
875 application.SendNotification();
876 application.Render();
878 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
880 // Remove the constraint, it should still be at position
883 application.SendNotification();
884 application.Render();
886 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), originalPosition, TEST_LOCATION);
887 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
892 ///////////////////////////////////////////////////////////////////////////////
894 ///////////////////////////////////////////////////////////////////////////////
896 // Constraint::Remove
897 ///////////////////////////////////////////////////////////////////////////////
898 int UtcDaliConstraintApplyRemove(void)
900 // Ensure constraint functors are called appropriately
902 TestApplication application;
903 bool functorCalled = false;
905 Actor actor = Actor::New();
906 application.GetScene().Add(actor);
908 application.SendNotification();
909 application.Render();
911 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
913 // Create a constraint and apply, functor should be called
914 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
917 application.SendNotification();
918 application.Render();
920 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
923 functorCalled = false;
925 // Remove the constraint, functor should not be called
928 application.SendNotification();
929 application.Render();
931 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
933 // Re-apply the constraint, functor should be called again
936 application.SendNotification();
937 application.Render();
939 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
944 int UtcDaliConstraintApplyBeforeAddedToStage(void)
946 // Constraint gets applied to an off-stage actor.
947 // Constraint should be automatically applied when the actor is added to the stage and not before
949 TestApplication application;
950 bool functorCalled = false;
952 // Create an actor and a constraint and apply, DON'T add to stage just yet
953 Actor actor = Actor::New();
954 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
957 application.SendNotification();
958 application.Render();
960 // Should NOT be called
961 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
963 // Add actor to stage
964 application.GetScene().Add(actor);
966 application.SendNotification();
967 application.Render();
969 // Should now be called
970 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
975 int UtcDaliConstraintApplyAndRemoveBeforeAddedToStage(void)
977 // Constraint gets applied to an off-stage actor, then gets removed before it's added to the stage
978 // Constraint should NOT be called at all
980 TestApplication application;
981 bool functorCalled = false;
983 // Create an actor and a constraint and apply, DON'T add to stage just yet
984 Actor actor = Actor::New();
985 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
988 application.SendNotification();
989 application.Render();
991 // Should NOT be called
992 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
994 // Remove the constraint
997 // Add actor to stage
998 application.GetScene().Add(actor);
1000 application.SendNotification();
1001 application.Render();
1003 // Still should NOT be called
1004 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
1009 int UtcDaliConstraintApplyActorStagedUnstaged(void)
1011 // Apply a constraint to an actor which is staged and unstaged.
1012 // Functor should only be called while the actor is staged.
1014 TestApplication application;
1015 bool functorCalled = false;
1017 // Create an actor and add to stage
1018 Actor actor = Actor::New();
1019 Integration::Scene stage = application.GetScene();
1022 // Create a constraint and apply
1023 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
1026 application.SendNotification();
1027 application.Render();
1029 // Constraint should be called
1030 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
1033 functorCalled = false;
1035 // Remove actor from stage
1036 stage.Remove(actor);
1038 application.SendNotification();
1039 application.Render();
1041 // Constraint should NOT be called
1042 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
1047 application.SendNotification();
1048 application.Render();
1050 // Constraint should be called
1051 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
1056 int UtcDaliConstraintApplySeveralTimes(void)
1058 // Apply the same constraint several times.
1059 // Should not cause any problems (subsequent attempts should be no-ops)
1061 TestApplication application;
1064 // Create an actor and add to stage
1065 Actor actor = Actor::New();
1066 Integration::Scene stage = application.GetScene();
1069 // Create a constraint and apply
1070 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, CalledCountFunctor<Vector3>(count));
1074 constraint.Apply(); // no-op
1076 application.SendNotification();
1077 application.Render();
1079 // Should only have been called once
1080 DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
1086 constraint.Apply(); // no-op
1088 application.SendNotification();
1089 application.Render();
1091 DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
1096 // Change the position property, apply again
1097 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
1100 application.SendNotification();
1101 application.Render();
1103 // Constraint should have been called once
1104 DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
1109 ///////////////////////////////////////////////////////////////////////////////
1111 ///////////////////////////////////////////////////////////////////////////////
1112 // Constraint::AddSource
1113 ///////////////////////////////////////////////////////////////////////////////
1114 namespace UtcDaliConstraintAddSource
1116 void Function(Vector3& /* current */, const PropertyInputContainer& inputs)
1118 DALI_TEST_EQUALS(inputs.Size(), 4u, TEST_LOCATION);
1119 DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION);
1120 DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION);
1121 DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION);
1122 DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION);
1124 } // namespace UtcDaliConstraintAddSource
1126 int UtcDaliConstraintAddSourceP(void)
1128 // Ensure all sources are in the correct order in the functor
1130 TestApplication application;
1132 Actor actor = Actor::New();
1133 application.GetScene().Add(actor);
1135 // Create a constraint, add sources
1136 Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintAddSource::Function);
1137 constraint.AddSource(LocalSource(Actor::Property::SIZE));
1138 constraint.AddSource(LocalSource(Actor::Property::ORIENTATION));
1139 constraint.AddSource(LocalSource(Actor::Property::COLOR));
1140 constraint.AddSource(LocalSource(Actor::Property::VISIBLE));
1143 application.SendNotification();
1144 application.Render();
1149 int UtcDaliConstraintAddSourceN(void)
1151 // Attempt to set from uninitialised constraint
1153 TestApplication application;
1155 Constraint constraint;
1158 constraint.AddSource(LocalSource(Actor::Property::POSITION));
1159 DALI_TEST_CHECK(false); // Should not reach here!
1163 DALI_TEST_CHECK(true);
1168 ///////////////////////////////////////////////////////////////////////////////
1170 ///////////////////////////////////////////////////////////////////////////////
1171 namespace TestChaining
1173 const Vector3 gFunction1Output(Vector3::ONE);
1174 void Function1(Vector3& current, const PropertyInputContainer& /* inputs */)
1176 // current is original position
1177 DALI_TEST_EQUALS(current, Vector3::ZERO, TEST_LOCATION);
1178 current = gFunction1Output;
1181 const Vector3 gFunction2Output(10.0f, 20.0f, 30.0f);
1182 void Function2(Vector3& current, const PropertyInputContainer& /* inputs */)
1184 // current is output from Function1
1185 DALI_TEST_EQUALS(current, gFunction1Output, TEST_LOCATION);
1187 current = gFunction2Output;
1190 const Vector3 gFunction3Output(10.0f, 20.0f, 30.0f);
1191 void Function3(Vector3& current, const PropertyInputContainer& /* inputs */)
1193 // current is output from Function2
1194 DALI_TEST_EQUALS(current, gFunction2Output, TEST_LOCATION);
1196 current = gFunction3Output;
1199 const Vector3 gFunction4Output(10.0f, 20.0f, 30.0f);
1200 void Function4(Vector3& current, const PropertyInputContainer& /* inputs */)
1202 // current is output from Function3
1203 DALI_TEST_EQUALS(current, gFunction3Output, TEST_LOCATION);
1205 current = gFunction4Output;
1208 void Function5(Vector3& current, const PropertyInputContainer& /* inputs */)
1210 // current is output from Function4
1211 DALI_TEST_EQUALS(current, gFunction4Output, TEST_LOCATION);
1213 current = Vector3::ZERO;
1216 } // namespace TestChaining
1218 int UtcDaliConstraintChaining(void)
1220 // Apply several constraints to the same property and ensure the functors are called in the correct order.
1222 TestApplication application;
1224 Actor actor = Actor::New();
1225 application.GetScene().Add(actor);
1227 Constraint constraint1 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function1);
1228 Constraint constraint2 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function2);
1229 Constraint constraint3 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function3);
1230 Constraint constraint4 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function4);
1231 Constraint constraint5 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function5);
1233 constraint1.Apply();
1234 constraint2.Apply();
1235 constraint3.Apply();
1236 constraint4.Apply();
1237 constraint5.Apply();
1239 application.SendNotification();
1240 application.Render();
1244 ///////////////////////////////////////////////////////////////////////////////
1246 ///////////////////////////////////////////////////////////////////////////////
1247 namespace TestPropertyTypes
1249 template<typename T>
1250 void Execute(T value)
1252 TestApplication application;
1253 bool functorCalled = false;
1255 Actor actor = Actor::New();
1256 Property::Index index = actor.RegisterProperty("TEMP_PROPERTY_NAME", value);
1258 application.GetScene().Add(actor);
1260 application.SendNotification();
1261 application.Render();
1263 DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
1266 Constraint constraint = Constraint::New<T>(actor, index, BasicCalledFunctor<T>(functorCalled));
1267 DALI_TEST_CHECK(constraint);
1270 application.SendNotification();
1271 application.Render();
1273 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
1275 } // namespace TestPropertyTypes
1277 int UtcDaliConstraintTestPropertyTypesP(void)
1279 // Ensure we can use a constraint functor with all supported property types
1281 TestPropertyTypes::Execute<bool>(false);
1282 TestPropertyTypes::Execute<int>(0);
1283 TestPropertyTypes::Execute<float>(0.0f);
1284 TestPropertyTypes::Execute<Vector2>(Vector2::ZERO);
1285 TestPropertyTypes::Execute<Vector3>(Vector3::ZERO);
1286 TestPropertyTypes::Execute<Vector4>(Vector4::ZERO);
1287 TestPropertyTypes::Execute<Quaternion>(Quaternion::IDENTITY);
1288 TestPropertyTypes::Execute<Matrix>(Matrix::IDENTITY);
1289 TestPropertyTypes::Execute<Matrix3>(Matrix3::IDENTITY);
1294 ///////////////////////////////////////////////////////////////////////////////
1296 ///////////////////////////////////////////////////////////////////////////////
1299 void SetHalfOpacity(Vector4& current, const PropertyInputContainer& inputs)
1303 } // unnamed namespace
1305 int UtcDaliConstraintEnsureResetterAppliedOnSceneRemoval(void)
1307 // Ensure BOTH double-buffered values of our color property is reset when a constraint is applied to it.
1309 TestApplication application;
1311 Actor actor = Actor::New();
1312 application.GetScene().Add(actor);
1314 // Check initial value is fully opaque
1315 application.SendNotification();
1316 application.Render();
1317 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1319 // Create a constraint whose value is discarded when it is removed
1320 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, SetHalfOpacity);
1321 constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD);
1324 // Check value after one render, it should be constrained
1325 application.SendNotification();
1326 application.Render();
1327 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1329 // Render another frame, ensure the other value has also been updated
1330 application.SendNotification();
1331 application.Render();
1332 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1334 // Remove the actor from the stage and delete the constraint
1336 constraint.Remove();
1339 // Check value while off-stage, it should be fully opaque
1340 application.SendNotification();
1341 application.Render();
1342 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1344 // Add the actor back to the stage and check the value, it should be fully opaque again
1345 application.GetScene().Add(actor);
1347 // Check value when back on-stage, it should be fully opaque as the constraint is no longer applied to it.
1348 application.SendNotification();
1349 application.Render();
1350 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1352 // Render for another frame to ensure both buffers have the correct value
1353 application.SendNotification();
1354 application.Render();
1355 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1360 int UtcDaliConstraintOnActorAddedAndRemoved(void)
1362 // Ensure adding and removing an actor from stage with a constraint still has it applied when it is re-added back to the stage
1364 TestApplication application;
1366 Actor actor = Actor::New();
1367 application.GetScene().Add(actor);
1369 // Check initial value is fully opaque
1370 application.SendNotification();
1371 application.Render();
1372 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1374 // Create a constraint whose value is discarded when it is removed
1375 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, SetHalfOpacity);
1376 constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD);
1379 // Check value after one render, it should be constrained
1380 application.SendNotification();
1381 application.Render();
1382 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1384 // Render another frame, ensure the other value has also been updated
1385 application.SendNotification();
1386 application.Render();
1387 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1389 // Remove the actor from the stage
1392 // Check value while off-stage, the constraint is no longer being applied as it's off-stage
1393 application.SendNotification();
1394 application.Render();
1395 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1397 // Check the other buffer, the constraint should not be applied to this either.
1398 application.SendNotification();
1399 application.Render();
1400 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
1402 // Add the actor back to the stage and check the value, the constraint should have been re-applied
1403 application.GetScene().Add(actor);
1404 application.SendNotification();
1405 application.Render();
1406 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1408 // Render for another frame to ensure both buffers have the correct value
1409 application.SendNotification();
1410 application.Render();
1411 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
1416 ///////////////////////////////////////////////////////////////////////////////
1418 int UtcDaliConstraintGetTargetObjectNegative(void)
1420 TestApplication application;
1421 Dali::Constraint instance;
1424 instance.GetTargetObject();
1425 DALI_TEST_CHECK(false); // Should not get here
1429 DALI_TEST_CHECK(true); // We expect an assert
1434 int UtcDaliConstraintSetRemoveActionNegative(void)
1436 TestApplication application;
1437 Dali::Constraint instance;
1440 Dali::Constraint::RemoveAction arg1(Constraint::BAKE);
1441 instance.SetRemoveAction(arg1);
1442 DALI_TEST_CHECK(false); // Should not get here
1446 DALI_TEST_CHECK(true); // We expect an assert
1451 int UtcDaliConstraintGetTargetPropertyNegative(void)
1453 TestApplication application;
1454 Dali::Constraint instance;
1457 instance.GetTargetProperty();
1458 DALI_TEST_CHECK(false); // Should not get here
1462 DALI_TEST_CHECK(true); // We expect an assert
1467 int UtcDaliConstraintApplyNegative(void)
1469 TestApplication application;
1470 Dali::Constraint instance;
1474 DALI_TEST_CHECK(false); // Should not get here
1478 DALI_TEST_CHECK(true); // We expect an assert
1483 int UtcDaliConstraintCloneNegative(void)
1485 TestApplication application;
1486 Dali::Constraint instance;
1490 instance.Clone(arg1);
1491 DALI_TEST_CHECK(false); // Should not get here
1495 DALI_TEST_CHECK(true); // We expect an assert
1500 int UtcDaliConstraintRemoveNegative(void)
1502 TestApplication application;
1503 Dali::Constraint instance;
1507 DALI_TEST_CHECK(false); // Should not get here
1511 DALI_TEST_CHECK(true); // We expect an assert
1516 int UtcDaliConstraintSetTagNegative(void)
1518 TestApplication application;
1519 Dali::Constraint instance;
1522 unsigned int arg1(0u);
1523 instance.SetTag(arg1);
1524 DALI_TEST_CHECK(false); // Should not get here
1528 DALI_TEST_CHECK(true); // We expect an assert
1533 int UtcDaliConstraintGetRemoveActionNegative(void)
1535 TestApplication application;
1536 Dali::Constraint instance;
1539 instance.GetRemoveAction();
1540 DALI_TEST_CHECK(false); // Should not get here
1544 DALI_TEST_CHECK(true); // We expect an assert
1549 int UtcDaliConstraintGetTagNegative(void)
1551 TestApplication application;
1552 Dali::Constraint instance;
1556 DALI_TEST_CHECK(false); // Should not get here
1560 DALI_TEST_CHECK(true); // We expect an assert
1565 namespace ComponentTest
1567 void CheckComponentProperty(TestApplication& application, Actor& actor, Property::Index property)
1569 float value = actor.GetCurrentProperty<float>(property);
1571 // Add a component 0 constraint
1572 RelativeToConstraintFloat relativeConstraint(2.0f);
1573 Constraint constraint = Constraint::New<float>(actor, property, relativeConstraint);
1574 constraint.AddSource(Source{actor, property});
1575 DALI_TEST_CHECK(constraint);
1576 constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD);
1579 application.SendNotification();
1580 application.Render();
1582 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(property), value * 2.0f, TEST_LOCATION);
1584 constraint.Remove();
1586 application.SendNotification();
1587 application.Render();
1589 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(property), value, TEST_LOCATION);
1591 } // namespace ComponentTest
1593 int UtcDaliConstraintComponentTransformPropertyConstraintP(void)
1595 TestApplication application;
1597 Actor actor = Actor::New();
1598 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 100.0f));
1599 application.GetScene().Add(actor);
1601 application.SendNotification();
1602 application.Render();
1604 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 100.0f, 100.0f), TEST_LOCATION);
1606 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::POSITION_X); // Component 0
1607 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::POSITION_Y); // Component 1
1608 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::POSITION_Z); // Component 2
1613 int UtcDaliConstraintComponentNonTransformPropertyConstraintP(void)
1615 TestApplication application;
1617 Actor actor = Actor::New();
1618 actor.SetProperty(Actor::Property::COLOR, Vector4(0.25f, 0.25f, 0.25f, 0.25f));
1619 application.GetScene().Add(actor);
1621 application.SendNotification();
1622 application.Render();
1624 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Vector4(0.25f, 0.25f, 0.25f, 0.25f), TEST_LOCATION);
1626 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_RED); // Component 0
1627 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_GREEN); // Component 1
1628 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_BLUE); // Component 2
1629 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_ALPHA); // Component 3
1635 namespace PostConstraintTest
1637 void CheckComponentProperty(TestApplication& application, Actor& actor, Handle target)
1639 actor.SetProperty(Actor::Property::POSITION, Vector3::ONE);
1640 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ONE, TEST_LOCATION);
1642 application.SendNotification();
1643 application.Render();
1645 actor.SetProperty(Actor::Property::POSITION, Vector3::ONE * 2.0f);
1647 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ONE * 2.0f, TEST_LOCATION);
1648 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ONE, TEST_LOCATION);
1650 Property::Index prePropertyIndex = target.RegisterProperty("testPreProperty", Vector3::ZERO);
1651 Constraint preConstraint = Constraint::New<Vector3>(target, prePropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs) {
1652 output = inputs[0]->GetVector3();
1654 preConstraint.AddSource(Source{actor, Actor::Property::WORLD_POSITION});
1655 preConstraint.Apply();
1657 Property::Index postPropertyIndex = target.RegisterProperty("testPostProperty", Vector3::ZERO);
1658 Constraint postConstraint = Constraint::New<Vector3>(target, postPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs) {
1659 output = inputs[0]->GetVector3();
1661 postConstraint.AddSource(Source{actor, Actor::Property::WORLD_POSITION});
1662 postConstraint.ApplyPost();
1664 application.SendNotification();
1665 application.Render();
1667 DALI_TEST_EQUALS(target.GetCurrentProperty<Vector3>(prePropertyIndex), Vector3(-239.0, -399.0, 1.0), TEST_LOCATION);
1668 DALI_TEST_EQUALS(target.GetCurrentProperty<Vector3>(postPropertyIndex), Vector3(-238.0, -398.0, 2.0), TEST_LOCATION);
1670 preConstraint.Remove();
1671 postConstraint.Remove();
1675 int UtcDaliConstraintApplyPost(void)
1677 TestApplication application;
1679 Actor actor = Actor::New();
1680 application.GetScene().Add(actor);
1682 Geometry targetGeometry = CreateQuadGeometry();
1683 Shader targetShader = CreateShader();
1684 Renderer targetRenderer = Renderer::New(targetGeometry, targetShader);
1685 Actor targetActor = Actor::New();
1686 RenderTaskList taskList = application.GetScene().GetRenderTaskList();
1688 application.GetScene().Add(targetActor);
1689 PostConstraintTest::CheckComponentProperty(application, actor, targetShader); // Shader
1690 PostConstraintTest::CheckComponentProperty(application, actor, targetRenderer); // Renderer
1691 PostConstraintTest::CheckComponentProperty(application, actor, targetActor); // Actor(Node)
1692 PostConstraintTest::CheckComponentProperty(application, actor, taskList.GetTask(0u)); // RenderTask