2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // 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/devel-api/common/capabilities.h>
24 #include <dali/integration-api/debug.h>
25 #include <dali/integration-api/events/hover-event-integ.h>
26 #include <dali/integration-api/events/touch-event-integ.h>
27 #include <dali/public-api/dali-core.h>
28 #include <mesh-builder.h>
29 #include <test-actor-utils.h>
31 #include <cfloat> // For FLT_MAX
41 void utc_dali_actor_startup(void)
43 test_return_value = TET_UNDEF;
46 void utc_dali_actor_cleanup(void)
48 test_return_value = TET_PASS;
53 bool gTouchCallBackCalled = false;
54 bool gTouchCallBackCalled2 = false;
55 bool gTouchCallBackCalled3 = false;
57 bool gHoverCallBackCalled = false;
59 static bool gTestConstraintCalled;
61 LayoutDirection::Type gLayoutDirectionType;
65 void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
67 gTestConstraintCalled = true;
72 * TestConstraint reference.
73 * When constraint is called, the resultRef is updated
74 * with the value supplied.
77 struct TestConstraintRef
79 TestConstraintRef(unsigned int& resultRef, unsigned int value)
80 : mResultRef(resultRef),
85 void operator()(T& current, const PropertyInputContainer& /* inputs */)
90 unsigned int& mResultRef;
94 static bool TestTouchCallback(Actor, const TouchEvent&)
96 gTouchCallBackCalled = true;
101 static bool TestTouchCallback2(Actor, const TouchEvent&)
103 gTouchCallBackCalled2 = true;
108 static bool TestTouchCallback3(Actor, const TouchEvent&)
110 gTouchCallBackCalled3 = true;
115 static void ResetTouchCallbacks()
117 gTouchCallBackCalled = false;
118 gTouchCallBackCalled2 = false;
119 gTouchCallBackCalled3 = false;
122 static bool TestCallback3(Actor actor, const HoverEvent& event)
124 gHoverCallBackCalled = true;
129 // validation stuff for onstage & offstage signals
130 static std::vector<std::string> gActorNamesOnOffScene;
131 static int gOnSceneCallBackCalled;
132 void OnSceneCallback(Actor actor)
134 ++gOnSceneCallBackCalled;
135 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
136 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
138 static int gOffSceneCallBackCalled;
139 void OffSceneCallback(Actor actor)
141 ++gOffSceneCallBackCalled;
142 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
143 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
146 struct PositionComponentConstraint
148 PositionComponentConstraint()
152 void operator()(Vector3& pos, const PropertyInputContainer& inputs)
154 const Matrix& m = inputs[0]->GetMatrix();
157 m.GetTransformComponents(pos, rot, scale);
161 struct OrientationComponentConstraint
163 OrientationComponentConstraint()
167 void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
169 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
172 orientation = parentOrientation;
177 static bool gOnRelayoutCallBackCalled = false;
178 static std::vector<std::string> gActorNamesRelayout;
180 void OnRelayoutCallback(Actor actor)
182 gOnRelayoutCallBackCalled = true;
183 gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
186 struct VisibilityChangedFunctorData
188 VisibilityChangedFunctorData()
191 type(DevelActor::VisibilityChange::SELF),
200 type = DevelActor::VisibilityChange::SELF;
204 void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
206 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
207 DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
208 DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
209 DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
212 void Check(bool compareCalled, const std::string& location)
214 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
219 DevelActor::VisibilityChange::Type type;
223 struct VisibilityChangedFunctor
225 VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
230 void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
233 data.visible = visible;
238 VisibilityChangedFunctorData& data;
241 struct VisibilityChangedVoidFunctor
243 VisibilityChangedVoidFunctor(bool& signalCalled)
244 : mSignalCalled(signalCalled)
250 mSignalCalled = true;
256 struct ChildOrderChangedFunctor
258 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
259 : mSignalCalled(signalCalled),
264 void operator()(Actor actor)
266 mSignalCalled = true;
274 struct CulledPropertyNotificationFunctor
276 CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
277 : mSignalCalled(signalCalled),
278 mPropertyNotification(propertyNotification)
282 void operator()(PropertyNotification& source)
284 mSignalCalled = true;
285 mPropertyNotification = source;
289 PropertyNotification& mPropertyNotification;
292 } // anonymous namespace
294 //& purpose: Testing New API
295 int UtcDaliActorNew(void)
297 TestApplication application;
299 Actor actor = Actor::New();
301 DALI_TEST_CHECK(actor);
305 //& purpose: Testing Dali::Actor::DownCast()
306 int UtcDaliActorDownCastP(void)
308 TestApplication application;
309 tet_infoline("Testing Dali::Actor::DownCast()");
311 Actor actor = Actor::New();
312 BaseHandle object(actor);
313 Actor actor2 = Actor::DownCast(object);
314 DALI_TEST_CHECK(actor2);
318 //& purpose: Testing Dali::Actor::DownCast()
319 int UtcDaliActorDownCastN(void)
321 TestApplication application;
322 tet_infoline("Testing Dali::Actor::DownCast()");
324 BaseHandle unInitializedObject;
325 Actor actor = Actor::DownCast(unInitializedObject);
326 DALI_TEST_CHECK(!actor);
330 int UtcDaliActorMoveConstructor(void)
332 TestApplication application;
334 Actor actor = Actor::New();
335 DALI_TEST_CHECK(actor);
337 int id = actor.GetProperty<int>(Actor::Property::ID);
339 Actor moved = std::move(actor);
340 DALI_TEST_CHECK(moved);
341 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
342 DALI_TEST_CHECK(!actor);
347 int UtcDaliActorMoveAssignment(void)
349 TestApplication application;
351 Actor actor = Actor::New();
352 DALI_TEST_CHECK(actor);
354 int id = actor.GetProperty<int>(Actor::Property::ID);
357 moved = std::move(actor);
358 DALI_TEST_CHECK(moved);
359 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
360 DALI_TEST_CHECK(!actor);
365 //& purpose: Testing Dali::Actor::GetName()
366 int UtcDaliActorGetName(void)
368 TestApplication application;
370 Actor actor = Actor::New();
372 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
376 //& purpose: Testing Dali::Actor::SetName()
377 int UtcDaliActorSetName(void)
379 TestApplication application;
381 string str("ActorName");
382 Actor actor = Actor::New();
384 actor.SetProperty(Actor::Property::NAME, str);
385 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
389 int UtcDaliActorGetId(void)
391 tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
392 TestApplication application;
394 Actor first = Actor::New();
395 Actor second = Actor::New();
396 Actor third = Actor::New();
398 DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
399 DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
403 int UtcDaliActorIsRoot(void)
405 TestApplication application;
407 Actor actor = Actor::New();
408 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
410 // get the root layer
411 actor = application.GetScene().GetLayer(0);
412 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
416 int UtcDaliActorOnScene(void)
418 TestApplication application;
420 Actor actor = Actor::New();
421 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
423 // get the root layer
424 actor = application.GetScene().GetLayer(0);
425 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
429 int UtcDaliActorIsLayer(void)
431 TestApplication application;
433 Actor actor = Actor::New();
434 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
436 // get the root layer
437 actor = application.GetScene().GetLayer(0);
438 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
442 int UtcDaliActorGetLayer(void)
444 TestApplication application;
446 Actor actor = Actor::New();
447 application.GetScene().Add(actor);
448 Layer layer = actor.GetLayer();
450 DALI_TEST_CHECK(layer);
452 // get the root layers layer
453 actor = application.GetScene().GetLayer(0);
454 DALI_TEST_CHECK(actor.GetLayer());
458 int UtcDaliActorAddP(void)
460 tet_infoline("Testing Actor::Add");
461 TestApplication application;
463 Actor parent = Actor::New();
464 Actor child = Actor::New();
466 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
470 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
472 Actor parent2 = Actor::New();
475 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
476 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
478 // try Adding to same parent again, works
480 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
482 // try reparenting an orphaned child
484 Actor temporaryParent = Actor::New();
485 temporaryParent.Add(child);
486 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
488 // temporaryParent has now died, reparent the orphaned child
490 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
495 int UtcDaliActorAddN(void)
497 tet_infoline("Testing Actor::Add");
498 TestApplication application;
500 Actor child = Actor::New();
502 Actor parent2 = Actor::New();
508 parent2.Add(parent2);
509 tet_printf("Assertion test failed - no Exception\n");
510 tet_result(TET_FAIL);
512 catch(Dali::DaliException& e)
514 DALI_TEST_PRINT_ASSERT(e);
515 DALI_TEST_ASSERT(e, "&mOwner != &child", TEST_LOCATION);
516 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
520 tet_printf("Assertion test failed - wrong Exception\n");
521 tet_result(TET_FAIL);
524 // try reparenting root
527 parent2.Add(application.GetScene().GetLayer(0));
528 tet_printf("Assertion test failed - no Exception\n");
529 tet_result(TET_FAIL);
531 catch(Dali::DaliException& e)
533 DALI_TEST_PRINT_ASSERT(e);
534 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
535 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
539 tet_printf("Assertion test failed - wrong Exception\n");
540 tet_result(TET_FAIL);
548 tet_printf("Assertion test failed - no Exception\n");
549 tet_result(TET_FAIL);
551 catch(Dali::DaliException& e)
553 DALI_TEST_PRINT_ASSERT(e);
554 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
555 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
559 tet_printf("Assertion test failed - wrong Exception\n");
560 tet_result(TET_FAIL);
566 int UtcDaliActorRemoveN(void)
568 tet_infoline("Testing Actor::Remove");
569 TestApplication application;
571 Actor parent = Actor::New();
572 Actor child = Actor::New();
573 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
576 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
578 parent.Remove(child);
579 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
581 // remove again, no problem
582 parent.Remove(child);
583 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
587 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
588 // try Remove self, its a no-op
589 parent.Remove(parent);
590 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
596 parent.Remove(empty);
597 tet_printf("Assertion test failed - no Exception\n");
598 tet_result(TET_FAIL);
600 catch(Dali::DaliException& e)
602 DALI_TEST_PRINT_ASSERT(e);
603 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
604 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
608 tet_printf("Assertion test failed - wrong Exception\n");
609 tet_result(TET_FAIL);
614 int UtcDaliActorRemoveP(void)
616 TestApplication application;
618 Actor parent = Actor::New();
619 Actor child = Actor::New();
620 Actor random = Actor::New();
622 application.GetScene().Add(parent);
624 DALI_TEST_CHECK(parent.GetChildCount() == 0);
628 DALI_TEST_CHECK(parent.GetChildCount() == 1);
630 parent.Remove(random);
632 DALI_TEST_CHECK(parent.GetChildCount() == 1);
634 application.GetScene().Remove(parent);
636 DALI_TEST_CHECK(parent.GetChildCount() == 1);
640 int UtcDaliActorSwitchParentN(void)
642 tet_infoline("Testing Actor::UtcDaliActorSwitchParentN");
643 TestApplication application;
645 Actor parent1 = Actor::New();
646 Actor child = Actor::New();
648 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
652 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
654 Actor parent2 = Actor::New();
656 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
658 // Try switch parent with that both of parent1 and parent2 are off scene.
659 DevelActor::SwitchParent(child, parent2);
661 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
662 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
666 int UtcDaliActorGetChildCount(void)
668 TestApplication application;
670 Actor parent = Actor::New();
671 Actor child = Actor::New();
673 DALI_TEST_CHECK(parent.GetChildCount() == 0);
677 DALI_TEST_CHECK(parent.GetChildCount() == 1);
681 int UtcDaliActorGetChildren01(void)
683 TestApplication application;
685 Actor parent = Actor::New();
686 Actor first = Actor::New();
687 Actor second = Actor::New();
688 Actor third = Actor::New();
694 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
695 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
696 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
700 int UtcDaliActorGetChildren02(void)
702 TestApplication application;
704 Actor parent = Actor::New();
705 Actor first = Actor::New();
706 Actor second = Actor::New();
707 Actor third = Actor::New();
713 const Actor& constParent = parent;
715 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
716 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
717 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
721 int UtcDaliActorGetParent01(void)
723 TestApplication application;
725 Actor parent = Actor::New();
726 Actor child = Actor::New();
730 DALI_TEST_CHECK(child.GetParent() == parent);
734 int UtcDaliActorGetParent02(void)
736 TestApplication application;
738 Actor actor = Actor::New();
740 DALI_TEST_CHECK(!actor.GetParent());
744 int UtcDaliActorCustomProperty(void)
746 TestApplication application;
748 Actor actor = Actor::New();
749 application.GetScene().Add(actor);
751 float startValue(1.0f);
752 Property::Index index = actor.RegisterProperty("testProperty", startValue);
753 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
755 application.SendNotification();
756 application.Render(0);
757 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
759 actor.SetProperty(index, 5.0f);
761 application.SendNotification();
762 application.Render(0);
763 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
767 int UtcDaliActorCustomPropertyIntToFloat(void)
769 TestApplication application;
771 Actor actor = Actor::New();
772 application.GetScene().Add(actor);
774 float startValue(5.0f);
775 Property::Index index = actor.RegisterProperty("testProperty", startValue);
776 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
778 application.SendNotification();
779 application.Render(0);
780 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
782 actor.SetProperty(index, int(1));
784 application.SendNotification();
785 application.Render(0);
786 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
790 int UtcDaliActorCustomPropertyFloatToInt(void)
792 TestApplication application;
794 Actor actor = Actor::New();
795 application.GetScene().Add(actor);
798 Property::Index index = actor.RegisterProperty("testProperty", startValue);
799 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
801 application.SendNotification();
802 application.Render(0);
803 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
805 actor.SetProperty(index, float(1.5));
807 application.SendNotification();
808 application.Render(0);
809 DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
813 int UtcDaliActorSetParentOrigin(void)
815 TestApplication application;
817 Actor actor = Actor::New();
819 Vector3 vector(0.7f, 0.8f, 0.9f);
820 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
822 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
824 // flush the queue and render once
825 application.SendNotification();
826 application.Render();
828 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
830 application.GetScene().Add(actor);
832 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
834 // flush the queue and render once
835 application.SendNotification();
836 application.Render();
838 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
840 application.GetScene().Remove(actor);
844 int UtcDaliActorSetParentOriginIndividual(void)
846 TestApplication application;
848 Actor actor = Actor::New();
850 Vector3 vector(0.7f, 0.8f, 0.9f);
851 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
853 actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
855 // flush the queue and render once
856 application.SendNotification();
857 application.Render();
859 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
861 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
863 // flush the queue and render once
864 application.SendNotification();
865 application.Render();
867 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
869 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
871 // flush the queue and render once
872 application.SendNotification();
873 application.Render();
875 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
880 int UtcDaliActorGetCurrentParentOrigin(void)
882 TestApplication application;
884 Actor actor = Actor::New();
886 Vector3 vector(0.7f, 0.8f, 0.9f);
887 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
889 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
891 // flush the queue and render once
892 application.SendNotification();
893 application.Render();
895 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
899 int UtcDaliActorSetAnchorPoint(void)
901 TestApplication application;
903 Actor actor = Actor::New();
905 Vector3 vector(0.7f, 0.8f, 0.9f);
906 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
908 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
910 // flush the queue and render once
911 application.SendNotification();
912 application.Render();
914 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
916 application.GetScene().Add(actor);
918 actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
919 // flush the queue and render once
920 application.SendNotification();
921 application.Render();
923 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
925 application.GetScene().Remove(actor);
929 int UtcDaliActorSetAnchorPointIndividual(void)
931 TestApplication application;
933 Actor actor = Actor::New();
935 Vector3 vector(0.7f, 0.8f, 0.9f);
936 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
938 actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
940 // flush the queue and render once
941 application.SendNotification();
942 application.Render();
944 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
946 actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
948 // flush the queue and render once
949 application.SendNotification();
950 application.Render();
952 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
954 actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
956 // flush the queue and render once
957 application.SendNotification();
958 application.Render();
960 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
965 int UtcDaliActorGetCurrentAnchorPoint(void)
967 TestApplication application;
969 Actor actor = Actor::New();
971 Vector3 vector(0.7f, 0.8f, 0.9f);
972 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
974 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
976 // flush the queue and render once
977 application.SendNotification();
978 application.Render();
980 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
984 int UtcDaliActorSetSize01(void)
986 TestApplication application;
988 Actor actor = Actor::New();
989 Vector3 vector(100.0f, 100.0f, 0.0f);
991 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
993 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
995 // Immediately retrieve the size after setting
996 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
997 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
998 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
999 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1000 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1002 // Flush the queue and render once
1003 application.SendNotification();
1004 application.Render();
1006 // Check the size in the new frame
1007 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1009 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1010 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1011 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1012 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1013 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1015 // Check async behaviour
1016 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
1017 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1018 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1019 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1020 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1022 // Change the resize policy and check whether the size stays the same
1023 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1025 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1026 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1028 // Set a new size after resize policy is changed and check the new size
1029 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1031 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1032 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1034 // Change the resize policy again and check whether the new size stays the same
1035 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1037 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1038 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1040 // Set another new size after resize policy is changed and check the new size
1041 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1043 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1044 DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1049 int UtcDaliActorSetSize02(void)
1051 TestApplication application;
1053 Actor actor = Actor::New();
1054 Vector3 vector(100.0f, 100.0f, 100.0f);
1056 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1058 actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1060 // Immediately check the size after setting
1061 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1062 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1064 // flush the queue and render once
1065 application.SendNotification();
1066 application.Render();
1068 // Check the size in the new frame
1069 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1071 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1072 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1077 // SetSize(Vector2 size)
1078 int UtcDaliActorSetSize03(void)
1080 TestApplication application;
1082 Actor actor = Actor::New();
1083 Vector3 vector(100.0f, 100.0f, 0.0f);
1085 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1087 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1089 // Immediately check the size after setting
1090 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1091 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1093 // flush the queue and render once
1094 application.SendNotification();
1095 application.Render();
1097 // Check the size in the new frame
1098 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1100 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1101 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1106 // SetSize(Vector3 size)
1107 int UtcDaliActorSetSize04(void)
1109 TestApplication application;
1111 Actor actor = Actor::New();
1112 Vector3 vector(100.0f, 100.0f, 100.0f);
1114 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1116 actor.SetProperty(Actor::Property::SIZE, vector);
1118 // Immediately check the size after setting
1119 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1120 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1122 // flush the queue and render once
1123 application.SendNotification();
1124 application.Render();
1126 // Check the size in the new frame
1127 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1129 application.GetScene().Add(actor);
1130 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1132 // Immediately check the size after setting
1133 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1134 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1136 // flush the queue and render once
1137 application.SendNotification();
1138 application.Render();
1140 // Check the size in the new frame
1141 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1143 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1144 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1146 application.GetScene().Remove(actor);
1150 int UtcDaliActorSetSizeIndividual(void)
1152 TestApplication application;
1154 Actor actor = Actor::New();
1156 Vector3 vector(0.7f, 0.8f, 0.9f);
1157 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1159 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1161 // Immediately check the width after setting
1162 float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1163 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1165 // flush the queue and render once
1166 application.SendNotification();
1167 application.Render();
1169 // Check the width in the new frame
1170 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1172 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1173 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1175 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1177 // Immediately check the height after setting
1178 float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1179 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1181 // flush the queue and render once
1182 application.SendNotification();
1183 application.Render();
1185 // Check the height in the new frame
1186 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1188 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1189 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1191 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1193 // Immediately check the depth after setting
1194 float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1195 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1197 // flush the queue and render once
1198 application.SendNotification();
1199 application.Render();
1201 // Check the depth in the new frame
1202 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1204 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1205 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1207 // Change the resize policy and check whether the size stays the same
1208 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1210 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1211 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1213 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1214 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1216 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1217 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1219 // Change the resize policy again and check whether the size stays the same
1220 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1222 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1223 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1225 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1226 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1228 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1229 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1234 int UtcDaliActorSetSizeIndividual02(void)
1236 TestApplication application;
1238 Actor actor = Actor::New();
1239 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1240 application.GetScene().Add(actor);
1242 Vector3 vector(100.0f, 200.0f, 400.0f);
1243 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1245 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1246 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1248 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1249 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1251 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1252 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1254 // flush the queue and render once
1255 application.SendNotification();
1256 application.Render();
1258 // Check the width in the new frame
1259 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1260 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1265 int UtcDaliActorGetCurrentSize(void)
1267 TestApplication application;
1269 Actor actor = Actor::New();
1270 Vector3 vector(100.0f, 100.0f, 20.0f);
1272 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1274 actor.SetProperty(Actor::Property::SIZE, vector);
1276 // flush the queue and render once
1277 application.SendNotification();
1278 application.Render();
1280 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1284 int UtcDaliActorGetNaturalSize(void)
1286 TestApplication application;
1288 Actor actor = Actor::New();
1289 Vector3 vector(0.0f, 0.0f, 0.0f);
1291 DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1296 int UtcDaliActorGetCurrentSizeImmediate(void)
1298 TestApplication application;
1300 Actor actor = Actor::New();
1301 Vector3 vector(100.0f, 100.0f, 20.0f);
1303 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1304 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1306 actor.SetProperty(Actor::Property::SIZE, vector);
1308 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1309 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1311 // flush the queue and render once
1312 application.SendNotification();
1313 application.Render();
1315 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1316 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1319 // Build the animation
1320 const float durationSeconds = 2.0f;
1321 Animation animation = Animation::New(durationSeconds);
1322 const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1323 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1325 DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1327 application.GetScene().Add(actor);
1329 // Start the animation
1332 application.SendNotification();
1333 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1335 DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1340 int UtcDaliActorCalculateScreenExtents(void)
1342 TestApplication application;
1344 Actor actor = Actor::New();
1346 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1347 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1349 application.SendNotification();
1350 application.Render();
1352 auto expectedExtent = Rect<>{-0.5f, -0.5f, 1.0f, 1.0f};
1353 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1354 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1355 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1356 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1357 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1359 application.GetScene().Remove(actor);
1363 // SetPosition(float x, float y)
1364 int UtcDaliActorSetPosition01(void)
1366 TestApplication application;
1368 Actor actor = Actor::New();
1370 // Set to random to start off with
1371 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1373 Vector3 vector(100.0f, 100.0f, 0.0f);
1375 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1377 actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1378 // flush the queue and render once
1379 application.SendNotification();
1380 application.Render();
1381 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1383 application.GetScene().Add(actor);
1384 actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1385 // flush the queue and render once
1386 application.SendNotification();
1387 application.Render();
1388 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1390 actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1391 actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1392 actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1393 // flush the queue and render once
1394 application.SendNotification();
1395 application.Render();
1396 DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1398 actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1399 // flush the queue and render once
1400 application.SendNotification();
1401 application.Render();
1402 DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1404 application.GetScene().Remove(actor);
1408 // SetPosition(float x, float y, float z)
1409 int UtcDaliActorSetPosition02(void)
1411 TestApplication application;
1413 Actor actor = Actor::New();
1415 // Set to random to start off with
1416 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1418 Vector3 vector(100.0f, 100.0f, 100.0f);
1420 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1422 actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1424 // flush the queue and render once
1425 application.SendNotification();
1426 application.Render();
1428 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1432 // SetPosition(Vector3 position)
1433 int UtcDaliActorSetPosition03(void)
1435 TestApplication application;
1437 Actor actor = Actor::New();
1439 // Set to random to start off with
1440 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1442 Vector3 vector(100.0f, 100.0f, 100.0f);
1444 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1446 actor.SetProperty(Actor::Property::POSITION, vector);
1448 // flush the queue and render once
1449 application.SendNotification();
1450 application.Render();
1452 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1456 int UtcDaliActorSetX(void)
1458 TestApplication application;
1460 Actor actor = Actor::New();
1462 Vector3 vector(100.0f, 0.0f, 0.0f);
1464 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1466 actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1468 // flush the queue and render once
1469 application.SendNotification();
1470 application.Render();
1472 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1476 int UtcDaliActorSetY(void)
1478 TestApplication application;
1480 Actor actor = Actor::New();
1482 Vector3 vector(0.0f, 100.0f, 0.0f);
1484 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1486 actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1488 // flush the queue and render once
1489 application.SendNotification();
1490 application.Render();
1492 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1496 int UtcDaliActorSetZ(void)
1498 TestApplication application;
1500 Actor actor = Actor::New();
1502 Vector3 vector(0.0f, 0.0f, 100.0f);
1504 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1506 actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1508 // flush the queue and render once
1509 application.SendNotification();
1510 application.Render();
1512 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1516 int UtcDaliActorSetPositionProperties(void)
1518 TestApplication application;
1520 Actor actor = Actor::New();
1522 Vector3 vector(0.7f, 0.8f, 0.9f);
1523 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1525 actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1526 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1527 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1529 // flush the queue and render once
1530 application.SendNotification();
1531 application.Render();
1533 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1534 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1535 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1536 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1537 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1539 actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1540 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1541 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1543 // flush the queue and render once
1544 application.SendNotification();
1545 application.Render();
1547 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1548 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1549 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1550 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1551 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1553 actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
1554 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1555 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1557 // flush the queue and render once
1558 application.SendNotification();
1559 application.Render();
1561 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1562 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1563 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1564 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1565 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1570 int UtcDaliActorTranslateBy(void)
1572 TestApplication application;
1574 Actor actor = Actor::New();
1575 Vector3 vector(100.0f, 100.0f, 100.0f);
1577 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1579 actor.SetProperty(Actor::Property::POSITION, vector);
1581 // flush the queue and render once
1582 application.SendNotification();
1583 application.Render();
1585 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1587 actor.TranslateBy(vector);
1589 // flush the queue and render once
1590 application.SendNotification();
1591 application.Render();
1593 DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1597 int UtcDaliActorGetCurrentPosition(void)
1599 TestApplication application;
1601 Actor actor = Actor::New();
1602 Vector3 setVector(100.0f, 100.0f, 0.0f);
1603 actor.SetProperty(Actor::Property::POSITION, setVector);
1605 // flush the queue and render once
1606 application.SendNotification();
1607 application.Render();
1609 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
1613 int UtcDaliActorGetCurrentWorldPosition(void)
1615 TestApplication application;
1617 Actor parent = Actor::New();
1618 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1619 parent.SetProperty(Actor::Property::POSITION, parentPosition);
1620 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1621 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1622 application.GetScene().Add(parent);
1624 Actor child = Actor::New();
1625 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1626 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1627 Vector3 childPosition(6.0f, 6.0f, 6.0f);
1628 child.SetProperty(Actor::Property::POSITION, childPosition);
1631 // The actors should not have a world position yet
1632 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1633 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1635 application.SendNotification();
1636 application.Render(0);
1638 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1639 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1641 // The actors should have a world position now
1642 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1643 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1647 int UtcDaliActorSetInheritPosition(void)
1649 tet_infoline("Testing Actor::SetInheritPosition");
1650 TestApplication application;
1652 Actor parent = Actor::New();
1653 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1654 parent.SetProperty(Actor::Property::POSITION, parentPosition);
1655 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1656 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1657 application.GetScene().Add(parent);
1659 Actor child = Actor::New();
1660 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1661 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1662 Vector3 childPosition(10.0f, 11.0f, 12.0f);
1663 child.SetProperty(Actor::Property::POSITION, childPosition);
1666 // The actors should not have a world position yet
1667 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1668 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1670 // first test default, which is to inherit position
1671 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1672 application.SendNotification();
1673 application.Render(0); // should only really call Update as Render is not required to update scene
1674 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1675 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
1676 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1677 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
1679 //Change child position
1680 Vector3 childOffset(-1.0f, 1.0f, 0.0f);
1681 child.SetProperty(Actor::Property::POSITION, childOffset);
1683 // Use local position as world postion
1684 child.SetProperty(Actor::Property::INHERIT_POSITION, false);
1685 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
1686 application.SendNotification();
1687 application.Render(0); // should only really call Update as Render is not required to update scene
1688 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1689 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1690 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1691 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
1693 //Change back to inherit position from parent
1694 child.SetProperty(Actor::Property::INHERIT_POSITION, true);
1695 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
1696 application.SendNotification();
1697 application.Render(0); // should only really call Update as Render is not required to update scene
1698 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
1699 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
1700 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
1701 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
1705 int UtcDaliActorInheritOpacity(void)
1707 tet_infoline("Testing Actor::Inherit Opacity");
1708 TestApplication application;
1710 Actor parent = Actor::New();
1711 Actor child = Actor::New();
1713 application.GetScene().Add(parent);
1715 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1716 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1718 // flush the queue and render once
1719 application.SendNotification();
1720 application.Render();
1722 parent.SetProperty(Actor::Property::OPACITY, 0.1f);
1724 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1725 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
1727 application.SendNotification();
1728 application.Render();
1730 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1731 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
1732 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1733 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1734 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
1735 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
1740 // SetOrientation(float angleRadians, Vector3 axis)
1741 int UtcDaliActorSetOrientation01(void)
1743 TestApplication application;
1745 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1746 Actor actor = Actor::New();
1748 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1750 // flush the queue and render once
1751 application.SendNotification();
1752 application.Render();
1754 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1758 int UtcDaliActorSetOrientation02(void)
1760 TestApplication application;
1762 Actor actor = Actor::New();
1764 Radian angle(0.785f);
1765 Vector3 axis(1.0f, 1.0f, 0.0f);
1767 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1768 Quaternion rotation(angle, axis);
1769 // flush the queue and render once
1770 application.SendNotification();
1771 application.Render();
1772 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1774 application.GetScene().Add(actor);
1775 actor.RotateBy(Degree(360), axis);
1776 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1778 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
1779 Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
1780 // flush the queue and render once
1781 application.SendNotification();
1782 application.Render();
1783 DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1785 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
1786 // flush the queue and render once
1787 application.SendNotification();
1788 application.Render();
1789 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1791 application.GetScene().Remove(actor);
1795 // SetOrientation(float angleRadians, Vector3 axis)
1796 int UtcDaliActorSetOrientationProperty(void)
1798 TestApplication application;
1800 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1801 Actor actor = Actor::New();
1803 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1804 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1806 // flush the queue and render once
1807 application.SendNotification();
1808 application.Render();
1810 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1811 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1812 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1816 // RotateBy(float angleRadians, Vector3 axis)
1817 int UtcDaliActorRotateBy01(void)
1819 TestApplication application;
1821 Actor actor = Actor::New();
1823 Radian angle(M_PI * 0.25f);
1824 actor.RotateBy((angle), Vector3::ZAXIS);
1825 // flush the queue and render once
1826 application.SendNotification();
1827 application.Render();
1828 DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1830 application.GetScene().Add(actor);
1832 actor.RotateBy(angle, Vector3::ZAXIS);
1833 // flush the queue and render once
1834 application.SendNotification();
1835 application.Render();
1836 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1838 application.GetScene().Remove(actor);
1842 // RotateBy(Quaternion relativeRotation)
1843 int UtcDaliActorRotateBy02(void)
1845 TestApplication application;
1847 Actor actor = Actor::New();
1849 Radian angle(M_PI * 0.25f);
1850 Quaternion rotation(angle, Vector3::ZAXIS);
1851 actor.RotateBy(rotation);
1852 // flush the queue and render once
1853 application.SendNotification();
1854 application.Render();
1855 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1857 actor.RotateBy(rotation);
1858 // flush the queue and render once
1859 application.SendNotification();
1860 application.Render();
1861 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1865 int UtcDaliActorGetCurrentOrientation(void)
1867 TestApplication application;
1868 Actor actor = Actor::New();
1870 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1871 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
1872 // flush the queue and render once
1873 application.SendNotification();
1874 application.Render();
1875 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
1879 int UtcDaliActorGetCurrentWorldOrientation(void)
1881 tet_infoline("Testing Actor::GetCurrentWorldRotation");
1882 TestApplication application;
1884 Actor parent = Actor::New();
1885 Radian rotationAngle(Degree(90.0f));
1886 Quaternion rotation(rotationAngle, Vector3::YAXIS);
1887 parent.SetProperty(Actor::Property::ORIENTATION, rotation);
1888 application.GetScene().Add(parent);
1890 Actor child = Actor::New();
1891 child.SetProperty(Actor::Property::ORIENTATION, rotation);
1894 // The actors should not have a world rotation yet
1895 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1896 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
1898 application.SendNotification();
1899 application.Render(0);
1901 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1902 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
1904 // The actors should have a world rotation now
1905 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1906 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
1908 // turn off child rotation inheritance
1909 child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
1910 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
1911 application.SendNotification();
1912 application.Render(0);
1914 // The actors should have a world rotation now
1915 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
1916 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
1920 // SetScale(float scale)
1921 int UtcDaliActorSetScale01(void)
1923 TestApplication application;
1925 Actor actor = Actor::New();
1927 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1928 actor.SetProperty(Actor::Property::SCALE, 0.25f);
1930 Vector3 scale(10.0f, 10.0f, 10.0f);
1931 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1933 actor.SetProperty(Actor::Property::SCALE, scale.x);
1935 // flush the queue and render once
1936 application.SendNotification();
1937 application.Render();
1939 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1943 // SetScale(float scaleX, float scaleY, float scaleZ)
1944 int UtcDaliActorSetScale02(void)
1946 TestApplication application;
1947 Vector3 scale(10.0f, 10.0f, 10.0f);
1949 Actor actor = Actor::New();
1951 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1952 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1954 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1956 actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
1957 // flush the queue and render once
1958 application.SendNotification();
1959 application.Render();
1960 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1962 // add to stage and test
1963 application.GetScene().Add(actor);
1964 actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
1965 // flush the queue and render once
1966 application.SendNotification();
1967 application.Render();
1968 DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
1970 application.GetScene().Remove(actor);
1975 // SetScale(Vector3 scale)
1976 int UtcDaliActorSetScale03(void)
1978 TestApplication application;
1979 Vector3 scale(10.0f, 10.0f, 10.0f);
1981 Actor actor = Actor::New();
1983 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1984 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
1986 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
1988 actor.SetProperty(Actor::Property::SCALE, scale);
1990 // flush the queue and render once
1991 application.SendNotification();
1992 application.Render();
1994 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
1998 int UtcDaliActorSetScaleIndividual(void)
2000 TestApplication application;
2002 Actor actor = Actor::New();
2004 Vector3 vector(0.7f, 0.8f, 0.9f);
2005 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2007 actor.SetProperty(Actor::Property::SCALE_X, vector.x);
2008 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2010 // flush the queue and render once
2011 application.SendNotification();
2012 application.Render();
2014 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
2015 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2016 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2018 actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
2019 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2021 // flush the queue and render once
2022 application.SendNotification();
2023 application.Render();
2025 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
2026 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2027 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2029 actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2030 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2032 // flush the queue and render once
2033 application.SendNotification();
2034 application.Render();
2036 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2037 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2038 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2040 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2041 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2046 int UtcDaliActorScaleBy(void)
2048 TestApplication application;
2049 Actor actor = Actor::New();
2050 Vector3 vector(100.0f, 100.0f, 100.0f);
2052 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2054 actor.SetProperty(Actor::Property::SCALE, vector);
2056 // flush the queue and render once
2057 application.SendNotification();
2058 application.Render();
2060 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2062 actor.ScaleBy(vector);
2064 // flush the queue and render once
2065 application.SendNotification();
2066 application.Render();
2068 DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2072 int UtcDaliActorGetCurrentScale(void)
2074 TestApplication application;
2075 Vector3 scale(12.0f, 1.0f, 2.0f);
2077 Actor actor = Actor::New();
2079 actor.SetProperty(Actor::Property::SCALE, scale);
2081 // flush the queue and render once
2082 application.SendNotification();
2083 application.Render();
2085 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2089 int UtcDaliActorGetCurrentWorldScale(void)
2091 TestApplication application;
2093 Actor parent = Actor::New();
2094 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2095 parent.SetProperty(Actor::Property::SCALE, parentScale);
2096 application.GetScene().Add(parent);
2098 Actor child = Actor::New();
2099 Vector3 childScale(2.0f, 2.0f, 2.0f);
2100 child.SetProperty(Actor::Property::SCALE, childScale);
2103 // The actors should not have a scale yet
2104 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2105 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2107 // The actors should not have a world scale yet
2108 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2109 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2111 application.SendNotification();
2112 application.Render(0);
2114 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2115 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2117 // The actors should have a world scale now
2118 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2119 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2123 int UtcDaliActorInheritScale(void)
2125 tet_infoline("Testing Actor::SetInheritScale");
2126 TestApplication application;
2128 Actor parent = Actor::New();
2129 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2130 parent.SetProperty(Actor::Property::SCALE, parentScale);
2131 application.GetScene().Add(parent);
2133 Actor child = Actor::New();
2134 Vector3 childScale(2.0f, 2.0f, 2.0f);
2135 child.SetProperty(Actor::Property::SCALE, childScale);
2138 application.SendNotification();
2139 application.Render(0);
2141 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2142 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2144 child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2145 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2147 application.SendNotification();
2148 application.Render(0);
2150 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2154 int UtcDaliActorSetVisible(void)
2156 TestApplication application;
2158 Actor actor = Actor::New();
2159 actor.SetProperty(Actor::Property::VISIBLE, false);
2160 // flush the queue and render once
2161 application.SendNotification();
2162 application.Render();
2163 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2165 actor.SetProperty(Actor::Property::VISIBLE, true);
2166 // flush the queue and render once
2167 application.SendNotification();
2168 application.Render();
2169 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2171 // put actor on stage
2172 application.GetScene().Add(actor);
2173 actor.SetProperty(Actor::Property::VISIBLE, false);
2174 // flush the queue and render once
2175 application.SendNotification();
2176 application.Render();
2177 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2181 int UtcDaliActorIsVisible(void)
2183 TestApplication application;
2185 Actor actor = Actor::New();
2187 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2191 int UtcDaliActorSetOpacity(void)
2193 TestApplication application;
2195 Actor actor = Actor::New();
2196 // initial opacity is 1
2197 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2199 actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2200 // flush the queue and render once
2201 application.SendNotification();
2202 application.Render();
2203 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2205 // change opacity, actor is on stage to change is not immediate
2206 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2207 // flush the queue and render once
2208 application.SendNotification();
2209 application.Render();
2210 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2212 // put actor on stage
2213 application.GetScene().Add(actor);
2215 // change opacity, actor is on stage to change is not immediate
2216 actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2217 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2218 // flush the queue and render once
2219 application.SendNotification();
2220 application.Render();
2221 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2223 // change opacity, actor is on stage to change is not immediate
2224 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2225 // flush the queue and render once
2226 application.SendNotification();
2227 application.Render();
2228 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2232 int UtcDaliActorGetCurrentOpacity(void)
2234 TestApplication application;
2236 Actor actor = Actor::New();
2237 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2239 actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2240 // flush the queue and render once
2241 application.SendNotification();
2242 application.Render();
2243 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2247 int UtcDaliActorSetSensitive(void)
2249 TestApplication application;
2250 Actor actor = Actor::New();
2252 bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2254 actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2256 DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2260 int UtcDaliActorIsSensitive(void)
2262 TestApplication application;
2263 Actor actor = Actor::New();
2264 actor.SetProperty(Actor::Property::SENSITIVE, false);
2266 DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2270 int UtcDaliActorSetColor(void)
2272 TestApplication application;
2273 Actor actor = Actor::New();
2274 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2276 DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2278 actor.SetProperty(Actor::Property::COLOR, color);
2279 // flush the queue and render once
2280 application.SendNotification();
2281 application.Render();
2282 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2284 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2285 // flush the queue and render once
2286 application.SendNotification();
2287 application.Render();
2288 DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2290 application.GetScene().Add(actor);
2291 actor.SetProperty(Actor::Property::COLOR, color);
2292 // flush the queue and render once
2293 application.SendNotification();
2294 application.Render();
2295 DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2297 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2298 // flush the queue and render once
2299 application.SendNotification();
2300 application.Render();
2301 // Actor color is not clamped
2302 DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2303 // world color is clamped
2304 DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2306 actor.SetProperty(Actor::Property::COLOR, color);
2307 DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2309 Vector3 newColor(1.0f, 0.0f, 0.0f);
2310 actor.SetProperty(Actor::Property::COLOR, newColor);
2311 DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2313 application.GetScene().Remove(actor);
2317 int UtcDaliActorSetColorIndividual(void)
2319 TestApplication application;
2321 Actor actor = Actor::New();
2323 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2324 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2326 actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2327 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2329 // flush the queue and render once
2330 application.SendNotification();
2331 application.Render();
2333 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2334 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2335 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2337 actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2338 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2340 // flush the queue and render once
2341 application.SendNotification();
2342 application.Render();
2344 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2345 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2346 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2348 actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2349 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2351 // flush the queue and render once
2352 application.SendNotification();
2353 application.Render();
2355 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2356 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2357 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2359 actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2360 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2362 // flush the queue and render once
2363 application.SendNotification();
2364 application.Render();
2366 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2367 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2368 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2370 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2371 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2373 actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2375 // flush the queue and render once
2376 application.SendNotification();
2377 application.Render();
2379 DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2384 int UtcDaliActorGetCurrentColor(void)
2386 TestApplication application;
2387 Actor actor = Actor::New();
2388 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2390 actor.SetProperty(Actor::Property::COLOR, color);
2391 // flush the queue and render once
2392 application.SendNotification();
2393 application.Render();
2394 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2398 int UtcDaliActorGetCurrentWorldColor(void)
2400 tet_infoline("Actor::GetCurrentWorldColor");
2401 TestApplication application;
2403 Actor parent = Actor::New();
2404 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2405 parent.SetProperty(Actor::Property::COLOR, parentColor);
2406 application.GetScene().Add(parent);
2408 Actor child = Actor::New();
2409 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2410 child.SetProperty(Actor::Property::COLOR, childColor);
2413 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2414 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2416 // verify the default color mode
2417 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2419 // The actors should not have a world color yet
2420 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2421 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2423 application.SendNotification();
2424 application.Render(0);
2426 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2427 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2429 // The actors should have a world color now
2430 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2431 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2434 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2435 application.SendNotification();
2436 application.Render(0);
2437 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2440 child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2441 application.SendNotification();
2442 application.Render(0);
2443 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2444 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2447 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2448 application.SendNotification();
2449 application.Render(0);
2450 Vector4 expectedColor(childColor);
2451 expectedColor.a *= parentColor.a;
2452 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2453 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2457 int UtcDaliActorSetColorMode(void)
2459 tet_infoline("Actor::SetColorMode");
2460 TestApplication application;
2461 Actor actor = Actor::New();
2462 Actor child = Actor::New();
2465 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2466 DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2468 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2469 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2471 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2472 DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2474 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2475 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2479 int UtcDaliActorScreenToLocal(void)
2481 TestApplication application;
2482 Actor actor = Actor::New();
2483 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2484 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2485 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2486 application.GetScene().Add(actor);
2488 // flush the queue and render once
2489 application.SendNotification();
2490 application.Render();
2495 application.SendNotification();
2496 application.Render();
2498 DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2500 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2501 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2505 int UtcDaliActorSetLeaveRequired(void)
2507 TestApplication application;
2509 Actor actor = Actor::New();
2511 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2512 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2514 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2515 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2519 int UtcDaliActorGetLeaveRequired(void)
2521 TestApplication application;
2523 Actor actor = Actor::New();
2525 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2529 int UtcDaliActorSetKeyboardFocusable(void)
2531 TestApplication application;
2533 Actor actor = Actor::New();
2535 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2536 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2538 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2539 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2543 int UtcDaliActorIsKeyboardFocusable(void)
2545 TestApplication application;
2547 Actor actor = Actor::New();
2549 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2553 int UtcDaliActorSetKeyboardFocusableChildren(void)
2555 TestApplication application;
2557 Actor actor = Actor::New();
2559 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
2560 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2562 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
2563 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
2567 int UtcDaliActorAreChildrenKeyBoardFocusable(void)
2569 TestApplication application;
2571 Actor actor = Actor::New();
2573 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2577 int UtcDaliActorSetTouchFocusable(void)
2579 TestApplication application;
2581 Actor actor = Actor::New();
2583 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
2584 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
2586 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
2587 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2591 int UtcDaliActorIsTouchFocusable(void)
2593 TestApplication application;
2595 Actor actor = Actor::New();
2597 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2601 int UtcDaliActorRemoveConstraints(void)
2603 tet_infoline(" UtcDaliActorRemoveConstraints");
2604 TestApplication application;
2606 gTestConstraintCalled = false;
2608 Actor actor = Actor::New();
2610 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
2612 actor.RemoveConstraints();
2614 DALI_TEST_CHECK(gTestConstraintCalled == false);
2616 application.GetScene().Add(actor);
2619 // flush the queue and render once
2620 application.SendNotification();
2621 application.Render();
2623 actor.RemoveConstraints();
2625 DALI_TEST_CHECK(gTestConstraintCalled == true);
2629 int UtcDaliActorRemoveConstraintTag(void)
2631 tet_infoline(" UtcDaliActorRemoveConstraintTag");
2632 TestApplication application;
2634 Actor actor = Actor::New();
2636 // 1. Apply Constraint1 and Constraint2, and test...
2637 unsigned int result1 = 0u;
2638 unsigned int result2 = 0u;
2640 unsigned constraint1Tag = 1u;
2641 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
2642 constraint1.SetTag(constraint1Tag);
2643 constraint1.Apply();
2645 unsigned constraint2Tag = 2u;
2646 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
2647 constraint2.SetTag(constraint2Tag);
2648 constraint2.Apply();
2650 application.GetScene().Add(actor);
2651 // flush the queue and render once
2652 application.SendNotification();
2653 application.Render();
2655 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2656 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2658 // 2. Remove Constraint1 and test...
2661 actor.RemoveConstraints(constraint1Tag);
2662 // make color property dirty, which will trigger constraints to be reapplied.
2663 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2664 // flush the queue and render once
2665 application.SendNotification();
2666 application.Render();
2668 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2669 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2671 // 3. Re-Apply Constraint1 and test...
2674 constraint1.Apply();
2675 // make color property dirty, which will trigger constraints to be reapplied.
2676 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2677 // flush the queue and render once
2678 application.SendNotification();
2679 application.Render();
2681 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2682 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2684 // 2. Remove Constraint2 and test...
2687 actor.RemoveConstraints(constraint2Tag);
2688 // make color property dirty, which will trigger constraints to be reapplied.
2689 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2690 // flush the queue and render once
2691 application.SendNotification();
2692 application.Render();
2694 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2695 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2697 // 2. Remove Constraint1 as well and test...
2700 actor.RemoveConstraints(constraint1Tag);
2701 // make color property dirty, which will trigger constraints to be reapplied.
2702 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2703 // flush the queue and render once
2704 application.SendNotification();
2705 application.Render();
2707 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2708 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2712 int UtcDaliActorTouchedSignal(void)
2714 TestApplication application;
2716 ResetTouchCallbacks();
2718 // get the root layer
2719 Actor actor = application.GetScene().GetRootLayer();
2720 DALI_TEST_CHECK(gTouchCallBackCalled == false);
2722 application.SendNotification();
2723 application.Render();
2725 // connect to its touch signal
2726 actor.TouchedSignal().Connect(TestTouchCallback);
2728 // simulate a touch event in the middle of the screen
2729 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2730 Dali::Integration::Point point;
2731 point.SetDeviceId(1);
2732 point.SetState(PointState::DOWN);
2733 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2734 Dali::Integration::TouchEvent touchEvent;
2735 touchEvent.AddPoint(point);
2736 application.ProcessEvent(touchEvent);
2738 DALI_TEST_CHECK(gTouchCallBackCalled == true);
2742 int UtcDaliActorHoveredSignal(void)
2744 TestApplication application;
2746 gHoverCallBackCalled = false;
2748 // get the root layer
2749 Actor actor = application.GetScene().GetRootLayer();
2750 DALI_TEST_CHECK(gHoverCallBackCalled == false);
2752 application.SendNotification();
2753 application.Render();
2755 // connect to its hover signal
2756 actor.HoveredSignal().Connect(TestCallback3);
2758 // simulate a hover event in the middle of the screen
2759 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2760 Dali::Integration::Point point;
2761 point.SetDeviceId(1);
2762 point.SetState(PointState::MOTION);
2763 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2764 Dali::Integration::HoverEvent hoverEvent;
2765 hoverEvent.AddPoint(point);
2766 application.ProcessEvent(hoverEvent);
2768 DALI_TEST_CHECK(gHoverCallBackCalled == true);
2772 int UtcDaliActorOnOffSceneSignal(void)
2774 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
2776 TestApplication application;
2779 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2780 gActorNamesOnOffScene.clear();
2782 Actor parent = Actor::New();
2783 parent.SetProperty(Actor::Property::NAME, "parent");
2784 parent.OnSceneSignal().Connect(OnSceneCallback);
2785 parent.OffSceneSignal().Connect(OffSceneCallback);
2787 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
2788 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
2790 // add parent to the scene
2791 application.GetScene().Add(parent);
2792 // onstage emitted, offstage not
2793 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2794 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2795 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2797 // test adding a child, should get onstage emitted
2799 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2800 gActorNamesOnOffScene.clear();
2802 Actor child = Actor::New();
2803 child.SetProperty(Actor::Property::NAME, "child");
2804 child.OnSceneSignal().Connect(OnSceneCallback);
2805 child.OffSceneSignal().Connect(OffSceneCallback);
2806 parent.Add(child); // add child
2807 // onscene emitted, offscene not
2808 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2809 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2810 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2812 // test removing parent from the scene
2814 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2815 gActorNamesOnOffScene.clear();
2817 application.GetScene().Remove(parent);
2818 // onscene not emitted, offscene is
2819 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2820 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
2821 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2822 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
2824 // test adding parent back to the scene
2826 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2827 gActorNamesOnOffScene.clear();
2829 application.GetScene().Add(parent);
2830 // onscene emitted, offscene not
2831 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
2832 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2833 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2834 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
2836 // test removing child
2838 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2839 gActorNamesOnOffScene.clear();
2841 parent.Remove(child);
2842 // onscene not emitted, offscene is
2843 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2844 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2845 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2847 // test removing parent
2849 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2850 gActorNamesOnOffScene.clear();
2852 application.GetScene().Remove(parent);
2853 // onscene not emitted, offscene is
2854 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2855 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2856 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2860 int UtcDaliActorFindChildByName(void)
2862 tet_infoline("Testing Dali::Actor::FindChildByName()");
2863 TestApplication application;
2865 Actor parent = Actor::New();
2866 parent.SetProperty(Actor::Property::NAME, "parent");
2867 Actor first = Actor::New();
2868 first.SetProperty(Actor::Property::NAME, "first");
2869 Actor second = Actor::New();
2870 second.SetProperty(Actor::Property::NAME, "second");
2875 Actor found = parent.FindChildByName("foo");
2876 DALI_TEST_CHECK(!found);
2878 found = parent.FindChildByName("parent");
2879 DALI_TEST_CHECK(found == parent);
2881 found = parent.FindChildByName("first");
2882 DALI_TEST_CHECK(found == first);
2884 found = parent.FindChildByName("second");
2885 DALI_TEST_CHECK(found == second);
2889 int UtcDaliActorFindChildById(void)
2891 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2892 TestApplication application;
2894 Actor parent = Actor::New();
2895 Actor first = Actor::New();
2896 Actor second = Actor::New();
2901 Actor found = parent.FindChildById(100000);
2902 DALI_TEST_CHECK(!found);
2904 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
2905 DALI_TEST_CHECK(found == parent);
2907 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
2908 DALI_TEST_CHECK(found == first);
2910 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
2911 DALI_TEST_CHECK(found == second);
2915 int UtcDaliActorHitTest(void)
2920 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
2922 mTouchPoint(touchPoint),
2928 Vector2 mTouchPoint;
2932 TestApplication application;
2933 tet_infoline(" UtcDaliActorHitTest");
2935 // Fill a vector with different hit tests.
2936 struct HitTestData* hitTestData[] = {
2937 // scale touch point result
2938 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
2939 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
2940 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.
2941 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
2942 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.
2946 // get the root layer
2947 Actor actor = Actor::New();
2948 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2949 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2951 application.GetScene().Add(actor);
2953 ResetTouchCallbacks();
2955 unsigned int index = 0;
2956 while(NULL != hitTestData[index])
2958 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
2959 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
2961 // flush the queue and render once
2962 application.SendNotification();
2963 application.Render();
2965 DALI_TEST_CHECK(!gTouchCallBackCalled);
2967 // connect to its touch signal
2968 actor.TouchedSignal().Connect(TestTouchCallback);
2970 Dali::Integration::Point point;
2971 point.SetState(PointState::DOWN);
2972 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
2973 Dali::Integration::TouchEvent event;
2974 event.AddPoint(point);
2976 // flush the queue and render once
2977 application.SendNotification();
2978 application.Render();
2979 application.ProcessEvent(event);
2981 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
2983 if(gTouchCallBackCalled != hitTestData[index]->mResult)
2984 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2985 hitTestData[index]->mScale.x,
2986 hitTestData[index]->mScale.y,
2987 hitTestData[index]->mScale.z,
2988 hitTestData[index]->mTouchPoint.x,
2989 hitTestData[index]->mTouchPoint.y,
2990 hitTestData[index]->mResult);
2992 ResetTouchCallbacks();
2998 int UtcDaliActorSetDrawMode(void)
3000 TestApplication application;
3001 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
3003 Actor a = Actor::New();
3005 application.GetScene().Add(a);
3006 application.SendNotification();
3007 application.Render(0);
3008 application.SendNotification();
3009 application.Render(1);
3011 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
3013 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3014 application.SendNotification();
3015 application.Render(1);
3017 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
3019 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3020 application.SendNotification();
3021 application.Render(1);
3023 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
3027 int UtcDaliActorSetDrawModeOverlayRender(void)
3029 TestApplication application;
3030 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
3032 application.SendNotification();
3033 application.Render(1);
3035 std::vector<GLuint> ids;
3036 ids.push_back(8); // first rendered actor
3037 ids.push_back(9); // second rendered actor
3038 ids.push_back(10); // third rendered actor
3039 application.GetGlAbstraction().SetNextTextureIds(ids);
3041 Texture imageA = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3042 Texture imageB = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3043 Texture imageC = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3044 Actor a = CreateRenderableActor(imageA);
3045 Actor b = CreateRenderableActor(imageB);
3046 Actor c = CreateRenderableActor(imageC);
3048 application.SendNotification();
3049 application.Render(1);
3051 //Textures are bound when first created. Clear bound textures vector
3052 application.GetGlAbstraction().ClearBoundTextures();
3054 // Render a,b,c as regular non-overlays. so order will be:
3058 application.GetScene().Add(a);
3059 application.GetScene().Add(b);
3060 application.GetScene().Add(c);
3062 application.SendNotification();
3063 application.Render(1);
3065 // Should be 3 textures changes.
3066 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3067 typedef std::vector<GLuint>::size_type TextureSize;
3068 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3069 if(boundTextures.size() == 3)
3071 DALI_TEST_CHECK(boundTextures[0] == 8u);
3072 DALI_TEST_CHECK(boundTextures[1] == 9u);
3073 DALI_TEST_CHECK(boundTextures[2] == 10u);
3076 // Now texture ids have been set, we can monitor their render order.
3077 // render a as an overlay (last), so order will be:
3081 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3082 application.GetGlAbstraction().ClearBoundTextures();
3084 application.SendNotification();
3085 application.Render(1);
3087 // Should be 3 texture changes.
3088 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3089 if(boundTextures.size() == 3)
3091 DALI_TEST_CHECK(boundTextures[0] == 9u);
3092 DALI_TEST_CHECK(boundTextures[1] == 10u);
3093 DALI_TEST_CHECK(boundTextures[2] == 8u);
3098 int UtcDaliActorGetCurrentWorldMatrix(void)
3100 TestApplication application;
3101 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3103 Actor parent = Actor::New();
3104 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3105 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3106 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3107 Radian rotationAngle(Degree(85.0f));
3108 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3109 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3110 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3111 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3112 parent.SetProperty(Actor::Property::SCALE, parentScale);
3113 application.GetScene().Add(parent);
3115 Actor child = Actor::New();
3116 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3117 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3118 Radian childRotationAngle(Degree(23.0f));
3119 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3120 Vector3 childScale(2.0f, 2.0f, 2.0f);
3121 child.SetProperty(Actor::Property::POSITION, childPosition);
3122 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3123 child.SetProperty(Actor::Property::SCALE, childScale);
3126 application.SendNotification();
3127 application.Render(0);
3128 application.Render();
3129 application.SendNotification();
3131 Matrix parentMatrix(false);
3132 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3134 Matrix childMatrix(false);
3135 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3137 //Child matrix should be the composition of child and parent
3138 Matrix childWorldMatrix(false);
3139 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3141 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3142 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3146 int UtcDaliActorConstrainedToWorldMatrix(void)
3148 TestApplication application;
3149 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3151 Actor parent = Actor::New();
3152 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3153 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3154 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3155 Radian rotationAngle(Degree(85.0f));
3156 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3157 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3158 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3159 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3160 parent.SetProperty(Actor::Property::SCALE, parentScale);
3161 application.GetScene().Add(parent);
3163 Actor child = Actor::New();
3164 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3165 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3166 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3167 posConstraint.Apply();
3169 application.GetScene().Add(child);
3171 application.SendNotification();
3172 application.Render(0);
3173 application.Render();
3174 application.SendNotification();
3176 Matrix parentMatrix(false);
3177 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3179 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3180 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3184 int UtcDaliActorConstrainedToOrientation(void)
3186 TestApplication application;
3187 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3189 Actor parent = Actor::New();
3190 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3191 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3192 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3193 Radian rotationAngle(Degree(85.0f));
3194 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3195 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3196 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3197 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3198 parent.SetProperty(Actor::Property::SCALE, parentScale);
3199 application.GetScene().Add(parent);
3201 Actor child = Actor::New();
3202 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3203 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3204 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3205 posConstraint.Apply();
3207 application.GetScene().Add(child);
3209 application.SendNotification();
3210 application.Render(0);
3211 application.Render();
3212 application.SendNotification();
3214 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3218 int UtcDaliActorConstrainedToOpacity(void)
3220 TestApplication application;
3221 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3223 Actor parent = Actor::New();
3224 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3225 application.GetScene().Add(parent);
3227 Actor child = Actor::New();
3228 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3229 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3230 opacityConstraint.Apply();
3232 application.GetScene().Add(child);
3234 application.SendNotification();
3235 application.Render(0);
3236 application.Render();
3237 application.SendNotification();
3239 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3241 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3243 application.SendNotification();
3244 application.Render(0);
3245 application.Render();
3246 application.SendNotification();
3248 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3253 int UtcDaliActorUnparent(void)
3255 TestApplication application;
3256 tet_infoline(" UtcDaliActorUnparent");
3258 Actor parent = Actor::New();
3259 application.GetScene().Add(parent);
3261 Actor child = Actor::New();
3263 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3264 DALI_TEST_CHECK(!child.GetParent());
3266 // Test that calling Unparent with no parent is a NOOP
3269 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3270 DALI_TEST_CHECK(!child.GetParent());
3272 // Test that Unparent works
3275 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3276 DALI_TEST_CHECK(parent == child.GetParent());
3280 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3281 DALI_TEST_CHECK(!child.GetParent());
3283 // Test that UnparentAndReset works
3286 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3287 DALI_TEST_CHECK(parent == child.GetParent());
3289 UnparentAndReset(child);
3291 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3292 DALI_TEST_CHECK(!child);
3294 // Test that UnparentAndReset is a NOOP with empty handle
3295 UnparentAndReset(child);
3297 DALI_TEST_CHECK(!child);
3301 int UtcDaliActorGetChildAt(void)
3303 TestApplication application;
3304 tet_infoline(" UtcDaliActorGetChildAt");
3306 Actor parent = Actor::New();
3307 application.GetScene().Add(parent);
3309 Actor child0 = Actor::New();
3312 Actor child1 = Actor::New();
3315 Actor child2 = Actor::New();
3318 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3319 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3320 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3324 int UtcDaliActorSetGetOverlay(void)
3326 TestApplication application;
3327 tet_infoline(" UtcDaliActorSetGetOverlay");
3329 Actor parent = Actor::New();
3330 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3331 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3335 int UtcDaliActorCreateDestroy(void)
3337 Actor* actor = new Actor;
3338 DALI_TEST_CHECK(actor);
3345 struct PropertyStringIndex
3347 const char* const name;
3348 const Property::Index index;
3349 const Property::Type type;
3352 const PropertyStringIndex PROPERTY_TABLE[] =
3354 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3355 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3356 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3357 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3358 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3359 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3360 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3361 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3362 {"size", Actor::Property::SIZE, Property::VECTOR3},
3363 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3364 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3365 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3366 {"position", Actor::Property::POSITION, Property::VECTOR3},
3367 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3368 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3369 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3370 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3371 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3372 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
3373 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
3374 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
3375 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
3376 {"scale", Actor::Property::SCALE, Property::VECTOR3},
3377 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
3378 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
3379 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
3380 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
3381 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
3382 {"color", Actor::Property::COLOR, Property::VECTOR4},
3383 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
3384 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
3385 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
3386 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
3387 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
3388 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
3389 {"name", Actor::Property::NAME, Property::STRING},
3390 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
3391 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
3392 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
3393 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
3394 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
3395 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
3396 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
3397 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
3398 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
3399 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
3400 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
3401 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
3402 {"padding", Actor::Property::PADDING, Property::VECTOR4},
3403 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
3404 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
3405 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
3406 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
3407 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
3409 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
3410 } // unnamed namespace
3412 int UtcDaliActorProperties(void)
3414 TestApplication application;
3416 Actor actor = Actor::New();
3418 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
3420 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
3421 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
3422 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
3423 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
3428 int UtcDaliRelayoutProperties_ResizePolicies(void)
3430 TestApplication application;
3432 Actor actor = Actor::New();
3435 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3436 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3438 // Set resize policy for all dimensions
3439 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
3440 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3442 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
3445 // Set individual dimensions
3446 const char* const widthPolicy = "FILL_TO_PARENT";
3447 const char* const heightPolicy = "FIXED";
3449 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
3450 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
3452 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
3453 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
3455 // Set individual dimensions using enums
3456 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
3457 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3459 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
3460 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
3462 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
3463 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
3468 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3470 TestApplication application;
3472 Actor actor = Actor::New();
3475 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
3477 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3478 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
3479 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
3482 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
3483 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3485 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
3486 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
3488 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
3489 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
3494 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3496 TestApplication application;
3498 Actor actor = Actor::New();
3501 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3502 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3504 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
3505 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
3506 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
3509 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
3511 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
3512 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
3517 int UtcDaliRelayoutProperties_DimensionDependency(void)
3519 TestApplication application;
3521 Actor actor = Actor::New();
3524 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3525 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
3528 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
3529 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
3531 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
3532 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
3534 // Test setting another resize policy
3535 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
3536 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3541 int UtcDaliRelayoutProperties_Padding(void)
3543 TestApplication application;
3545 Actor actor = Actor::New();
3548 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
3551 actor.SetProperty(Actor::Property::PADDING, padding);
3552 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
3554 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3559 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3561 TestApplication application;
3563 Actor actor = Actor::New();
3566 Vector2 minSize(1.0f, 2.0f);
3568 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
3569 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
3571 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3573 Vector2 maxSize(3.0f, 4.0f);
3575 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
3576 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
3578 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3583 int UtcDaliActorGetHeightForWidth(void)
3585 TestApplication application;
3587 Actor actor = Actor::New();
3589 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
3594 int UtcDaliActorGetWidthForHeight(void)
3596 TestApplication application;
3598 Actor actor = Actor::New();
3600 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
3605 int UtcDaliActorGetRelayoutSize(void)
3607 TestApplication application;
3609 Actor actor = Actor::New();
3611 // Add actor to stage
3612 application.GetScene().Add(actor);
3614 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
3616 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
3617 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
3619 // Flush the queue and render once
3620 application.SendNotification();
3621 application.Render();
3623 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
3628 int UtcDaliActorSetPadding(void)
3630 TestApplication application;
3632 Actor actor = Actor::New();
3635 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3637 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
3638 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
3639 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
3640 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
3642 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
3643 actor.SetProperty(Actor::Property::PADDING, padding2);
3645 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3647 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
3648 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
3649 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
3650 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
3655 int UtcDaliActorSetMinimumSize(void)
3657 TestApplication application;
3659 Actor actor = Actor::New();
3661 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3663 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
3664 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
3666 Vector2 size2(1.0f, 2.0f);
3667 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
3669 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3671 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3672 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3677 int UtcDaliActorSetMaximumSize(void)
3679 TestApplication application;
3681 Actor actor = Actor::New();
3683 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3685 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
3686 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
3688 Vector2 size2(1.0f, 2.0f);
3689 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
3691 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3693 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3694 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3699 int UtcDaliActorOnRelayoutSignal(void)
3701 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3703 TestApplication application;
3706 gOnRelayoutCallBackCalled = false;
3707 gActorNamesRelayout.clear();
3709 Actor actor = Actor::New();
3710 actor.SetProperty(Actor::Property::NAME, "actor");
3711 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
3714 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
3716 // Add actor to stage
3717 application.GetScene().Add(actor);
3719 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
3720 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
3722 // Flush the queue and render once
3723 application.SendNotification();
3724 application.Render();
3726 // OnRelayout emitted
3727 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
3728 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
3733 int UtcDaliActorGetHierachyDepth(void)
3735 TestApplication application;
3736 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3738 /* Build tree of actors:
3748 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3750 Integration::Scene stage(application.GetScene());
3752 Actor actorA = Actor::New();
3753 Actor actorB = Actor::New();
3754 Actor actorC = Actor::New();
3755 Actor actorD = Actor::New();
3756 Actor actorE = Actor::New();
3757 Actor actorF = Actor::New();
3759 //Test that root actor has depth equal 0
3760 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3762 //Test actors return depth -1 when not connected to the tree
3763 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3764 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3765 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3766 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3767 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3768 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3770 //Create the hierarchy
3778 //Test actors return correct depth
3779 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3780 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3781 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3782 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3783 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3784 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3786 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3787 actorA.Remove(actorB);
3789 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3790 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3791 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3793 //Removing actorA from the stage. All actors should have depth equal -1
3794 stage.Remove(actorA);
3796 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3797 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3798 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3799 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3800 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3801 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3806 int UtcDaliActorAnchorPointPropertyAsString(void)
3808 TestApplication application;
3810 Actor actor = Actor::New();
3812 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
3813 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3815 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
3816 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3818 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
3819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3821 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
3822 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3824 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
3825 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
3827 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
3828 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3830 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
3831 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3833 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
3834 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3836 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
3837 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3839 // Invalid should not change anything
3840 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
3841 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3846 int UtcDaliActorParentOriginPropertyAsString(void)
3848 TestApplication application;
3850 Actor actor = Actor::New();
3852 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
3853 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3855 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
3856 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3858 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
3859 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3861 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
3862 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3864 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
3865 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
3867 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
3868 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3870 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
3871 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3873 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
3874 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3876 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
3877 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3879 // Invalid should not change anything
3880 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
3881 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3886 int UtcDaliActorColorModePropertyAsString(void)
3888 TestApplication application;
3890 Actor actor = Actor::New();
3892 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
3893 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3895 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
3896 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3898 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
3899 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3901 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
3902 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3904 // Invalid should not change anything
3905 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
3906 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3911 int UtcDaliActorDrawModePropertyAsString(void)
3913 TestApplication application;
3915 Actor actor = Actor::New();
3917 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
3918 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3920 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
3921 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3923 // Invalid should not change anything
3924 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
3925 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3930 int UtcDaliActorColorModePropertyAsEnum(void)
3932 TestApplication application;
3934 Actor actor = Actor::New();
3936 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
3937 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3939 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
3940 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3942 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
3943 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3945 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
3946 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3951 int UtcDaliActorDrawModePropertyAsEnum(void)
3953 TestApplication application;
3955 Actor actor = Actor::New();
3957 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3958 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3960 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3961 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3966 int UtcDaliActorAddRendererP(void)
3968 tet_infoline("Testing Actor::AddRenderer");
3969 TestApplication application;
3971 Actor actor = Actor::New();
3973 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3975 Geometry geometry = CreateQuadGeometry();
3976 Shader shader = CreateShader();
3977 Renderer renderer = Renderer::New(geometry, shader);
3979 actor.AddRenderer(renderer);
3980 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
3981 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
3986 int UtcDaliActorAddRendererN01(void)
3988 tet_infoline("Testing Actor::AddRenderer");
3989 TestApplication application;
3991 Actor actor = Actor::New();
3997 actor.AddRenderer(renderer);
3998 tet_printf("Assertion test failed - no Exception\n");
3999 tet_result(TET_FAIL);
4001 catch(Dali::DaliException& e)
4003 DALI_TEST_PRINT_ASSERT(e);
4004 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
4005 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4009 tet_printf("Assertion test failed - wrong Exception\n");
4010 tet_result(TET_FAIL);
4016 int UtcDaliActorAddRendererN02(void)
4018 tet_infoline("UtcDaliActorAddRendererN02");
4024 TestApplication application;
4026 Geometry geometry = CreateQuadGeometry();
4027 Shader shader = CreateShader();
4028 renderer = Renderer::New(geometry, shader);
4030 actor = Actor::New();
4033 // try illegal AddRenderer
4036 actor.AddRenderer(renderer);
4037 tet_printf("Assertion test failed - no Exception\n");
4038 tet_result(TET_FAIL);
4040 catch(Dali::DaliException& e)
4042 DALI_TEST_PRINT_ASSERT(e);
4043 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
4047 tet_printf("Assertion test failed - wrong Exception\n");
4048 tet_result(TET_FAIL);
4054 int UtcDaliActorAddRendererOnScene(void)
4056 tet_infoline("Testing Actor::AddRenderer");
4057 TestApplication application;
4059 Actor actor = Actor::New();
4060 application.GetScene().Add(actor);
4062 application.SendNotification();
4063 application.Render(0);
4065 Geometry geometry = CreateQuadGeometry();
4066 Shader shader = CreateShader();
4067 Renderer renderer = Renderer::New(geometry, shader);
4069 application.SendNotification();
4070 application.Render(0);
4074 actor.AddRenderer(renderer);
4075 tet_result(TET_PASS);
4079 tet_result(TET_FAIL);
4085 int UtcDaliActorRemoveRendererP1(void)
4087 tet_infoline("Testing Actor::RemoveRenderer");
4088 TestApplication application;
4090 Actor actor = Actor::New();
4092 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4095 Geometry geometry = CreateQuadGeometry();
4096 Shader shader = CreateShader();
4097 Renderer renderer = Renderer::New(geometry, shader);
4099 actor.AddRenderer(renderer);
4100 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4101 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4103 application.SendNotification();
4104 application.Render();
4108 Renderer renderer = actor.GetRendererAt(0);
4109 actor.RemoveRenderer(renderer);
4110 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4112 application.SendNotification();
4113 application.Render();
4116 // Call one final time to ensure that the renderer is actually removed after
4117 // the handle goes out of scope, and excercises the deletion code path in
4118 // scene graph and render.
4119 application.SendNotification();
4120 application.Render();
4125 int UtcDaliActorRemoveRendererP2(void)
4127 tet_infoline("Testing Actor::RemoveRenderer");
4128 TestApplication application;
4130 Actor actor = Actor::New();
4132 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4134 Geometry geometry = CreateQuadGeometry();
4135 Shader shader = CreateShader();
4136 Renderer renderer = Renderer::New(geometry, shader);
4138 actor.AddRenderer(renderer);
4139 application.SendNotification();
4140 application.Render();
4142 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4143 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4145 actor.RemoveRenderer(0);
4146 application.SendNotification();
4147 application.Render();
4149 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4151 // Shut down whilst holding onto the renderer handle.
4155 int UtcDaliActorRemoveRendererN(void)
4157 tet_infoline("Testing Actor::RemoveRenderer");
4158 TestApplication application;
4160 Actor actor = Actor::New();
4162 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4164 Geometry geometry = CreateQuadGeometry();
4165 Shader shader = CreateShader();
4166 Renderer renderer = Renderer::New(geometry, shader);
4168 actor.AddRenderer(renderer);
4169 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4170 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4172 actor.RemoveRenderer(10);
4173 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4174 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4179 // Clipping test helper functions:
4180 Actor CreateActorWithContent(uint32_t width, uint32_t height)
4182 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
4183 Actor actor = CreateRenderableActor(image);
4185 // Setup dimensions and position so actor is not skipped by culling.
4186 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4187 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
4188 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4189 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4194 Actor CreateActorWithContent16x16()
4196 return CreateActorWithContent(16, 16);
4199 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
4201 enabledDisableTrace.Reset();
4202 stencilTrace.Reset();
4203 enabledDisableTrace.Enable(true);
4204 stencilTrace.Enable(true);
4206 application.SendNotification();
4207 application.Render();
4209 enabledDisableTrace.Enable(false);
4210 stencilTrace.Enable(false);
4213 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
4215 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4217 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
4218 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
4219 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
4221 // @todo only test alpha if the framebuffer has an alpha channel
4222 //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
4225 int UtcDaliActorPropertyClippingP(void)
4227 // This test checks the clippingMode property.
4228 tet_infoline("Testing Actor::Property::ClippingMode: P");
4229 TestApplication application;
4231 Actor actor = Actor::New();
4233 // Check default clippingEnabled value.
4234 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4237 bool getValueResult = getValue.Get(value);
4238 DALI_TEST_CHECK(getValueResult);
4242 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4245 // Check setting the property to the stencil mode.
4246 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4248 // Check the new value was set.
4249 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4250 getValueResult = getValue.Get(value);
4251 DALI_TEST_CHECK(getValueResult);
4255 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4258 // Check setting the property to the scissor mode.
4259 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4261 // Check the new value was set.
4262 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4263 getValueResult = getValue.Get(value);
4264 DALI_TEST_CHECK(getValueResult);
4268 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4273 int UtcDaliActorPropertyClippingN(void)
4275 // Negative test case for Clipping.
4276 tet_infoline("Testing Actor::Property::ClippingMode: N");
4277 TestApplication application;
4279 Actor actor = Actor::New();
4281 // Check default clippingEnabled value.
4282 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4285 bool getValueResult = getValue.Get(value);
4286 DALI_TEST_CHECK(getValueResult);
4290 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4293 // Check setting an invalid property value won't change the current property value.
4294 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4296 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4297 getValueResult = getValue.Get(value);
4298 DALI_TEST_CHECK(getValueResult);
4302 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4308 int UtcDaliActorPropertyClippingActor(void)
4310 // This test checks that an actor is correctly setup for clipping.
4311 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4312 TestApplication application;
4314 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4315 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4316 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4317 size_t startIndex = 0u;
4319 // Create a clipping actor.
4320 Actor actorDepth1Clip = CreateActorWithContent16x16();
4321 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4322 application.GetScene().Add(actorDepth1Clip);
4324 // Gather the call trace.
4325 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4327 // Check we are writing to the color buffer.
4328 CheckColorMask(glAbstraction, true);
4330 // Check the stencil buffer was enabled.
4331 std::ostringstream oss;
4332 oss << std::hex << GL_STENCIL_TEST;
4333 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4335 // Check the stencil buffer was cleared.
4336 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4338 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4339 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4340 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4341 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4346 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4348 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4349 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
4350 TestApplication application;
4352 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4353 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4354 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4355 size_t startIndex = 0u;
4357 // Create a clipping actor.
4358 Actor actorDepth1Clip = CreateActorWithContent16x16();
4359 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4360 application.GetScene().Add(actorDepth1Clip);
4362 // Gather the call trace.
4363 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4365 // Check we are writing to the color buffer.
4366 CheckColorMask(glAbstraction, true);
4368 // Check the stencil buffer was enabled.
4369 std::ostringstream oss;
4370 oss << std::hex << GL_STENCIL_TEST;
4371 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4373 // Check the stencil buffer was cleared.
4374 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4376 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4377 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4378 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4379 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4381 // Now disable the clipping
4382 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4384 // Gather the call trace.
4385 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4387 // Check the stencil buffer was disabled.
4388 std::ostringstream stencil;
4389 stencil << std::hex << GL_STENCIL_TEST;
4390 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", stencil.str()));
4392 // Ensure all values in stencil-mask are set to 1.
4394 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
4399 int UtcDaliActorPropertyClippingNestedChildren(void)
4401 // This test checks that a hierarchy of actors are clipped correctly by
4402 // writing to and reading from the correct bit-planes of the stencil buffer.
4403 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
4404 TestApplication application;
4405 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4406 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4407 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4409 // Create a clipping actor.
4410 Actor actorDepth1Clip = CreateActorWithContent16x16();
4411 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4412 application.GetScene().Add(actorDepth1Clip);
4414 // Create a child actor.
4415 Actor childDepth2 = CreateActorWithContent16x16();
4416 actorDepth1Clip.Add(childDepth2);
4418 // Create another clipping actor.
4419 Actor childDepth2Clip = CreateActorWithContent16x16();
4420 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4421 childDepth2.Add(childDepth2Clip);
4423 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4424 // This tests the sort algorithm.
4425 Actor childDepth3 = CreateActorWithContent16x16();
4426 childDepth2Clip.Add(childDepth3);
4427 Actor childDepth4 = CreateActorWithContent16x16();
4428 childDepth3.Add(childDepth4);
4430 // Gather the call trace.
4431 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4433 // Check we are writing to the color buffer.
4434 CheckColorMask(glAbstraction, true);
4436 // Check the stencil buffer was enabled.
4437 std::ostringstream oss;
4438 oss << std::hex << GL_STENCIL_TEST;
4439 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4441 // Perform the test twice, once for 2D layer, and once for 3D.
4442 for(unsigned int i = 0u; i < 2u; ++i)
4444 size_t startIndex = 0u;
4446 // Check the stencil buffer was cleared.
4447 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4449 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4450 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4451 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
4452 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4454 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4455 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 1", startIndex)); // 514 is GL_EQUAL
4456 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4458 // Check we are set up to write to the second bitplane of the stencil buffer (only).
4459 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4460 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
4461 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4463 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4464 // (Both must be set to pass the check).
4465 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 3", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4466 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4468 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4471 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
4472 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4479 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4481 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4482 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
4483 TestApplication application;
4484 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4485 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4487 /* We create a small tree of actors as follows:
4491 Clipping enabled -> B D
4495 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4498 for(int i = 0; i < 5; ++i)
4500 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
4501 Actor actor = CreateRenderableActor(image);
4503 // Setup dimensions and position so actor is not skipped by culling.
4504 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4505 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
4509 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4513 float b = i > 2 ? 1.0f : -1.0f;
4514 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
4520 // Enable clipping on the actor at the top of the left branch.
4521 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4523 // Build the scene graph.
4524 application.GetScene().Add(actors[0]);
4527 actors[0].Add(actors[1]);
4528 actors[1].Add(actors[2]);
4531 actors[0].Add(actors[3]);
4532 actors[3].Add(actors[4]);
4534 // Gather the call trace.
4535 enabledDisableTrace.Reset();
4536 enabledDisableTrace.Enable(true);
4537 application.SendNotification();
4538 application.Render();
4539 enabledDisableTrace.Enable(false);
4541 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4543 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
4544 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4546 size_t startIndex = 0u;
4547 std::ostringstream blend;
4548 blend << std::hex << GL_BLEND;
4549 std::ostringstream stencil;
4550 stencil << std::hex << GL_STENCIL_TEST;
4552 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", blend.str(), startIndex));
4553 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
4554 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
4556 // Swap the clipping actor from top of left branch to top of right branch.
4557 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4558 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4560 // Gather the call trace.
4561 enabledDisableTrace.Reset();
4562 enabledDisableTrace.Enable(true);
4563 application.SendNotification();
4564 application.Render();
4565 enabledDisableTrace.Enable(false);
4567 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4568 // This proves the draw order has remained the same.
4570 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
4571 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
4576 int UtcDaliActorPropertyScissorClippingActor01(void)
4578 // This test checks that an actor is correctly setup for clipping.
4579 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
4580 TestApplication application;
4582 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4583 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4584 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4586 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4587 const Vector2 imageSize(16.0f, 16.0f);
4589 // Create a clipping actor.
4590 Actor clippingActorA = CreateActorWithContent16x16();
4591 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4592 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4593 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4594 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4595 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4596 application.GetScene().Add(clippingActorA);
4598 // Gather the call trace.
4599 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4601 // Check we are writing to the color buffer.
4602 CheckColorMask(glAbstraction, true);
4604 // Check scissor test was enabled.
4606 std::ostringstream scissor;
4607 scissor << std::hex << GL_SCISSOR_TEST;
4608 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4610 // Check the scissor was set, and the coordinates are correct.
4611 std::stringstream compareParametersString;
4612 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4613 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4615 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4616 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4618 // Gather the call trace.
4619 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4621 // Check the scissor was set, and the coordinates are correct.
4622 compareParametersString.str(std::string());
4623 compareParametersString.clear();
4624 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
4625 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4630 int UtcDaliActorPropertyScissorClippingActor02(void)
4632 // This test checks that an actor is correctly setup for clipping.
4633 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
4634 TestApplication application;
4636 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4637 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4638 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4640 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4641 const Vector2 actorSize(16.0f, 16.0f);
4643 // Create a clipping actor.
4644 Actor clippingActorA = CreateRenderableActor();
4645 clippingActorA[Actor::Property::SIZE] = actorSize;
4647 Renderer renderer = clippingActorA.GetRendererAt(0);
4648 DALI_TEST_CHECK(renderer);
4650 // Make Renderer opacity 0.
4651 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
4653 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4654 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4655 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4656 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4657 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4658 application.GetScene().Add(clippingActorA);
4660 // Gather the call trace.
4661 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4663 // Check we are writing to the color buffer.
4664 CheckColorMask(glAbstraction, true);
4666 // Check scissor test was enabled.
4668 std::ostringstream scissor;
4669 scissor << std::hex << GL_SCISSOR_TEST;
4670 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4672 // Check the scissor was set, and the coordinates are correct.
4673 std::stringstream compareParametersString;
4674 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
4675 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4677 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4678 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4680 // Gather the call trace.
4681 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4683 // Check the scissor was set, and the coordinates are correct.
4684 compareParametersString.str(std::string());
4685 compareParametersString.clear();
4686 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
4687 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4692 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4694 // This test checks that an actor is correctly setup for clipping.
4695 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
4696 TestApplication application;
4698 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4699 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4700 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4702 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4703 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4704 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4706 // Create a clipping actors.
4707 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4708 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4710 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4711 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4712 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4714 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4715 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4716 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4718 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4719 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4721 application.GetScene().Add(clippingActorA);
4722 application.GetScene().Add(clippingActorB);
4724 // Gather the call trace.
4725 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4727 // Check we are writing to the color buffer.
4728 CheckColorMask(glAbstraction, true);
4730 // Check scissor test was enabled.
4731 std::ostringstream scissor;
4732 scissor << std::hex << GL_SCISSOR_TEST;
4733 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4735 // Check the scissor was set, and the coordinates are correct.
4736 std::stringstream compareParametersString;
4738 std::string clipA("0, 500, 480, 200");
4739 std::string clipB("0, 380, 480, 40");
4741 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4742 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4747 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4749 // This test checks that an actor is correctly setup for clipping.
4750 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4751 TestApplication application;
4753 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4754 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4755 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4757 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4758 const Vector2 imageSize(16.0f, 16.0f);
4760 /* Create a nest of 2 scissors to test nesting (intersecting clips).
4762 A is drawn first - with scissor clipping on
4763 B is drawn second - also with scissor clipping on
4764 C is the generated clipping region, the intersection ( A ∩ B )
4768 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
4769 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
4770 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
4774 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4777 // Create a clipping actor.
4778 Actor clippingActorA = CreateActorWithContent16x16();
4779 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4780 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4781 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4782 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4783 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4784 application.GetScene().Add(clippingActorA);
4786 // Create a child clipping actor.
4787 Actor clippingActorB = CreateActorWithContent16x16();
4788 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4789 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4790 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4791 clippingActorA.Add(clippingActorB);
4793 // positionModifiers is an array of positions to position B around.
4794 // expect is an array of expected scissor clip coordinate results.
4795 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
4796 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
4798 // Loop through each overlap combination.
4799 for(unsigned int test = 0u; test < 4u; ++test)
4801 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4802 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
4803 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
4805 // Gather the call trace.
4806 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4808 // Check we are writing to the color buffer.
4809 CheckColorMask(glAbstraction, true);
4811 // Check scissor test was enabled.
4812 std::ostringstream scissor;
4813 scissor << std::hex << GL_SCISSOR_TEST;
4814 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4816 // Check the scissor was set, and the coordinates are correct.
4817 const Vector4& expectResults(expect[test]);
4818 std::stringstream compareParametersString;
4819 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4820 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
4826 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4828 // This test checks that an actor is correctly setup for clipping.
4829 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4830 TestApplication application;
4832 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4833 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4834 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4836 /* Create a nest of 2 scissors and siblings of the parent.
4846 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4847 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4848 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4849 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
4850 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
4851 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
4853 // Create a clipping actors.
4854 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4855 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4856 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
4857 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
4858 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
4860 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4861 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4862 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4864 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4865 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4866 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4868 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4869 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4870 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4872 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4873 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4874 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4876 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4877 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4879 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4880 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4881 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
4882 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4883 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4885 application.GetScene().Add(clippingActorA);
4886 clippingActorA.Add(clippingActorB);
4887 application.GetScene().Add(clippingActorC);
4888 application.GetScene().Add(clippingActorD);
4889 clippingActorD.Add(clippingActorE);
4891 // Gather the call trace.
4892 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4894 // Check we are writing to the color buffer.
4895 CheckColorMask(glAbstraction, true);
4897 // Check scissor test was enabled.
4898 std::ostringstream scissor;
4899 scissor << std::hex << GL_SCISSOR_TEST;
4900 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4902 // Check the scissor was set, and the coordinates are correct.
4903 std::string clipA("0, 500, 480, 200");
4904 std::string clipB("0, 580, 480, 40");
4905 std::string clipC("0, 200, 480, 200");
4906 std::string clipD("0, 300, 480, 200");
4908 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4909 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4910 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
4911 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
4912 DALI_TEST_EQUALS(scissorTrace.CountMethod("Scissor"), 4, TEST_LOCATION); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4917 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4919 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4920 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
4921 TestApplication application;
4923 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4924 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4925 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4927 // Create a clipping actor.
4928 Actor actorDepth1Clip = CreateActorWithContent16x16();
4929 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4930 application.GetScene().Add(actorDepth1Clip);
4932 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4933 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
4935 // Gather the call trace.
4936 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4938 // Check we are writing to the color buffer.
4939 CheckColorMask(glAbstraction, true);
4941 // Check the stencil buffer was not enabled.
4942 std::ostringstream stencil;
4943 stencil << std::hex << GL_STENCIL_TEST;
4944 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", stencil.str()));
4946 // Check stencil functions are not called.
4947 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
4948 // TODO: Temporarily commented out the line below when caching is disabled. Will need to add it back.
4949 // DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask"));
4950 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
4952 // Check that scissor clipping is overriden by the renderer properties.
4953 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4955 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4957 // Gather the call trace.
4958 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4960 // Check the stencil buffer was not enabled.
4961 std::ostringstream scissor;
4962 scissor << std::hex << GL_SCISSOR_TEST;
4963 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4965 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
4970 int UtcDaliActorPropertyClippingActorCulled(void)
4972 // This test checks that child actors are clipped by an culled parent actor.
4973 tet_infoline("Testing child actors are clipped by an culled parent actor");
4974 TestApplication application;
4976 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4977 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4978 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4980 const Vector2 actorSize(160.0f, 160.0f);
4982 // Create a clipping actor.
4983 Actor clippingActorA = CreateRenderableActor();
4984 clippingActorA[Actor::Property::SIZE] = actorSize;
4986 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4987 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4988 clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
4989 clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
4990 clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
4991 application.GetScene().Add(clippingActorA);
4993 // Create a child actor
4994 Actor childActor = CreateRenderableActor();
4995 childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
4996 childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
4997 childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
4998 childActor[Actor::Property::INHERIT_POSITION] = false;
5000 // Gather the call trace.
5001 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5003 // Check scissor test was enabled.
5004 std::ostringstream scissor;
5005 scissor << std::hex << GL_SCISSOR_TEST;
5006 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5008 // Check the scissor was set, and the coordinates are correct.
5009 std::stringstream compareParametersString;
5010 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5011 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5013 // Move the clipping actor out of screen
5014 clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
5016 // Gather the call trace.
5017 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5019 // Check the scissor was set, and the coordinates are correct.
5020 compareParametersString.str(std::string());
5021 compareParametersString.clear();
5022 compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
5023 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
5028 int UtcDaliGetPropertyN(void)
5030 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
5031 TestApplication application;
5033 Actor actor = Actor::New();
5035 unsigned int propertyCount = actor.GetPropertyCount();
5036 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
5040 int UtcDaliActorRaiseLower(void)
5042 tet_infoline("UtcDaliActor Raise and Lower test\n");
5044 TestApplication application;
5046 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5048 Integration::Scene stage(application.GetScene());
5050 Actor actorA = Actor::New();
5051 Actor actorB = Actor::New();
5052 Actor actorC = Actor::New();
5054 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5055 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5057 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5058 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5060 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5061 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5063 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5064 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5066 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5067 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5069 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5070 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5076 ResetTouchCallbacks();
5078 application.SendNotification();
5079 application.Render();
5081 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5082 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5083 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5085 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5086 // Only top actor will get touched.
5087 actorA.TouchedSignal().Connect(TestTouchCallback);
5088 actorB.TouchedSignal().Connect(TestTouchCallback2);
5089 actorC.TouchedSignal().Connect(TestTouchCallback3);
5091 // Connect ChildOrderChangedSignal
5092 bool orderChangedSignal(false);
5093 Actor orderChangedActor;
5094 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5095 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5097 Dali::Integration::Point point;
5098 point.SetDeviceId(1);
5099 point.SetState(PointState::DOWN);
5100 point.SetScreenPosition(Vector2(10.f, 10.f));
5101 Dali::Integration::TouchEvent touchEvent;
5102 touchEvent.AddPoint(point);
5104 application.ProcessEvent(touchEvent);
5106 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5107 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5108 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5110 ResetTouchCallbacks();
5112 tet_printf("Testing Raising of Actor\n");
5114 int preActorOrder(0);
5115 int postActorOrder(0);
5117 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5118 value.Get(preActorOrder);
5120 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5122 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5123 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5125 // Ensure sort order is calculated before next touch event
5126 application.SendNotification();
5128 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5129 value.Get(postActorOrder);
5131 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5133 application.ProcessEvent(touchEvent);
5135 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5136 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5137 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5139 ResetTouchCallbacks();
5141 tet_printf("Testing Lowering of Actor\n");
5143 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5144 value.Get(preActorOrder);
5146 orderChangedSignal = false;
5148 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5150 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5151 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5153 application.SendNotification(); // ensure sort order calculated before next touch event
5155 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5156 value.Get(postActorOrder);
5158 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5160 application.ProcessEvent(touchEvent);
5162 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5163 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5164 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5166 ResetTouchCallbacks();
5168 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
5173 int UtcDaliActorRaiseToTopLowerToBottom(void)
5175 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
5177 TestApplication application;
5179 Integration::Scene stage(application.GetScene());
5181 Actor actorA = Actor::New();
5182 Actor actorB = Actor::New();
5183 Actor actorC = Actor::New();
5185 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5186 // enables checking of which actor the uniform is assigned too
5187 Shader shaderA = CreateShader();
5188 shaderA.RegisterProperty("uRendererColor", 1.f);
5190 Shader shaderB = CreateShader();
5191 shaderB.RegisterProperty("uRendererColor", 2.f);
5193 Shader shaderC = CreateShader();
5194 shaderC.RegisterProperty("uRendererColor", 3.f);
5196 Geometry geometry = CreateQuadGeometry();
5198 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5199 Renderer rendererA = Renderer::New(geometry, shaderA);
5200 actorA.AddRenderer(rendererA);
5202 Renderer rendererB = Renderer::New(geometry, shaderB);
5203 actorB.AddRenderer(rendererB);
5205 Renderer rendererC = Renderer::New(geometry, shaderC);
5206 actorC.AddRenderer(rendererC);
5208 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5209 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5211 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5212 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5214 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5215 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5217 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5218 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5220 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5221 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5223 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5224 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5230 ResetTouchCallbacks();
5232 // Connect ChildOrderChangedSignal
5233 bool orderChangedSignal(false);
5234 Actor orderChangedActor;
5235 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5236 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5238 // Set up gl abstraction trace so can query the set uniform order
5239 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5240 glAbstraction.EnableSetUniformCallTrace(true);
5241 glAbstraction.ResetSetUniformCallStack();
5243 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5245 application.SendNotification();
5246 application.Render();
5248 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
5250 // Test order of uniforms in stack
5251 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5252 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5253 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5255 bool CBA = (indexC > indexB) && (indexB > indexA);
5257 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5259 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5260 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5261 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5263 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5264 // Only top actor will get touched.
5265 actorA.TouchedSignal().Connect(TestTouchCallback);
5266 actorB.TouchedSignal().Connect(TestTouchCallback2);
5267 actorC.TouchedSignal().Connect(TestTouchCallback3);
5269 Dali::Integration::Point point;
5270 point.SetDeviceId(1);
5271 point.SetState(PointState::DOWN);
5272 point.SetScreenPosition(Vector2(10.f, 10.f));
5273 Dali::Integration::TouchEvent touchEvent;
5274 touchEvent.AddPoint(point);
5276 application.ProcessEvent(touchEvent);
5278 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5279 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5280 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5282 ResetTouchCallbacks();
5284 tet_printf("RaiseToTop ActorA\n");
5286 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5287 actorA.RaiseToTop();
5288 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5289 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5291 application.SendNotification(); // ensure sorting order is calculated before next touch event
5293 application.ProcessEvent(touchEvent);
5295 glSetUniformStack.Reset();
5297 application.SendNotification();
5298 application.Render();
5300 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5302 // Test order of uniforms in stack
5303 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5304 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5305 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5307 tet_infoline("Testing A above C and B at bottom\n");
5308 bool ACB = (indexA > indexC) && (indexC > indexB);
5310 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
5312 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5313 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5314 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5316 ResetTouchCallbacks();
5318 tet_printf("RaiseToTop ActorB\n");
5320 orderChangedSignal = false;
5322 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5323 actorB.RaiseToTop();
5324 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5325 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5327 application.SendNotification(); // Ensure sort order is calculated before next touch event
5329 application.ProcessEvent(touchEvent);
5331 glSetUniformStack.Reset();
5333 application.SendNotification();
5334 application.Render();
5336 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5338 // Test order of uniforms in stack
5339 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5340 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5341 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5343 tet_infoline("Testing B above A and C at bottom\n");
5344 bool BAC = (indexB > indexA) && (indexA > indexC);
5346 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
5348 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5349 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5350 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5352 ResetTouchCallbacks();
5354 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
5356 orderChangedSignal = false;
5358 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5359 actorA.LowerToBottom();
5360 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5361 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5363 application.SendNotification();
5364 application.Render();
5366 orderChangedSignal = false;
5368 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5369 actorB.LowerToBottom();
5370 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5371 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5373 application.SendNotification();
5374 application.Render();
5376 application.ProcessEvent(touchEvent);
5378 glSetUniformStack.Reset();
5380 application.SendNotification();
5381 application.Render();
5383 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5385 // Test order of uniforms in stack
5386 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5387 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5388 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5390 tet_infoline("Testing C above A and B at bottom\n");
5391 bool CAB = (indexC > indexA) && (indexA > indexB);
5393 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
5395 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5396 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5397 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5399 ResetTouchCallbacks();
5404 int UtcDaliActorRaiseAbove(void)
5406 tet_infoline("UtcDaliActor RaiseToAbove test \n");
5408 TestApplication application;
5410 Integration::Scene stage(application.GetScene());
5412 Actor actorA = Actor::New();
5413 Actor actorB = Actor::New();
5414 Actor actorC = Actor::New();
5416 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5417 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5419 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5420 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5422 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5423 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5425 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5426 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5428 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5429 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5431 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5432 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5438 ResetTouchCallbacks();
5440 application.SendNotification();
5441 application.Render();
5443 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5444 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5445 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5447 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5448 // Only top actor will get touched.
5449 actorA.TouchedSignal().Connect(TestTouchCallback);
5450 actorB.TouchedSignal().Connect(TestTouchCallback2);
5451 actorC.TouchedSignal().Connect(TestTouchCallback3);
5453 bool orderChangedSignal(false);
5454 Actor orderChangedActor;
5455 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5456 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5458 Dali::Integration::Point point;
5459 point.SetDeviceId(1);
5460 point.SetState(PointState::DOWN);
5461 point.SetScreenPosition(Vector2(10.f, 10.f));
5462 Dali::Integration::TouchEvent touchEvent;
5463 touchEvent.AddPoint(point);
5465 application.ProcessEvent(touchEvent);
5467 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5468 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5469 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5471 ResetTouchCallbacks();
5473 tet_printf("Raise actor B Above Actor C\n");
5475 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5476 actorB.RaiseAbove(actorC);
5477 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5478 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5480 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5481 application.SendNotification();
5482 application.ProcessEvent(touchEvent);
5484 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5485 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5486 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5488 ResetTouchCallbacks();
5490 tet_printf("Raise actor A Above Actor B\n");
5492 orderChangedSignal = false;
5494 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5495 actorA.RaiseAbove(actorB);
5496 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5497 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5499 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5500 application.SendNotification();
5502 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5504 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5505 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5506 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5508 ResetTouchCallbacks();
5513 int UtcDaliActorRaiseAbove2(void)
5515 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
5517 TestApplication application;
5519 Integration::Scene stage(application.GetScene());
5521 Actor actorA = Actor::New();
5522 Actor actorB = Actor::New();
5523 Actor actorC = Actor::New();
5525 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5526 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5528 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5529 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5531 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5532 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5534 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5535 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5537 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5538 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5540 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5541 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5547 ResetTouchCallbacks();
5549 application.SendNotification();
5550 application.Render();
5552 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5553 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5554 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5556 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5557 // Only top actor will get touched.
5558 actorA.TouchedSignal().Connect(TestTouchCallback);
5559 actorB.TouchedSignal().Connect(TestTouchCallback2);
5560 actorC.TouchedSignal().Connect(TestTouchCallback3);
5562 bool orderChangedSignal(false);
5563 Actor orderChangedActor;
5564 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5565 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5567 Dali::Integration::Point point;
5568 point.SetDeviceId(1);
5569 point.SetState(PointState::DOWN);
5570 point.SetScreenPosition(Vector2(10.f, 10.f));
5571 Dali::Integration::TouchEvent touchEvent;
5572 touchEvent.AddPoint(point);
5574 application.ProcessEvent(touchEvent);
5576 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5577 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5578 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5580 ResetTouchCallbacks();
5582 tet_printf("Raise actor B Above Actor C\n");
5584 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5585 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
5586 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
5587 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5588 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5590 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5591 application.SendNotification();
5592 application.ProcessEvent(touchEvent);
5594 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5595 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5596 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5598 ResetTouchCallbacks();
5600 tet_printf("Raise actor A Above Actor B\n");
5602 orderChangedSignal = false;
5604 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5605 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
5606 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
5607 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5608 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5610 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5611 application.SendNotification();
5613 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5615 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5616 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5617 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5619 ResetTouchCallbacks();
5624 int UtcDaliActorLowerBelow(void)
5626 tet_infoline("UtcDaliActor LowerBelow test \n");
5628 TestApplication application;
5630 Integration::Scene stage(application.GetScene());
5632 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5633 // enables checking of which actor the uniform is assigned too
5634 Shader shaderA = CreateShader();
5635 shaderA.RegisterProperty("uRendererColor", 1.f);
5637 Shader shaderB = CreateShader();
5638 shaderB.RegisterProperty("uRendererColor", 2.f);
5640 Shader shaderC = CreateShader();
5641 shaderC.RegisterProperty("uRendererColor", 3.f);
5643 Actor actorA = Actor::New();
5644 Actor actorB = Actor::New();
5645 Actor actorC = Actor::New();
5647 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5648 Geometry geometry = CreateQuadGeometry();
5650 Renderer rendererA = Renderer::New(geometry, shaderA);
5651 actorA.AddRenderer(rendererA);
5653 Renderer rendererB = Renderer::New(geometry, shaderB);
5654 actorB.AddRenderer(rendererB);
5656 Renderer rendererC = Renderer::New(geometry, shaderC);
5657 actorC.AddRenderer(rendererC);
5659 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5660 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5662 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5663 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5665 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5666 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5668 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5669 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5671 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5672 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5674 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5675 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5677 Actor container = Actor::New();
5678 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5679 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5680 stage.Add(container);
5682 container.Add(actorA);
5683 container.Add(actorB);
5684 container.Add(actorC);
5686 ResetTouchCallbacks();
5688 // Connect ChildOrderChangedSignal
5689 bool orderChangedSignal(false);
5690 Actor orderChangedActor;
5691 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5692 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5694 // Set up gl abstraction trace so can query the set uniform order
5695 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5696 glAbstraction.EnableSetUniformCallTrace(true);
5697 glAbstraction.ResetSetUniformCallStack();
5698 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5700 glAbstraction.ResetSetUniformCallStack();
5702 application.SendNotification();
5703 application.Render();
5705 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5707 // Test order of uniforms in stack
5708 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5709 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5710 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5712 tet_infoline("Testing C above B and A at bottom\n");
5713 bool CBA = (indexC > indexB) && (indexB > indexA);
5715 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5717 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5718 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5719 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5721 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5722 // Only top actor will get touched.
5723 actorA.TouchedSignal().Connect(TestTouchCallback);
5724 actorB.TouchedSignal().Connect(TestTouchCallback2);
5725 actorC.TouchedSignal().Connect(TestTouchCallback3);
5727 Dali::Integration::Point point;
5728 point.SetDeviceId(1);
5729 point.SetState(PointState::DOWN);
5730 point.SetScreenPosition(Vector2(10.f, 10.f));
5731 Dali::Integration::TouchEvent touchEvent;
5732 touchEvent.AddPoint(point);
5734 tet_infoline("UtcDaliActor Test Set up completed \n");
5736 application.ProcessEvent(touchEvent);
5738 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5739 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5740 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5742 ResetTouchCallbacks();
5744 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");
5746 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5747 actorC.LowerBelow(actorB);
5748 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5749 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5751 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5752 application.SendNotification();
5753 application.Render();
5755 application.ProcessEvent(touchEvent); // touch event
5757 glSetUniformStack.Reset();
5759 application.SendNotification();
5760 application.Render();
5762 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5764 // Test order of uniforms in stack
5765 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5766 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5767 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5769 tet_infoline("Testing render order is A, C, B");
5770 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5771 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5773 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5774 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5775 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5777 ResetTouchCallbacks();
5779 tet_printf("Lower actor C below Actor A leaving B on top\n");
5781 orderChangedSignal = false;
5783 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5784 actorC.LowerBelow(actorA);
5785 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5786 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5788 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5789 application.SendNotification();
5790 application.Render();
5792 application.ProcessEvent(touchEvent);
5794 glSetUniformStack.Reset();
5796 application.Render();
5797 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5799 // Test order of uniforms in stack
5800 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5801 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5802 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5804 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5805 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5807 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5808 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5809 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5811 ResetTouchCallbacks();
5813 tet_printf("Lower actor B below Actor C leaving A on top\n");
5815 orderChangedSignal = false;
5817 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5818 actorB.LowerBelow(actorC);
5819 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5820 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5822 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5823 application.SendNotification();
5824 application.Render();
5826 application.ProcessEvent(touchEvent);
5828 glSetUniformStack.Reset();
5830 application.Render();
5831 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5833 // Test order of uniforms in stack
5834 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5835 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5836 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5838 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5839 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5844 int UtcDaliActorLowerBelow2(void)
5846 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
5848 TestApplication application;
5850 Integration::Scene stage(application.GetScene());
5852 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5853 // enables checking of which actor the uniform is assigned too
5854 Shader shaderA = CreateShader();
5855 shaderA.RegisterProperty("uRendererColor", 1.f);
5857 Shader shaderB = CreateShader();
5858 shaderB.RegisterProperty("uRendererColor", 2.f);
5860 Shader shaderC = CreateShader();
5861 shaderC.RegisterProperty("uRendererColor", 3.f);
5863 Actor actorA = Actor::New();
5864 Actor actorB = Actor::New();
5865 Actor actorC = Actor::New();
5867 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5868 Geometry geometry = CreateQuadGeometry();
5870 Renderer rendererA = Renderer::New(geometry, shaderA);
5871 actorA.AddRenderer(rendererA);
5873 Renderer rendererB = Renderer::New(geometry, shaderB);
5874 actorB.AddRenderer(rendererB);
5876 Renderer rendererC = Renderer::New(geometry, shaderC);
5877 actorC.AddRenderer(rendererC);
5879 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5880 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5882 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5883 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5885 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5886 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5888 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5889 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5891 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5892 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5894 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5895 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5897 Actor container = Actor::New();
5898 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5899 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5900 stage.Add(container);
5902 container.Add(actorA);
5903 container.Add(actorB);
5904 container.Add(actorC);
5906 ResetTouchCallbacks();
5908 // Connect ChildOrderChangedSignal
5909 bool orderChangedSignal(false);
5910 Actor orderChangedActor;
5911 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5912 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5914 // Set up gl abstraction trace so can query the set uniform order
5915 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5916 glAbstraction.EnableSetUniformCallTrace(true);
5917 glAbstraction.ResetSetUniformCallStack();
5918 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5920 glAbstraction.ResetSetUniformCallStack();
5922 application.SendNotification();
5923 application.Render();
5925 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5927 // Test order of uniforms in stack
5928 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5929 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5930 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5932 tet_infoline("Testing C above B and A at bottom\n");
5933 bool CBA = (indexC > indexB) && (indexB > indexA);
5935 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5937 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5938 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5939 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5941 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5942 // Only top actor will get touched.
5943 actorA.TouchedSignal().Connect(TestTouchCallback);
5944 actorB.TouchedSignal().Connect(TestTouchCallback2);
5945 actorC.TouchedSignal().Connect(TestTouchCallback3);
5947 Dali::Integration::Point point;
5948 point.SetDeviceId(1);
5949 point.SetState(PointState::DOWN);
5950 point.SetScreenPosition(Vector2(10.f, 10.f));
5951 Dali::Integration::TouchEvent touchEvent;
5952 touchEvent.AddPoint(point);
5954 tet_infoline("UtcDaliActor Test Set up completed \n");
5956 application.ProcessEvent(touchEvent);
5958 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5959 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5960 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5962 ResetTouchCallbacks();
5964 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");
5966 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5967 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
5968 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5969 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5971 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5972 application.SendNotification();
5973 application.Render();
5975 application.ProcessEvent(touchEvent); // touch event
5977 glSetUniformStack.Reset();
5979 application.SendNotification();
5980 application.Render();
5982 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5984 // Test order of uniforms in stack
5985 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5986 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5987 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5989 tet_infoline("Testing render order is A, C, B");
5990 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5991 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5993 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5994 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5995 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5997 ResetTouchCallbacks();
5999 tet_printf("Lower actor C below Actor A leaving B on top\n");
6001 orderChangedSignal = false;
6003 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6004 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
6005 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6006 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6008 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6009 application.SendNotification();
6010 application.Render();
6012 application.ProcessEvent(touchEvent);
6014 glSetUniformStack.Reset();
6016 application.Render();
6017 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6019 // Test order of uniforms in stack
6020 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6021 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6022 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6024 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6025 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
6027 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6028 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6029 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6031 ResetTouchCallbacks();
6033 tet_printf("Lower actor B below Actor C leaving A on top\n");
6035 orderChangedSignal = false;
6037 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6038 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
6039 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6040 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6042 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6043 application.SendNotification();
6044 application.Render();
6046 application.ProcessEvent(touchEvent);
6048 glSetUniformStack.Reset();
6050 application.Render();
6051 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6053 // Test order of uniforms in stack
6054 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6055 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6056 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6058 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
6059 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6064 int UtcDaliActorRaiseAboveDifferentParentsN(void)
6066 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
6068 TestApplication application;
6070 Integration::Scene stage(application.GetScene());
6072 Actor parentA = Actor::New();
6073 Actor parentB = Actor::New();
6074 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6075 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6076 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6077 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6079 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6080 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6082 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6083 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6088 Actor actorA = Actor::New();
6089 Actor actorB = Actor::New();
6090 Actor actorC = Actor::New();
6092 parentA.Add(actorA);
6093 parentA.Add(actorB);
6095 tet_printf("Actor C added to different parent from A and B \n");
6096 parentB.Add(actorC);
6098 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6099 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6101 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6102 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6104 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6105 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6107 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6108 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6110 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6111 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6113 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6114 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6116 ResetTouchCallbacks();
6118 // Connect ChildOrderChangedSignal
6119 bool orderChangedSignal(false);
6120 Actor orderChangedActor;
6121 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6122 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6124 application.SendNotification();
6125 application.Render();
6127 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6128 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6129 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6131 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6132 // Only top actor will get touched.
6133 actorA.TouchedSignal().Connect(TestTouchCallback);
6134 actorB.TouchedSignal().Connect(TestTouchCallback2);
6135 actorC.TouchedSignal().Connect(TestTouchCallback3);
6137 Dali::Integration::Point point;
6138 point.SetDeviceId(1);
6139 point.SetState(PointState::DOWN);
6140 point.SetScreenPosition(Vector2(10.f, 10.f));
6141 Dali::Integration::TouchEvent touchEvent;
6142 touchEvent.AddPoint(point);
6144 application.ProcessEvent(touchEvent);
6146 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6147 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6148 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6150 ResetTouchCallbacks();
6152 tet_printf("Raise actor A Above Actor C which have different parents\n");
6154 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6155 actorA.RaiseAbove(actorC);
6156 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6158 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6159 application.SendNotification();
6161 application.ProcessEvent(touchEvent); // touch event
6163 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6164 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6165 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6167 ResetTouchCallbacks();
6172 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
6174 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
6176 TestApplication application;
6178 Integration::Scene stage(application.GetScene());
6180 Actor actorA = Actor::New();
6181 Actor actorB = Actor::New();
6182 Actor actorC = Actor::New();
6184 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6185 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6187 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6188 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6190 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6191 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6193 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6194 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6196 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6197 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6199 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6200 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6202 ResetTouchCallbacks();
6204 // Connect ChildOrderChangedSignal
6205 bool orderChangedSignal(false);
6206 Actor orderChangedActor;
6207 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6208 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6210 application.SendNotification();
6211 application.Render();
6213 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6214 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6215 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6217 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6218 // Only top actor will get touched.
6219 actorA.TouchedSignal().Connect(TestTouchCallback);
6220 actorB.TouchedSignal().Connect(TestTouchCallback2);
6221 actorC.TouchedSignal().Connect(TestTouchCallback3);
6223 Dali::Integration::Point point;
6224 point.SetDeviceId(1);
6225 point.SetState(PointState::DOWN);
6226 point.SetScreenPosition(Vector2(10.f, 10.f));
6227 Dali::Integration::TouchEvent touchEvent;
6228 touchEvent.AddPoint(point);
6230 tet_printf("Raise actor A Above Actor C which have no parents\n");
6232 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6233 actorA.RaiseAbove(actorC);
6234 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6236 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6237 application.SendNotification();
6239 application.ProcessEvent(touchEvent);
6241 tet_printf("Not parented so RaiseAbove should show no effect\n");
6243 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6244 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6245 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6247 ResetTouchCallbacks();
6249 orderChangedSignal = false;
6252 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
6254 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6255 actorA.LowerBelow(actorC);
6256 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6258 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6259 application.SendNotification();
6260 application.Render();
6262 application.ProcessEvent(touchEvent);
6264 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
6265 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6266 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6267 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6269 ResetTouchCallbacks();
6271 orderChangedSignal = false;
6273 tet_printf("Adding Actor A to stage, will be on top\n");
6276 application.SendNotification();
6277 application.Render();
6279 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
6281 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6282 actorB.RaiseAbove(actorC);
6283 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6285 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6286 application.SendNotification();
6288 application.ProcessEvent(touchEvent);
6290 tet_printf("C not parented so RaiseAbove should show no effect\n");
6291 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6292 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6293 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6295 ResetTouchCallbacks();
6297 orderChangedSignal = false;
6299 tet_printf("Lower actor A below Actor C when only A has a parent\n");
6301 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6302 actorA.LowerBelow(actorC);
6303 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6305 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6306 application.SendNotification();
6308 application.ProcessEvent(touchEvent);
6310 tet_printf("C not parented so LowerBelow should show no effect\n");
6311 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6312 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6313 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6315 ResetTouchCallbacks();
6317 orderChangedSignal = false;
6321 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6322 actorA.RaiseAbove(actorC);
6323 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6324 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6326 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6327 application.SendNotification();
6328 application.Render();
6330 application.ProcessEvent(touchEvent);
6332 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
6333 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6334 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6335 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6340 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
6342 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
6344 TestApplication application;
6346 Integration::Scene stage(application.GetScene());
6348 Actor actorA = Actor::New();
6349 Actor actorB = Actor::New();
6350 Actor actorC = Actor::New();
6352 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6353 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6355 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6356 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6358 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6359 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6361 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6362 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6364 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6365 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6367 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6368 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6370 ResetTouchCallbacks();
6372 // Connect ChildOrderChangedSignal
6373 bool orderChangedSignal(false);
6374 Actor orderChangedActor;
6375 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6376 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6378 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6379 // Only top actor will get touched.
6380 actorA.TouchedSignal().Connect(TestTouchCallback);
6381 actorB.TouchedSignal().Connect(TestTouchCallback2);
6382 actorC.TouchedSignal().Connect(TestTouchCallback3);
6384 Dali::Integration::Point point;
6385 point.SetDeviceId(1);
6386 point.SetState(PointState::DOWN);
6387 point.SetScreenPosition(Vector2(10.f, 10.f));
6388 Dali::Integration::TouchEvent touchEvent;
6389 touchEvent.AddPoint(point);
6392 tet_printf("Raise actor B Above Actor C but B not parented\n");
6394 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6396 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6398 application.SendNotification();
6399 application.Render();
6401 application.ProcessEvent(touchEvent);
6403 tet_printf("Not parented so RaiseAbove should show no effect\n");
6405 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6406 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6407 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6409 tet_printf("Raise actor B Above Actor C but B not parented\n");
6410 ResetTouchCallbacks();
6412 orderChangedSignal = false;
6414 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6416 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6418 // Sort actor tree before next touch event
6419 application.SendNotification();
6420 application.Render();
6422 application.ProcessEvent(touchEvent);
6424 tet_printf("Not parented so RaiseAbove should show no effect\n");
6426 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6427 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6428 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6429 ResetTouchCallbacks();
6431 orderChangedSignal = false;
6433 tet_printf("Lower actor C below B but C not parented\n");
6435 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6437 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6439 // Sort actor tree before next touch event
6440 application.SendNotification();
6441 application.Render();
6443 application.ProcessEvent(touchEvent);
6445 tet_printf("Not parented so Lower should show no effect\n");
6447 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6448 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6449 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6450 ResetTouchCallbacks();
6452 orderChangedSignal = false;
6454 tet_printf("Raise actor B to top\n");
6456 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6457 actorB.RaiseToTop();
6458 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6460 // Sort actor tree before next touch event
6461 application.SendNotification();
6462 application.Render();
6464 application.ProcessEvent(touchEvent);
6466 tet_printf("Not parented so RaiseToTop should show no effect\n");
6468 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6469 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6470 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6471 ResetTouchCallbacks();
6473 orderChangedSignal = false;
6475 tet_printf("Add ActorB to stage so only Actor C not parented\n");
6479 tet_printf("Lower actor C to Bottom, B stays at top\n");
6481 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6482 actorC.LowerToBottom();
6483 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6485 application.SendNotification();
6486 application.Render();
6488 application.ProcessEvent(touchEvent);
6490 tet_printf("Not parented so LowerToBottom should show no effect\n");
6492 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6493 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6494 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6495 ResetTouchCallbacks();
6500 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
6502 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
6504 TestApplication application;
6506 Integration::Scene stage(application.GetScene());
6508 Actor actorA = Actor::New();
6509 Actor actorB = Actor::New();
6510 Actor actorC = Actor::New();
6512 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6513 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6515 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6516 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6518 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6519 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6521 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6522 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6524 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6525 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6527 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6528 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6534 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6535 // Only top actor will get touched.
6536 actorA.TouchedSignal().Connect(TestTouchCallback);
6537 actorB.TouchedSignal().Connect(TestTouchCallback2);
6538 actorC.TouchedSignal().Connect(TestTouchCallback3);
6540 ResetTouchCallbacks();
6542 // Connect ChildOrderChangedSignal
6543 bool orderChangedSignal(false);
6544 Actor orderChangedActor;
6545 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6546 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6548 application.SendNotification();
6549 application.Render();
6551 Dali::Integration::Point point;
6552 point.SetDeviceId(1);
6553 point.SetState(PointState::DOWN);
6554 point.SetScreenPosition(Vector2(10.f, 10.f));
6555 Dali::Integration::TouchEvent touchEvent;
6556 touchEvent.AddPoint(point);
6558 application.ProcessEvent(touchEvent);
6560 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6561 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6562 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6564 ResetTouchCallbacks();
6566 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
6568 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6569 actorA.RaiseAbove(actorA);
6570 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6571 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6573 application.SendNotification();
6574 application.Render();
6576 application.ProcessEvent(touchEvent);
6578 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
6580 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6581 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6582 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6584 ResetTouchCallbacks();
6586 orderChangedSignal = false;
6588 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6589 actorA.RaiseAbove(actorC);
6590 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6591 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6593 application.SendNotification();
6594 application.Render();
6596 application.ProcessEvent(touchEvent);
6598 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
6599 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6600 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6601 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6606 int UtcDaliActorGetScreenPosition(void)
6608 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
6610 TestApplication application;
6612 Integration::Scene stage(application.GetScene());
6614 Actor actorA = Actor::New();
6615 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6617 Vector2 size2(10.0f, 20.0f);
6618 actorA.SetProperty(Actor::Property::SIZE, size2);
6620 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6622 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
6626 application.SendNotification();
6627 application.Render();
6629 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6630 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6632 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6633 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
6635 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6636 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6638 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
6640 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6642 application.SendNotification();
6643 application.Render();
6645 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6646 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6648 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6649 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
6651 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6652 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6654 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
6656 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6658 application.SendNotification();
6659 application.Render();
6661 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6662 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6664 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6665 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
6667 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6668 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6670 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
6672 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
6674 application.SendNotification();
6675 application.Render();
6677 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6678 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6680 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
6681 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6683 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6684 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6686 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
6688 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
6690 application.SendNotification();
6691 application.Render();
6693 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6694 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6696 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6697 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
6699 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
6700 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6702 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
6704 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6705 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
6707 Actor actorB = Actor::New();
6708 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6709 actorB.SetProperty(Actor::Property::SIZE, size2);
6710 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
6713 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6715 application.SendNotification();
6716 application.Render();
6718 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6720 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
6721 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
6726 int UtcDaliActorGetScreenPositionAfterScaling(void)
6728 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
6730 TestApplication application;
6732 Integration::Scene stage(application.GetScene());
6734 Actor actorA = Actor::New();
6735 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6737 Vector2 size2(10.0f, 20.0f);
6738 actorA.SetProperty(Actor::Property::SIZE, size2);
6739 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
6740 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6742 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
6746 application.SendNotification();
6747 application.Render();
6749 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6750 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6752 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6753 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6755 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6756 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6758 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
6760 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6762 application.SendNotification();
6763 application.Render();
6765 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6766 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6768 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6769 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6771 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
6772 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6777 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6779 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
6781 TestApplication application;
6783 Integration::Scene stage(application.GetScene());
6785 Actor actorA = Actor::New();
6786 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6787 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6788 Vector2 size2(10.0f, 20.0f);
6789 actorA.SetProperty(Actor::Property::SIZE, size2);
6790 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6792 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6796 application.SendNotification();
6797 application.Render();
6799 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6800 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6802 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6803 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6805 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
6806 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
6808 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
6810 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
6811 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6813 application.SendNotification();
6814 application.Render();
6816 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6817 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6819 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6820 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6822 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
6823 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6829 int UtcDaliActorGetScreenPositionWithChildActors(void)
6831 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
6833 TestApplication application;
6835 Integration::Scene stage(application.GetScene());
6837 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6839 Actor actorA = Actor::New();
6840 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6841 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6842 Vector2 size1(10.0f, 20.0f);
6843 actorA.SetProperty(Actor::Property::SIZE, size1);
6844 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6846 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6848 Actor parentActorA = Actor::New();
6849 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6850 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6851 Vector2 size2(30.0f, 60.0f);
6852 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6853 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6855 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6857 stage.Add(parentActorA);
6858 parentActorA.Add(actorA);
6860 application.SendNotification();
6861 application.Render();
6863 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6864 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6866 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6867 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6869 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
6870 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
6872 tet_infoline("Test 2\n");
6874 tet_infoline("change parent anchor point and parent origin then check screen position \n");
6876 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6877 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
6879 application.SendNotification();
6880 application.Render();
6882 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6883 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6885 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6886 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6888 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
6889 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
6894 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6896 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
6898 TestApplication application;
6900 Integration::Scene stage(application.GetScene());
6902 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6904 Actor actorA = Actor::New();
6905 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6906 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6907 Vector2 size1(10.0f, 20.0f);
6908 actorA.SetProperty(Actor::Property::SIZE, size1);
6909 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6911 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6913 Actor parentActorA = Actor::New();
6914 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6915 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6916 Vector2 size2(30.0f, 60.0f);
6917 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6918 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6920 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
6922 Actor grandParentActorA = Actor::New();
6923 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6924 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
6925 Vector2 size3(60.0f, 120.0f);
6926 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
6927 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6929 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
6931 stage.Add(grandParentActorA);
6932 grandParentActorA.Add(parentActorA);
6934 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6936 parentActorA.Add(actorA);
6938 application.SendNotification();
6939 application.Render();
6941 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6942 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6944 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6945 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6947 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
6948 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
6953 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6955 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
6957 TestApplication application;
6959 Integration::Scene stage(application.GetScene());
6961 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6963 Actor actorA = Actor::New();
6964 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6965 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6966 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6967 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
6970 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6972 Actor actorB = Actor::New();
6973 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6974 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6975 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6976 Vector2 actorBSize(30.0f, 60.0f);
6977 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
6980 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6982 Actor actorC = Actor::New();
6983 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6984 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6985 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6986 Vector2 actorCSize(60.0f, 120.0f);
6987 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
6990 application.SendNotification();
6991 application.Render();
6993 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
6995 Vector2 center(stage.GetSize() * 0.5f);
6997 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6998 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
6999 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7001 tet_infoline("Add scale to all actors");
7003 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
7004 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
7005 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
7007 application.SendNotification();
7008 application.Render();
7010 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
7011 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
7012 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
7017 int utcDaliActorPositionUsesAnchorPoint(void)
7019 TestApplication application;
7020 tet_infoline("Check default behaviour\n");
7022 Actor actor = Actor::New();
7023 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7024 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7025 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7026 application.GetScene().Add(actor);
7028 application.SendNotification();
7029 application.Render();
7031 tet_infoline("Check that the world position is in the center\n");
7032 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7034 tet_infoline("Set the position uses anchor point property to false\n");
7035 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7037 application.SendNotification();
7038 application.Render();
7040 tet_infoline("Check that the world position has changed appropriately\n");
7041 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7046 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
7048 TestApplication application;
7049 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7051 Actor actor = Actor::New();
7052 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7053 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7054 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7055 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7056 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7057 application.GetScene().Add(actor);
7059 application.SendNotification();
7060 application.Render();
7062 tet_infoline("Check the world position is the same as it would be without a scale\n");
7063 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7065 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7066 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7067 application.SendNotification();
7068 application.Render();
7069 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
7071 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7072 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7073 application.SendNotification();
7074 application.Render();
7075 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7080 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
7082 TestApplication application;
7083 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7085 Actor actor = Actor::New();
7086 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7087 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7088 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7089 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7090 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7091 application.GetScene().Add(actor);
7093 application.SendNotification();
7094 application.Render();
7096 tet_infoline("Check the world position is the same as it would be without a rotation\n");
7097 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7099 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7100 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7101 application.SendNotification();
7102 application.Render();
7103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
7105 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7106 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7107 application.SendNotification();
7108 application.Render();
7109 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
7114 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
7116 TestApplication application;
7117 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7119 Actor actor = Actor::New();
7120 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7121 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7122 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7123 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7124 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7125 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7126 application.GetScene().Add(actor);
7128 application.SendNotification();
7129 application.Render();
7131 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
7132 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7134 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7135 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7136 application.SendNotification();
7137 application.Render();
7138 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
7140 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7141 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7142 application.SendNotification();
7143 application.Render();
7144 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
7149 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
7151 TestApplication application;
7152 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7154 Actor parent = Actor::New();
7156 application.GetScene().Add(parent);
7157 Vector2 stageSize(application.GetScene().GetSize());
7159 Actor actor = Actor::New();
7160 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7161 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7162 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7163 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
7164 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
7165 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7168 application.SendNotification();
7169 application.Render();
7171 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
7173 tet_infoline("Check the world position is in the right place\n");
7174 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7176 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
7177 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7178 application.SendNotification();
7179 application.Render();
7180 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7182 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
7183 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7184 application.SendNotification();
7185 application.Render();
7186 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7191 int utcDaliActorVisibilityChangeSignalSelf(void)
7193 TestApplication application;
7194 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7196 Actor actor = Actor::New();
7198 VisibilityChangedFunctorData data;
7199 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7201 actor.SetProperty(Actor::Property::VISIBLE, false);
7203 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7205 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7208 actor.SetProperty(Actor::Property::VISIBLE, false);
7209 data.Check(false /* not called */, TEST_LOCATION);
7211 tet_infoline("Change the visibility using properties, ensure called");
7214 actor.SetProperty(Actor::Property::VISIBLE, true);
7215 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7217 tet_infoline("Set the visibility to current using properties, ensure not called");
7220 actor.SetProperty(Actor::Property::VISIBLE, true);
7221 data.Check(false /* not called */, TEST_LOCATION);
7226 int utcDaliActorVisibilityChangeSignalChildren(void)
7228 TestApplication application;
7229 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
7231 Actor parent = Actor::New();
7232 Actor child = Actor::New();
7235 Actor grandChild = Actor::New();
7236 child.Add(grandChild);
7238 VisibilityChangedFunctorData parentData;
7239 VisibilityChangedFunctorData childData;
7240 VisibilityChangedFunctorData grandChildData;
7242 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
7243 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
7244 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
7246 parent.SetProperty(Actor::Property::VISIBLE, false);
7247 parentData.Check(false /* not called */, TEST_LOCATION);
7248 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7249 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7251 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
7254 grandChildData.Reset();
7256 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
7258 parent.SetProperty(Actor::Property::VISIBLE, true);
7259 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7260 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7261 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7263 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
7266 grandChildData.Reset();
7268 parent.SetProperty(Actor::Property::VISIBLE, true);
7269 parentData.Check(false /* not called */, TEST_LOCATION);
7270 childData.Check(false /* not called */, TEST_LOCATION);
7271 grandChildData.Check(false /* not called */, TEST_LOCATION);
7276 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
7278 TestApplication application;
7279 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
7281 Actor actor = Actor::New();
7282 application.GetScene().Add(actor);
7284 application.SendNotification();
7285 application.Render();
7287 VisibilityChangedFunctorData data;
7288 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7290 Animation animation = Animation::New(1.0f);
7291 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
7293 data.Check(false, TEST_LOCATION);
7294 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7295 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7297 tet_infoline("Play the animation and check the property value");
7300 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7301 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7303 tet_infoline("Animation not currently finished, so the current visibility should still be true");
7304 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7306 application.SendNotification();
7307 application.Render(1100); // After the animation
7309 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7314 int utcDaliActorVisibilityChangeSignalByName(void)
7316 TestApplication application;
7317 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7319 Actor actor = Actor::New();
7321 bool signalCalled = false;
7322 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
7323 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7324 actor.SetProperty(Actor::Property::VISIBLE, false);
7325 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7327 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7328 signalCalled = false;
7329 actor.SetProperty(Actor::Property::VISIBLE, false);
7330 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7332 tet_infoline("Change the visibility using properties, ensure called");
7333 actor.SetProperty(Actor::Property::VISIBLE, true);
7334 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7336 tet_infoline("Set the visibility to current using properties, ensure not called");
7337 signalCalled = false;
7339 actor.SetProperty(Actor::Property::VISIBLE, true);
7340 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7345 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
7347 gLayoutDirectionType = type;
7350 int UtcDaliActorLayoutDirectionProperty(void)
7352 TestApplication application;
7353 tet_infoline("Check layout direction property");
7355 Actor actor0 = Actor::New();
7356 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7357 application.GetScene().Add(actor0);
7359 application.SendNotification();
7360 application.Render();
7362 Actor actor1 = Actor::New();
7363 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7364 Actor actor2 = Actor::New();
7365 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7366 Actor actor3 = Actor::New();
7367 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7368 Actor actor4 = Actor::New();
7369 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7370 Actor actor5 = Actor::New();
7371 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7372 Actor actor6 = Actor::New();
7373 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7374 Actor actor7 = Actor::New();
7375 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7376 Actor actor8 = Actor::New();
7377 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7378 Actor actor9 = Actor::New();
7379 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7382 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
7383 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
7385 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7386 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7387 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7389 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7390 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7391 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
7393 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7395 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7396 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7398 application.GetScene().Add(actor3);
7405 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7406 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7408 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7409 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
7410 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7412 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7414 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7415 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7416 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7417 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7418 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7419 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7420 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7422 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7423 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7424 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7426 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7427 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7428 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7429 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7431 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7432 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7433 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7438 struct LayoutDirectionFunctor
7440 LayoutDirectionFunctor(bool& signalCalled)
7441 : mSignalCalled(signalCalled)
7445 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
7446 : mSignalCalled(rhs.mSignalCalled)
7452 mSignalCalled = true;
7455 bool& mSignalCalled;
7458 int UtcDaliActorLayoutDirectionSignal(void)
7460 TestApplication application;
7461 tet_infoline("Check changing layout direction property sends a signal");
7463 Actor actor = Actor::New();
7464 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7465 application.GetScene().Add(actor);
7466 bool signalCalled = false;
7467 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
7469 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
7470 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7472 // Test that writing the same value doesn't send a signal
7473 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7474 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7476 // Test that writing a different value sends the signal
7477 signalCalled = false;
7478 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7479 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7481 signalCalled = false;
7482 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7483 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7488 struct ChildAddedSignalCheck
7490 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
7491 : mSignalReceived(signalReceived),
7492 mChildHandle(childHandle)
7496 void operator()(Actor childHandle)
7498 mSignalReceived = true;
7499 mChildHandle = childHandle;
7503 mSignalReceived = true;
7504 mChildHandle = Actor();
7507 bool& mSignalReceived;
7508 Actor& mChildHandle;
7511 int UtcDaliChildAddedSignalP1(void)
7513 TestApplication application;
7514 auto stage = application.GetScene();
7516 bool signalReceived = false;
7519 ChildAddedSignalCheck signal(signalReceived, childActor);
7520 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7521 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7523 auto actorA = Actor::New();
7525 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7526 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7527 signalReceived = false;
7529 auto actorB = Actor::New();
7531 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7532 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7537 int UtcDaliChildAddedSignalP2(void)
7539 TestApplication application;
7540 auto stage = application.GetScene();
7542 bool signalReceived = false;
7545 ChildAddedSignalCheck signal(signalReceived, childActor);
7546 tet_infoline("Connect to childAdded signal by name");
7548 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
7549 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7551 auto actorA = Actor::New();
7553 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7555 // Can't test which actor was added; signal signature is void() when connecting via name.
7556 signalReceived = false;
7558 auto actorB = Actor::New();
7560 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7565 int UtcDaliChildAddedSignalN(void)
7567 TestApplication application;
7568 auto stage = application.GetScene();
7570 bool signalReceived = false;
7573 ChildAddedSignalCheck signal(signalReceived, childActor);
7574 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7575 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7577 auto actorA = Actor::New();
7579 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7580 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7581 signalReceived = false;
7583 auto actorB = Actor::New();
7585 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7589 struct ChildRemovedSignalCheck
7591 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
7592 : mSignalReceived(signalReceived),
7593 mChildHandle(childHandle)
7597 void operator()(Actor childHandle)
7599 mSignalReceived = true;
7600 mChildHandle = childHandle;
7605 mSignalReceived = true;
7608 bool& mSignalReceived;
7609 Actor& mChildHandle;
7612 int UtcDaliChildRemovedSignalP1(void)
7614 TestApplication application;
7615 auto stage = application.GetScene();
7617 bool signalReceived = false;
7620 ChildRemovedSignalCheck signal(signalReceived, childActor);
7621 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7622 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7624 auto actorA = Actor::New();
7626 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7627 DALI_TEST_CHECK(!childActor);
7629 stage.Remove(actorA);
7630 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7631 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7633 signalReceived = false;
7634 auto actorB = Actor::New();
7636 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7638 stage.Remove(actorB);
7639 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7640 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7645 int UtcDaliChildRemovedSignalP2(void)
7647 TestApplication application;
7648 auto stage = application.GetScene();
7650 bool signalReceived = false;
7653 ChildAddedSignalCheck signal(signalReceived, childActor);
7654 tet_infoline("Connect to childRemoved signal by name");
7656 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
7657 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7659 auto actorA = Actor::New();
7661 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7663 stage.Remove(actorA);
7664 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7666 signalReceived = false;
7667 auto actorB = Actor::New();
7669 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7671 stage.Remove(actorB);
7672 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7677 int UtcDaliChildRemovedSignalN(void)
7679 TestApplication application;
7680 auto stage = application.GetScene();
7682 bool signalReceived = false;
7685 ChildRemovedSignalCheck signal(signalReceived, childActor);
7686 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7687 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7689 auto actorA = Actor::New();
7692 auto actorB = Actor::New();
7695 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7696 DALI_TEST_CHECK(!childActor);
7698 actorA.Remove(actorB);
7699 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7703 int UtcDaliChildMovedSignalP(void)
7705 TestApplication application;
7706 auto stage = application.GetScene();
7708 bool addedASignalReceived = false;
7709 bool removedASignalReceived = false;
7710 bool addedBSignalReceived = false;
7711 bool removedBSignalReceived = false;
7714 auto actorA = Actor::New();
7715 auto actorB = Actor::New();
7719 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
7720 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
7721 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
7722 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
7724 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
7725 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
7726 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
7727 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
7729 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7730 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7731 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7732 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7734 // Create a child of A
7736 auto child = Actor::New();
7739 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7740 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7741 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7742 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7743 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
7746 addedASignalReceived = false;
7747 addedBSignalReceived = false;
7748 removedASignalReceived = false;
7749 removedBSignalReceived = false;
7751 actorB.Add(child); // Expect this child to be re-parented
7752 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7753 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
7754 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
7755 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7757 // Move child back to A:
7758 addedASignalReceived = false;
7759 addedBSignalReceived = false;
7760 removedASignalReceived = false;
7761 removedBSignalReceived = false;
7763 actorA.Add(child); // Expect this child to be re-parented
7764 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7765 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7766 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7767 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
7772 int UtcDaliActorSwitchParentP(void)
7774 tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
7775 TestApplication application;
7777 Actor parent1 = Actor::New();
7778 Actor child = Actor::New();
7780 application.GetScene().Add(parent1);
7782 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
7784 child.OnSceneSignal().Connect(OnSceneCallback);
7785 child.OffSceneSignal().Connect(OffSceneCallback);
7788 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
7789 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7793 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
7795 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
7796 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7798 Actor parent2 = Actor::New();
7799 application.GetScene().Add(parent2);
7801 bool addSignalReceived = false;
7802 ChildAddedSignalCheck addedSignal(addSignalReceived, child);
7803 DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
7804 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
7806 bool removedSignalReceived = false;
7807 ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
7808 DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
7809 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
7811 DevelActor::SwitchParent(child, parent2);
7813 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
7814 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
7816 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
7817 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
7819 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
7820 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7821 DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
7822 DALI_TEST_CHECK(child.GetParent() == parent2);
7827 int utcDaliActorCulled(void)
7829 TestApplication application;
7830 auto stage = application.GetScene();
7832 tet_infoline("Check that the actor is culled if the actor is out of the screen");
7834 Actor actor = Actor::New();
7835 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7837 Geometry geometry = CreateQuadGeometry();
7838 Shader shader = CreateShader();
7839 Renderer renderer = Renderer::New(geometry, shader);
7840 actor.AddRenderer(renderer);
7844 application.SendNotification();
7845 application.Render(0);
7847 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
7849 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
7850 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
7852 // Connect NotifySignal
7853 bool propertyNotificationSignal(false);
7854 PropertyNotification source;
7855 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
7856 notification.NotifySignal().Connect(&application, f);
7858 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
7860 application.SendNotification();
7861 application.Render();
7863 application.SendNotification();
7865 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
7867 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
7868 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
7869 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
7874 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7876 TestApplication application;
7877 auto stage = application.GetScene();
7879 tet_infoline("Ensure we clear the screen when the last actor is removed");
7881 Actor actor = CreateRenderableActor();
7882 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7885 application.SendNotification();
7886 application.Render();
7888 auto& glAbstraction = application.GetGlAbstraction();
7889 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7893 application.SendNotification();
7894 application.Render();
7896 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7901 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7903 TestApplication application;
7904 auto stage = application.GetScene();
7906 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
7908 Actor actor = CreateRenderableActor();
7909 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7912 application.SendNotification();
7913 application.Render();
7915 auto& glAbstraction = application.GetGlAbstraction();
7916 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7918 actor.SetProperty(Actor::Property::VISIBLE, false);
7920 application.SendNotification();
7921 application.Render();
7923 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7928 int utcDaliActorGetSizeAfterAnimation(void)
7930 TestApplication application;
7931 tet_infoline("Check the actor size before / after an animation is finished");
7933 Vector3 actorSize(100.0f, 100.0f, 0.0f);
7935 Actor actor = Actor::New();
7936 actor.SetProperty(Actor::Property::SIZE, actorSize);
7937 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7938 application.GetScene().Add(actor);
7940 // Size should be updated without rendering.
7941 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7942 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7944 application.SendNotification();
7945 application.Render();
7947 // Size and current size should be updated.
7948 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7949 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7950 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7951 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7952 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7954 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7955 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7956 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7957 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7958 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7961 actorSize = Vector3(200.0f, 200.0f, 0.0f);
7962 actor.SetProperty(Actor::Property::SIZE, actorSize);
7964 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7965 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7967 Vector3 targetValue(10.0f, 20.0f, 0.0f);
7969 Animation animation = Animation::New(1.0f);
7970 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
7973 // Size should be updated without rendering.
7974 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7975 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7977 application.SendNotification();
7978 application.Render(1100); // After the animation
7980 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7981 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7982 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7983 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7984 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7986 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7987 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7988 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7989 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7990 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7992 targetValue.width = 50.0f;
7995 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
7998 application.SendNotification();
7999 application.Render(1100); // After the animation
8001 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8002 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8003 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8004 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8005 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8007 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8008 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8009 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8010 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8011 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8013 targetValue.height = 70.0f;
8016 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
8019 application.SendNotification();
8020 application.Render(1100); // After the animation
8022 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8023 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8024 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8025 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8026 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8028 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8029 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8030 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8031 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8032 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8034 Vector3 offset(10.0f, 20.0f, 0.0f);
8037 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
8040 application.SendNotification();
8041 application.Render(1100); // After the animation
8043 targetValue += offset;
8045 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8046 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8047 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8048 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8049 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8051 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8052 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8053 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8054 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8055 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8057 offset.width = 20.0f;
8060 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
8063 application.SendNotification();
8064 application.Render(1100); // After the animation
8066 targetValue.width += offset.width;
8068 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8069 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8070 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8071 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8072 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8074 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8075 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8076 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8077 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8078 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8080 offset.height = 10.0f;
8083 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
8086 application.SendNotification();
8087 application.Render(1100); // After the animation
8089 targetValue.height += offset.height;
8091 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8092 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8093 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8094 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8095 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8097 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8098 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8099 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8100 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8101 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8104 actorSize = Vector3(300.0f, 300.0f, 0.0f);
8106 actor.SetProperty(Actor::Property::SIZE, actorSize);
8108 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8109 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8111 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8112 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8114 application.SendNotification();
8115 application.Render();
8117 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8118 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8120 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8121 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8126 int utcDaliActorRelayoutAndAnimation(void)
8128 TestApplication application;
8129 tet_infoline("Check the actor size when relayoutting and playing animation");
8131 Vector3 parentSize(300.0f, 300.0f, 0.0f);
8132 Vector3 actorSize(100.0f, 100.0f, 0.0f);
8135 Actor parentA = Actor::New();
8136 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8137 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8138 application.GetScene().Add(parentA);
8140 Actor parentB = Actor::New();
8141 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8142 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8143 application.GetScene().Add(parentB);
8145 Actor actor = Actor::New();
8146 actor.SetProperty(Actor::Property::SIZE, actorSize);
8147 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8150 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8151 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8153 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8155 Animation animation = Animation::New(1.0f);
8156 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8159 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8160 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8162 application.SendNotification();
8163 application.Render(1100); // After the animation
8165 // Size and current size should be updated.
8166 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8167 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8169 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8170 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8175 application.SendNotification();
8176 application.Render();
8178 // Size and current size should be same.
8179 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8180 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8182 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8183 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8191 Actor parentA = Actor::New();
8192 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8193 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8194 application.GetScene().Add(parentA);
8196 Actor parentB = Actor::New();
8197 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8198 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8199 application.GetScene().Add(parentB);
8201 Actor actor = Actor::New();
8202 actor.SetProperty(Actor::Property::SIZE, actorSize);
8203 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8206 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8207 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8209 application.SendNotification();
8210 application.Render();
8212 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8213 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8215 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8216 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8218 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8220 // Make an animation
8221 Animation animation = Animation::New(1.0f);
8222 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8225 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8226 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8228 application.SendNotification();
8229 application.Render(1100); // After the animation
8231 // Size and current size should be updated.
8232 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8233 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8235 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8236 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8241 application.SendNotification();
8242 application.Render();
8244 // Size and current size should be same.
8245 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8246 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8248 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8249 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8259 int utcDaliActorPartialUpdate(void)
8261 TestApplication application(
8262 TestApplication::DEFAULT_SURFACE_WIDTH,
8263 TestApplication::DEFAULT_SURFACE_HEIGHT,
8264 TestApplication::DEFAULT_HORIZONTAL_DPI,
8265 TestApplication::DEFAULT_VERTICAL_DPI,
8269 tet_infoline("Check the damaged area");
8271 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8273 std::vector<Rect<int>> damagedRects;
8274 Rect<int> clippingRect;
8275 application.SendNotification();
8276 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8278 // First render pass, nothing to render, adaptor would just do swap buffer.
8279 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8281 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8282 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8284 Actor actor = CreateRenderableActor();
8285 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8286 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8287 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8288 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8289 application.GetScene().Add(actor);
8291 application.SendNotification();
8293 // 1. Actor added, damaged rect is added size of actor
8294 damagedRects.clear();
8295 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8296 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8299 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8300 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8301 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8302 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8303 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8304 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8305 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8308 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
8309 application.SendNotification();
8311 damagedRects.clear();
8312 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8313 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8316 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
8317 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8318 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8319 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8320 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8321 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8322 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8324 // 3. Set new position
8325 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
8326 application.SendNotification();
8328 damagedRects.clear();
8329 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8330 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8333 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
8334 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8335 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8336 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8337 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8338 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8339 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8341 application.GetScene().Remove(actor);
8342 application.SendNotification();
8344 // Actor removed, last 3 dirty rects are reported. Adaptor would merge them together.
8345 damagedRects.clear();
8346 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8347 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
8349 clippingRect = damagedRects[0];
8350 clippingRect.Merge(damagedRects[1]);
8351 clippingRect.Merge(damagedRects[2]);
8353 DALI_TEST_EQUALS(clippingRect.IsEmpty(), false, TEST_LOCATION);
8354 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
8355 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(16, 736, 64, 64), TEST_LOCATION);
8357 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8358 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8359 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8360 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8361 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8366 int utcDaliActorPartialUpdateSetColor(void)
8368 TestApplication application(
8369 TestApplication::DEFAULT_SURFACE_WIDTH,
8370 TestApplication::DEFAULT_SURFACE_HEIGHT,
8371 TestApplication::DEFAULT_HORIZONTAL_DPI,
8372 TestApplication::DEFAULT_VERTICAL_DPI,
8376 tet_infoline("Check uniform update");
8378 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8380 std::vector<Rect<int>> damagedRects;
8381 Rect<int> clippingRect;
8382 application.SendNotification();
8383 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8385 // First render pass, nothing to render, adaptor would just do swap buffer.
8386 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8388 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8389 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8391 Actor actor = CreateRenderableActor();
8392 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8393 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8394 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8395 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8396 application.GetScene().Add(actor);
8398 application.SendNotification();
8400 // 1. Actor added, damaged rect is added size of actor
8401 damagedRects.clear();
8402 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8403 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8406 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8407 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8408 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8409 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8410 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8411 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8412 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8414 damagedRects.clear();
8415 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8417 damagedRects.clear();
8418 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8421 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
8422 application.SendNotification();
8424 damagedRects.clear();
8425 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8426 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8429 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8430 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8431 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8432 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8433 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8434 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8435 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8440 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
8441 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
8442 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
8443 const char* const RENDER_SHADOW_VERTEX_SOURCE =
8444 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
8445 " uniform mediump mat4 uLightCameraViewMatrix;\n"
8449 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
8450 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
8451 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
8454 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
8455 "uniform lowp vec4 uShadowColor;\n"
8458 " lowp float alpha;\n"
8459 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
8460 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
8463 int utcDaliActorPartialUpdateSetProperty(void)
8465 TestApplication application(
8466 TestApplication::DEFAULT_SURFACE_WIDTH,
8467 TestApplication::DEFAULT_SURFACE_HEIGHT,
8468 TestApplication::DEFAULT_HORIZONTAL_DPI,
8469 TestApplication::DEFAULT_VERTICAL_DPI,
8473 tet_infoline("Set/Update property with partial update");
8475 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8477 std::vector<Rect<int>> damagedRects;
8478 Rect<int> clippingRect;
8479 application.SendNotification();
8480 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8482 // First render pass, nothing to render, adaptor would just do swap buffer.
8483 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8485 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8486 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8488 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
8489 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
8490 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8491 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8492 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8493 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8494 application.GetScene().Add(actor);
8496 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
8498 damagedRects.clear();
8499 application.SendNotification();
8500 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8501 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8504 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8505 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8506 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8507 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8508 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8509 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8510 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8512 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
8513 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
8515 damagedRects.clear();
8516 application.SendNotification();
8517 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8518 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8520 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8521 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8522 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8523 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8524 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8525 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8527 // Should be no damage rects, nothing changed
8528 damagedRects.clear();
8529 application.SendNotification();
8530 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8531 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8533 // Should be 1 damage rect due to change in size
8534 damagedRects.clear();
8535 actor.SetProperty(Actor::Property::SIZE, Vector3(26.0f, 26.0f, 0.0f));
8536 application.SendNotification();
8537 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8538 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8540 clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
8541 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8542 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8543 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8544 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8545 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8546 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8548 damagedRects.clear();
8549 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8550 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8555 int utcDaliActorPartialUpdateTwoActors(void)
8557 TestApplication application(
8558 TestApplication::DEFAULT_SURFACE_WIDTH,
8559 TestApplication::DEFAULT_SURFACE_HEIGHT,
8560 TestApplication::DEFAULT_HORIZONTAL_DPI,
8561 TestApplication::DEFAULT_VERTICAL_DPI,
8565 tet_infoline("Check the damaged rects with partial update and two actors");
8567 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8569 Actor actor = CreateRenderableActor();
8570 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
8571 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
8572 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8573 application.GetScene().Add(actor);
8575 Actor actor2 = CreateRenderableActor();
8576 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
8577 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
8578 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8579 application.GetScene().Add(actor2);
8581 application.SendNotification();
8582 std::vector<Rect<int>> damagedRects;
8583 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8585 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
8586 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
8587 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
8589 // in screen coordinates, adaptor would calculate it using previous frames information
8590 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
8591 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8593 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8594 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8595 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8596 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8598 // Change a Renderer of actor1
8599 Geometry geometry = CreateQuadGeometry();
8600 Shader shader = CreateShader();
8601 Renderer newRenderer = Renderer::New(geometry, shader);
8602 Renderer renderer = actor.GetRendererAt(0);
8604 actor.RemoveRenderer(renderer);
8605 actor.AddRenderer(newRenderer);
8607 damagedRects.clear();
8609 application.SendNotification();
8610 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8612 DALI_TEST_CHECK(damagedRects.size() > 0);
8613 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
8615 // in screen coordinates, adaptor would calculate it using previous frames information
8616 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8618 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8619 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8620 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8621 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8626 int utcDaliActorPartialUpdateActorsWithSizeHint(void)
8628 TestApplication application(
8629 TestApplication::DEFAULT_SURFACE_WIDTH,
8630 TestApplication::DEFAULT_SURFACE_HEIGHT,
8631 TestApplication::DEFAULT_HORIZONTAL_DPI,
8632 TestApplication::DEFAULT_VERTICAL_DPI,
8636 tet_infoline("Check the damaged rect with partial update and actor size hint");
8638 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8640 Actor actor = CreateRenderableActor();
8641 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
8642 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
8643 actor.SetProperty(DevelActor::Property::UPDATE_SIZE_HINT, Vector3(64.0f, 64.0f, 0.0f));
8644 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8645 application.GetScene().Add(actor);
8647 application.SendNotification();
8648 std::vector<Rect<int>> damagedRects;
8649 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8651 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8653 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
8654 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8656 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8658 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8659 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8660 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8661 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8666 int utcDaliActorPartialUpdateAnimation(void)
8668 TestApplication application(
8669 TestApplication::DEFAULT_SURFACE_WIDTH,
8670 TestApplication::DEFAULT_SURFACE_HEIGHT,
8671 TestApplication::DEFAULT_HORIZONTAL_DPI,
8672 TestApplication::DEFAULT_VERTICAL_DPI,
8676 tet_infoline("Check the damaged area with partial update and animation");
8678 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
8679 drawTrace.Enable(true);
8682 Actor actor1 = CreateRenderableActor();
8683 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8684 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
8685 application.GetScene().Add(actor1);
8687 Actor actor2 = CreateRenderableActor();
8688 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8689 actor2.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8690 application.GetScene().Add(actor2);
8692 std::vector<Rect<int>> damagedRects;
8693 Rect<int> clippingRect;
8694 Rect<int> expectedRect1, expectedRect2;
8696 application.SendNotification();
8697 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8699 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
8702 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
8703 expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 3 last frames updates
8704 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
8705 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[1], TEST_LOCATION);
8707 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8708 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8710 damagedRects.clear();
8711 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8712 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8713 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8715 // Make an animation
8716 Animation animation = Animation::New(1.0f);
8717 animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
8720 application.SendNotification();
8722 damagedRects.clear();
8723 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8724 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8725 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8728 damagedRects.clear();
8730 // In animation deley time
8731 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8732 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8733 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8736 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
8739 damagedRects.clear();
8741 // Also in animation deley time
8742 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8743 application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
8744 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8747 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
8749 // Unparent 2 actors and make a new actor
8753 Actor actor3 = CreateRenderableActor();
8754 actor3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8755 actor3.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8756 application.GetScene().Add(actor3);
8758 application.SendNotification();
8760 // Started animation
8761 damagedRects.clear();
8762 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
8763 DALI_TEST_EQUALS(damagedRects.size(), 5, TEST_LOCATION);
8765 // The first dirty rect is actor3's.
8766 // We don't know the exact dirty rect of actor2
8767 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
8768 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[1], TEST_LOCATION);
8770 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8771 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8773 // Finished animation, but the actor was already unparented
8774 damagedRects.clear();
8775 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
8777 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8778 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
8780 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8781 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8786 int utcDaliActorPartialUpdateChangeVisibility(void)
8788 TestApplication application(
8789 TestApplication::DEFAULT_SURFACE_WIDTH,
8790 TestApplication::DEFAULT_SURFACE_HEIGHT,
8791 TestApplication::DEFAULT_HORIZONTAL_DPI,
8792 TestApplication::DEFAULT_VERTICAL_DPI,
8796 tet_infoline("Check the damaged rect with partial update and visibility change");
8798 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8800 Actor actor = CreateRenderableActor();
8801 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8802 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8803 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8804 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8805 application.GetScene().Add(actor);
8807 application.SendNotification();
8809 std::vector<Rect<int>> damagedRects;
8810 Rect<int> clippingRect;
8812 // 1. Actor added, damaged rect is added size of actor
8813 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8814 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8817 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8818 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8819 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8820 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8821 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8822 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8823 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8825 damagedRects.clear();
8826 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8827 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8829 damagedRects.clear();
8830 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8831 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8833 // Ensure the damaged rect is empty
8834 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8836 // 2. Make the Actor invisible
8837 actor.SetProperty(Actor::Property::VISIBLE, false);
8838 application.SendNotification();
8840 damagedRects.clear();
8841 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8842 DALI_TEST_CHECK(damagedRects.size() > 0);
8843 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8845 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8846 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8847 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8848 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8849 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8851 // 3. Make the Actor visible again
8852 actor.SetProperty(Actor::Property::VISIBLE, true);
8853 application.SendNotification();
8855 damagedRects.clear();
8856 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8857 DALI_TEST_CHECK(damagedRects.size() > 0);
8858 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8860 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8861 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8862 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8863 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8864 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8869 int utcDaliActorPartialUpdateOnOffScene(void)
8871 TestApplication application(
8872 TestApplication::DEFAULT_SURFACE_WIDTH,
8873 TestApplication::DEFAULT_SURFACE_HEIGHT,
8874 TestApplication::DEFAULT_HORIZONTAL_DPI,
8875 TestApplication::DEFAULT_VERTICAL_DPI,
8879 tet_infoline("Check the damaged rect with partial update and on/off scene");
8881 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8883 Actor actor = CreateRenderableActor();
8884 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8885 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8886 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8887 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8888 application.GetScene().Add(actor);
8890 application.SendNotification();
8892 std::vector<Rect<int>> damagedRects;
8893 Rect<int> clippingRect;
8895 // 1. Actor added, damaged rect is added size of actor
8896 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8897 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8900 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8901 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8902 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8903 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8904 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8905 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8906 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8908 damagedRects.clear();
8909 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8910 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8912 damagedRects.clear();
8913 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8914 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8916 // Ensure the damaged rect is empty
8917 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8919 // 2. Remove the Actor from the Scene
8921 application.SendNotification();
8923 damagedRects.clear();
8924 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8925 DALI_TEST_CHECK(damagedRects.size() > 0);
8926 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8928 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8929 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8930 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8931 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8932 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8934 // 3. Add the Actor to the Scene again
8935 application.GetScene().Add(actor);
8936 application.SendNotification();
8938 damagedRects.clear();
8939 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8940 DALI_TEST_CHECK(damagedRects.size() > 0);
8941 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8943 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8944 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8945 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8946 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8947 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8952 int utcDaliActorPartialUpdateSkipRendering(void)
8954 TestApplication application(
8955 TestApplication::DEFAULT_SURFACE_WIDTH,
8956 TestApplication::DEFAULT_SURFACE_HEIGHT,
8957 TestApplication::DEFAULT_HORIZONTAL_DPI,
8958 TestApplication::DEFAULT_VERTICAL_DPI,
8962 tet_infoline("Check to skip rendering in case of the empty damaged rect");
8964 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
8965 drawTrace.Enable(true);
8968 Actor actor1 = CreateRenderableActor();
8969 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8970 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
8971 application.GetScene().Add(actor1);
8973 std::vector<Rect<int>> damagedRects;
8974 Rect<int> clippingRect;
8975 Rect<int> expectedRect1;
8977 application.SendNotification();
8978 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8980 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8983 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
8984 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
8986 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8987 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8989 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
8991 damagedRects.clear();
8992 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8993 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8994 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8999 application.SendNotification();
9001 damagedRects.clear();
9002 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9004 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
9006 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9007 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9009 // Render again without any change
9010 damagedRects.clear();
9012 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9014 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9016 clippingRect = Rect<int>();
9017 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9020 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
9022 // Add the actor again
9023 application.GetScene().Add(actor1);
9025 application.SendNotification();
9027 damagedRects.clear();
9029 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9031 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
9033 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9034 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9036 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9041 int utcDaliActorPartialUpdate3DNode(void)
9043 TestApplication application(
9044 TestApplication::DEFAULT_SURFACE_WIDTH,
9045 TestApplication::DEFAULT_SURFACE_HEIGHT,
9046 TestApplication::DEFAULT_HORIZONTAL_DPI,
9047 TestApplication::DEFAULT_VERTICAL_DPI,
9051 tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
9053 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
9054 drawTrace.Enable(true);
9057 Actor actor1 = CreateRenderableActor();
9058 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9059 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
9060 application.GetScene().Add(actor1);
9062 std::vector<Rect<int>> damagedRects;
9063 Rect<int> clippingRect;
9065 application.SendNotification();
9066 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9068 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9070 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9071 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9073 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9075 // Change the layer to 3D
9076 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
9078 application.SendNotification();
9080 damagedRects.clear();
9081 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9083 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9084 DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
9086 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9088 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9090 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9092 // Change the layer to 2D
9093 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
9095 application.SendNotification();
9097 damagedRects.clear();
9098 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9100 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9102 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9103 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9105 // Make 3D transform
9106 actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
9108 application.SendNotification();
9110 damagedRects.clear();
9111 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9113 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9114 DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
9116 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9118 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9120 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9125 int utcDaliActorPartialUpdateNotRenderableActor(void)
9127 TestApplication application(
9128 TestApplication::DEFAULT_SURFACE_WIDTH,
9129 TestApplication::DEFAULT_SURFACE_HEIGHT,
9130 TestApplication::DEFAULT_HORIZONTAL_DPI,
9131 TestApplication::DEFAULT_VERTICAL_DPI,
9135 tet_infoline("Check the damaged rect with not renderable parent actor");
9137 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9139 Actor parent = Actor::New();
9140 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9141 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9142 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9143 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9144 application.GetScene().Add(parent);
9146 Actor child = CreateRenderableActor();
9147 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9148 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9149 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9152 application.SendNotification();
9154 std::vector<Rect<int>> damagedRects;
9156 // 1. Actor added, damaged rect is added size of actor
9157 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9158 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9161 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9162 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9164 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9165 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9166 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9167 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9168 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9170 damagedRects.clear();
9171 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9172 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9174 damagedRects.clear();
9175 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9176 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9178 // Ensure the damaged rect is empty
9179 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9184 int utcDaliActorPartialUpdateChangeTransparency(void)
9186 TestApplication application(
9187 TestApplication::DEFAULT_SURFACE_WIDTH,
9188 TestApplication::DEFAULT_SURFACE_HEIGHT,
9189 TestApplication::DEFAULT_HORIZONTAL_DPI,
9190 TestApplication::DEFAULT_VERTICAL_DPI,
9194 tet_infoline("Check the damaged rect with changing transparency");
9196 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9198 Actor actor = CreateRenderableActor();
9199 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9200 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9201 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9202 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9203 application.GetScene().Add(actor);
9205 application.SendNotification();
9207 std::vector<Rect<int>> damagedRects;
9209 // Actor added, damaged rect is added size of actor
9210 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9211 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9214 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9215 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9217 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9218 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9219 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9220 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9221 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9223 damagedRects.clear();
9224 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9225 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9227 damagedRects.clear();
9228 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9229 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9231 // Make the actor transparent by changing opacity of the Renderer
9232 // It changes a uniform value
9233 Renderer renderer = actor.GetRendererAt(0);
9234 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
9236 application.SendNotification();
9238 // The damaged rect should be same
9239 damagedRects.clear();
9240 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9241 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9242 DALI_TEST_CHECK(damagedRects.size() > 0);
9243 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9245 damagedRects.clear();
9246 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9247 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9249 // Ensure the damaged rect is empty
9250 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9252 // Make the actor opaque again
9253 renderer[DevelRenderer::Property::OPACITY] = 1.0f;
9255 application.SendNotification();
9257 // The damaged rect should not be empty
9258 damagedRects.clear();
9259 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9260 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9261 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9262 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9264 damagedRects.clear();
9265 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9266 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9268 damagedRects.clear();
9269 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9270 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9272 // Make the actor culled
9273 actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
9275 application.SendNotification();
9277 // The damaged rect should be same
9278 damagedRects.clear();
9279 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9280 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9281 DALI_TEST_CHECK(damagedRects.size() > 0);
9282 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9284 damagedRects.clear();
9285 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9286 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9288 // Ensure the damaged rect is empty
9289 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9291 // Make the actor not culled again
9292 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 16.0f);
9294 application.SendNotification();
9296 // The damaged rect should not be empty
9297 damagedRects.clear();
9298 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9299 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9300 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9301 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9306 int utcDaliActorPartialUpdateChangeParentOpacity(void)
9308 TestApplication application(
9309 TestApplication::DEFAULT_SURFACE_WIDTH,
9310 TestApplication::DEFAULT_SURFACE_HEIGHT,
9311 TestApplication::DEFAULT_HORIZONTAL_DPI,
9312 TestApplication::DEFAULT_VERTICAL_DPI,
9316 tet_infoline("Check the damaged rect with changing parent's opacity");
9318 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9320 Actor parent = Actor::New();
9321 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9322 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9323 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9324 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9325 application.GetScene().Add(parent);
9327 Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
9328 Actor child = CreateRenderableActor(texture);
9329 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9330 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9331 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9334 application.SendNotification();
9336 std::vector<Rect<int>> damagedRects;
9338 // Actor added, damaged rect is added size of actor
9339 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9340 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9343 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9344 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9346 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9347 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9348 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9349 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9350 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9352 damagedRects.clear();
9353 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9354 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9356 damagedRects.clear();
9357 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9358 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9360 // Ensure the damaged rect is empty
9361 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9363 // Change the parent's opacity
9364 parent[Actor::Property::OPACITY] = 0.5f;
9366 application.SendNotification();
9368 // The damaged rect should be same
9369 damagedRects.clear();
9370 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9371 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9372 DALI_TEST_CHECK(damagedRects.size() > 0);
9373 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9378 int utcDaliActorPartialAddRemoveRenderer(void)
9380 TestApplication application(
9381 TestApplication::DEFAULT_SURFACE_WIDTH,
9382 TestApplication::DEFAULT_SURFACE_HEIGHT,
9383 TestApplication::DEFAULT_HORIZONTAL_DPI,
9384 TestApplication::DEFAULT_VERTICAL_DPI,
9388 tet_infoline("Check the damaged rect with adding / removing renderer");
9390 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9392 Actor actor = CreateRenderableActor();
9393 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9394 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9395 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9396 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9397 application.GetScene().Add(actor);
9399 application.SendNotification();
9401 std::vector<Rect<int>> damagedRects;
9403 // Actor added, damaged rect is added size of actor
9404 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9405 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9408 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9409 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9411 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9412 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9413 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9414 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9415 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9417 damagedRects.clear();
9418 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9419 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9421 damagedRects.clear();
9422 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9423 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9425 // Remove the Renderer
9426 Renderer renderer = actor.GetRendererAt(0);
9427 actor.RemoveRenderer(renderer);
9429 application.SendNotification();
9431 // The damaged rect should be the actor area
9432 damagedRects.clear();
9433 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9434 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9435 DALI_TEST_CHECK(damagedRects.size() > 0);
9436 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9438 damagedRects.clear();
9439 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9440 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9442 // Ensure the damaged rect is empty
9443 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9445 // Add the Renderer again
9446 actor.AddRenderer(renderer);
9448 application.SendNotification();
9450 // The damaged rect should be the actor area
9451 damagedRects.clear();
9452 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9453 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9454 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9455 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9460 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
9462 TestApplication application;
9464 Actor actor = Actor::New();
9465 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
9466 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
9467 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
9468 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
9469 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
9470 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
9471 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
9472 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
9476 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
9478 TestApplication application;
9480 Actor actor = Actor::New();
9482 // Make sure setting invalid types does not cause a crash
9485 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
9486 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
9487 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
9488 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
9489 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
9490 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
9491 tet_result(TET_PASS);
9495 tet_result(TET_FAIL);
9500 int UtcDaliActorTouchAreaOffsetPropertyP(void)
9502 TestApplication application;
9504 Actor actor = Actor::New();
9505 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
9506 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
9507 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
9508 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
9509 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
9513 int UtcDaliActorTouchAreaOffsetPropertyN(void)
9515 TestApplication application;
9517 Actor actor = Actor::New();
9519 // Make sure setting invalid types does not cause a crash
9522 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
9523 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
9524 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
9525 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
9526 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
9527 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
9528 tet_result(TET_PASS);
9532 tet_result(TET_FAIL);
9537 int UtcDaliActorLowerBelowNegative(void)
9539 TestApplication application;
9540 Dali::Actor instance;
9544 instance.LowerBelow(arg1);
9545 DALI_TEST_CHECK(false); // Should not get here
9549 DALI_TEST_CHECK(true); // We expect an assert
9554 int UtcDaliActorRaiseAboveNegative(void)
9556 TestApplication application;
9557 Dali::Actor instance;
9561 instance.RaiseAbove(arg1);
9562 DALI_TEST_CHECK(false); // Should not get here
9566 DALI_TEST_CHECK(true); // We expect an assert
9571 int UtcDaliActorRaiseToTopNegative(void)
9573 TestApplication application;
9574 Dali::Actor instance;
9577 instance.RaiseToTop();
9578 DALI_TEST_CHECK(false); // Should not get here
9582 DALI_TEST_CHECK(true); // We expect an assert
9587 int UtcDaliActorAddRendererNegative(void)
9589 TestApplication application;
9590 Dali::Actor instance;
9593 Dali::Renderer arg1;
9594 instance.AddRenderer(arg1);
9595 DALI_TEST_CHECK(false); // Should not get here
9599 DALI_TEST_CHECK(true); // We expect an assert
9604 int UtcDaliActorTouchedSignalNegative(void)
9606 TestApplication application;
9607 Dali::Actor instance;
9610 instance.TouchedSignal();
9611 DALI_TEST_CHECK(false); // Should not get here
9615 DALI_TEST_CHECK(true); // We expect an assert
9620 int UtcDaliActorTranslateByNegative(void)
9622 TestApplication application;
9623 Dali::Actor instance;
9627 instance.TranslateBy(arg1);
9628 DALI_TEST_CHECK(false); // Should not get here
9632 DALI_TEST_CHECK(true); // We expect an assert
9637 int UtcDaliActorFindChildByIdNegative(void)
9639 TestApplication application;
9640 Dali::Actor instance;
9643 unsigned int arg1 = 0u;
9644 instance.FindChildById(arg1);
9645 DALI_TEST_CHECK(false); // Should not get here
9649 DALI_TEST_CHECK(true); // We expect an assert
9654 int UtcDaliActorGetRendererAtNegative(void)
9656 TestApplication application;
9657 Dali::Actor instance;
9660 unsigned int arg1 = 0u;
9661 instance.GetRendererAt(arg1);
9662 DALI_TEST_CHECK(false); // Should not get here
9666 DALI_TEST_CHECK(true); // We expect an assert
9671 int UtcDaliActorHoveredSignalNegative(void)
9673 TestApplication application;
9674 Dali::Actor instance;
9677 instance.HoveredSignal();
9678 DALI_TEST_CHECK(false); // Should not get here
9682 DALI_TEST_CHECK(true); // We expect an assert
9687 int UtcDaliActorLowerToBottomNegative(void)
9689 TestApplication application;
9690 Dali::Actor instance;
9693 instance.LowerToBottom();
9694 DALI_TEST_CHECK(false); // Should not get here
9698 DALI_TEST_CHECK(true); // We expect an assert
9703 int UtcDaliActorOnSceneSignalNegative(void)
9705 TestApplication application;
9706 Dali::Actor instance;
9709 instance.OnSceneSignal();
9710 DALI_TEST_CHECK(false); // Should not get here
9714 DALI_TEST_CHECK(true); // We expect an assert
9719 int UtcDaliActorOffSceneSignalNegative(void)
9721 TestApplication application;
9722 Dali::Actor instance;
9725 instance.OffSceneSignal();
9726 DALI_TEST_CHECK(false); // Should not get here
9730 DALI_TEST_CHECK(true); // We expect an assert
9735 int UtcDaliActorRemoveRendererNegative01(void)
9737 TestApplication application;
9738 Dali::Actor instance;
9741 unsigned int arg1 = 0u;
9742 instance.RemoveRenderer(arg1);
9743 DALI_TEST_CHECK(false); // Should not get here
9747 DALI_TEST_CHECK(true); // We expect an assert
9752 int UtcDaliActorRemoveRendererNegative02(void)
9754 TestApplication application;
9755 Dali::Actor instance;
9758 Dali::Renderer arg1;
9759 instance.RemoveRenderer(arg1);
9760 DALI_TEST_CHECK(false); // Should not get here
9764 DALI_TEST_CHECK(true); // We expect an assert
9769 int UtcDaliActorFindChildByNameNegative(void)
9771 TestApplication application;
9772 Dali::Actor instance;
9776 instance.FindChildByName(arg1);
9777 DALI_TEST_CHECK(false); // Should not get here
9781 DALI_TEST_CHECK(true); // We expect an assert
9786 int UtcDaliActorSetResizePolicyNegative(void)
9788 TestApplication application;
9789 Dali::Actor instance;
9792 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
9793 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
9794 instance.SetResizePolicy(arg1, arg2);
9795 DALI_TEST_CHECK(false); // Should not get here
9799 DALI_TEST_CHECK(true); // We expect an assert
9804 int UtcDaliActorOnRelayoutSignalNegative(void)
9806 TestApplication application;
9807 Dali::Actor instance;
9810 instance.OnRelayoutSignal();
9811 DALI_TEST_CHECK(false); // Should not get here
9815 DALI_TEST_CHECK(true); // We expect an assert
9820 int UtcDaliActorWheelEventSignalNegative(void)
9822 TestApplication application;
9823 Dali::Actor instance;
9826 instance.WheelEventSignal();
9827 DALI_TEST_CHECK(false); // Should not get here
9831 DALI_TEST_CHECK(true); // We expect an assert
9836 int UtcDaliActorGetHeightForWidthNegative(void)
9838 TestApplication application;
9839 Dali::Actor instance;
9843 instance.GetHeightForWidth(arg1);
9844 DALI_TEST_CHECK(false); // Should not get here
9848 DALI_TEST_CHECK(true); // We expect an assert
9853 int UtcDaliActorGetWidthForHeightNegative(void)
9855 TestApplication application;
9856 Dali::Actor instance;
9860 instance.GetWidthForHeight(arg1);
9861 DALI_TEST_CHECK(false); // Should not get here
9865 DALI_TEST_CHECK(true); // We expect an assert
9870 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
9872 TestApplication application;
9873 Dali::Actor instance;
9876 instance.LayoutDirectionChangedSignal();
9877 DALI_TEST_CHECK(false); // Should not get here
9881 DALI_TEST_CHECK(true); // We expect an assert
9886 int UtcDaliActorAddNegative(void)
9888 TestApplication application;
9889 Dali::Actor instance;
9894 DALI_TEST_CHECK(false); // Should not get here
9898 DALI_TEST_CHECK(true); // We expect an assert
9903 int UtcDaliActorLowerNegative(void)
9905 TestApplication application;
9906 Dali::Actor instance;
9910 DALI_TEST_CHECK(false); // Should not get here
9914 DALI_TEST_CHECK(true); // We expect an assert
9919 int UtcDaliActorRaiseNegative(void)
9921 TestApplication application;
9922 Dali::Actor instance;
9926 DALI_TEST_CHECK(false); // Should not get here
9930 DALI_TEST_CHECK(true); // We expect an assert
9935 int UtcDaliActorRemoveNegative(void)
9937 TestApplication application;
9938 Dali::Actor instance;
9942 instance.Remove(arg1);
9943 DALI_TEST_CHECK(false); // Should not get here
9947 DALI_TEST_CHECK(true); // We expect an assert
9952 int UtcDaliActorScaleByNegative(void)
9954 TestApplication application;
9955 Dali::Actor instance;
9959 instance.ScaleBy(arg1);
9960 DALI_TEST_CHECK(false); // Should not get here
9964 DALI_TEST_CHECK(true); // We expect an assert
9969 int UtcDaliActorGetLayerNegative(void)
9971 TestApplication application;
9972 Dali::Actor instance;
9975 instance.GetLayer();
9976 DALI_TEST_CHECK(false); // Should not get here
9980 DALI_TEST_CHECK(true); // We expect an assert
9985 int UtcDaliActorRotateByNegative01(void)
9987 TestApplication application;
9988 Dali::Actor instance;
9991 Dali::Quaternion arg1;
9992 instance.RotateBy(arg1);
9993 DALI_TEST_CHECK(false); // Should not get here
9997 DALI_TEST_CHECK(true); // We expect an assert
10002 int UtcDaliActorRotateByNegative02(void)
10004 TestApplication application;
10005 Dali::Actor instance;
10009 Dali::Vector3 arg2;
10010 instance.RotateBy(arg1, arg2);
10011 DALI_TEST_CHECK(false); // Should not get here
10015 DALI_TEST_CHECK(true); // We expect an assert
10020 int UtcDaliActorUnparentNegative(void)
10022 TestApplication application;
10023 Dali::Actor instance;
10026 instance.Unparent();
10027 DALI_TEST_CHECK(false); // Should not get here
10031 DALI_TEST_CHECK(true); // We expect an assert
10036 int UtcDaliActorGetChildAtNegative(void)
10038 TestApplication application;
10039 Dali::Actor instance;
10042 unsigned int arg1 = 0u;
10043 instance.GetChildAt(arg1);
10044 DALI_TEST_CHECK(false); // Should not get here
10048 DALI_TEST_CHECK(true); // We expect an assert
10053 int UtcDaliActorGetChildCountNegative(void)
10055 TestApplication application;
10056 Dali::Actor instance;
10059 instance.GetChildCount();
10060 DALI_TEST_CHECK(false); // Should not get here
10064 DALI_TEST_CHECK(true); // We expect an assert
10069 int UtcDaliActorGetTargetSizeNegative(void)
10071 TestApplication application;
10072 Dali::Actor instance;
10075 instance.GetTargetSize();
10076 DALI_TEST_CHECK(false); // Should not get here
10080 DALI_TEST_CHECK(true); // We expect an assert
10085 int UtcDaliActorScreenToLocalNegative(void)
10087 TestApplication application;
10088 Dali::Actor instance;
10095 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
10096 DALI_TEST_CHECK(false); // Should not get here
10100 DALI_TEST_CHECK(true); // We expect an assert
10105 int UtcDaliActorGetNaturalSizeNegative(void)
10107 TestApplication application;
10108 Dali::Actor instance;
10111 instance.GetNaturalSize();
10112 DALI_TEST_CHECK(false); // Should not get here
10116 DALI_TEST_CHECK(true); // We expect an assert
10121 int UtcDaliActorGetRelayoutSizeNegative(void)
10123 TestApplication application;
10124 Dali::Actor instance;
10127 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
10128 instance.GetRelayoutSize(arg1);
10129 DALI_TEST_CHECK(false); // Should not get here
10133 DALI_TEST_CHECK(true); // We expect an assert
10138 int UtcDaliActorGetResizePolicyNegative(void)
10140 TestApplication application;
10141 Dali::Actor instance;
10144 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
10145 instance.GetResizePolicy(arg1);
10146 DALI_TEST_CHECK(false); // Should not get here
10150 DALI_TEST_CHECK(true); // We expect an assert
10155 int UtcDaliActorGetRendererCountNegative(void)
10157 TestApplication application;
10158 Dali::Actor instance;
10161 instance.GetRendererCount();
10162 DALI_TEST_CHECK(false); // Should not get here
10166 DALI_TEST_CHECK(true); // We expect an assert
10171 int UtcDaliActorGetParentNegative(void)
10173 TestApplication application;
10174 Dali::Actor instance;
10177 instance.GetParent();
10178 DALI_TEST_CHECK(false); // Should not get here
10182 DALI_TEST_CHECK(true); // We expect an assert
10187 int UtcDaliActorPropertyBlendEquation(void)
10189 TestApplication application;
10191 tet_infoline("Test SetProperty AdvancedBlendEquation");
10193 Geometry geometry = CreateQuadGeometry();
10194 Shader shader = CreateShader();
10195 Renderer renderer1 = Renderer::New(geometry, shader);
10197 Actor actor = Actor::New();
10198 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
10200 actor.AddRenderer(renderer1);
10201 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
10202 application.GetScene().Add(actor);
10204 if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
10206 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
10207 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
10208 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
10211 if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
10213 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
10214 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
10215 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
10218 Renderer renderer2 = Renderer::New(geometry, shader);
10219 actor.AddRenderer(renderer2);
10224 int UtcDaliActorRegisterProperty(void)
10226 tet_infoline("Test property registration and uniform map update\n");
10228 TestApplication application;
10230 Geometry geometry = CreateQuadGeometry();
10231 Shader shader = CreateShader();
10232 Renderer renderer1 = Renderer::New(geometry, shader);
10233 Renderer renderer2 = Renderer::New(geometry, shader);
10235 Actor actor1 = Actor::New();
10236 actor1.AddRenderer(renderer1);
10237 actor1.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
10238 actor1.RegisterProperty("uCustom", 1);
10239 application.GetScene().Add(actor1);
10241 Actor actor2 = Actor::New();
10242 actor2.AddRenderer(renderer2);
10243 actor2.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
10244 application.GetScene().Add(actor2);
10246 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
10247 TraceCallStack& callStack = glAbstraction.GetSetUniformTrace();
10248 glAbstraction.EnableSetUniformCallTrace(true);
10250 application.SendNotification();
10251 application.Render();
10253 std::stringstream out;
10255 std::string params;
10257 // Test uniform value of the custom property
10258 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
10259 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
10262 actor1[Actor::Property::VISIBLE] = false;
10264 application.SendNotification();
10265 application.Render();
10267 // Make visible again
10268 actor1[Actor::Property::VISIBLE] = true;
10269 actor1["uCustom"] = 2;
10271 glAbstraction.ResetSetUniformCallStack();
10273 application.SendNotification();
10274 application.Render();
10278 // The uniform value should not be changed
10279 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
10280 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);