2 * Copyright (c) 2021 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 // Enable debug log for test coverage
19 #define DEBUG_ENABLED 1
21 #include <dali-test-suite-utils.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali/integration-api/events/touch-event-integ.h>
26 #include <dali/public-api/dali-core.h>
27 #include <mesh-builder.h>
29 #include <cfloat> // For FLT_MAX
39 void utc_dali_actor_startup(void)
41 test_return_value = TET_UNDEF;
44 void utc_dali_actor_cleanup(void)
46 test_return_value = TET_PASS;
51 bool gTouchCallBackCalled = false;
52 bool gTouchCallBackCalled2 = false;
53 bool gTouchCallBackCalled3 = false;
55 bool gHoverCallBackCalled = false;
57 static bool gTestConstraintCalled;
59 LayoutDirection::Type gLayoutDirectionType;
63 void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
65 gTestConstraintCalled = true;
70 * TestConstraint reference.
71 * When constraint is called, the resultRef is updated
72 * with the value supplied.
75 struct TestConstraintRef
77 TestConstraintRef(unsigned int& resultRef, unsigned int value)
78 : mResultRef(resultRef),
83 void operator()(T& current, const PropertyInputContainer& /* inputs */)
88 unsigned int& mResultRef;
92 static bool TestTouchCallback(Actor, const TouchEvent&)
94 gTouchCallBackCalled = true;
99 static bool TestTouchCallback2(Actor, const TouchEvent&)
101 gTouchCallBackCalled2 = true;
106 static bool TestTouchCallback3(Actor, const TouchEvent&)
108 gTouchCallBackCalled3 = true;
113 static void ResetTouchCallbacks()
115 gTouchCallBackCalled = false;
116 gTouchCallBackCalled2 = false;
117 gTouchCallBackCalled3 = false;
120 static bool TestCallback3(Actor actor, const HoverEvent& event)
122 gHoverCallBackCalled = true;
127 // validation stuff for onstage & offstage signals
128 static std::vector<std::string> gActorNamesOnOffScene;
129 static int gOnSceneCallBackCalled;
130 void OnSceneCallback(Actor actor)
132 ++gOnSceneCallBackCalled;
133 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
134 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
136 static int gOffSceneCallBackCalled;
137 void OffSceneCallback(Actor actor)
139 ++gOffSceneCallBackCalled;
140 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
141 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
144 struct PositionComponentConstraint
146 PositionComponentConstraint()
150 void operator()(Vector3& pos, const PropertyInputContainer& inputs)
152 const Matrix& m = inputs[0]->GetMatrix();
155 m.GetTransformComponents(pos, rot, scale);
159 struct OrientationComponentConstraint
161 OrientationComponentConstraint()
165 void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
167 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
170 orientation = parentOrientation;
175 static bool gOnRelayoutCallBackCalled = false;
176 static std::vector<std::string> gActorNamesRelayout;
178 void OnRelayoutCallback(Actor actor)
180 gOnRelayoutCallBackCalled = true;
181 gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
184 struct VisibilityChangedFunctorData
186 VisibilityChangedFunctorData()
189 type(DevelActor::VisibilityChange::SELF),
198 type = DevelActor::VisibilityChange::SELF;
202 void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
204 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
205 DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
206 DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
207 DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
210 void Check(bool compareCalled, const std::string& location)
212 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
217 DevelActor::VisibilityChange::Type type;
221 struct VisibilityChangedFunctor
223 VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
228 void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
231 data.visible = visible;
236 VisibilityChangedFunctorData& data;
239 struct VisibilityChangedVoidFunctor
241 VisibilityChangedVoidFunctor(bool& signalCalled)
242 : mSignalCalled(signalCalled)
248 mSignalCalled = true;
254 struct ChildOrderChangedFunctor
256 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
257 : mSignalCalled(signalCalled),
262 void operator()(Actor actor)
264 mSignalCalled = true;
272 struct CulledPropertyNotificationFunctor
274 CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
275 : mSignalCalled(signalCalled),
276 mPropertyNotification(propertyNotification)
280 void operator()(PropertyNotification& source)
282 mSignalCalled = true;
283 mPropertyNotification = source;
287 PropertyNotification& mPropertyNotification;
290 } // anonymous namespace
292 //& purpose: Testing New API
293 int UtcDaliActorNew(void)
295 TestApplication application;
297 Actor actor = Actor::New();
299 DALI_TEST_CHECK(actor);
303 //& purpose: Testing Dali::Actor::DownCast()
304 int UtcDaliActorDownCastP(void)
306 TestApplication application;
307 tet_infoline("Testing Dali::Actor::DownCast()");
309 Actor actor = Actor::New();
310 BaseHandle object(actor);
311 Actor actor2 = Actor::DownCast(object);
312 DALI_TEST_CHECK(actor2);
316 //& purpose: Testing Dali::Actor::DownCast()
317 int UtcDaliActorDownCastN(void)
319 TestApplication application;
320 tet_infoline("Testing Dali::Actor::DownCast()");
322 BaseHandle unInitializedObject;
323 Actor actor = Actor::DownCast(unInitializedObject);
324 DALI_TEST_CHECK(!actor);
328 int UtcDaliActorMoveConstructor(void)
330 TestApplication application;
332 Actor actor = Actor::New();
333 DALI_TEST_CHECK(actor);
335 int id = actor.GetProperty<int>(Actor::Property::ID);
337 Actor moved = std::move(actor);
338 DALI_TEST_CHECK(moved);
339 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
340 DALI_TEST_CHECK(!actor);
345 int UtcDaliActorMoveAssignment(void)
347 TestApplication application;
349 Actor actor = Actor::New();
350 DALI_TEST_CHECK(actor);
352 int id = actor.GetProperty<int>(Actor::Property::ID);
355 moved = std::move(actor);
356 DALI_TEST_CHECK(moved);
357 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
358 DALI_TEST_CHECK(!actor);
363 //& purpose: Testing Dali::Actor::GetName()
364 int UtcDaliActorGetName(void)
366 TestApplication application;
368 Actor actor = Actor::New();
370 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
374 //& purpose: Testing Dali::Actor::SetName()
375 int UtcDaliActorSetName(void)
377 TestApplication application;
379 string str("ActorName");
380 Actor actor = Actor::New();
382 actor.SetProperty(Actor::Property::NAME, str);
383 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
387 int UtcDaliActorGetId(void)
389 tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
390 TestApplication application;
392 Actor first = Actor::New();
393 Actor second = Actor::New();
394 Actor third = Actor::New();
396 DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
397 DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
401 int UtcDaliActorIsRoot(void)
403 TestApplication application;
405 Actor actor = Actor::New();
406 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
408 // get the root layer
409 actor = application.GetScene().GetLayer(0);
410 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
414 int UtcDaliActorOnScene(void)
416 TestApplication application;
418 Actor actor = Actor::New();
419 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
421 // get the root layer
422 actor = application.GetScene().GetLayer(0);
423 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
427 int UtcDaliActorIsLayer(void)
429 TestApplication application;
431 Actor actor = Actor::New();
432 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
434 // get the root layer
435 actor = application.GetScene().GetLayer(0);
436 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
440 int UtcDaliActorGetLayer(void)
442 TestApplication application;
444 Actor actor = Actor::New();
445 application.GetScene().Add(actor);
446 Layer layer = actor.GetLayer();
448 DALI_TEST_CHECK(layer);
450 // get the root layers layer
451 actor = application.GetScene().GetLayer(0);
452 DALI_TEST_CHECK(actor.GetLayer());
456 int UtcDaliActorAddP(void)
458 tet_infoline("Testing Actor::Add");
459 TestApplication application;
461 Actor parent = Actor::New();
462 Actor child = Actor::New();
464 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
468 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
470 Actor parent2 = Actor::New();
473 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
474 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
476 // try Adding to same parent again, works
478 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
480 // try reparenting an orphaned child
482 Actor temporaryParent = Actor::New();
483 temporaryParent.Add(child);
484 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
486 // temporaryParent has now died, reparent the orphaned child
488 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
493 int UtcDaliActorAddN(void)
495 tet_infoline("Testing Actor::Add");
496 TestApplication application;
498 Actor child = Actor::New();
500 Actor parent2 = Actor::New();
506 parent2.Add(parent2);
507 tet_printf("Assertion test failed - no Exception\n");
508 tet_result(TET_FAIL);
510 catch(Dali::DaliException& e)
512 DALI_TEST_PRINT_ASSERT(e);
513 DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
514 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
518 tet_printf("Assertion test failed - wrong Exception\n");
519 tet_result(TET_FAIL);
522 // try reparenting root
525 parent2.Add(application.GetScene().GetLayer(0));
526 tet_printf("Assertion test failed - no Exception\n");
527 tet_result(TET_FAIL);
529 catch(Dali::DaliException& e)
531 DALI_TEST_PRINT_ASSERT(e);
532 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
533 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
537 tet_printf("Assertion test failed - wrong Exception\n");
538 tet_result(TET_FAIL);
546 tet_printf("Assertion test failed - no Exception\n");
547 tet_result(TET_FAIL);
549 catch(Dali::DaliException& e)
551 DALI_TEST_PRINT_ASSERT(e);
552 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
553 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
557 tet_printf("Assertion test failed - wrong Exception\n");
558 tet_result(TET_FAIL);
564 int UtcDaliActorRemoveN(void)
566 tet_infoline("Testing Actor::Remove");
567 TestApplication application;
569 Actor parent = Actor::New();
570 Actor child = Actor::New();
571 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
574 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
576 parent.Remove(child);
577 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
579 // remove again, no problem
580 parent.Remove(child);
581 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
585 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
586 // try Remove self, its a no-op
587 parent.Remove(parent);
588 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
594 parent.Remove(empty);
595 tet_printf("Assertion test failed - no Exception\n");
596 tet_result(TET_FAIL);
598 catch(Dali::DaliException& e)
600 DALI_TEST_PRINT_ASSERT(e);
601 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
602 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
606 tet_printf("Assertion test failed - wrong Exception\n");
607 tet_result(TET_FAIL);
612 int UtcDaliActorRemoveP(void)
614 TestApplication application;
616 Actor parent = Actor::New();
617 Actor child = Actor::New();
618 Actor random = Actor::New();
620 application.GetScene().Add(parent);
622 DALI_TEST_CHECK(parent.GetChildCount() == 0);
626 DALI_TEST_CHECK(parent.GetChildCount() == 1);
628 parent.Remove(random);
630 DALI_TEST_CHECK(parent.GetChildCount() == 1);
632 application.GetScene().Remove(parent);
634 DALI_TEST_CHECK(parent.GetChildCount() == 1);
638 int UtcDaliActorGetChildCount(void)
640 TestApplication application;
642 Actor parent = Actor::New();
643 Actor child = Actor::New();
645 DALI_TEST_CHECK(parent.GetChildCount() == 0);
649 DALI_TEST_CHECK(parent.GetChildCount() == 1);
653 int UtcDaliActorGetChildren01(void)
655 TestApplication application;
657 Actor parent = Actor::New();
658 Actor first = Actor::New();
659 Actor second = Actor::New();
660 Actor third = Actor::New();
666 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
667 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
668 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
672 int UtcDaliActorGetChildren02(void)
674 TestApplication application;
676 Actor parent = Actor::New();
677 Actor first = Actor::New();
678 Actor second = Actor::New();
679 Actor third = Actor::New();
685 const Actor& constParent = parent;
687 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
688 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
689 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
693 int UtcDaliActorGetParent01(void)
695 TestApplication application;
697 Actor parent = Actor::New();
698 Actor child = Actor::New();
702 DALI_TEST_CHECK(child.GetParent() == parent);
706 int UtcDaliActorGetParent02(void)
708 TestApplication application;
710 Actor actor = Actor::New();
712 DALI_TEST_CHECK(!actor.GetParent());
716 int UtcDaliActorCustomProperty(void)
718 TestApplication application;
720 Actor actor = Actor::New();
721 application.GetScene().Add(actor);
723 float startValue(1.0f);
724 Property::Index index = actor.RegisterProperty("testProperty", startValue);
725 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
727 application.SendNotification();
728 application.Render(0);
729 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
731 actor.SetProperty(index, 5.0f);
733 application.SendNotification();
734 application.Render(0);
735 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
739 int UtcDaliActorCustomPropertyIntToFloat(void)
741 TestApplication application;
743 Actor actor = Actor::New();
744 application.GetScene().Add(actor);
746 float startValue(5.0f);
747 Property::Index index = actor.RegisterProperty("testProperty", startValue);
748 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
750 application.SendNotification();
751 application.Render(0);
752 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
754 actor.SetProperty(index, int(1));
756 application.SendNotification();
757 application.Render(0);
758 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
762 int UtcDaliActorCustomPropertyFloatToInt(void)
764 TestApplication application;
766 Actor actor = Actor::New();
767 application.GetScene().Add(actor);
770 Property::Index index = actor.RegisterProperty("testProperty", startValue);
771 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
773 application.SendNotification();
774 application.Render(0);
775 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
777 actor.SetProperty(index, float(1.5));
779 application.SendNotification();
780 application.Render(0);
781 DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
785 int UtcDaliActorSetParentOrigin(void)
787 TestApplication application;
789 Actor actor = Actor::New();
791 Vector3 vector(0.7f, 0.8f, 0.9f);
792 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
794 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
796 // flush the queue and render once
797 application.SendNotification();
798 application.Render();
800 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
802 application.GetScene().Add(actor);
804 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
806 // flush the queue and render once
807 application.SendNotification();
808 application.Render();
810 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
812 application.GetScene().Remove(actor);
816 int UtcDaliActorSetParentOriginIndividual(void)
818 TestApplication application;
820 Actor actor = Actor::New();
822 Vector3 vector(0.7f, 0.8f, 0.9f);
823 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
825 actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
827 // flush the queue and render once
828 application.SendNotification();
829 application.Render();
831 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
833 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
835 // flush the queue and render once
836 application.SendNotification();
837 application.Render();
839 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
841 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
843 // flush the queue and render once
844 application.SendNotification();
845 application.Render();
847 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
852 int UtcDaliActorGetCurrentParentOrigin(void)
854 TestApplication application;
856 Actor actor = Actor::New();
858 Vector3 vector(0.7f, 0.8f, 0.9f);
859 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
861 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
863 // flush the queue and render once
864 application.SendNotification();
865 application.Render();
867 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
871 int UtcDaliActorSetAnchorPoint(void)
873 TestApplication application;
875 Actor actor = Actor::New();
877 Vector3 vector(0.7f, 0.8f, 0.9f);
878 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
880 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
882 // flush the queue and render once
883 application.SendNotification();
884 application.Render();
886 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
888 application.GetScene().Add(actor);
890 actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
891 // flush the queue and render once
892 application.SendNotification();
893 application.Render();
895 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
897 application.GetScene().Remove(actor);
901 int UtcDaliActorSetAnchorPointIndividual(void)
903 TestApplication application;
905 Actor actor = Actor::New();
907 Vector3 vector(0.7f, 0.8f, 0.9f);
908 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
910 actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
912 // flush the queue and render once
913 application.SendNotification();
914 application.Render();
916 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
918 actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
920 // flush the queue and render once
921 application.SendNotification();
922 application.Render();
924 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
926 actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
928 // flush the queue and render once
929 application.SendNotification();
930 application.Render();
932 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
937 int UtcDaliActorGetCurrentAnchorPoint(void)
939 TestApplication application;
941 Actor actor = Actor::New();
943 Vector3 vector(0.7f, 0.8f, 0.9f);
944 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
946 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
948 // flush the queue and render once
949 application.SendNotification();
950 application.Render();
952 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
956 int UtcDaliActorSetSize01(void)
958 TestApplication application;
960 Actor actor = Actor::New();
961 Vector3 vector(100.0f, 100.0f, 0.0f);
963 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
965 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
967 // Immediately retrieve the size after setting
968 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
969 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
970 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
971 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
972 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
974 // Flush the queue and render once
975 application.SendNotification();
976 application.Render();
978 // Check the size in the new frame
979 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
981 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
982 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
983 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
984 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
985 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
987 // Check async behaviour
988 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
989 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
990 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
991 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
992 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
994 // Change the resize policy and check whether the size stays the same
995 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
997 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
998 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1000 // Set a new size after resize policy is changed and check the new size
1001 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1003 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1004 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1006 // Change the resize policy again and check whether the new size stays the same
1007 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1009 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1010 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1012 // Set another new size after resize policy is changed and check the new size
1013 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1015 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1016 DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1021 int UtcDaliActorSetSize02(void)
1023 TestApplication application;
1025 Actor actor = Actor::New();
1026 Vector3 vector(100.0f, 100.0f, 100.0f);
1028 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1030 actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1032 // Immediately check the size after setting
1033 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1034 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1036 // flush the queue and render once
1037 application.SendNotification();
1038 application.Render();
1040 // Check the size in the new frame
1041 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1043 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1044 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1049 // SetSize(Vector2 size)
1050 int UtcDaliActorSetSize03(void)
1052 TestApplication application;
1054 Actor actor = Actor::New();
1055 Vector3 vector(100.0f, 100.0f, 0.0f);
1057 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1059 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1061 // Immediately check the size after setting
1062 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1063 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1065 // flush the queue and render once
1066 application.SendNotification();
1067 application.Render();
1069 // Check the size in the new frame
1070 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1072 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1073 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1078 // SetSize(Vector3 size)
1079 int UtcDaliActorSetSize04(void)
1081 TestApplication application;
1083 Actor actor = Actor::New();
1084 Vector3 vector(100.0f, 100.0f, 100.0f);
1086 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1088 actor.SetProperty(Actor::Property::SIZE, vector);
1090 // Immediately check the size after setting
1091 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1092 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1094 // flush the queue and render once
1095 application.SendNotification();
1096 application.Render();
1098 // Check the size in the new frame
1099 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1101 application.GetScene().Add(actor);
1102 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1104 // Immediately check the size after setting
1105 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1106 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1108 // flush the queue and render once
1109 application.SendNotification();
1110 application.Render();
1112 // Check the size in the new frame
1113 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1115 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1116 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1118 application.GetScene().Remove(actor);
1122 int UtcDaliActorSetSizeIndividual(void)
1124 TestApplication application;
1126 Actor actor = Actor::New();
1128 Vector3 vector(0.7f, 0.8f, 0.9f);
1129 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1131 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1133 // Immediately check the width after setting
1134 float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1135 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1137 // flush the queue and render once
1138 application.SendNotification();
1139 application.Render();
1141 // Check the width in the new frame
1142 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1144 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1145 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1147 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1149 // Immediately check the height after setting
1150 float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1151 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1153 // flush the queue and render once
1154 application.SendNotification();
1155 application.Render();
1157 // Check the height in the new frame
1158 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1160 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1161 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1163 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1165 // Immediately check the depth after setting
1166 float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1167 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1169 // flush the queue and render once
1170 application.SendNotification();
1171 application.Render();
1173 // Check the depth in the new frame
1174 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1176 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1177 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1179 // Change the resize policy and check whether the size stays the same
1180 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1182 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1183 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1185 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1186 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1188 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1189 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1191 // Change the resize policy again and check whether the size stays the same
1192 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1194 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1195 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1197 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1198 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1200 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1201 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1206 int UtcDaliActorSetSizeIndividual02(void)
1208 TestApplication application;
1210 Actor actor = Actor::New();
1211 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1212 application.GetScene().Add(actor);
1214 Vector3 vector(100.0f, 200.0f, 400.0f);
1215 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1217 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1218 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1220 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1221 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1223 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1224 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1226 // flush the queue and render once
1227 application.SendNotification();
1228 application.Render();
1230 // Check the width in the new frame
1231 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1232 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1237 int UtcDaliActorGetCurrentSize(void)
1239 TestApplication application;
1241 Actor actor = Actor::New();
1242 Vector3 vector(100.0f, 100.0f, 20.0f);
1244 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1246 actor.SetProperty(Actor::Property::SIZE, vector);
1248 // flush the queue and render once
1249 application.SendNotification();
1250 application.Render();
1252 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1256 int UtcDaliActorGetNaturalSize(void)
1258 TestApplication application;
1260 Actor actor = Actor::New();
1261 Vector3 vector(0.0f, 0.0f, 0.0f);
1263 DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1268 int UtcDaliActorGetCurrentSizeImmediate(void)
1270 TestApplication application;
1272 Actor actor = Actor::New();
1273 Vector3 vector(100.0f, 100.0f, 20.0f);
1275 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1276 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1278 actor.SetProperty(Actor::Property::SIZE, vector);
1280 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1281 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1283 // flush the queue and render once
1284 application.SendNotification();
1285 application.Render();
1287 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1288 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1291 // Build the animation
1292 const float durationSeconds = 2.0f;
1293 Animation animation = Animation::New(durationSeconds);
1294 const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1295 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1297 DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1299 application.GetScene().Add(actor);
1301 // Start the animation
1304 application.SendNotification();
1305 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1307 DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1312 int UtcDaliActorCalculateScreenExtents(void)
1314 TestApplication application;
1316 Actor actor = Actor::New();
1318 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1319 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1321 application.SendNotification();
1322 application.Render();
1324 auto expectedExtent = Rect<>{-0.5f, -0.5f, 1.0f, 1.0f};
1325 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1326 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1327 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1328 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1329 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1331 application.GetScene().Remove(actor);
1335 // SetPosition(float x, float y)
1336 int UtcDaliActorSetPosition01(void)
1338 TestApplication application;
1340 Actor actor = Actor::New();
1342 // Set to random to start off with
1343 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1345 Vector3 vector(100.0f, 100.0f, 0.0f);
1347 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1349 actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1350 // flush the queue and render once
1351 application.SendNotification();
1352 application.Render();
1353 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1355 application.GetScene().Add(actor);
1356 actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1357 // flush the queue and render once
1358 application.SendNotification();
1359 application.Render();
1360 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1362 actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1363 actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1364 actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1365 // flush the queue and render once
1366 application.SendNotification();
1367 application.Render();
1368 DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1370 actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1371 // flush the queue and render once
1372 application.SendNotification();
1373 application.Render();
1374 DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1376 application.GetScene().Remove(actor);
1380 // SetPosition(float x, float y, float z)
1381 int UtcDaliActorSetPosition02(void)
1383 TestApplication application;
1385 Actor actor = Actor::New();
1387 // Set to random to start off with
1388 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1390 Vector3 vector(100.0f, 100.0f, 100.0f);
1392 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1394 actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1396 // flush the queue and render once
1397 application.SendNotification();
1398 application.Render();
1400 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1404 // SetPosition(Vector3 position)
1405 int UtcDaliActorSetPosition03(void)
1407 TestApplication application;
1409 Actor actor = Actor::New();
1411 // Set to random to start off with
1412 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1414 Vector3 vector(100.0f, 100.0f, 100.0f);
1416 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1418 actor.SetProperty(Actor::Property::POSITION, vector);
1420 // flush the queue and render once
1421 application.SendNotification();
1422 application.Render();
1424 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1428 int UtcDaliActorSetX(void)
1430 TestApplication application;
1432 Actor actor = Actor::New();
1434 Vector3 vector(100.0f, 0.0f, 0.0f);
1436 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1438 actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1440 // flush the queue and render once
1441 application.SendNotification();
1442 application.Render();
1444 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1448 int UtcDaliActorSetY(void)
1450 TestApplication application;
1452 Actor actor = Actor::New();
1454 Vector3 vector(0.0f, 100.0f, 0.0f);
1456 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1458 actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1460 // flush the queue and render once
1461 application.SendNotification();
1462 application.Render();
1464 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1468 int UtcDaliActorSetZ(void)
1470 TestApplication application;
1472 Actor actor = Actor::New();
1474 Vector3 vector(0.0f, 0.0f, 100.0f);
1476 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1478 actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1480 // flush the queue and render once
1481 application.SendNotification();
1482 application.Render();
1484 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1488 int UtcDaliActorSetPositionProperties(void)
1490 TestApplication application;
1492 Actor actor = Actor::New();
1494 Vector3 vector(0.7f, 0.8f, 0.9f);
1495 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1497 actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1498 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1499 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1501 // flush the queue and render once
1502 application.SendNotification();
1503 application.Render();
1505 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1506 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1507 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1508 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1509 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1511 actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1512 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1513 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1515 // flush the queue and render once
1516 application.SendNotification();
1517 application.Render();
1519 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1520 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1521 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1522 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1523 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1525 actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
1526 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1527 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1529 // flush the queue and render once
1530 application.SendNotification();
1531 application.Render();
1533 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1534 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1535 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1536 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1537 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1542 int UtcDaliActorTranslateBy(void)
1544 TestApplication application;
1546 Actor actor = Actor::New();
1547 Vector3 vector(100.0f, 100.0f, 100.0f);
1549 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1551 actor.SetProperty(Actor::Property::POSITION, vector);
1553 // flush the queue and render once
1554 application.SendNotification();
1555 application.Render();
1557 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1559 actor.TranslateBy(vector);
1561 // flush the queue and render once
1562 application.SendNotification();
1563 application.Render();
1565 DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1569 int UtcDaliActorGetCurrentPosition(void)
1571 TestApplication application;
1573 Actor actor = Actor::New();
1574 Vector3 setVector(100.0f, 100.0f, 0.0f);
1575 actor.SetProperty(Actor::Property::POSITION, setVector);
1577 // flush the queue and render once
1578 application.SendNotification();
1579 application.Render();
1581 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
1585 int UtcDaliActorGetCurrentWorldPosition(void)
1587 TestApplication application;
1589 Actor parent = Actor::New();
1590 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1591 parent.SetProperty(Actor::Property::POSITION, parentPosition);
1592 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1593 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1594 application.GetScene().Add(parent);
1596 Actor child = Actor::New();
1597 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1598 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1599 Vector3 childPosition(6.0f, 6.0f, 6.0f);
1600 child.SetProperty(Actor::Property::POSITION, childPosition);
1603 // The actors should not have a world position yet
1604 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1605 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1607 application.SendNotification();
1608 application.Render(0);
1610 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1611 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1613 // The actors should have a world position now
1614 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1615 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1619 int UtcDaliActorSetInheritPosition(void)
1621 tet_infoline("Testing Actor::SetInheritPosition");
1622 TestApplication application;
1624 Actor parent = Actor::New();
1625 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1626 parent.SetProperty(Actor::Property::POSITION, parentPosition);
1627 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1628 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1629 application.GetScene().Add(parent);
1631 Actor child = Actor::New();
1632 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1633 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1634 Vector3 childPosition(10.0f, 11.0f, 12.0f);
1635 child.SetProperty(Actor::Property::POSITION, childPosition);
1638 // The actors should not have a world position yet
1639 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1640 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1642 // first test default, which is to inherit position
1643 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1644 application.SendNotification();
1645 application.Render(0); // should only really call Update as Render is not required to update scene
1646 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1647 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1648 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1649 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1651 //Change child position
1652 Vector3 childOffset(-1.0f, 1.0f, 0.0f);
1653 child.SetProperty(Actor::Property::POSITION, childOffset);
1655 // Use local position as world postion
1656 child.SetProperty(Actor::Property::INHERIT_POSITION, false);
1657 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
1658 application.SendNotification();
1659 application.Render(0); // should only really call Update as Render is not required to update scene
1660 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1661 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1662 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1663 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
1665 //Change back to inherit position from parent
1666 child.SetProperty(Actor::Property::INHERIT_POSITION, true);
1667 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1668 application.SendNotification();
1669 application.Render(0); // should only really call Update as Render is not required to update scene
1670 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1671 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1672 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1673 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
1677 int UtcDaliActorInheritOpacity(void)
1679 tet_infoline("Testing Actor::Inherit Opacity");
1680 TestApplication application;
1682 Actor parent = Actor::New();
1683 Actor child = Actor::New();
1685 application.GetScene().Add(parent);
1687 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1688 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1690 // flush the queue and render once
1691 application.SendNotification();
1692 application.Render();
1694 parent.SetProperty(Actor::Property::OPACITY, 0.1f);
1696 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1697 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1699 application.SendNotification();
1700 application.Render();
1702 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1703 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1704 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1705 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1706 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1707 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
1712 // SetOrientation(float angleRadians, Vector3 axis)
1713 int UtcDaliActorSetOrientation01(void)
1715 TestApplication application;
1717 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1718 Actor actor = Actor::New();
1720 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1722 // flush the queue and render once
1723 application.SendNotification();
1724 application.Render();
1726 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1730 int UtcDaliActorSetOrientation02(void)
1732 TestApplication application;
1734 Actor actor = Actor::New();
1736 Radian angle(0.785f);
1737 Vector3 axis(1.0f, 1.0f, 0.0f);
1739 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1740 Quaternion rotation(angle, axis);
1741 // flush the queue and render once
1742 application.SendNotification();
1743 application.Render();
1744 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1746 application.GetScene().Add(actor);
1747 actor.RotateBy(Degree(360), axis);
1748 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1750 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
1751 Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
1752 // flush the queue and render once
1753 application.SendNotification();
1754 application.Render();
1755 DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1757 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1758 // flush the queue and render once
1759 application.SendNotification();
1760 application.Render();
1761 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1763 application.GetScene().Remove(actor);
1767 // SetOrientation(float angleRadians, Vector3 axis)
1768 int UtcDaliActorSetOrientationProperty(void)
1770 TestApplication application;
1772 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1773 Actor actor = Actor::New();
1775 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1776 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1778 // flush the queue and render once
1779 application.SendNotification();
1780 application.Render();
1782 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1783 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1784 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1788 // RotateBy(float angleRadians, Vector3 axis)
1789 int UtcDaliActorRotateBy01(void)
1791 TestApplication application;
1793 Actor actor = Actor::New();
1795 Radian angle(M_PI * 0.25f);
1796 actor.RotateBy((angle), Vector3::ZAXIS);
1797 // flush the queue and render once
1798 application.SendNotification();
1799 application.Render();
1800 DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1802 application.GetScene().Add(actor);
1804 actor.RotateBy(angle, Vector3::ZAXIS);
1805 // flush the queue and render once
1806 application.SendNotification();
1807 application.Render();
1808 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1810 application.GetScene().Remove(actor);
1814 // RotateBy(Quaternion relativeRotation)
1815 int UtcDaliActorRotateBy02(void)
1817 TestApplication application;
1819 Actor actor = Actor::New();
1821 Radian angle(M_PI * 0.25f);
1822 Quaternion rotation(angle, Vector3::ZAXIS);
1823 actor.RotateBy(rotation);
1824 // flush the queue and render once
1825 application.SendNotification();
1826 application.Render();
1827 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1829 actor.RotateBy(rotation);
1830 // flush the queue and render once
1831 application.SendNotification();
1832 application.Render();
1833 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1837 int UtcDaliActorGetCurrentOrientation(void)
1839 TestApplication application;
1840 Actor actor = Actor::New();
1842 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1843 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1844 // flush the queue and render once
1845 application.SendNotification();
1846 application.Render();
1847 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1851 int UtcDaliActorGetCurrentWorldOrientation(void)
1853 tet_infoline("Testing Actor::GetCurrentWorldRotation");
1854 TestApplication application;
1856 Actor parent = Actor::New();
1857 Radian rotationAngle(Degree(90.0f));
1858 Quaternion rotation(rotationAngle, Vector3::YAXIS);
1859 parent.SetProperty(Actor::Property::ORIENTATION, rotation);
1860 application.GetScene().Add(parent);
1862 Actor child = Actor::New();
1863 child.SetProperty(Actor::Property::ORIENTATION, rotation);
1866 // The actors should not have a world rotation yet
1867 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1868 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1870 application.SendNotification();
1871 application.Render(0);
1873 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1874 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1876 // The actors should have a world rotation now
1877 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1878 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
1880 // turn off child rotation inheritance
1881 child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
1882 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
1883 application.SendNotification();
1884 application.Render(0);
1886 // The actors should have a world rotation now
1887 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1888 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
1892 // SetScale(float scale)
1893 int UtcDaliActorSetScale01(void)
1895 TestApplication application;
1897 Actor actor = Actor::New();
1899 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1900 actor.SetProperty(Actor::Property::SCALE, 0.25f);
1902 Vector3 scale(10.0f, 10.0f, 10.0f);
1903 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1905 actor.SetProperty(Actor::Property::SCALE, scale.x);
1907 // flush the queue and render once
1908 application.SendNotification();
1909 application.Render();
1911 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1915 // SetScale(float scaleX, float scaleY, float scaleZ)
1916 int UtcDaliActorSetScale02(void)
1918 TestApplication application;
1919 Vector3 scale(10.0f, 10.0f, 10.0f);
1921 Actor actor = Actor::New();
1923 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1924 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1926 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1928 actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
1929 // flush the queue and render once
1930 application.SendNotification();
1931 application.Render();
1932 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1934 // add to stage and test
1935 application.GetScene().Add(actor);
1936 actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
1937 // flush the queue and render once
1938 application.SendNotification();
1939 application.Render();
1940 DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
1942 application.GetScene().Remove(actor);
1947 // SetScale(Vector3 scale)
1948 int UtcDaliActorSetScale03(void)
1950 TestApplication application;
1951 Vector3 scale(10.0f, 10.0f, 10.0f);
1953 Actor actor = Actor::New();
1955 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1956 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1958 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1960 actor.SetProperty(Actor::Property::SCALE, scale);
1962 // flush the queue and render once
1963 application.SendNotification();
1964 application.Render();
1966 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1970 int UtcDaliActorSetScaleIndividual(void)
1972 TestApplication application;
1974 Actor actor = Actor::New();
1976 Vector3 vector(0.7f, 0.8f, 0.9f);
1977 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
1979 actor.SetProperty(Actor::Property::SCALE_X, vector.x);
1980 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1982 // flush the queue and render once
1983 application.SendNotification();
1984 application.Render();
1986 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
1987 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1988 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
1990 actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
1991 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
1993 // flush the queue and render once
1994 application.SendNotification();
1995 application.Render();
1997 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
1998 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
1999 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2001 actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2002 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2004 // flush the queue and render once
2005 application.SendNotification();
2006 application.Render();
2008 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2009 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2010 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2012 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2013 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2018 int UtcDaliActorScaleBy(void)
2020 TestApplication application;
2021 Actor actor = Actor::New();
2022 Vector3 vector(100.0f, 100.0f, 100.0f);
2024 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2026 actor.SetProperty(Actor::Property::SCALE, vector);
2028 // flush the queue and render once
2029 application.SendNotification();
2030 application.Render();
2032 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2034 actor.ScaleBy(vector);
2036 // flush the queue and render once
2037 application.SendNotification();
2038 application.Render();
2040 DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2044 int UtcDaliActorGetCurrentScale(void)
2046 TestApplication application;
2047 Vector3 scale(12.0f, 1.0f, 2.0f);
2049 Actor actor = Actor::New();
2051 actor.SetProperty(Actor::Property::SCALE, scale);
2053 // flush the queue and render once
2054 application.SendNotification();
2055 application.Render();
2057 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2061 int UtcDaliActorGetCurrentWorldScale(void)
2063 TestApplication application;
2065 Actor parent = Actor::New();
2066 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2067 parent.SetProperty(Actor::Property::SCALE, parentScale);
2068 application.GetScene().Add(parent);
2070 Actor child = Actor::New();
2071 Vector3 childScale(2.0f, 2.0f, 2.0f);
2072 child.SetProperty(Actor::Property::SCALE, childScale);
2075 // The actors should not have a scale yet
2076 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2077 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2079 // The actors should not have a world scale yet
2080 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2081 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2083 application.SendNotification();
2084 application.Render(0);
2086 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2087 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2089 // The actors should have a world scale now
2090 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2091 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2095 int UtcDaliActorInheritScale(void)
2097 tet_infoline("Testing Actor::SetInheritScale");
2098 TestApplication application;
2100 Actor parent = Actor::New();
2101 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2102 parent.SetProperty(Actor::Property::SCALE, parentScale);
2103 application.GetScene().Add(parent);
2105 Actor child = Actor::New();
2106 Vector3 childScale(2.0f, 2.0f, 2.0f);
2107 child.SetProperty(Actor::Property::SCALE, childScale);
2110 application.SendNotification();
2111 application.Render(0);
2113 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2114 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2116 child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2117 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2119 application.SendNotification();
2120 application.Render(0);
2122 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2126 int UtcDaliActorSetVisible(void)
2128 TestApplication application;
2130 Actor actor = Actor::New();
2131 actor.SetProperty(Actor::Property::VISIBLE, false);
2132 // flush the queue and render once
2133 application.SendNotification();
2134 application.Render();
2135 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2137 actor.SetProperty(Actor::Property::VISIBLE, true);
2138 // flush the queue and render once
2139 application.SendNotification();
2140 application.Render();
2141 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2143 // put actor on stage
2144 application.GetScene().Add(actor);
2145 actor.SetProperty(Actor::Property::VISIBLE, false);
2146 // flush the queue and render once
2147 application.SendNotification();
2148 application.Render();
2149 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2153 int UtcDaliActorIsVisible(void)
2155 TestApplication application;
2157 Actor actor = Actor::New();
2159 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2163 int UtcDaliActorSetOpacity(void)
2165 TestApplication application;
2167 Actor actor = Actor::New();
2168 // initial opacity is 1
2169 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2171 actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2172 // flush the queue and render once
2173 application.SendNotification();
2174 application.Render();
2175 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2177 // change opacity, actor is on stage to change is not immediate
2178 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2179 // flush the queue and render once
2180 application.SendNotification();
2181 application.Render();
2182 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2184 // put actor on stage
2185 application.GetScene().Add(actor);
2187 // change opacity, actor is on stage to change is not immediate
2188 actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2189 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2190 // flush the queue and render once
2191 application.SendNotification();
2192 application.Render();
2193 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2195 // change opacity, actor is on stage to change is not immediate
2196 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2197 // flush the queue and render once
2198 application.SendNotification();
2199 application.Render();
2200 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2204 int UtcDaliActorGetCurrentOpacity(void)
2206 TestApplication application;
2208 Actor actor = Actor::New();
2209 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2211 actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2212 // flush the queue and render once
2213 application.SendNotification();
2214 application.Render();
2215 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2219 int UtcDaliActorSetSensitive(void)
2221 TestApplication application;
2222 Actor actor = Actor::New();
2224 bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2226 actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2228 DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2232 int UtcDaliActorIsSensitive(void)
2234 TestApplication application;
2235 Actor actor = Actor::New();
2236 actor.SetProperty(Actor::Property::SENSITIVE, false);
2238 DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2242 int UtcDaliActorSetColor(void)
2244 TestApplication application;
2245 Actor actor = Actor::New();
2246 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2248 DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2250 actor.SetProperty(Actor::Property::COLOR, color);
2251 // flush the queue and render once
2252 application.SendNotification();
2253 application.Render();
2254 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2256 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2257 // flush the queue and render once
2258 application.SendNotification();
2259 application.Render();
2260 DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2262 application.GetScene().Add(actor);
2263 actor.SetProperty(Actor::Property::COLOR, color);
2264 // flush the queue and render once
2265 application.SendNotification();
2266 application.Render();
2267 DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2269 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2270 // flush the queue and render once
2271 application.SendNotification();
2272 application.Render();
2273 // Actor color is not clamped
2274 DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2275 // world color is clamped
2276 DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2278 actor.SetProperty(Actor::Property::COLOR, color);
2279 DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2281 Vector3 newColor(1.0f, 0.0f, 0.0f);
2282 actor.SetProperty(Actor::Property::COLOR, newColor);
2283 DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2285 application.GetScene().Remove(actor);
2289 int UtcDaliActorSetColorIndividual(void)
2291 TestApplication application;
2293 Actor actor = Actor::New();
2295 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2296 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2298 actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2299 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2301 // flush the queue and render once
2302 application.SendNotification();
2303 application.Render();
2305 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2306 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2307 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2309 actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2310 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2312 // flush the queue and render once
2313 application.SendNotification();
2314 application.Render();
2316 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2317 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2318 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2320 actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2321 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2323 // flush the queue and render once
2324 application.SendNotification();
2325 application.Render();
2327 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2328 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2329 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2331 actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2332 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2334 // flush the queue and render once
2335 application.SendNotification();
2336 application.Render();
2338 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2339 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2340 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2342 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2343 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2345 actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2347 // flush the queue and render once
2348 application.SendNotification();
2349 application.Render();
2351 DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2356 int UtcDaliActorGetCurrentColor(void)
2358 TestApplication application;
2359 Actor actor = Actor::New();
2360 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2362 actor.SetProperty(Actor::Property::COLOR, color);
2363 // flush the queue and render once
2364 application.SendNotification();
2365 application.Render();
2366 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2370 int UtcDaliActorGetCurrentWorldColor(void)
2372 tet_infoline("Actor::GetCurrentWorldColor");
2373 TestApplication application;
2375 Actor parent = Actor::New();
2376 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2377 parent.SetProperty(Actor::Property::COLOR, parentColor);
2378 application.GetScene().Add(parent);
2380 Actor child = Actor::New();
2381 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2382 child.SetProperty(Actor::Property::COLOR, childColor);
2385 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2386 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2388 // verify the default color mode
2389 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2391 // The actors should not have a world color yet
2392 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2393 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2395 application.SendNotification();
2396 application.Render(0);
2398 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2399 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2401 // The actors should have a world color now
2402 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2403 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2406 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2407 application.SendNotification();
2408 application.Render(0);
2409 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2412 child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2413 application.SendNotification();
2414 application.Render(0);
2415 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2416 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2419 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2420 application.SendNotification();
2421 application.Render(0);
2422 Vector4 expectedColor(childColor);
2423 expectedColor.a *= parentColor.a;
2424 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2425 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2429 int UtcDaliActorSetColorMode(void)
2431 tet_infoline("Actor::SetColorMode");
2432 TestApplication application;
2433 Actor actor = Actor::New();
2434 Actor child = Actor::New();
2437 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2438 DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2440 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2441 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2443 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2444 DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2446 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2447 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2451 int UtcDaliActorScreenToLocal(void)
2453 TestApplication application;
2454 Actor actor = Actor::New();
2455 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2456 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2457 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2458 application.GetScene().Add(actor);
2460 // flush the queue and render once
2461 application.SendNotification();
2462 application.Render();
2467 application.SendNotification();
2468 application.Render();
2470 DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2472 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2473 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2477 int UtcDaliActorSetLeaveRequired(void)
2479 TestApplication application;
2481 Actor actor = Actor::New();
2483 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2484 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2486 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2487 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2491 int UtcDaliActorGetLeaveRequired(void)
2493 TestApplication application;
2495 Actor actor = Actor::New();
2497 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2501 int UtcDaliActorSetKeyboardFocusable(void)
2503 TestApplication application;
2505 Actor actor = Actor::New();
2507 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2508 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2510 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2511 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2515 int UtcDaliActorIsKeyboardFocusable(void)
2517 TestApplication application;
2519 Actor actor = Actor::New();
2521 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2525 int UtcDaliActorSetTouchFocusable(void)
2527 TestApplication application;
2529 Actor actor = Actor::New();
2531 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
2532 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
2534 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
2535 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2539 int UtcDaliActorIsTouchFocusable(void)
2541 TestApplication application;
2543 Actor actor = Actor::New();
2545 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2549 int UtcDaliActorRemoveConstraints(void)
2551 tet_infoline(" UtcDaliActorRemoveConstraints");
2552 TestApplication application;
2554 gTestConstraintCalled = false;
2556 Actor actor = Actor::New();
2558 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
2560 actor.RemoveConstraints();
2562 DALI_TEST_CHECK(gTestConstraintCalled == false);
2564 application.GetScene().Add(actor);
2567 // flush the queue and render once
2568 application.SendNotification();
2569 application.Render();
2571 actor.RemoveConstraints();
2573 DALI_TEST_CHECK(gTestConstraintCalled == true);
2577 int UtcDaliActorRemoveConstraintTag(void)
2579 tet_infoline(" UtcDaliActorRemoveConstraintTag");
2580 TestApplication application;
2582 Actor actor = Actor::New();
2584 // 1. Apply Constraint1 and Constraint2, and test...
2585 unsigned int result1 = 0u;
2586 unsigned int result2 = 0u;
2588 unsigned constraint1Tag = 1u;
2589 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
2590 constraint1.SetTag(constraint1Tag);
2591 constraint1.Apply();
2593 unsigned constraint2Tag = 2u;
2594 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
2595 constraint2.SetTag(constraint2Tag);
2596 constraint2.Apply();
2598 application.GetScene().Add(actor);
2599 // flush the queue and render once
2600 application.SendNotification();
2601 application.Render();
2603 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2604 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2606 // 2. Remove Constraint1 and test...
2609 actor.RemoveConstraints(constraint1Tag);
2610 // make color property dirty, which will trigger constraints to be reapplied.
2611 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2612 // flush the queue and render once
2613 application.SendNotification();
2614 application.Render();
2616 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2617 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2619 // 3. Re-Apply Constraint1 and test...
2622 constraint1.Apply();
2623 // make color property dirty, which will trigger constraints to be reapplied.
2624 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2625 // flush the queue and render once
2626 application.SendNotification();
2627 application.Render();
2629 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2630 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2632 // 2. Remove Constraint2 and test...
2635 actor.RemoveConstraints(constraint2Tag);
2636 // make color property dirty, which will trigger constraints to be reapplied.
2637 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2638 // flush the queue and render once
2639 application.SendNotification();
2640 application.Render();
2642 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2643 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2645 // 2. Remove Constraint1 as well and test...
2648 actor.RemoveConstraints(constraint1Tag);
2649 // make color property dirty, which will trigger constraints to be reapplied.
2650 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2651 // flush the queue and render once
2652 application.SendNotification();
2653 application.Render();
2655 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2656 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2660 int UtcDaliActorTouchedSignal(void)
2662 TestApplication application;
2664 ResetTouchCallbacks();
2666 // get the root layer
2667 Actor actor = application.GetScene().GetRootLayer();
2668 DALI_TEST_CHECK(gTouchCallBackCalled == false);
2670 application.SendNotification();
2671 application.Render();
2673 // connect to its touch signal
2674 actor.TouchedSignal().Connect(TestTouchCallback);
2676 // simulate a touch event in the middle of the screen
2677 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2678 Dali::Integration::Point point;
2679 point.SetDeviceId(1);
2680 point.SetState(PointState::DOWN);
2681 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2682 Dali::Integration::TouchEvent touchEvent;
2683 touchEvent.AddPoint(point);
2684 application.ProcessEvent(touchEvent);
2686 DALI_TEST_CHECK(gTouchCallBackCalled == true);
2690 int UtcDaliActorHoveredSignal(void)
2692 TestApplication application;
2694 gHoverCallBackCalled = false;
2696 // get the root layer
2697 Actor actor = application.GetScene().GetRootLayer();
2698 DALI_TEST_CHECK(gHoverCallBackCalled == false);
2700 application.SendNotification();
2701 application.Render();
2703 // connect to its hover signal
2704 actor.HoveredSignal().Connect(TestCallback3);
2706 // simulate a hover event in the middle of the screen
2707 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2708 Dali::Integration::Point point;
2709 point.SetDeviceId(1);
2710 point.SetState(PointState::MOTION);
2711 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2712 Dali::Integration::HoverEvent hoverEvent;
2713 hoverEvent.AddPoint(point);
2714 application.ProcessEvent(hoverEvent);
2716 DALI_TEST_CHECK(gHoverCallBackCalled == true);
2720 int UtcDaliActorOnOffSceneSignal(void)
2722 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
2724 TestApplication application;
2727 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2728 gActorNamesOnOffScene.clear();
2730 Actor parent = Actor::New();
2731 parent.SetProperty(Actor::Property::NAME, "parent");
2732 parent.OnSceneSignal().Connect(OnSceneCallback);
2733 parent.OffSceneSignal().Connect(OffSceneCallback);
2735 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
2736 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
2738 // add parent to the scene
2739 application.GetScene().Add(parent);
2740 // onstage emitted, offstage not
2741 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2742 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2743 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2745 // test adding a child, should get onstage emitted
2747 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2748 gActorNamesOnOffScene.clear();
2750 Actor child = Actor::New();
2751 child.SetProperty(Actor::Property::NAME, "child");
2752 child.OnSceneSignal().Connect(OnSceneCallback);
2753 child.OffSceneSignal().Connect(OffSceneCallback);
2754 parent.Add(child); // add child
2755 // onscene emitted, offscene not
2756 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2757 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2758 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2760 // test removing parent from the scene
2762 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2763 gActorNamesOnOffScene.clear();
2765 application.GetScene().Remove(parent);
2766 // onscene not emitted, offscene is
2767 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2768 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
2769 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2770 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
2772 // test adding parent back to the scene
2774 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2775 gActorNamesOnOffScene.clear();
2777 application.GetScene().Add(parent);
2778 // onscene emitted, offscene not
2779 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
2780 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2781 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2782 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
2784 // test removing child
2786 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2787 gActorNamesOnOffScene.clear();
2789 parent.Remove(child);
2790 // onscene not emitted, offscene is
2791 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2792 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2793 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2795 // test removing parent
2797 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2798 gActorNamesOnOffScene.clear();
2800 application.GetScene().Remove(parent);
2801 // onscene not emitted, offscene is
2802 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2803 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2804 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2808 int UtcDaliActorFindChildByName(void)
2810 tet_infoline("Testing Dali::Actor::FindChildByName()");
2811 TestApplication application;
2813 Actor parent = Actor::New();
2814 parent.SetProperty(Actor::Property::NAME, "parent");
2815 Actor first = Actor::New();
2816 first.SetProperty(Actor::Property::NAME, "first");
2817 Actor second = Actor::New();
2818 second.SetProperty(Actor::Property::NAME, "second");
2823 Actor found = parent.FindChildByName("foo");
2824 DALI_TEST_CHECK(!found);
2826 found = parent.FindChildByName("parent");
2827 DALI_TEST_CHECK(found == parent);
2829 found = parent.FindChildByName("first");
2830 DALI_TEST_CHECK(found == first);
2832 found = parent.FindChildByName("second");
2833 DALI_TEST_CHECK(found == second);
2837 int UtcDaliActorFindChildById(void)
2839 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2840 TestApplication application;
2842 Actor parent = Actor::New();
2843 Actor first = Actor::New();
2844 Actor second = Actor::New();
2849 Actor found = parent.FindChildById(100000);
2850 DALI_TEST_CHECK(!found);
2852 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
2853 DALI_TEST_CHECK(found == parent);
2855 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
2856 DALI_TEST_CHECK(found == first);
2858 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
2859 DALI_TEST_CHECK(found == second);
2863 int UtcDaliActorHitTest(void)
2868 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
2870 mTouchPoint(touchPoint),
2876 Vector2 mTouchPoint;
2880 TestApplication application;
2881 tet_infoline(" UtcDaliActorHitTest");
2883 // Fill a vector with different hit tests.
2884 struct HitTestData* hitTestData[] = {
2885 // scale touch point result
2886 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
2887 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
2888 new HitTestData(Vector3(110.f, 100.f, 1.f), Vector2(291.f, 400.f), true), // same point as above with a wider scale. Should be inside.
2889 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
2890 new HitTestData(Vector3(100.f, 110.f, 1.f), Vector2(200.f, 451.f), true), // same point as above with a wider scale. Should be inside.
2894 // get the root layer
2895 Actor actor = Actor::New();
2896 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2897 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2899 application.GetScene().Add(actor);
2901 ResetTouchCallbacks();
2903 unsigned int index = 0;
2904 while(NULL != hitTestData[index])
2906 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
2907 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
2909 // flush the queue and render once
2910 application.SendNotification();
2911 application.Render();
2913 DALI_TEST_CHECK(!gTouchCallBackCalled);
2915 // connect to its touch signal
2916 actor.TouchedSignal().Connect(TestTouchCallback);
2918 Dali::Integration::Point point;
2919 point.SetState(PointState::DOWN);
2920 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
2921 Dali::Integration::TouchEvent event;
2922 event.AddPoint(point);
2924 // flush the queue and render once
2925 application.SendNotification();
2926 application.Render();
2927 application.ProcessEvent(event);
2929 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
2931 if(gTouchCallBackCalled != hitTestData[index]->mResult)
2932 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2933 hitTestData[index]->mScale.x,
2934 hitTestData[index]->mScale.y,
2935 hitTestData[index]->mScale.z,
2936 hitTestData[index]->mTouchPoint.x,
2937 hitTestData[index]->mTouchPoint.y,
2938 hitTestData[index]->mResult);
2940 ResetTouchCallbacks();
2946 int UtcDaliActorSetDrawMode(void)
2948 TestApplication application;
2949 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2951 Actor a = Actor::New();
2953 application.GetScene().Add(a);
2954 application.SendNotification();
2955 application.Render(0);
2956 application.SendNotification();
2957 application.Render(1);
2959 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
2961 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
2962 application.SendNotification();
2963 application.Render(1);
2965 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
2967 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
2968 application.SendNotification();
2969 application.Render(1);
2971 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
2975 int UtcDaliActorSetDrawModeOverlayRender(void)
2977 TestApplication application;
2978 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2980 application.SendNotification();
2981 application.Render(1);
2983 std::vector<GLuint> ids;
2984 ids.push_back(8); // first rendered actor
2985 ids.push_back(9); // second rendered actor
2986 ids.push_back(10); // third rendered actor
2987 application.GetGlAbstraction().SetNextTextureIds(ids);
2989 Texture imageA = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2990 Texture imageB = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2991 Texture imageC = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
2992 Actor a = CreateRenderableActor(imageA);
2993 Actor b = CreateRenderableActor(imageB);
2994 Actor c = CreateRenderableActor(imageC);
2996 application.SendNotification();
2997 application.Render(1);
2999 //Textures are bound when first created. Clear bound textures vector
3000 application.GetGlAbstraction().ClearBoundTextures();
3002 // Render a,b,c as regular non-overlays. so order will be:
3006 application.GetScene().Add(a);
3007 application.GetScene().Add(b);
3008 application.GetScene().Add(c);
3010 application.SendNotification();
3011 application.Render(1);
3013 // Should be 3 textures changes.
3014 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3015 typedef std::vector<GLuint>::size_type TextureSize;
3016 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3017 if(boundTextures.size() == 3)
3019 DALI_TEST_CHECK(boundTextures[0] == 8u);
3020 DALI_TEST_CHECK(boundTextures[1] == 9u);
3021 DALI_TEST_CHECK(boundTextures[2] == 10u);
3024 // Now texture ids have been set, we can monitor their render order.
3025 // render a as an overlay (last), so order will be:
3029 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3030 application.GetGlAbstraction().ClearBoundTextures();
3032 application.SendNotification();
3033 application.Render(1);
3035 // Should be 3 texture changes.
3036 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3037 if(boundTextures.size() == 3)
3039 DALI_TEST_CHECK(boundTextures[0] == 9u);
3040 DALI_TEST_CHECK(boundTextures[1] == 10u);
3041 DALI_TEST_CHECK(boundTextures[2] == 8u);
3046 int UtcDaliActorGetCurrentWorldMatrix(void)
3048 TestApplication application;
3049 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3051 Actor parent = Actor::New();
3052 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3053 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3054 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3055 Radian rotationAngle(Degree(85.0f));
3056 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3057 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3058 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3059 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3060 parent.SetProperty(Actor::Property::SCALE, parentScale);
3061 application.GetScene().Add(parent);
3063 Actor child = Actor::New();
3064 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3065 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3066 Radian childRotationAngle(Degree(23.0f));
3067 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3068 Vector3 childScale(2.0f, 2.0f, 2.0f);
3069 child.SetProperty(Actor::Property::POSITION, childPosition);
3070 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3071 child.SetProperty(Actor::Property::SCALE, childScale);
3074 application.SendNotification();
3075 application.Render(0);
3076 application.Render();
3077 application.SendNotification();
3079 Matrix parentMatrix(false);
3080 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3082 Matrix childMatrix(false);
3083 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3085 //Child matrix should be the composition of child and parent
3086 Matrix childWorldMatrix(false);
3087 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3089 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3090 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3094 int UtcDaliActorConstrainedToWorldMatrix(void)
3096 TestApplication application;
3097 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3099 Actor parent = Actor::New();
3100 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3101 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3102 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3103 Radian rotationAngle(Degree(85.0f));
3104 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3105 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3106 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3107 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3108 parent.SetProperty(Actor::Property::SCALE, parentScale);
3109 application.GetScene().Add(parent);
3111 Actor child = Actor::New();
3112 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3113 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3114 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3115 posConstraint.Apply();
3117 application.GetScene().Add(child);
3119 application.SendNotification();
3120 application.Render(0);
3121 application.Render();
3122 application.SendNotification();
3124 Matrix parentMatrix(false);
3125 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3127 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3128 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3132 int UtcDaliActorConstrainedToOrientation(void)
3134 TestApplication application;
3135 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3137 Actor parent = Actor::New();
3138 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3139 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3140 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3141 Radian rotationAngle(Degree(85.0f));
3142 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3143 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3144 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3145 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3146 parent.SetProperty(Actor::Property::SCALE, parentScale);
3147 application.GetScene().Add(parent);
3149 Actor child = Actor::New();
3150 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3151 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3152 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3153 posConstraint.Apply();
3155 application.GetScene().Add(child);
3157 application.SendNotification();
3158 application.Render(0);
3159 application.Render();
3160 application.SendNotification();
3162 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3166 int UtcDaliActorConstrainedToOpacity(void)
3168 TestApplication application;
3169 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3171 Actor parent = Actor::New();
3172 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3173 application.GetScene().Add(parent);
3175 Actor child = Actor::New();
3176 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3177 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3178 opacityConstraint.Apply();
3180 application.GetScene().Add(child);
3182 application.SendNotification();
3183 application.Render(0);
3184 application.Render();
3185 application.SendNotification();
3187 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3189 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3191 application.SendNotification();
3192 application.Render(0);
3193 application.Render();
3194 application.SendNotification();
3196 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3201 int UtcDaliActorUnparent(void)
3203 TestApplication application;
3204 tet_infoline(" UtcDaliActorUnparent");
3206 Actor parent = Actor::New();
3207 application.GetScene().Add(parent);
3209 Actor child = Actor::New();
3211 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3212 DALI_TEST_CHECK(!child.GetParent());
3214 // Test that calling Unparent with no parent is a NOOP
3217 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3218 DALI_TEST_CHECK(!child.GetParent());
3220 // Test that Unparent works
3223 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3224 DALI_TEST_CHECK(parent == child.GetParent());
3228 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3229 DALI_TEST_CHECK(!child.GetParent());
3231 // Test that UnparentAndReset works
3234 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3235 DALI_TEST_CHECK(parent == child.GetParent());
3237 UnparentAndReset(child);
3239 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3240 DALI_TEST_CHECK(!child);
3242 // Test that UnparentAndReset is a NOOP with empty handle
3243 UnparentAndReset(child);
3245 DALI_TEST_CHECK(!child);
3249 int UtcDaliActorGetChildAt(void)
3251 TestApplication application;
3252 tet_infoline(" UtcDaliActorGetChildAt");
3254 Actor parent = Actor::New();
3255 application.GetScene().Add(parent);
3257 Actor child0 = Actor::New();
3260 Actor child1 = Actor::New();
3263 Actor child2 = Actor::New();
3266 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3267 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3268 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3272 int UtcDaliActorSetGetOverlay(void)
3274 TestApplication application;
3275 tet_infoline(" UtcDaliActorSetGetOverlay");
3277 Actor parent = Actor::New();
3278 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3279 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3283 int UtcDaliActorCreateDestroy(void)
3285 Actor* actor = new Actor;
3286 DALI_TEST_CHECK(actor);
3293 struct PropertyStringIndex
3295 const char* const name;
3296 const Property::Index index;
3297 const Property::Type type;
3300 const PropertyStringIndex PROPERTY_TABLE[] =
3302 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3303 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3304 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3305 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3306 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3307 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3308 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3309 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3310 {"size", Actor::Property::SIZE, Property::VECTOR3},
3311 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3312 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3313 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3314 {"position", Actor::Property::POSITION, Property::VECTOR3},
3315 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3316 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3317 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3318 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3319 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3320 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
3321 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
3322 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
3323 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
3324 {"scale", Actor::Property::SCALE, Property::VECTOR3},
3325 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
3326 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
3327 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
3328 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
3329 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
3330 {"color", Actor::Property::COLOR, Property::VECTOR4},
3331 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
3332 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
3333 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
3334 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
3335 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
3336 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
3337 {"name", Actor::Property::NAME, Property::STRING},
3338 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
3339 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
3340 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
3341 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
3342 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
3343 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
3344 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
3345 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
3346 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
3347 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
3348 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
3349 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
3350 {"padding", Actor::Property::PADDING, Property::VECTOR4},
3351 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
3352 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
3353 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
3354 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
3355 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
3357 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
3358 } // unnamed namespace
3360 int UtcDaliActorProperties(void)
3362 TestApplication application;
3364 Actor actor = Actor::New();
3366 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
3368 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
3369 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
3370 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
3371 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
3376 int UtcDaliRelayoutProperties_ResizePolicies(void)
3378 TestApplication application;
3380 Actor actor = Actor::New();
3383 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3384 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3386 // Set resize policy for all dimensions
3387 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
3388 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3390 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
3393 // Set individual dimensions
3394 const char* const widthPolicy = "FILL_TO_PARENT";
3395 const char* const heightPolicy = "FIXED";
3397 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
3398 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
3400 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
3401 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
3403 // Set individual dimensions using enums
3404 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
3405 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3407 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
3408 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
3410 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
3411 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
3416 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3418 TestApplication application;
3420 Actor actor = Actor::New();
3423 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
3425 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3426 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
3427 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
3430 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
3431 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3433 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
3434 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
3436 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
3437 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
3442 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3444 TestApplication application;
3446 Actor actor = Actor::New();
3449 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3450 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3452 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
3453 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
3454 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
3457 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
3459 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
3460 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
3465 int UtcDaliRelayoutProperties_DimensionDependency(void)
3467 TestApplication application;
3469 Actor actor = Actor::New();
3472 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3473 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
3476 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
3477 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
3479 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
3480 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
3482 // Test setting another resize policy
3483 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
3484 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3489 int UtcDaliRelayoutProperties_Padding(void)
3491 TestApplication application;
3493 Actor actor = Actor::New();
3496 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
3499 actor.SetProperty(Actor::Property::PADDING, padding);
3500 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
3502 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3507 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3509 TestApplication application;
3511 Actor actor = Actor::New();
3514 Vector2 minSize(1.0f, 2.0f);
3516 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
3517 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
3519 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3521 Vector2 maxSize(3.0f, 4.0f);
3523 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
3524 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
3526 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3531 int UtcDaliActorGetHeightForWidth(void)
3533 TestApplication application;
3535 Actor actor = Actor::New();
3537 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
3542 int UtcDaliActorGetWidthForHeight(void)
3544 TestApplication application;
3546 Actor actor = Actor::New();
3548 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
3553 int UtcDaliActorGetRelayoutSize(void)
3555 TestApplication application;
3557 Actor actor = Actor::New();
3559 // Add actor to stage
3560 application.GetScene().Add(actor);
3562 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
3564 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
3565 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
3567 // Flush the queue and render once
3568 application.SendNotification();
3569 application.Render();
3571 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
3576 int UtcDaliActorSetPadding(void)
3578 TestApplication application;
3580 Actor actor = Actor::New();
3583 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3585 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
3586 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
3587 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
3588 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
3590 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
3591 actor.SetProperty(Actor::Property::PADDING, padding2);
3593 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3595 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
3596 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
3597 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
3598 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
3603 int UtcDaliActorSetMinimumSize(void)
3605 TestApplication application;
3607 Actor actor = Actor::New();
3609 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3611 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
3612 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
3614 Vector2 size2(1.0f, 2.0f);
3615 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
3617 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3619 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3620 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3625 int UtcDaliActorSetMaximumSize(void)
3627 TestApplication application;
3629 Actor actor = Actor::New();
3631 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3633 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
3634 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
3636 Vector2 size2(1.0f, 2.0f);
3637 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
3639 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3641 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3642 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3647 int UtcDaliActorOnRelayoutSignal(void)
3649 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3651 TestApplication application;
3654 gOnRelayoutCallBackCalled = false;
3655 gActorNamesRelayout.clear();
3657 Actor actor = Actor::New();
3658 actor.SetProperty(Actor::Property::NAME, "actor");
3659 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
3662 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
3664 // Add actor to stage
3665 application.GetScene().Add(actor);
3667 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
3668 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
3670 // Flush the queue and render once
3671 application.SendNotification();
3672 application.Render();
3674 // OnRelayout emitted
3675 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
3676 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
3681 int UtcDaliActorGetHierachyDepth(void)
3683 TestApplication application;
3684 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3686 /* Build tree of actors:
3696 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3698 Integration::Scene stage(application.GetScene());
3700 Actor actorA = Actor::New();
3701 Actor actorB = Actor::New();
3702 Actor actorC = Actor::New();
3703 Actor actorD = Actor::New();
3704 Actor actorE = Actor::New();
3705 Actor actorF = Actor::New();
3707 //Test that root actor has depth equal 0
3708 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3710 //Test actors return depth -1 when not connected to the tree
3711 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3712 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3713 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3714 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3715 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3716 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3718 //Create the hierarchy
3726 //Test actors return correct depth
3727 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3728 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3729 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3730 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3731 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3732 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3734 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3735 actorA.Remove(actorB);
3737 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3738 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3739 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3741 //Removing actorA from the stage. All actors should have depth equal -1
3742 stage.Remove(actorA);
3744 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3745 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3746 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3747 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3748 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3749 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3754 int UtcDaliActorAnchorPointPropertyAsString(void)
3756 TestApplication application;
3758 Actor actor = Actor::New();
3760 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
3761 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3763 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
3764 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3766 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
3767 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3769 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
3770 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3772 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
3773 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
3775 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
3776 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3778 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
3779 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3781 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
3782 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3784 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
3785 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3787 // Invalid should not change anything
3788 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
3789 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3794 int UtcDaliActorParentOriginPropertyAsString(void)
3796 TestApplication application;
3798 Actor actor = Actor::New();
3800 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
3801 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3803 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
3804 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3806 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
3807 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3809 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
3810 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3812 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
3813 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
3815 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
3816 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3818 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
3819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3821 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
3822 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3824 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
3825 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3827 // Invalid should not change anything
3828 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
3829 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3834 int UtcDaliActorColorModePropertyAsString(void)
3836 TestApplication application;
3838 Actor actor = Actor::New();
3840 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
3841 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3843 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
3844 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3846 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
3847 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3849 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
3850 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3852 // Invalid should not change anything
3853 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
3854 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3859 int UtcDaliActorDrawModePropertyAsString(void)
3861 TestApplication application;
3863 Actor actor = Actor::New();
3865 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
3866 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3868 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
3869 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3871 // Invalid should not change anything
3872 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
3873 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3878 int UtcDaliActorColorModePropertyAsEnum(void)
3880 TestApplication application;
3882 Actor actor = Actor::New();
3884 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
3885 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3887 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
3888 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3890 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
3891 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3893 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
3894 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3899 int UtcDaliActorDrawModePropertyAsEnum(void)
3901 TestApplication application;
3903 Actor actor = Actor::New();
3905 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3906 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3908 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3909 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3914 int UtcDaliActorAddRendererP(void)
3916 tet_infoline("Testing Actor::AddRenderer");
3917 TestApplication application;
3919 Actor actor = Actor::New();
3921 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3923 Geometry geometry = CreateQuadGeometry();
3924 Shader shader = CreateShader();
3925 Renderer renderer = Renderer::New(geometry, shader);
3927 actor.AddRenderer(renderer);
3928 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
3929 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
3934 int UtcDaliActorAddRendererN01(void)
3936 tet_infoline("Testing Actor::AddRenderer");
3937 TestApplication application;
3939 Actor actor = Actor::New();
3945 actor.AddRenderer(renderer);
3946 tet_printf("Assertion test failed - no Exception\n");
3947 tet_result(TET_FAIL);
3949 catch(Dali::DaliException& e)
3951 DALI_TEST_PRINT_ASSERT(e);
3952 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3953 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3957 tet_printf("Assertion test failed - wrong Exception\n");
3958 tet_result(TET_FAIL);
3964 int UtcDaliActorAddRendererN02(void)
3966 tet_infoline("UtcDaliActorAddRendererN02");
3972 TestApplication application;
3974 Geometry geometry = CreateQuadGeometry();
3975 Shader shader = CreateShader();
3976 renderer = Renderer::New(geometry, shader);
3978 actor = Actor::New();
3981 // try illegal AddRenderer
3984 actor.AddRenderer(renderer);
3985 tet_printf("Assertion test failed - no Exception\n");
3986 tet_result(TET_FAIL);
3988 catch(Dali::DaliException& e)
3990 DALI_TEST_PRINT_ASSERT(e);
3991 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
3995 tet_printf("Assertion test failed - wrong Exception\n");
3996 tet_result(TET_FAIL);
4002 int UtcDaliActorAddRendererOnScene(void)
4004 tet_infoline("Testing Actor::AddRenderer");
4005 TestApplication application;
4007 Actor actor = Actor::New();
4008 application.GetScene().Add(actor);
4010 application.SendNotification();
4011 application.Render(0);
4013 Geometry geometry = CreateQuadGeometry();
4014 Shader shader = CreateShader();
4015 Renderer renderer = Renderer::New(geometry, shader);
4017 application.SendNotification();
4018 application.Render(0);
4022 actor.AddRenderer(renderer);
4023 tet_result(TET_PASS);
4027 tet_result(TET_FAIL);
4033 int UtcDaliActorRemoveRendererP1(void)
4035 tet_infoline("Testing Actor::RemoveRenderer");
4036 TestApplication application;
4038 Actor actor = Actor::New();
4040 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4043 Geometry geometry = CreateQuadGeometry();
4044 Shader shader = CreateShader();
4045 Renderer renderer = Renderer::New(geometry, shader);
4047 actor.AddRenderer(renderer);
4048 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4049 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4051 application.SendNotification();
4052 application.Render();
4056 Renderer renderer = actor.GetRendererAt(0);
4057 actor.RemoveRenderer(renderer);
4058 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4060 application.SendNotification();
4061 application.Render();
4064 // Call one final time to ensure that the renderer is actually removed after
4065 // the handle goes out of scope, and excercises the deletion code path in
4066 // scene graph and render.
4067 application.SendNotification();
4068 application.Render();
4073 int UtcDaliActorRemoveRendererP2(void)
4075 tet_infoline("Testing Actor::RemoveRenderer");
4076 TestApplication application;
4078 Actor actor = Actor::New();
4080 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4082 Geometry geometry = CreateQuadGeometry();
4083 Shader shader = CreateShader();
4084 Renderer renderer = Renderer::New(geometry, shader);
4086 actor.AddRenderer(renderer);
4087 application.SendNotification();
4088 application.Render();
4090 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4091 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4093 actor.RemoveRenderer(0);
4094 application.SendNotification();
4095 application.Render();
4097 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4099 // Shut down whilst holding onto the renderer handle.
4103 int UtcDaliActorRemoveRendererN(void)
4105 tet_infoline("Testing Actor::RemoveRenderer");
4106 TestApplication application;
4108 Actor actor = Actor::New();
4110 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4112 Geometry geometry = CreateQuadGeometry();
4113 Shader shader = CreateShader();
4114 Renderer renderer = Renderer::New(geometry, shader);
4116 actor.AddRenderer(renderer);
4117 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4118 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4120 actor.RemoveRenderer(10);
4121 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4122 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4127 // Clipping test helper functions:
4128 Actor CreateActorWithContent(uint32_t width, uint32_t height)
4130 Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
4131 Actor actor = CreateRenderableActor(image);
4133 // Setup dimensions and position so actor is not skipped by culling.
4134 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4135 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
4136 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4137 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4142 Actor CreateActorWithContent16x16()
4144 return CreateActorWithContent(16, 16);
4147 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
4149 enabledDisableTrace.Reset();
4150 stencilTrace.Reset();
4151 enabledDisableTrace.Enable(true);
4152 stencilTrace.Enable(true);
4154 application.SendNotification();
4155 application.Render();
4157 enabledDisableTrace.Enable(false);
4158 stencilTrace.Enable(false);
4161 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
4163 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4165 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
4166 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
4167 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
4168 DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
4171 int UtcDaliActorPropertyClippingP(void)
4173 // This test checks the clippingMode property.
4174 tet_infoline("Testing Actor::Property::ClippingMode: P");
4175 TestApplication application;
4177 Actor actor = Actor::New();
4179 // Check default clippingEnabled value.
4180 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4183 bool getValueResult = getValue.Get(value);
4184 DALI_TEST_CHECK(getValueResult);
4188 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4191 // Check setting the property to the stencil mode.
4192 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4194 // Check the new value was set.
4195 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4196 getValueResult = getValue.Get(value);
4197 DALI_TEST_CHECK(getValueResult);
4201 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4204 // Check setting the property to the scissor mode.
4205 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4207 // Check the new value was set.
4208 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4209 getValueResult = getValue.Get(value);
4210 DALI_TEST_CHECK(getValueResult);
4214 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4219 int UtcDaliActorPropertyClippingN(void)
4221 // Negative test case for Clipping.
4222 tet_infoline("Testing Actor::Property::ClippingMode: N");
4223 TestApplication application;
4225 Actor actor = Actor::New();
4227 // Check default clippingEnabled value.
4228 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4231 bool getValueResult = getValue.Get(value);
4232 DALI_TEST_CHECK(getValueResult);
4236 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4239 // Check setting an invalid property value won't change the current property value.
4240 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4242 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4243 getValueResult = getValue.Get(value);
4244 DALI_TEST_CHECK(getValueResult);
4248 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4254 int UtcDaliActorPropertyClippingActor(void)
4256 // This test checks that an actor is correctly setup for clipping.
4257 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4258 TestApplication application;
4260 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4261 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4262 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4263 size_t startIndex = 0u;
4265 // Create a clipping actor.
4266 Actor actorDepth1Clip = CreateActorWithContent16x16();
4267 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4268 application.GetScene().Add(actorDepth1Clip);
4270 // Gather the call trace.
4271 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4273 // Check we are writing to the color buffer.
4274 CheckColorMask(glAbstraction, true);
4276 // Check the stencil buffer was enabled.
4277 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4279 // Check the stencil buffer was cleared.
4280 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4282 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4283 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4284 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4285 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4290 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4292 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4293 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
4294 TestApplication application;
4296 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4297 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4298 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4299 size_t startIndex = 0u;
4301 // Create a clipping actor.
4302 Actor actorDepth1Clip = CreateActorWithContent16x16();
4303 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4304 application.GetScene().Add(actorDepth1Clip);
4306 // Gather the call trace.
4307 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4309 // Check we are writing to the color buffer.
4310 CheckColorMask(glAbstraction, true);
4312 // Check the stencil buffer was enabled.
4313 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4315 // Check the stencil buffer was cleared.
4316 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4318 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4319 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4320 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4321 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4323 // Now disable the clipping
4324 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4326 // Gather the call trace.
4327 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4329 // Check the stencil buffer was disabled.
4330 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", "2960")); // 2960 is GL_STENCIL_TEST
4332 // Ensure all values in stencil-mask are set to 1.
4334 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
4339 int UtcDaliActorPropertyClippingNestedChildren(void)
4341 // This test checks that a hierarchy of actors are clipped correctly by
4342 // writing to and reading from the correct bit-planes of the stencil buffer.
4343 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
4344 TestApplication application;
4345 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4346 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4347 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4349 // Create a clipping actor.
4350 Actor actorDepth1Clip = CreateActorWithContent16x16();
4351 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4352 application.GetScene().Add(actorDepth1Clip);
4354 // Create a child actor.
4355 Actor childDepth2 = CreateActorWithContent16x16();
4356 actorDepth1Clip.Add(childDepth2);
4358 // Create another clipping actor.
4359 Actor childDepth2Clip = CreateActorWithContent16x16();
4360 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4361 childDepth2.Add(childDepth2Clip);
4363 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4364 // This tests the sort algorithm.
4365 Actor childDepth3 = CreateActorWithContent16x16();
4366 childDepth2Clip.Add(childDepth3);
4367 Actor childDepth4 = CreateActorWithContent16x16();
4368 childDepth3.Add(childDepth4);
4370 // Gather the call trace.
4371 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4373 // Check we are writing to the color buffer.
4374 CheckColorMask(glAbstraction, true);
4376 // Check the stencil buffer was enabled.
4377 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4379 // Perform the test twice, once for 2D layer, and once for 3D.
4380 for(unsigned int i = 0u; i < 2u; ++i)
4382 size_t startIndex = 0u;
4384 // Check the stencil buffer was cleared.
4385 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4387 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4388 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4389 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
4390 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4392 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4393 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 255", startIndex)); // 514 is GL_EQUAL
4394 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4396 // Check we are set up to write to the second bitplane of the stencil buffer (only).
4397 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4398 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
4399 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4401 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4402 // (Both must be set to pass the check).
4403 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 255", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4404 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4406 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4409 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
4410 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4417 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4419 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4420 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
4421 TestApplication application;
4422 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4423 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4425 /* We create a small tree of actors as follows:
4429 Clipping enabled -> B D
4433 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4436 for(int i = 0; i < 5; ++i)
4438 Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
4439 Actor actor = CreateRenderableActor(image);
4441 // Setup dimensions and position so actor is not skipped by culling.
4442 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4443 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
4447 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4451 float b = i > 2 ? 1.0f : -1.0f;
4452 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
4458 // Enable clipping on the actor at the top of the left branch.
4459 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4461 // Build the scene graph.
4462 application.GetScene().Add(actors[0]);
4465 actors[0].Add(actors[1]);
4466 actors[1].Add(actors[2]);
4469 actors[0].Add(actors[3]);
4470 actors[3].Add(actors[4]);
4472 // Gather the call trace.
4473 enabledDisableTrace.Reset();
4474 enabledDisableTrace.Enable(true);
4475 application.SendNotification();
4476 application.Render();
4477 enabledDisableTrace.Enable(false);
4479 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4481 Note: Correct enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960 StackTrace: Index:2, Function:Disable, ParamList:2960
4482 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4484 size_t startIndex = 0u;
4485 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "3042", startIndex));
4486 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex)); // 2960 is GL_STENCIL_TEST
4487 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
4489 // Swap the clipping actor from top of left branch to top of right branch.
4490 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4491 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4493 // Gather the call trace.
4494 enabledDisableTrace.Reset();
4495 enabledDisableTrace.Enable(true);
4496 application.SendNotification();
4497 application.Render();
4498 enabledDisableTrace.Enable(false);
4500 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4501 // This proves the draw order has remained the same.
4503 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex));
4504 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
4509 int UtcDaliActorPropertyScissorClippingActor(void)
4511 // This test checks that an actor is correctly setup for clipping.
4512 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
4513 TestApplication application;
4515 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4516 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4517 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4519 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4520 const Vector2 imageSize(16.0f, 16.0f);
4522 // Create a clipping actor.
4523 Actor clippingActorA = CreateActorWithContent16x16();
4524 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4525 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4526 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4527 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4528 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4529 application.GetScene().Add(clippingActorA);
4531 // Gather the call trace.
4532 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4534 // Check we are writing to the color buffer.
4535 CheckColorMask(glAbstraction, true);
4537 // Check scissor test was enabled.
4538 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4540 // Check the scissor was set, and the coordinates are correct.
4541 std::stringstream compareParametersString;
4542 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4543 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4545 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4546 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4548 // Gather the call trace.
4549 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4551 // Check the scissor was set, and the coordinates are correct.
4552 compareParametersString.str(std::string());
4553 compareParametersString.clear();
4554 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
4555 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4560 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4562 // This test checks that an actor is correctly setup for clipping.
4563 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
4564 TestApplication application;
4566 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4567 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4568 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4570 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4571 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4572 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4574 // Create a clipping actors.
4575 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4576 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4578 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4579 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4580 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4582 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4583 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4584 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4586 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4587 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4589 application.GetScene().Add(clippingActorA);
4590 application.GetScene().Add(clippingActorB);
4592 // Gather the call trace.
4593 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4595 // Check we are writing to the color buffer.
4596 CheckColorMask(glAbstraction, true);
4598 // Check scissor test was enabled.
4599 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4601 // Check the scissor was set, and the coordinates are correct.
4602 std::stringstream compareParametersString;
4604 std::string clipA("0, 500, 480, 200");
4605 std::string clipB("0, 380, 480, 40");
4607 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4608 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4613 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4615 // This test checks that an actor is correctly setup for clipping.
4616 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4617 TestApplication application;
4619 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4620 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4621 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4623 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4624 const Vector2 imageSize(16.0f, 16.0f);
4626 /* Create a nest of 2 scissors to test nesting (intersecting clips).
4628 A is drawn first - with scissor clipping on
4629 B is drawn second - also with scissor clipping on
4630 C is the generated clipping region, the intersection ( A ∩ B )
4634 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
4635 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
4636 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
4640 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4643 // Create a clipping actor.
4644 Actor clippingActorA = CreateActorWithContent16x16();
4645 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4646 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4647 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4648 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4649 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4650 application.GetScene().Add(clippingActorA);
4652 // Create a child clipping actor.
4653 Actor clippingActorB = CreateActorWithContent16x16();
4654 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4655 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4656 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4657 clippingActorA.Add(clippingActorB);
4659 // positionModifiers is an array of positions to position B around.
4660 // expect is an array of expected scissor clip coordinate results.
4661 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
4662 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
4664 // Loop through each overlap combination.
4665 for(unsigned int test = 0u; test < 4u; ++test)
4667 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4668 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
4669 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
4671 // Gather the call trace.
4672 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4674 // Check we are writing to the color buffer.
4675 CheckColorMask(glAbstraction, true);
4677 // Check scissor test was enabled.
4678 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4680 // Check the scissor was set, and the coordinates are correct.
4681 const Vector4& expectResults(expect[test]);
4682 std::stringstream compareParametersString;
4683 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4684 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
4690 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4692 // This test checks that an actor is correctly setup for clipping.
4693 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4694 TestApplication application;
4696 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4697 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4698 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4700 /* Create a nest of 2 scissors and siblings of the parent.
4710 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4711 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4712 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4713 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
4714 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
4715 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
4717 // Create a clipping actors.
4718 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4719 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4720 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
4721 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
4722 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
4724 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4725 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4726 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4728 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4729 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4730 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4732 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4733 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4734 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4736 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4737 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4738 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4740 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4741 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4743 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4744 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4745 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
4746 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4747 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4749 application.GetScene().Add(clippingActorA);
4750 clippingActorA.Add(clippingActorB);
4751 application.GetScene().Add(clippingActorC);
4752 application.GetScene().Add(clippingActorD);
4753 clippingActorD.Add(clippingActorE);
4755 // Gather the call trace.
4756 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4758 // Check we are writing to the color buffer.
4759 CheckColorMask(glAbstraction, true);
4761 // Check scissor test was enabled.
4762 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4764 // Check the scissor was set, and the coordinates are correct.
4765 std::string clipA("0, 500, 480, 200");
4766 std::string clipB("0, 580, 480, 40");
4767 std::string clipC("0, 200, 480, 200");
4768 std::string clipD("0, 300, 480, 200");
4770 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4771 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4772 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
4773 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
4774 DALI_TEST_CHECK(scissorTrace.CountMethod("Scissor") == 4); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4779 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4781 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4782 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
4783 TestApplication application;
4785 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4786 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4787 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4789 // Create a clipping actor.
4790 Actor actorDepth1Clip = CreateActorWithContent16x16();
4791 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4792 application.GetScene().Add(actorDepth1Clip);
4794 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4795 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
4797 // Gather the call trace.
4798 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4800 // Check we are writing to the color buffer.
4801 CheckColorMask(glAbstraction, true);
4803 // Check the stencil buffer was not enabled.
4804 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
4806 // Check stencil functions are not called.
4807 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
4808 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask"));
4809 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
4811 // Check that scissor clipping is overriden by the renderer properties.
4812 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4814 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4816 // Gather the call trace.
4817 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4819 // Check the stencil buffer was not enabled.
4820 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4822 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
4827 int UtcDaliGetPropertyN(void)
4829 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
4830 TestApplication application;
4832 Actor actor = Actor::New();
4834 unsigned int propertyCount = actor.GetPropertyCount();
4835 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
4839 int UtcDaliActorRaiseLower(void)
4841 tet_infoline("UtcDaliActor Raise and Lower test\n");
4843 TestApplication application;
4845 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
4847 Integration::Scene stage(application.GetScene());
4849 Actor actorA = Actor::New();
4850 Actor actorB = Actor::New();
4851 Actor actorC = Actor::New();
4853 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4854 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4856 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4857 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4859 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4860 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4862 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4863 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4865 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4866 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4868 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
4869 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
4875 ResetTouchCallbacks();
4877 application.SendNotification();
4878 application.Render();
4880 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4881 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4882 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
4884 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4885 // Only top actor will get touched.
4886 actorA.TouchedSignal().Connect(TestTouchCallback);
4887 actorB.TouchedSignal().Connect(TestTouchCallback2);
4888 actorC.TouchedSignal().Connect(TestTouchCallback3);
4890 // Connect ChildOrderChangedSignal
4891 bool orderChangedSignal(false);
4892 Actor orderChangedActor;
4893 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
4894 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
4896 Dali::Integration::Point point;
4897 point.SetDeviceId(1);
4898 point.SetState(PointState::DOWN);
4899 point.SetScreenPosition(Vector2(10.f, 10.f));
4900 Dali::Integration::TouchEvent touchEvent;
4901 touchEvent.AddPoint(point);
4903 application.ProcessEvent(touchEvent);
4905 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4906 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4907 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
4909 ResetTouchCallbacks();
4911 tet_printf("Testing Raising of Actor\n");
4913 int preActorOrder(0);
4914 int postActorOrder(0);
4916 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4917 value.Get(preActorOrder);
4919 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
4921 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
4922 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
4924 // Ensure sort order is calculated before next touch event
4925 application.SendNotification();
4927 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4928 value.Get(postActorOrder);
4930 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
4932 application.ProcessEvent(touchEvent);
4934 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4935 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
4936 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
4938 ResetTouchCallbacks();
4940 tet_printf("Testing Lowering of Actor\n");
4942 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4943 value.Get(preActorOrder);
4945 orderChangedSignal = false;
4947 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
4949 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
4950 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
4952 application.SendNotification(); // ensure sort order calculated before next touch event
4954 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
4955 value.Get(postActorOrder);
4957 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
4959 application.ProcessEvent(touchEvent);
4961 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
4962 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
4963 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
4965 ResetTouchCallbacks();
4967 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
4972 int UtcDaliActorRaiseToTopLowerToBottom(void)
4974 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
4976 TestApplication application;
4978 Integration::Scene stage(application.GetScene());
4980 Actor actorA = Actor::New();
4981 Actor actorB = Actor::New();
4982 Actor actorC = Actor::New();
4984 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
4985 // enables checking of which actor the uniform is assigned too
4986 Shader shaderA = CreateShader();
4987 shaderA.RegisterProperty("uRendererColor", 1.f);
4989 Shader shaderB = CreateShader();
4990 shaderB.RegisterProperty("uRendererColor", 2.f);
4992 Shader shaderC = CreateShader();
4993 shaderC.RegisterProperty("uRendererColor", 3.f);
4995 Geometry geometry = CreateQuadGeometry();
4997 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
4998 Renderer rendererA = Renderer::New(geometry, shaderA);
4999 actorA.AddRenderer(rendererA);
5001 Renderer rendererB = Renderer::New(geometry, shaderB);
5002 actorB.AddRenderer(rendererB);
5004 Renderer rendererC = Renderer::New(geometry, shaderC);
5005 actorC.AddRenderer(rendererC);
5007 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5008 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5010 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5011 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5013 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5014 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5016 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5017 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5019 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5020 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5022 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5023 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5029 ResetTouchCallbacks();
5031 // Connect ChildOrderChangedSignal
5032 bool orderChangedSignal(false);
5033 Actor orderChangedActor;
5034 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5035 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5037 // Set up gl abstraction trace so can query the set uniform order
5038 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5039 glAbstraction.EnableSetUniformCallTrace(true);
5040 glAbstraction.ResetSetUniformCallStack();
5042 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5044 application.SendNotification();
5045 application.Render();
5047 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
5049 // Test order of uniforms in stack
5050 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5051 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5052 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5054 bool CBA = (indexC > indexB) && (indexB > indexA);
5056 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5058 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5059 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5060 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5062 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5063 // Only top actor will get touched.
5064 actorA.TouchedSignal().Connect(TestTouchCallback);
5065 actorB.TouchedSignal().Connect(TestTouchCallback2);
5066 actorC.TouchedSignal().Connect(TestTouchCallback3);
5068 Dali::Integration::Point point;
5069 point.SetDeviceId(1);
5070 point.SetState(PointState::DOWN);
5071 point.SetScreenPosition(Vector2(10.f, 10.f));
5072 Dali::Integration::TouchEvent touchEvent;
5073 touchEvent.AddPoint(point);
5075 application.ProcessEvent(touchEvent);
5077 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5078 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5079 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5081 ResetTouchCallbacks();
5083 tet_printf("RaiseToTop ActorA\n");
5085 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5086 actorA.RaiseToTop();
5087 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5088 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5090 application.SendNotification(); // ensure sorting order is calculated before next touch event
5092 application.ProcessEvent(touchEvent);
5094 glAbstraction.ResetSetUniformCallStack();
5095 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5097 application.SendNotification();
5098 application.Render();
5100 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5102 // Test order of uniforms in stack
5103 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5104 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5105 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5107 tet_infoline("Testing A above C and B at bottom\n");
5108 bool ACB = (indexA > indexC) && (indexC > indexB);
5110 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
5112 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5113 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5114 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5116 ResetTouchCallbacks();
5118 tet_printf("RaiseToTop ActorB\n");
5120 orderChangedSignal = false;
5122 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5123 actorB.RaiseToTop();
5124 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5125 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5127 application.SendNotification(); // Ensure sort order is calculated before next touch event
5129 application.ProcessEvent(touchEvent);
5131 glAbstraction.ResetSetUniformCallStack();
5132 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5134 application.SendNotification();
5135 application.Render();
5137 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5139 // Test order of uniforms in stack
5140 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5141 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5142 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5144 tet_infoline("Testing B above A and C at bottom\n");
5145 bool BAC = (indexB > indexA) && (indexA > indexC);
5147 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
5149 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5150 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5151 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5153 ResetTouchCallbacks();
5155 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
5157 orderChangedSignal = false;
5159 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5160 actorA.LowerToBottom();
5161 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5162 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5164 application.SendNotification();
5165 application.Render();
5167 orderChangedSignal = false;
5169 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5170 actorB.LowerToBottom();
5171 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5172 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5174 application.SendNotification();
5175 application.Render();
5177 application.ProcessEvent(touchEvent);
5179 glAbstraction.ResetSetUniformCallStack();
5180 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5182 application.SendNotification();
5183 application.Render();
5185 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5187 // Test order of uniforms in stack
5188 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5189 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5190 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5192 tet_infoline("Testing C above A and B at bottom\n");
5193 bool CAB = (indexC > indexA) && (indexA > indexB);
5195 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
5197 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5198 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5199 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5201 ResetTouchCallbacks();
5206 int UtcDaliActorRaiseAbove(void)
5208 tet_infoline("UtcDaliActor RaiseToAbove test \n");
5210 TestApplication application;
5212 Integration::Scene stage(application.GetScene());
5214 Actor actorA = Actor::New();
5215 Actor actorB = Actor::New();
5216 Actor actorC = Actor::New();
5218 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5219 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5221 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5222 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5224 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5225 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5227 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5228 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5230 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5231 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5233 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5234 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5240 ResetTouchCallbacks();
5242 application.SendNotification();
5243 application.Render();
5245 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5246 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5247 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5249 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5250 // Only top actor will get touched.
5251 actorA.TouchedSignal().Connect(TestTouchCallback);
5252 actorB.TouchedSignal().Connect(TestTouchCallback2);
5253 actorC.TouchedSignal().Connect(TestTouchCallback3);
5255 bool orderChangedSignal(false);
5256 Actor orderChangedActor;
5257 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5258 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5260 Dali::Integration::Point point;
5261 point.SetDeviceId(1);
5262 point.SetState(PointState::DOWN);
5263 point.SetScreenPosition(Vector2(10.f, 10.f));
5264 Dali::Integration::TouchEvent touchEvent;
5265 touchEvent.AddPoint(point);
5267 application.ProcessEvent(touchEvent);
5269 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5270 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5271 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5273 ResetTouchCallbacks();
5275 tet_printf("Raise actor B Above Actor C\n");
5277 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5278 actorB.RaiseAbove(actorC);
5279 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5280 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5282 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5283 application.SendNotification();
5284 application.ProcessEvent(touchEvent);
5286 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5287 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5288 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5290 ResetTouchCallbacks();
5292 tet_printf("Raise actor A Above Actor B\n");
5294 orderChangedSignal = false;
5296 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5297 actorA.RaiseAbove(actorB);
5298 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5299 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5301 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5302 application.SendNotification();
5304 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5306 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5307 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5308 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5310 ResetTouchCallbacks();
5315 int UtcDaliActorLowerBelow(void)
5317 tet_infoline("UtcDaliActor LowerBelow test \n");
5319 TestApplication application;
5321 Integration::Scene stage(application.GetScene());
5323 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5324 // enables checking of which actor the uniform is assigned too
5325 Shader shaderA = CreateShader();
5326 shaderA.RegisterProperty("uRendererColor", 1.f);
5328 Shader shaderB = CreateShader();
5329 shaderB.RegisterProperty("uRendererColor", 2.f);
5331 Shader shaderC = CreateShader();
5332 shaderC.RegisterProperty("uRendererColor", 3.f);
5334 Actor actorA = Actor::New();
5335 Actor actorB = Actor::New();
5336 Actor actorC = Actor::New();
5338 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5339 Geometry geometry = CreateQuadGeometry();
5341 Renderer rendererA = Renderer::New(geometry, shaderA);
5342 actorA.AddRenderer(rendererA);
5344 Renderer rendererB = Renderer::New(geometry, shaderB);
5345 actorB.AddRenderer(rendererB);
5347 Renderer rendererC = Renderer::New(geometry, shaderC);
5348 actorC.AddRenderer(rendererC);
5350 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5351 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5353 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5354 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5356 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5357 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5359 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5360 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5362 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5363 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5365 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5366 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5368 Actor container = Actor::New();
5369 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5370 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5371 stage.Add(container);
5373 container.Add(actorA);
5374 container.Add(actorB);
5375 container.Add(actorC);
5377 ResetTouchCallbacks();
5379 // Connect ChildOrderChangedSignal
5380 bool orderChangedSignal(false);
5381 Actor orderChangedActor;
5382 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5383 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5385 // Set up gl abstraction trace so can query the set uniform order
5386 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5387 glAbstraction.EnableSetUniformCallTrace(true);
5388 glAbstraction.ResetSetUniformCallStack();
5389 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5391 glAbstraction.ResetSetUniformCallStack();
5393 application.SendNotification();
5394 application.Render();
5396 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5398 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5400 // Test order of uniforms in stack
5401 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5402 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5403 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5405 tet_infoline("Testing C above B and A at bottom\n");
5406 bool CBA = (indexC > indexB) && (indexB > indexA);
5408 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5410 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5411 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5412 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5414 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5415 // Only top actor will get touched.
5416 actorA.TouchedSignal().Connect(TestTouchCallback);
5417 actorB.TouchedSignal().Connect(TestTouchCallback2);
5418 actorC.TouchedSignal().Connect(TestTouchCallback3);
5420 Dali::Integration::Point point;
5421 point.SetDeviceId(1);
5422 point.SetState(PointState::DOWN);
5423 point.SetScreenPosition(Vector2(10.f, 10.f));
5424 Dali::Integration::TouchEvent touchEvent;
5425 touchEvent.AddPoint(point);
5427 tet_infoline("UtcDaliActor Test Set up completed \n");
5429 application.ProcessEvent(touchEvent);
5431 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5432 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5433 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5435 ResetTouchCallbacks();
5437 tet_printf("Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n");
5439 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5440 actorC.LowerBelow(actorB);
5441 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5442 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5444 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5445 application.SendNotification();
5446 application.Render();
5448 application.ProcessEvent(touchEvent); // touch event
5450 glAbstraction.ResetSetUniformCallStack();
5451 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5453 application.SendNotification();
5454 application.Render();
5456 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5458 // Test order of uniforms in stack
5459 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5460 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5461 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5463 tet_infoline("Testing render order is A, C, B");
5464 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5465 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5467 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5468 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5469 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5471 ResetTouchCallbacks();
5473 tet_printf("Lower actor C below Actor A leaving B on top\n");
5475 orderChangedSignal = false;
5477 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5478 actorC.LowerBelow(actorA);
5479 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5480 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5482 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5483 application.SendNotification();
5484 application.Render();
5486 application.ProcessEvent(touchEvent);
5488 glAbstraction.ResetSetUniformCallStack();
5489 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5491 application.Render();
5492 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5494 // Test order of uniforms in stack
5495 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5496 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5497 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5499 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5500 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5502 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5503 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5504 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5506 ResetTouchCallbacks();
5508 tet_printf("Lower actor B below Actor C leaving A on top\n");
5510 orderChangedSignal = false;
5512 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5513 actorB.LowerBelow(actorC);
5514 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5515 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5517 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5518 application.SendNotification();
5519 application.Render();
5521 application.ProcessEvent(touchEvent);
5523 glAbstraction.ResetSetUniformCallStack();
5524 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5526 application.Render();
5527 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5529 // Test order of uniforms in stack
5530 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
5531 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
5532 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
5534 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5535 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5540 int UtcDaliActorRaiseAboveDifferentParentsN(void)
5542 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
5544 TestApplication application;
5546 Integration::Scene stage(application.GetScene());
5548 Actor parentA = Actor::New();
5549 Actor parentB = Actor::New();
5550 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5551 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5552 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5553 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5555 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5556 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5558 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5559 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5564 Actor actorA = Actor::New();
5565 Actor actorB = Actor::New();
5566 Actor actorC = Actor::New();
5568 parentA.Add(actorA);
5569 parentA.Add(actorB);
5571 tet_printf("Actor C added to different parent from A and B \n");
5572 parentB.Add(actorC);
5574 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5575 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5577 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5578 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5580 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5581 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5583 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5584 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5586 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5587 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5589 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5590 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5592 ResetTouchCallbacks();
5594 // Connect ChildOrderChangedSignal
5595 bool orderChangedSignal(false);
5596 Actor orderChangedActor;
5597 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5598 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5600 application.SendNotification();
5601 application.Render();
5603 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5604 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5605 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5607 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5608 // Only top actor will get touched.
5609 actorA.TouchedSignal().Connect(TestTouchCallback);
5610 actorB.TouchedSignal().Connect(TestTouchCallback2);
5611 actorC.TouchedSignal().Connect(TestTouchCallback3);
5613 Dali::Integration::Point point;
5614 point.SetDeviceId(1);
5615 point.SetState(PointState::DOWN);
5616 point.SetScreenPosition(Vector2(10.f, 10.f));
5617 Dali::Integration::TouchEvent touchEvent;
5618 touchEvent.AddPoint(point);
5620 application.ProcessEvent(touchEvent);
5622 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5623 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5624 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5626 ResetTouchCallbacks();
5628 tet_printf("Raise actor A Above Actor C which have different parents\n");
5630 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5631 actorA.RaiseAbove(actorC);
5632 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5634 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5635 application.SendNotification();
5637 application.ProcessEvent(touchEvent); // touch event
5639 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5640 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5641 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5643 ResetTouchCallbacks();
5648 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
5650 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
5652 TestApplication application;
5654 Integration::Scene stage(application.GetScene());
5656 Actor actorA = Actor::New();
5657 Actor actorB = Actor::New();
5658 Actor actorC = Actor::New();
5660 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5661 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5663 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5664 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5666 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5667 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5669 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5670 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5672 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5673 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5675 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5676 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5678 ResetTouchCallbacks();
5680 // Connect ChildOrderChangedSignal
5681 bool orderChangedSignal(false);
5682 Actor orderChangedActor;
5683 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5684 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5686 application.SendNotification();
5687 application.Render();
5689 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5690 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5691 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5693 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5694 // Only top actor will get touched.
5695 actorA.TouchedSignal().Connect(TestTouchCallback);
5696 actorB.TouchedSignal().Connect(TestTouchCallback2);
5697 actorC.TouchedSignal().Connect(TestTouchCallback3);
5699 Dali::Integration::Point point;
5700 point.SetDeviceId(1);
5701 point.SetState(PointState::DOWN);
5702 point.SetScreenPosition(Vector2(10.f, 10.f));
5703 Dali::Integration::TouchEvent touchEvent;
5704 touchEvent.AddPoint(point);
5706 tet_printf("Raise actor A Above Actor C which have no parents\n");
5708 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5709 actorA.RaiseAbove(actorC);
5710 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5712 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5713 application.SendNotification();
5715 application.ProcessEvent(touchEvent);
5717 tet_printf("Not parented so RaiseAbove should show no effect\n");
5719 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5720 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5721 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5723 ResetTouchCallbacks();
5725 orderChangedSignal = false;
5728 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
5730 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5731 actorA.LowerBelow(actorC);
5732 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5734 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5735 application.SendNotification();
5736 application.Render();
5738 application.ProcessEvent(touchEvent);
5740 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
5741 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5742 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5743 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5745 ResetTouchCallbacks();
5747 orderChangedSignal = false;
5749 tet_printf("Adding Actor A to stage, will be on top\n");
5752 application.SendNotification();
5753 application.Render();
5755 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
5757 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5758 actorB.RaiseAbove(actorC);
5759 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5761 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5762 application.SendNotification();
5764 application.ProcessEvent(touchEvent);
5766 tet_printf("C not parented so RaiseAbove should show no effect\n");
5767 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5768 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5769 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5771 ResetTouchCallbacks();
5773 orderChangedSignal = false;
5775 tet_printf("Lower actor A below Actor C when only A has a parent\n");
5777 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5778 actorA.LowerBelow(actorC);
5779 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5781 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5782 application.SendNotification();
5784 application.ProcessEvent(touchEvent);
5786 tet_printf("C not parented so LowerBelow should show no effect\n");
5787 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5788 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5789 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5791 ResetTouchCallbacks();
5793 orderChangedSignal = false;
5797 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5798 actorA.RaiseAbove(actorC);
5799 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5800 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5802 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5803 application.SendNotification();
5804 application.Render();
5806 application.ProcessEvent(touchEvent);
5808 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
5809 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5810 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5811 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5816 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
5818 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
5820 TestApplication application;
5822 Integration::Scene stage(application.GetScene());
5824 Actor actorA = Actor::New();
5825 Actor actorB = Actor::New();
5826 Actor actorC = Actor::New();
5828 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5829 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5831 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5832 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5834 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5835 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5837 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5838 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5840 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5841 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5843 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5844 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5846 ResetTouchCallbacks();
5848 // Connect ChildOrderChangedSignal
5849 bool orderChangedSignal(false);
5850 Actor orderChangedActor;
5851 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5852 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5854 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5855 // Only top actor will get touched.
5856 actorA.TouchedSignal().Connect(TestTouchCallback);
5857 actorB.TouchedSignal().Connect(TestTouchCallback2);
5858 actorC.TouchedSignal().Connect(TestTouchCallback3);
5860 Dali::Integration::Point point;
5861 point.SetDeviceId(1);
5862 point.SetState(PointState::DOWN);
5863 point.SetScreenPosition(Vector2(10.f, 10.f));
5864 Dali::Integration::TouchEvent touchEvent;
5865 touchEvent.AddPoint(point);
5868 tet_printf("Raise actor B Above Actor C but B not parented\n");
5870 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5872 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5874 application.SendNotification();
5875 application.Render();
5877 application.ProcessEvent(touchEvent);
5879 tet_printf("Not parented so RaiseAbove should show no effect\n");
5881 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5882 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5883 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5885 tet_printf("Raise actor B Above Actor C but B not parented\n");
5886 ResetTouchCallbacks();
5888 orderChangedSignal = false;
5890 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5892 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5894 // Sort actor tree before next touch event
5895 application.SendNotification();
5896 application.Render();
5898 application.ProcessEvent(touchEvent);
5900 tet_printf("Not parented so RaiseAbove should show no effect\n");
5902 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5903 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5904 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5905 ResetTouchCallbacks();
5907 orderChangedSignal = false;
5909 tet_printf("Lower actor C below B but C not parented\n");
5911 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5913 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5915 // Sort actor tree before next touch event
5916 application.SendNotification();
5917 application.Render();
5919 application.ProcessEvent(touchEvent);
5921 tet_printf("Not parented so Lower should show no effect\n");
5923 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5924 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5925 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5926 ResetTouchCallbacks();
5928 orderChangedSignal = false;
5930 tet_printf("Raise actor B to top\n");
5932 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5933 actorB.RaiseToTop();
5934 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5936 // Sort actor tree before next touch event
5937 application.SendNotification();
5938 application.Render();
5940 application.ProcessEvent(touchEvent);
5942 tet_printf("Not parented so RaiseToTop should show no effect\n");
5944 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5945 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5946 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5947 ResetTouchCallbacks();
5949 orderChangedSignal = false;
5951 tet_printf("Add ActorB to stage so only Actor C not parented\n");
5955 tet_printf("Lower actor C to Bottom, B stays at top\n");
5957 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5958 actorC.LowerToBottom();
5959 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5961 application.SendNotification();
5962 application.Render();
5964 application.ProcessEvent(touchEvent);
5966 tet_printf("Not parented so LowerToBottom should show no effect\n");
5968 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5969 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5970 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5971 ResetTouchCallbacks();
5976 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
5978 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
5980 TestApplication application;
5982 Integration::Scene stage(application.GetScene());
5984 Actor actorA = Actor::New();
5985 Actor actorB = Actor::New();
5986 Actor actorC = Actor::New();
5988 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5989 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5991 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5992 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5994 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5995 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5997 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5998 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6000 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6001 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6003 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6004 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6010 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6011 // Only top actor will get touched.
6012 actorA.TouchedSignal().Connect(TestTouchCallback);
6013 actorB.TouchedSignal().Connect(TestTouchCallback2);
6014 actorC.TouchedSignal().Connect(TestTouchCallback3);
6016 ResetTouchCallbacks();
6018 // Connect ChildOrderChangedSignal
6019 bool orderChangedSignal(false);
6020 Actor orderChangedActor;
6021 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6022 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6024 application.SendNotification();
6025 application.Render();
6027 Dali::Integration::Point point;
6028 point.SetDeviceId(1);
6029 point.SetState(PointState::DOWN);
6030 point.SetScreenPosition(Vector2(10.f, 10.f));
6031 Dali::Integration::TouchEvent touchEvent;
6032 touchEvent.AddPoint(point);
6034 application.ProcessEvent(touchEvent);
6036 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6037 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6038 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6040 ResetTouchCallbacks();
6042 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
6044 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6045 actorA.RaiseAbove(actorA);
6046 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6047 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6049 application.SendNotification();
6050 application.Render();
6052 application.ProcessEvent(touchEvent);
6054 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
6056 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6057 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6058 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6060 ResetTouchCallbacks();
6062 orderChangedSignal = false;
6064 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6065 actorA.RaiseAbove(actorC);
6066 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6067 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6069 application.SendNotification();
6070 application.Render();
6072 application.ProcessEvent(touchEvent);
6074 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
6075 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6076 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6077 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6082 int UtcDaliActorGetScreenPosition(void)
6084 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
6086 TestApplication application;
6088 Integration::Scene stage(application.GetScene());
6090 Actor actorA = Actor::New();
6091 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6093 Vector2 size2(10.0f, 20.0f);
6094 actorA.SetProperty(Actor::Property::SIZE, size2);
6096 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6098 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
6102 application.SendNotification();
6103 application.Render();
6105 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6106 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6108 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6109 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
6111 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6112 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6114 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
6116 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6118 application.SendNotification();
6119 application.Render();
6121 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6122 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6124 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6125 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
6127 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6128 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6130 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
6132 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6134 application.SendNotification();
6135 application.Render();
6137 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6138 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6140 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6141 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
6143 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6144 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6146 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
6148 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
6150 application.SendNotification();
6151 application.Render();
6153 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6154 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6156 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
6157 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6159 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6160 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6162 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
6164 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
6166 application.SendNotification();
6167 application.Render();
6169 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6170 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6172 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6173 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
6175 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
6176 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6178 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
6180 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6181 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
6183 Actor actorB = Actor::New();
6184 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6185 actorB.SetProperty(Actor::Property::SIZE, size2);
6186 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
6189 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6191 application.SendNotification();
6192 application.Render();
6194 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6196 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
6197 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
6202 int UtcDaliActorGetScreenPositionAfterScaling(void)
6204 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
6206 TestApplication application;
6208 Integration::Scene stage(application.GetScene());
6210 Actor actorA = Actor::New();
6211 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6213 Vector2 size2(10.0f, 20.0f);
6214 actorA.SetProperty(Actor::Property::SIZE, size2);
6215 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
6216 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6218 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
6222 application.SendNotification();
6223 application.Render();
6225 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6226 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6228 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6229 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6231 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6232 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6234 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
6236 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6238 application.SendNotification();
6239 application.Render();
6241 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6242 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6244 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6245 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6247 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
6248 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6253 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6255 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
6257 TestApplication application;
6259 Integration::Scene stage(application.GetScene());
6261 Actor actorA = Actor::New();
6262 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6263 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6264 Vector2 size2(10.0f, 20.0f);
6265 actorA.SetProperty(Actor::Property::SIZE, size2);
6266 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6268 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6272 application.SendNotification();
6273 application.Render();
6275 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6276 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6278 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6279 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6281 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
6282 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
6284 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
6286 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
6287 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6289 application.SendNotification();
6290 application.Render();
6292 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6293 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6295 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6296 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6298 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
6299 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6305 int UtcDaliActorGetScreenPositionWithChildActors(void)
6307 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
6309 TestApplication application;
6311 Integration::Scene stage(application.GetScene());
6313 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6315 Actor actorA = Actor::New();
6316 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6317 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6318 Vector2 size1(10.0f, 20.0f);
6319 actorA.SetProperty(Actor::Property::SIZE, size1);
6320 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6322 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6324 Actor parentActorA = Actor::New();
6325 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6326 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6327 Vector2 size2(30.0f, 60.0f);
6328 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6329 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6331 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6333 stage.Add(parentActorA);
6334 parentActorA.Add(actorA);
6336 application.SendNotification();
6337 application.Render();
6339 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6340 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6342 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6343 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6345 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
6346 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
6348 tet_infoline("Test 2\n");
6350 tet_infoline("change parent anchor point and parent origin then check screen position \n");
6352 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6353 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
6355 application.SendNotification();
6356 application.Render();
6358 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6359 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6361 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6362 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6364 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
6365 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
6370 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6372 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
6374 TestApplication application;
6376 Integration::Scene stage(application.GetScene());
6378 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6380 Actor actorA = Actor::New();
6381 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6382 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6383 Vector2 size1(10.0f, 20.0f);
6384 actorA.SetProperty(Actor::Property::SIZE, size1);
6385 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6387 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6389 Actor parentActorA = Actor::New();
6390 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6391 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6392 Vector2 size2(30.0f, 60.0f);
6393 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6394 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6396 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
6398 Actor grandParentActorA = Actor::New();
6399 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6400 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
6401 Vector2 size3(60.0f, 120.0f);
6402 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
6403 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6405 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
6407 stage.Add(grandParentActorA);
6408 grandParentActorA.Add(parentActorA);
6410 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6412 parentActorA.Add(actorA);
6414 application.SendNotification();
6415 application.Render();
6417 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6418 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6420 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6421 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6423 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
6424 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
6429 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6431 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
6433 TestApplication application;
6435 Integration::Scene stage(application.GetScene());
6437 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6439 Actor actorA = Actor::New();
6440 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6441 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6442 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6443 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
6446 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6448 Actor actorB = Actor::New();
6449 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6450 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6451 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6452 Vector2 actorBSize(30.0f, 60.0f);
6453 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
6456 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6458 Actor actorC = Actor::New();
6459 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6460 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6461 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6462 Vector2 actorCSize(60.0f, 120.0f);
6463 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
6466 application.SendNotification();
6467 application.Render();
6469 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
6471 Vector2 center(stage.GetSize() * 0.5f);
6473 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6474 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6475 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6477 tet_infoline("Add scale to all actors");
6479 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6480 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
6481 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
6483 application.SendNotification();
6484 application.Render();
6486 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
6487 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
6488 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
6493 int utcDaliActorPositionUsesAnchorPoint(void)
6495 TestApplication application;
6496 tet_infoline("Check default behaviour\n");
6498 Actor actor = Actor::New();
6499 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6500 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6501 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6502 application.GetScene().Add(actor);
6504 application.SendNotification();
6505 application.Render();
6507 tet_infoline("Check that the world position is in the center\n");
6508 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6510 tet_infoline("Set the position uses anchor point property to false\n");
6511 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6513 application.SendNotification();
6514 application.Render();
6516 tet_infoline("Check that the world position has changed appropriately\n");
6517 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6522 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
6524 TestApplication application;
6525 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6527 Actor actor = Actor::New();
6528 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6529 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6530 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6531 actor.SetProperty(Actor::Property::SCALE, 2.0f);
6532 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6533 application.GetScene().Add(actor);
6535 application.SendNotification();
6536 application.Render();
6538 tet_infoline("Check the world position is the same as it would be without a scale\n");
6539 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6541 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6542 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6543 application.SendNotification();
6544 application.Render();
6545 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
6547 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6548 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6549 application.SendNotification();
6550 application.Render();
6551 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
6556 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
6558 TestApplication application;
6559 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6561 Actor actor = Actor::New();
6562 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6563 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6564 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6565 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6566 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6567 application.GetScene().Add(actor);
6569 application.SendNotification();
6570 application.Render();
6572 tet_infoline("Check the world position is the same as it would be without a rotation\n");
6573 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6575 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6576 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6577 application.SendNotification();
6578 application.Render();
6579 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
6581 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6582 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6583 application.SendNotification();
6584 application.Render();
6585 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
6590 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
6592 TestApplication application;
6593 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6595 Actor actor = Actor::New();
6596 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6597 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6598 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6599 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
6600 actor.SetProperty(Actor::Property::SCALE, 2.0f);
6601 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6602 application.GetScene().Add(actor);
6604 application.SendNotification();
6605 application.Render();
6607 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
6608 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
6610 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
6611 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6612 application.SendNotification();
6613 application.Render();
6614 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
6616 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
6617 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6618 application.SendNotification();
6619 application.Render();
6620 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
6625 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
6627 TestApplication application;
6628 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
6630 Actor parent = Actor::New();
6632 application.GetScene().Add(parent);
6633 Vector2 stageSize(application.GetScene().GetSize());
6635 Actor actor = Actor::New();
6636 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6637 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6638 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
6639 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
6640 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
6641 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6644 application.SendNotification();
6645 application.Render();
6647 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
6649 tet_infoline("Check the world position is in the right place\n");
6650 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6652 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
6653 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6654 application.SendNotification();
6655 application.Render();
6656 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6658 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
6659 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6660 application.SendNotification();
6661 application.Render();
6662 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
6667 int utcDaliActorVisibilityChangeSignalSelf(void)
6669 TestApplication application;
6670 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
6672 Actor actor = Actor::New();
6674 VisibilityChangedFunctorData data;
6675 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
6677 actor.SetProperty(Actor::Property::VISIBLE, false);
6679 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6681 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
6684 actor.SetProperty(Actor::Property::VISIBLE, false);
6685 data.Check(false /* not called */, TEST_LOCATION);
6687 tet_infoline("Change the visibility using properties, ensure called");
6690 actor.SetProperty(Actor::Property::VISIBLE, true);
6691 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6693 tet_infoline("Set the visibility to current using properties, ensure not called");
6696 actor.SetProperty(Actor::Property::VISIBLE, true);
6697 data.Check(false /* not called */, TEST_LOCATION);
6702 int utcDaliActorVisibilityChangeSignalChildren(void)
6704 TestApplication application;
6705 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
6707 Actor parent = Actor::New();
6708 Actor child = Actor::New();
6711 Actor grandChild = Actor::New();
6712 child.Add(grandChild);
6714 VisibilityChangedFunctorData parentData;
6715 VisibilityChangedFunctorData childData;
6716 VisibilityChangedFunctorData grandChildData;
6718 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
6719 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
6720 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
6722 parent.SetProperty(Actor::Property::VISIBLE, false);
6723 parentData.Check(false /* not called */, TEST_LOCATION);
6724 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6725 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6727 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
6730 grandChildData.Reset();
6732 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
6734 parent.SetProperty(Actor::Property::VISIBLE, true);
6735 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6736 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6737 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
6739 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
6742 grandChildData.Reset();
6744 parent.SetProperty(Actor::Property::VISIBLE, true);
6745 parentData.Check(false /* not called */, TEST_LOCATION);
6746 childData.Check(false /* not called */, TEST_LOCATION);
6747 grandChildData.Check(false /* not called */, TEST_LOCATION);
6752 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
6754 TestApplication application;
6755 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
6757 Actor actor = Actor::New();
6758 application.GetScene().Add(actor);
6760 application.SendNotification();
6761 application.Render();
6763 VisibilityChangedFunctorData data;
6764 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
6766 Animation animation = Animation::New(1.0f);
6767 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
6769 data.Check(false, TEST_LOCATION);
6770 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6771 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6773 tet_infoline("Play the animation and check the property value");
6776 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
6777 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
6779 tet_infoline("Animation not currently finished, so the current visibility should still be true");
6780 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
6782 application.SendNotification();
6783 application.Render(1100); // After the animation
6785 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
6790 int utcDaliActorVisibilityChangeSignalByName(void)
6792 TestApplication application;
6793 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
6795 Actor actor = Actor::New();
6797 bool signalCalled = false;
6798 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
6799 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6800 actor.SetProperty(Actor::Property::VISIBLE, false);
6801 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6803 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
6804 signalCalled = false;
6805 actor.SetProperty(Actor::Property::VISIBLE, false);
6806 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6808 tet_infoline("Change the visibility using properties, ensure called");
6809 actor.SetProperty(Actor::Property::VISIBLE, true);
6810 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6812 tet_infoline("Set the visibility to current using properties, ensure not called");
6813 signalCalled = false;
6815 actor.SetProperty(Actor::Property::VISIBLE, true);
6816 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6821 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
6823 gLayoutDirectionType = type;
6826 int UtcDaliActorLayoutDirectionProperty(void)
6828 TestApplication application;
6829 tet_infoline("Check layout direction property");
6831 Actor actor0 = Actor::New();
6832 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6833 application.GetScene().Add(actor0);
6835 application.SendNotification();
6836 application.Render();
6838 Actor actor1 = Actor::New();
6839 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6840 Actor actor2 = Actor::New();
6841 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6842 Actor actor3 = Actor::New();
6843 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6844 Actor actor4 = Actor::New();
6845 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6846 Actor actor5 = Actor::New();
6847 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6848 Actor actor6 = Actor::New();
6849 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6850 Actor actor7 = Actor::New();
6851 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6852 Actor actor8 = Actor::New();
6853 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6854 Actor actor9 = Actor::New();
6855 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6858 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
6859 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
6861 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
6862 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6863 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
6865 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6866 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6867 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
6869 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
6871 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6872 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6874 application.GetScene().Add(actor3);
6881 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6882 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6884 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
6885 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
6886 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
6888 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6890 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6891 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6892 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6893 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6894 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6895 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6896 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6898 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
6899 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6900 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6902 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6903 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6904 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6905 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
6907 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
6908 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6909 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6914 struct LayoutDirectionFunctor
6916 LayoutDirectionFunctor(bool& signalCalled)
6917 : mSignalCalled(signalCalled)
6921 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
6922 : mSignalCalled(rhs.mSignalCalled)
6928 mSignalCalled = true;
6931 bool& mSignalCalled;
6934 int UtcDaliActorLayoutDirectionSignal(void)
6936 TestApplication application;
6937 tet_infoline("Check changing layout direction property sends a signal");
6939 Actor actor = Actor::New();
6940 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
6941 application.GetScene().Add(actor);
6942 bool signalCalled = false;
6943 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
6945 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
6946 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6948 // Test that writing the same value doesn't send a signal
6949 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
6950 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6952 // Test that writing a different value sends the signal
6953 signalCalled = false;
6954 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6955 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
6957 signalCalled = false;
6958 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
6959 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
6964 struct ChildAddedSignalCheck
6966 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
6967 : mSignalReceived(signalReceived),
6968 mChildHandle(childHandle)
6972 void operator()(Actor childHandle)
6974 mSignalReceived = true;
6975 mChildHandle = childHandle;
6979 mSignalReceived = true;
6980 mChildHandle = Actor();
6983 bool& mSignalReceived;
6984 Actor& mChildHandle;
6987 int UtcDaliChildAddedSignalP1(void)
6989 TestApplication application;
6990 auto stage = application.GetScene();
6992 bool signalReceived = false;
6995 ChildAddedSignalCheck signal(signalReceived, childActor);
6996 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
6997 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
6999 auto actorA = Actor::New();
7001 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7002 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7003 signalReceived = false;
7005 auto actorB = Actor::New();
7007 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7008 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7013 int UtcDaliChildAddedSignalP2(void)
7015 TestApplication application;
7016 auto stage = application.GetScene();
7018 bool signalReceived = false;
7021 ChildAddedSignalCheck signal(signalReceived, childActor);
7022 tet_infoline("Connect to childAdded signal by name");
7024 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
7025 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7027 auto actorA = Actor::New();
7029 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7031 // Can't test which actor was added; signal signature is void() when connecting via name.
7032 signalReceived = false;
7034 auto actorB = Actor::New();
7036 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7041 int UtcDaliChildAddedSignalN(void)
7043 TestApplication application;
7044 auto stage = application.GetScene();
7046 bool signalReceived = false;
7049 ChildAddedSignalCheck signal(signalReceived, childActor);
7050 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7051 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7053 auto actorA = Actor::New();
7055 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7056 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7057 signalReceived = false;
7059 auto actorB = Actor::New();
7061 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7065 struct ChildRemovedSignalCheck
7067 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
7068 : mSignalReceived(signalReceived),
7069 mChildHandle(childHandle)
7073 void operator()(Actor childHandle)
7075 mSignalReceived = true;
7076 mChildHandle = childHandle;
7081 mSignalReceived = true;
7084 bool& mSignalReceived;
7085 Actor& mChildHandle;
7088 int UtcDaliChildRemovedSignalP1(void)
7090 TestApplication application;
7091 auto stage = application.GetScene();
7093 bool signalReceived = false;
7096 ChildRemovedSignalCheck signal(signalReceived, childActor);
7097 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7098 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7100 auto actorA = Actor::New();
7102 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7103 DALI_TEST_CHECK(!childActor);
7105 stage.Remove(actorA);
7106 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7107 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7109 signalReceived = false;
7110 auto actorB = Actor::New();
7112 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7114 stage.Remove(actorB);
7115 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7116 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7121 int UtcDaliChildRemovedSignalP2(void)
7123 TestApplication application;
7124 auto stage = application.GetScene();
7126 bool signalReceived = false;
7129 ChildAddedSignalCheck signal(signalReceived, childActor);
7130 tet_infoline("Connect to childRemoved signal by name");
7132 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
7133 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7135 auto actorA = Actor::New();
7137 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7139 stage.Remove(actorA);
7140 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7142 signalReceived = false;
7143 auto actorB = Actor::New();
7145 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7147 stage.Remove(actorB);
7148 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7153 int UtcDaliChildRemovedSignalN(void)
7155 TestApplication application;
7156 auto stage = application.GetScene();
7158 bool signalReceived = false;
7161 ChildRemovedSignalCheck signal(signalReceived, childActor);
7162 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7163 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7165 auto actorA = Actor::New();
7168 auto actorB = Actor::New();
7171 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7172 DALI_TEST_CHECK(!childActor);
7174 actorA.Remove(actorB);
7175 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7179 int UtcDaliChildMovedSignalP(void)
7181 TestApplication application;
7182 auto stage = application.GetScene();
7184 bool addedASignalReceived = false;
7185 bool removedASignalReceived = false;
7186 bool addedBSignalReceived = false;
7187 bool removedBSignalReceived = false;
7190 auto actorA = Actor::New();
7191 auto actorB = Actor::New();
7195 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
7196 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
7197 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
7198 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
7200 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
7201 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
7202 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
7203 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
7205 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7206 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7207 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7208 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7210 // Create a child of A
7212 auto child = Actor::New();
7215 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7216 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7217 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7218 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7219 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
7222 addedASignalReceived = false;
7223 addedBSignalReceived = false;
7224 removedASignalReceived = false;
7225 removedBSignalReceived = false;
7227 actorB.Add(child); // Expect this child to be re-parented
7228 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7229 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
7230 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
7231 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7233 // Move child back to A:
7234 addedASignalReceived = false;
7235 addedBSignalReceived = false;
7236 removedASignalReceived = false;
7237 removedBSignalReceived = false;
7239 actorA.Add(child); // Expect this child to be re-parented
7240 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7241 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7242 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7243 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
7248 int utcDaliActorCulled(void)
7250 TestApplication application;
7251 auto stage = application.GetScene();
7253 tet_infoline("Check that the actor is culled if the actor is out of the screen");
7255 Actor actor = Actor::New();
7256 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7258 Geometry geometry = CreateQuadGeometry();
7259 Shader shader = CreateShader();
7260 Renderer renderer = Renderer::New(geometry, shader);
7261 actor.AddRenderer(renderer);
7265 application.SendNotification();
7266 application.Render(0);
7268 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
7270 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
7271 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
7273 // Connect NotifySignal
7274 bool propertyNotificationSignal(false);
7275 PropertyNotification source;
7276 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
7277 notification.NotifySignal().Connect(&application, f);
7279 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
7281 application.SendNotification();
7282 application.Render();
7284 application.SendNotification();
7286 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
7288 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
7289 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
7290 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
7295 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7297 TestApplication application;
7298 auto stage = application.GetScene();
7300 tet_infoline("Ensure we clear the screen when the last actor is removed");
7302 Actor actor = CreateRenderableActor();
7303 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7306 application.SendNotification();
7307 application.Render();
7309 auto& glAbstraction = application.GetGlAbstraction();
7310 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7314 application.SendNotification();
7315 application.Render();
7317 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7322 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7324 TestApplication application;
7325 auto stage = application.GetScene();
7327 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
7329 Actor actor = CreateRenderableActor();
7330 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7333 application.SendNotification();
7334 application.Render();
7336 auto& glAbstraction = application.GetGlAbstraction();
7337 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7339 actor.SetProperty(Actor::Property::VISIBLE, false);
7341 application.SendNotification();
7342 application.Render();
7344 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7349 int utcDaliActorGetSizeAfterAnimation(void)
7351 TestApplication application;
7352 tet_infoline("Check the actor size before / after an animation is finished");
7354 Vector3 actorSize(100.0f, 100.0f, 0.0f);
7356 Actor actor = Actor::New();
7357 actor.SetProperty(Actor::Property::SIZE, actorSize);
7358 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7359 application.GetScene().Add(actor);
7361 // Size should be updated without rendering.
7362 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7363 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7365 application.SendNotification();
7366 application.Render();
7368 // Size and current size should be updated.
7369 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7370 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7371 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7372 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7373 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7375 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7376 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7377 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7378 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7379 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7382 actorSize = Vector3(200.0f, 200.0f, 0.0f);
7383 actor.SetProperty(Actor::Property::SIZE, actorSize);
7385 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7386 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7388 Vector3 targetValue(10.0f, 20.0f, 0.0f);
7390 Animation animation = Animation::New(1.0f);
7391 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
7394 // Size should be updated without rendering.
7395 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7396 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7398 application.SendNotification();
7399 application.Render(1100); // After the animation
7401 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7402 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7403 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7404 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7405 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7407 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7408 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7409 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7410 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7411 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7413 targetValue.width = 50.0f;
7416 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
7419 application.SendNotification();
7420 application.Render(1100); // After the animation
7422 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7423 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7424 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7425 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7426 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7428 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7429 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7430 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7431 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7432 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7434 targetValue.height = 70.0f;
7437 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
7440 application.SendNotification();
7441 application.Render(1100); // After the animation
7443 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7444 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7445 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7446 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7447 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7449 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7450 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7451 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7452 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7453 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7455 Vector3 offset(10.0f, 20.0f, 0.0f);
7458 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
7461 application.SendNotification();
7462 application.Render(1100); // After the animation
7464 targetValue += offset;
7466 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7467 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7468 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7469 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7470 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7472 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7473 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7474 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7475 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7476 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7478 offset.width = 20.0f;
7481 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
7484 application.SendNotification();
7485 application.Render(1100); // After the animation
7487 targetValue.width += offset.width;
7489 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7490 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7491 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7492 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7493 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7495 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7496 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7497 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7498 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7499 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7501 offset.height = 10.0f;
7504 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
7507 application.SendNotification();
7508 application.Render(1100); // After the animation
7510 targetValue.height += offset.height;
7512 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7513 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7514 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7515 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7516 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7518 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7519 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7520 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7521 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7522 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7525 actorSize = Vector3(300.0f, 300.0f, 0.0f);
7527 actor.SetProperty(Actor::Property::SIZE, actorSize);
7529 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7530 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7532 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7533 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7535 application.SendNotification();
7536 application.Render();
7538 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7539 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7541 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7542 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7547 int utcDaliActorPartialUpdate(void)
7549 TestApplication application(
7550 TestApplication::DEFAULT_SURFACE_WIDTH,
7551 TestApplication::DEFAULT_SURFACE_HEIGHT,
7552 TestApplication::DEFAULT_HORIZONTAL_DPI,
7553 TestApplication::DEFAULT_VERTICAL_DPI,
7557 tet_infoline("Check the damaged area");
7559 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7561 std::vector<Rect<int>> damagedRects;
7562 Rect<int> clippingRect;
7563 application.SendNotification();
7564 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7566 // First render pass, nothing to render, adaptor would just do swap buffer.
7567 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7568 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7570 Actor actor = CreateRenderableActor();
7571 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7572 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7573 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7574 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7575 application.GetScene().Add(actor);
7577 application.SendNotification();
7579 // 1. Actor added, damaged rect is added size of actor
7580 damagedRects.clear();
7581 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7582 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7585 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7586 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7587 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7588 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7589 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7590 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7591 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7594 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
7595 application.SendNotification();
7597 damagedRects.clear();
7598 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7599 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7602 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
7603 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7604 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7605 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7606 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7607 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7608 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7610 // 3. Set new position
7611 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
7612 application.SendNotification();
7614 damagedRects.clear();
7615 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7616 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7619 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
7620 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7621 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7622 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7623 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7624 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7625 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7627 application.GetScene().Remove(actor);
7628 application.SendNotification();
7630 // Actor removed, last 3 dirty rects are reported. Adaptor would merge them together.
7631 damagedRects.clear();
7632 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7633 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
7635 clippingRect = damagedRects[0];
7636 clippingRect.Merge(damagedRects[1]);
7637 clippingRect.Merge(damagedRects[2]);
7639 DALI_TEST_EQUALS(clippingRect.IsEmpty(), false, TEST_LOCATION);
7640 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
7641 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(16, 736, 64, 64), TEST_LOCATION);
7643 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7644 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7645 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7646 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7647 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7652 int utcDaliActorPartialUpdateSetColor(void)
7654 TestApplication application(
7655 TestApplication::DEFAULT_SURFACE_WIDTH,
7656 TestApplication::DEFAULT_SURFACE_HEIGHT,
7657 TestApplication::DEFAULT_HORIZONTAL_DPI,
7658 TestApplication::DEFAULT_VERTICAL_DPI,
7662 tet_infoline("Check uniform update");
7664 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7666 std::vector<Rect<int>> damagedRects;
7667 Rect<int> clippingRect;
7668 application.SendNotification();
7669 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7671 // First render pass, nothing to render, adaptor would just do swap buffer.
7672 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7673 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7675 Actor actor = CreateRenderableActor();
7676 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7677 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7678 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7679 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7680 application.GetScene().Add(actor);
7682 application.SendNotification();
7684 // 1. Actor added, damaged rect is added size of actor
7685 damagedRects.clear();
7686 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7687 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7690 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7691 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7692 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7693 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7694 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7695 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7696 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7698 damagedRects.clear();
7699 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7701 damagedRects.clear();
7702 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7705 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
7706 application.SendNotification();
7708 damagedRects.clear();
7709 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7710 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7713 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7714 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7715 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7716 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7717 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7718 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7719 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7724 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
7725 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
7726 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
7727 const char* const RENDER_SHADOW_VERTEX_SOURCE =
7728 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
7729 " uniform mediump mat4 uLightCameraViewMatrix;\n"
7733 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
7734 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
7735 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
7738 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
7739 "uniform lowp vec4 uShadowColor;\n"
7742 " lowp float alpha;\n"
7743 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
7744 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
7747 int utcDaliActorPartialUpdateSetProperty(void)
7749 TestApplication application(
7750 TestApplication::DEFAULT_SURFACE_WIDTH,
7751 TestApplication::DEFAULT_SURFACE_HEIGHT,
7752 TestApplication::DEFAULT_HORIZONTAL_DPI,
7753 TestApplication::DEFAULT_VERTICAL_DPI,
7757 tet_infoline("Set/Update property with partial update");
7759 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7761 std::vector<Rect<int>> damagedRects;
7762 Rect<int> clippingRect;
7763 application.SendNotification();
7764 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7766 // First render pass, nothing to render, adaptor would just do swap buffer.
7767 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7768 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7770 Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
7771 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
7772 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7773 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
7774 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
7775 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7776 application.GetScene().Add(actor);
7778 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
7780 damagedRects.clear();
7781 application.SendNotification();
7782 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7783 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7786 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
7787 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7788 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7789 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7790 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7791 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7792 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7794 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
7795 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
7797 damagedRects.clear();
7798 application.SendNotification();
7799 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7800 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7802 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7803 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7804 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7805 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7806 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7807 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7809 damagedRects.clear();
7810 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7811 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7813 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7814 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7815 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7816 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7817 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7818 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7820 damagedRects.clear();
7821 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
7822 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
7827 int utcDaliActorPartialUpdateTwoActors(void)
7829 TestApplication application(
7830 TestApplication::DEFAULT_SURFACE_WIDTH,
7831 TestApplication::DEFAULT_SURFACE_HEIGHT,
7832 TestApplication::DEFAULT_HORIZONTAL_DPI,
7833 TestApplication::DEFAULT_VERTICAL_DPI,
7837 tet_infoline("Check the damaged rects with partial update and two actors");
7839 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7841 Actor actor = CreateRenderableActor();
7842 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
7843 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
7844 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7845 application.GetScene().Add(actor);
7847 Actor actor2 = CreateRenderableActor();
7848 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
7849 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
7850 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7851 application.GetScene().Add(actor2);
7853 application.SendNotification();
7854 std::vector<Rect<int>> damagedRects;
7855 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
7857 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
7858 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
7859 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
7861 // in screen coordinates, adaptor would calculate it using previous frames information
7862 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
7863 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7865 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7866 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7867 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7868 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7873 int utcDaliActorPartialUpdateActorsWithSizeHint(void)
7875 TestApplication application(
7876 TestApplication::DEFAULT_SURFACE_WIDTH,
7877 TestApplication::DEFAULT_SURFACE_HEIGHT,
7878 TestApplication::DEFAULT_HORIZONTAL_DPI,
7879 TestApplication::DEFAULT_VERTICAL_DPI,
7883 tet_infoline("Check the damaged rect with partial update and actor size hint");
7885 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
7887 Actor actor = CreateRenderableActor();
7888 actor.SetProperty(Actor::Property::POSITION, Vector3(75.0f, 150.0f, 0.0f));
7889 actor.SetProperty(Actor::Property::SIZE, Vector3(75.0f, 150.0f, 0.0f));
7890 actor.SetProperty(DevelActor::Property::UPDATE_SIZE_HINT, Vector3(150, 300, 0));
7891 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7892 application.GetScene().Add(actor);
7894 application.SendNotification();
7895 std::vector<Rect<int>> damagedRects;
7896 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
7898 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
7900 Rect<int> clippingRect = Rect<int>(0, 496, 160, 320);
7901 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
7903 application.RenderWithPartialUpdate(damagedRects, clippingRect);
7905 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
7906 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
7907 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
7908 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
7913 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
7915 TestApplication application;
7917 Actor actor = Actor::New();
7918 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
7919 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
7920 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
7921 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
7922 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
7923 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
7924 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
7925 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
7929 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
7931 TestApplication application;
7933 Actor actor = Actor::New();
7935 // Make sure setting invalid types does not cause a crash
7938 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
7939 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
7940 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
7941 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
7942 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
7943 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
7944 tet_result(TET_PASS);
7948 tet_result(TET_FAIL);
7953 int UtcDaliActorTouchAreaOffsetPropertyP(void)
7955 TestApplication application;
7957 Actor actor = Actor::New();
7958 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
7959 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
7960 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
7961 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
7962 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
7966 int UtcDaliActorTouchAreaOffsetPropertyN(void)
7968 TestApplication application;
7970 Actor actor = Actor::New();
7972 // Make sure setting invalid types does not cause a crash
7975 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
7976 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
7977 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
7978 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
7979 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
7980 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
7981 tet_result(TET_PASS);
7985 tet_result(TET_FAIL);
7990 int UtcDaliActorLowerBelowNegative(void)
7992 TestApplication application;
7993 Dali::Actor instance;
7997 instance.LowerBelow(arg1);
7998 DALI_TEST_CHECK(false); // Should not get here
8002 DALI_TEST_CHECK(true); // We expect an assert
8007 int UtcDaliActorRaiseAboveNegative(void)
8009 TestApplication application;
8010 Dali::Actor instance;
8014 instance.RaiseAbove(arg1);
8015 DALI_TEST_CHECK(false); // Should not get here
8019 DALI_TEST_CHECK(true); // We expect an assert
8024 int UtcDaliActorRaiseToTopNegative(void)
8026 TestApplication application;
8027 Dali::Actor instance;
8030 instance.RaiseToTop();
8031 DALI_TEST_CHECK(false); // Should not get here
8035 DALI_TEST_CHECK(true); // We expect an assert
8040 int UtcDaliActorAddRendererNegative(void)
8042 TestApplication application;
8043 Dali::Actor instance;
8046 Dali::Renderer arg1;
8047 instance.AddRenderer(arg1);
8048 DALI_TEST_CHECK(false); // Should not get here
8052 DALI_TEST_CHECK(true); // We expect an assert
8057 int UtcDaliActorTouchedSignalNegative(void)
8059 TestApplication application;
8060 Dali::Actor instance;
8063 instance.TouchedSignal();
8064 DALI_TEST_CHECK(false); // Should not get here
8068 DALI_TEST_CHECK(true); // We expect an assert
8073 int UtcDaliActorTranslateByNegative(void)
8075 TestApplication application;
8076 Dali::Actor instance;
8080 instance.TranslateBy(arg1);
8081 DALI_TEST_CHECK(false); // Should not get here
8085 DALI_TEST_CHECK(true); // We expect an assert
8090 int UtcDaliActorFindChildByIdNegative(void)
8092 TestApplication application;
8093 Dali::Actor instance;
8096 unsigned int arg1 = 0u;
8097 instance.FindChildById(arg1);
8098 DALI_TEST_CHECK(false); // Should not get here
8102 DALI_TEST_CHECK(true); // We expect an assert
8107 int UtcDaliActorGetRendererAtNegative(void)
8109 TestApplication application;
8110 Dali::Actor instance;
8113 unsigned int arg1 = 0u;
8114 instance.GetRendererAt(arg1);
8115 DALI_TEST_CHECK(false); // Should not get here
8119 DALI_TEST_CHECK(true); // We expect an assert
8124 int UtcDaliActorHoveredSignalNegative(void)
8126 TestApplication application;
8127 Dali::Actor instance;
8130 instance.HoveredSignal();
8131 DALI_TEST_CHECK(false); // Should not get here
8135 DALI_TEST_CHECK(true); // We expect an assert
8140 int UtcDaliActorLowerToBottomNegative(void)
8142 TestApplication application;
8143 Dali::Actor instance;
8146 instance.LowerToBottom();
8147 DALI_TEST_CHECK(false); // Should not get here
8151 DALI_TEST_CHECK(true); // We expect an assert
8156 int UtcDaliActorOnSceneSignalNegative(void)
8158 TestApplication application;
8159 Dali::Actor instance;
8162 instance.OnSceneSignal();
8163 DALI_TEST_CHECK(false); // Should not get here
8167 DALI_TEST_CHECK(true); // We expect an assert
8172 int UtcDaliActorOffSceneSignalNegative(void)
8174 TestApplication application;
8175 Dali::Actor instance;
8178 instance.OffSceneSignal();
8179 DALI_TEST_CHECK(false); // Should not get here
8183 DALI_TEST_CHECK(true); // We expect an assert
8188 int UtcDaliActorRemoveRendererNegative01(void)
8190 TestApplication application;
8191 Dali::Actor instance;
8194 unsigned int arg1 = 0u;
8195 instance.RemoveRenderer(arg1);
8196 DALI_TEST_CHECK(false); // Should not get here
8200 DALI_TEST_CHECK(true); // We expect an assert
8205 int UtcDaliActorRemoveRendererNegative02(void)
8207 TestApplication application;
8208 Dali::Actor instance;
8211 Dali::Renderer arg1;
8212 instance.RemoveRenderer(arg1);
8213 DALI_TEST_CHECK(false); // Should not get here
8217 DALI_TEST_CHECK(true); // We expect an assert
8222 int UtcDaliActorFindChildByNameNegative(void)
8224 TestApplication application;
8225 Dali::Actor instance;
8229 instance.FindChildByName(arg1);
8230 DALI_TEST_CHECK(false); // Should not get here
8234 DALI_TEST_CHECK(true); // We expect an assert
8239 int UtcDaliActorSetResizePolicyNegative(void)
8241 TestApplication application;
8242 Dali::Actor instance;
8245 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
8246 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
8247 instance.SetResizePolicy(arg1, arg2);
8248 DALI_TEST_CHECK(false); // Should not get here
8252 DALI_TEST_CHECK(true); // We expect an assert
8257 int UtcDaliActorOnRelayoutSignalNegative(void)
8259 TestApplication application;
8260 Dali::Actor instance;
8263 instance.OnRelayoutSignal();
8264 DALI_TEST_CHECK(false); // Should not get here
8268 DALI_TEST_CHECK(true); // We expect an assert
8273 int UtcDaliActorWheelEventSignalNegative(void)
8275 TestApplication application;
8276 Dali::Actor instance;
8279 instance.WheelEventSignal();
8280 DALI_TEST_CHECK(false); // Should not get here
8284 DALI_TEST_CHECK(true); // We expect an assert
8289 int UtcDaliActorGetHeightForWidthNegative(void)
8291 TestApplication application;
8292 Dali::Actor instance;
8296 instance.GetHeightForWidth(arg1);
8297 DALI_TEST_CHECK(false); // Should not get here
8301 DALI_TEST_CHECK(true); // We expect an assert
8306 int UtcDaliActorGetWidthForHeightNegative(void)
8308 TestApplication application;
8309 Dali::Actor instance;
8313 instance.GetWidthForHeight(arg1);
8314 DALI_TEST_CHECK(false); // Should not get here
8318 DALI_TEST_CHECK(true); // We expect an assert
8323 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
8325 TestApplication application;
8326 Dali::Actor instance;
8329 instance.LayoutDirectionChangedSignal();
8330 DALI_TEST_CHECK(false); // Should not get here
8334 DALI_TEST_CHECK(true); // We expect an assert
8339 int UtcDaliActorAddNegative(void)
8341 TestApplication application;
8342 Dali::Actor instance;
8347 DALI_TEST_CHECK(false); // Should not get here
8351 DALI_TEST_CHECK(true); // We expect an assert
8356 int UtcDaliActorLowerNegative(void)
8358 TestApplication application;
8359 Dali::Actor instance;
8363 DALI_TEST_CHECK(false); // Should not get here
8367 DALI_TEST_CHECK(true); // We expect an assert
8372 int UtcDaliActorRaiseNegative(void)
8374 TestApplication application;
8375 Dali::Actor instance;
8379 DALI_TEST_CHECK(false); // Should not get here
8383 DALI_TEST_CHECK(true); // We expect an assert
8388 int UtcDaliActorRemoveNegative(void)
8390 TestApplication application;
8391 Dali::Actor instance;
8395 instance.Remove(arg1);
8396 DALI_TEST_CHECK(false); // Should not get here
8400 DALI_TEST_CHECK(true); // We expect an assert
8405 int UtcDaliActorScaleByNegative(void)
8407 TestApplication application;
8408 Dali::Actor instance;
8412 instance.ScaleBy(arg1);
8413 DALI_TEST_CHECK(false); // Should not get here
8417 DALI_TEST_CHECK(true); // We expect an assert
8422 int UtcDaliActorGetLayerNegative(void)
8424 TestApplication application;
8425 Dali::Actor instance;
8428 instance.GetLayer();
8429 DALI_TEST_CHECK(false); // Should not get here
8433 DALI_TEST_CHECK(true); // We expect an assert
8438 int UtcDaliActorRotateByNegative01(void)
8440 TestApplication application;
8441 Dali::Actor instance;
8444 Dali::Quaternion arg1;
8445 instance.RotateBy(arg1);
8446 DALI_TEST_CHECK(false); // Should not get here
8450 DALI_TEST_CHECK(true); // We expect an assert
8455 int UtcDaliActorRotateByNegative02(void)
8457 TestApplication application;
8458 Dali::Actor instance;
8463 instance.RotateBy(arg1, arg2);
8464 DALI_TEST_CHECK(false); // Should not get here
8468 DALI_TEST_CHECK(true); // We expect an assert
8473 int UtcDaliActorUnparentNegative(void)
8475 TestApplication application;
8476 Dali::Actor instance;
8479 instance.Unparent();
8480 DALI_TEST_CHECK(false); // Should not get here
8484 DALI_TEST_CHECK(true); // We expect an assert
8489 int UtcDaliActorGetChildAtNegative(void)
8491 TestApplication application;
8492 Dali::Actor instance;
8495 unsigned int arg1 = 0u;
8496 instance.GetChildAt(arg1);
8497 DALI_TEST_CHECK(false); // Should not get here
8501 DALI_TEST_CHECK(true); // We expect an assert
8506 int UtcDaliActorGetChildCountNegative(void)
8508 TestApplication application;
8509 Dali::Actor instance;
8512 instance.GetChildCount();
8513 DALI_TEST_CHECK(false); // Should not get here
8517 DALI_TEST_CHECK(true); // We expect an assert
8522 int UtcDaliActorGetTargetSizeNegative(void)
8524 TestApplication application;
8525 Dali::Actor instance;
8528 instance.GetTargetSize();
8529 DALI_TEST_CHECK(false); // Should not get here
8533 DALI_TEST_CHECK(true); // We expect an assert
8538 int UtcDaliActorScreenToLocalNegative(void)
8540 TestApplication application;
8541 Dali::Actor instance;
8548 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
8549 DALI_TEST_CHECK(false); // Should not get here
8553 DALI_TEST_CHECK(true); // We expect an assert
8558 int UtcDaliActorGetNaturalSizeNegative(void)
8560 TestApplication application;
8561 Dali::Actor instance;
8564 instance.GetNaturalSize();
8565 DALI_TEST_CHECK(false); // Should not get here
8569 DALI_TEST_CHECK(true); // We expect an assert
8574 int UtcDaliActorGetRelayoutSizeNegative(void)
8576 TestApplication application;
8577 Dali::Actor instance;
8580 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
8581 instance.GetRelayoutSize(arg1);
8582 DALI_TEST_CHECK(false); // Should not get here
8586 DALI_TEST_CHECK(true); // We expect an assert
8591 int UtcDaliActorGetResizePolicyNegative(void)
8593 TestApplication application;
8594 Dali::Actor instance;
8597 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
8598 instance.GetResizePolicy(arg1);
8599 DALI_TEST_CHECK(false); // Should not get here
8603 DALI_TEST_CHECK(true); // We expect an assert
8608 int UtcDaliActorGetRendererCountNegative(void)
8610 TestApplication application;
8611 Dali::Actor instance;
8614 instance.GetRendererCount();
8615 DALI_TEST_CHECK(false); // Should not get here
8619 DALI_TEST_CHECK(true); // We expect an assert
8624 int UtcDaliActorGetParentNegative(void)
8626 TestApplication application;
8627 Dali::Actor instance;
8630 instance.GetParent();
8631 DALI_TEST_CHECK(false); // Should not get here
8635 DALI_TEST_CHECK(true); // We expect an assert