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 UtcDaliActorSetUserInteractionEnabled(void)
2603 TestApplication application;
2604 Actor actor = Actor::New();
2606 bool enabled = !actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED);
2608 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, enabled);
2610 DALI_TEST_CHECK(enabled == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
2614 int UtcDaliActorIsUserInteractionEnabled(void)
2616 TestApplication application;
2617 Actor actor = Actor::New();
2618 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
2620 DALI_TEST_CHECK(true == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
2624 int UtcDaliActorRemoveConstraints(void)
2626 tet_infoline(" UtcDaliActorRemoveConstraints");
2627 TestApplication application;
2629 gTestConstraintCalled = false;
2631 Actor actor = Actor::New();
2633 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
2635 actor.RemoveConstraints();
2637 DALI_TEST_CHECK(gTestConstraintCalled == false);
2639 application.GetScene().Add(actor);
2642 // flush the queue and render once
2643 application.SendNotification();
2644 application.Render();
2646 actor.RemoveConstraints();
2648 DALI_TEST_CHECK(gTestConstraintCalled == true);
2652 int UtcDaliActorRemoveConstraintTag(void)
2654 tet_infoline(" UtcDaliActorRemoveConstraintTag");
2655 TestApplication application;
2657 Actor actor = Actor::New();
2659 // 1. Apply Constraint1 and Constraint2, and test...
2660 unsigned int result1 = 0u;
2661 unsigned int result2 = 0u;
2663 unsigned constraint1Tag = 1u;
2664 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
2665 constraint1.SetTag(constraint1Tag);
2666 constraint1.Apply();
2668 unsigned constraint2Tag = 2u;
2669 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
2670 constraint2.SetTag(constraint2Tag);
2671 constraint2.Apply();
2673 application.GetScene().Add(actor);
2674 // flush the queue and render once
2675 application.SendNotification();
2676 application.Render();
2678 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2679 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2681 // 2. Remove Constraint1 and test...
2684 actor.RemoveConstraints(constraint1Tag);
2685 // make color property dirty, which will trigger constraints to be reapplied.
2686 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2687 // flush the queue and render once
2688 application.SendNotification();
2689 application.Render();
2691 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2692 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2694 // 3. Re-Apply Constraint1 and test...
2697 constraint1.Apply();
2698 // make color property dirty, which will trigger constraints to be reapplied.
2699 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2700 // flush the queue and render once
2701 application.SendNotification();
2702 application.Render();
2704 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2705 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
2707 // 2. Remove Constraint2 and test...
2710 actor.RemoveConstraints(constraint2Tag);
2711 // make color property dirty, which will trigger constraints to be reapplied.
2712 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2713 // flush the queue and render once
2714 application.SendNotification();
2715 application.Render();
2717 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
2718 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2720 // 2. Remove Constraint1 as well and test...
2723 actor.RemoveConstraints(constraint1Tag);
2724 // make color property dirty, which will trigger constraints to be reapplied.
2725 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
2726 // flush the queue and render once
2727 application.SendNotification();
2728 application.Render();
2730 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
2731 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
2735 int UtcDaliActorTouchedSignal(void)
2737 TestApplication application;
2739 ResetTouchCallbacks();
2741 // get the root layer
2742 Actor actor = application.GetScene().GetRootLayer();
2743 DALI_TEST_CHECK(gTouchCallBackCalled == false);
2745 application.SendNotification();
2746 application.Render();
2748 // connect to its touch signal
2749 actor.TouchedSignal().Connect(TestTouchCallback);
2751 // simulate a touch event in the middle of the screen
2752 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2753 Dali::Integration::Point point;
2754 point.SetDeviceId(1);
2755 point.SetState(PointState::DOWN);
2756 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2757 Dali::Integration::TouchEvent touchEvent;
2758 touchEvent.AddPoint(point);
2759 application.ProcessEvent(touchEvent);
2761 DALI_TEST_CHECK(gTouchCallBackCalled == true);
2765 int UtcDaliActorHoveredSignal(void)
2767 TestApplication application;
2769 gHoverCallBackCalled = false;
2771 // get the root layer
2772 Actor actor = application.GetScene().GetRootLayer();
2773 DALI_TEST_CHECK(gHoverCallBackCalled == false);
2775 application.SendNotification();
2776 application.Render();
2778 // connect to its hover signal
2779 actor.HoveredSignal().Connect(TestCallback3);
2781 // simulate a hover event in the middle of the screen
2782 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
2783 Dali::Integration::Point point;
2784 point.SetDeviceId(1);
2785 point.SetState(PointState::MOTION);
2786 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
2787 Dali::Integration::HoverEvent hoverEvent;
2788 hoverEvent.AddPoint(point);
2789 application.ProcessEvent(hoverEvent);
2791 DALI_TEST_CHECK(gHoverCallBackCalled == true);
2795 int UtcDaliActorOnOffSceneSignal(void)
2797 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
2799 TestApplication application;
2802 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2803 gActorNamesOnOffScene.clear();
2805 Actor parent = Actor::New();
2806 parent.SetProperty(Actor::Property::NAME, "parent");
2807 parent.OnSceneSignal().Connect(OnSceneCallback);
2808 parent.OffSceneSignal().Connect(OffSceneCallback);
2810 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
2811 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
2813 // add parent to the scene
2814 application.GetScene().Add(parent);
2815 // onstage emitted, offstage not
2816 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2817 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2818 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2820 // test adding a child, should get onstage emitted
2822 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2823 gActorNamesOnOffScene.clear();
2825 Actor child = Actor::New();
2826 child.SetProperty(Actor::Property::NAME, "child");
2827 child.OnSceneSignal().Connect(OnSceneCallback);
2828 child.OffSceneSignal().Connect(OffSceneCallback);
2829 parent.Add(child); // add child
2830 // onscene emitted, offscene not
2831 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
2832 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2833 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2835 // test removing parent from the scene
2837 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2838 gActorNamesOnOffScene.clear();
2840 application.GetScene().Remove(parent);
2841 // onscene not emitted, offscene is
2842 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2843 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
2844 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2845 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
2847 // test adding parent back to the scene
2849 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2850 gActorNamesOnOffScene.clear();
2852 application.GetScene().Add(parent);
2853 // onscene emitted, offscene not
2854 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
2855 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
2856 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2857 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
2859 // test removing child
2861 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2862 gActorNamesOnOffScene.clear();
2864 parent.Remove(child);
2865 // onscene not emitted, offscene is
2866 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2867 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2868 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
2870 // test removing parent
2872 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
2873 gActorNamesOnOffScene.clear();
2875 application.GetScene().Remove(parent);
2876 // onscene not emitted, offscene is
2877 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
2878 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
2879 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
2883 int UtcDaliActorFindChildByName(void)
2885 tet_infoline("Testing Dali::Actor::FindChildByName()");
2886 TestApplication application;
2888 Actor parent = Actor::New();
2889 parent.SetProperty(Actor::Property::NAME, "parent");
2890 Actor first = Actor::New();
2891 first.SetProperty(Actor::Property::NAME, "first");
2892 Actor second = Actor::New();
2893 second.SetProperty(Actor::Property::NAME, "second");
2898 Actor found = parent.FindChildByName("foo");
2899 DALI_TEST_CHECK(!found);
2901 found = parent.FindChildByName("parent");
2902 DALI_TEST_CHECK(found == parent);
2904 found = parent.FindChildByName("first");
2905 DALI_TEST_CHECK(found == first);
2907 found = parent.FindChildByName("second");
2908 DALI_TEST_CHECK(found == second);
2912 int UtcDaliActorFindChildById(void)
2914 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2915 TestApplication application;
2917 Actor parent = Actor::New();
2918 Actor first = Actor::New();
2919 Actor second = Actor::New();
2924 Actor found = parent.FindChildById(100000);
2925 DALI_TEST_CHECK(!found);
2927 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
2928 DALI_TEST_CHECK(found == parent);
2930 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
2931 DALI_TEST_CHECK(found == first);
2933 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
2934 DALI_TEST_CHECK(found == second);
2938 int UtcDaliActorHitTest(void)
2943 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
2945 mTouchPoint(touchPoint),
2951 Vector2 mTouchPoint;
2955 TestApplication application;
2956 tet_infoline(" UtcDaliActorHitTest");
2958 // Fill a vector with different hit tests.
2959 struct HitTestData* hitTestData[] = {
2960 // scale touch point result
2961 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
2962 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
2963 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.
2964 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
2965 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.
2969 // get the root layer
2970 Actor actor = Actor::New();
2971 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2972 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2974 application.GetScene().Add(actor);
2976 ResetTouchCallbacks();
2978 unsigned int index = 0;
2979 while(NULL != hitTestData[index])
2981 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
2982 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
2984 // flush the queue and render once
2985 application.SendNotification();
2986 application.Render();
2988 DALI_TEST_CHECK(!gTouchCallBackCalled);
2990 // connect to its touch signal
2991 actor.TouchedSignal().Connect(TestTouchCallback);
2993 Dali::Integration::Point point;
2994 point.SetState(PointState::DOWN);
2995 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
2996 Dali::Integration::TouchEvent event;
2997 event.AddPoint(point);
2999 // flush the queue and render once
3000 application.SendNotification();
3001 application.Render();
3002 application.ProcessEvent(event);
3004 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3006 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3007 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3008 hitTestData[index]->mScale.x,
3009 hitTestData[index]->mScale.y,
3010 hitTestData[index]->mScale.z,
3011 hitTestData[index]->mTouchPoint.x,
3012 hitTestData[index]->mTouchPoint.y,
3013 hitTestData[index]->mResult);
3015 ResetTouchCallbacks();
3021 int UtcDaliActorSetDrawMode(void)
3023 TestApplication application;
3024 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
3026 Actor a = Actor::New();
3028 application.GetScene().Add(a);
3029 application.SendNotification();
3030 application.Render(0);
3031 application.SendNotification();
3032 application.Render(1);
3034 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
3036 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3037 application.SendNotification();
3038 application.Render(1);
3040 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
3042 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3043 application.SendNotification();
3044 application.Render(1);
3046 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
3050 int UtcDaliActorSetDrawModeOverlayRender(void)
3052 TestApplication application;
3053 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
3055 application.SendNotification();
3056 application.Render(1);
3058 std::vector<GLuint> ids;
3059 ids.push_back(8); // first rendered actor
3060 ids.push_back(9); // second rendered actor
3061 ids.push_back(10); // third rendered actor
3062 application.GetGlAbstraction().SetNextTextureIds(ids);
3064 Texture imageA = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3065 Texture imageB = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3066 Texture imageC = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3067 Actor a = CreateRenderableActor(imageA);
3068 Actor b = CreateRenderableActor(imageB);
3069 Actor c = CreateRenderableActor(imageC);
3071 application.SendNotification();
3072 application.Render(1);
3074 //Textures are bound when first created. Clear bound textures vector
3075 application.GetGlAbstraction().ClearBoundTextures();
3077 // Render a,b,c as regular non-overlays. so order will be:
3081 application.GetScene().Add(a);
3082 application.GetScene().Add(b);
3083 application.GetScene().Add(c);
3085 application.SendNotification();
3086 application.Render(1);
3088 // Should be 3 textures changes.
3089 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3090 typedef std::vector<GLuint>::size_type TextureSize;
3091 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3092 if(boundTextures.size() == 3)
3094 DALI_TEST_CHECK(boundTextures[0] == 8u);
3095 DALI_TEST_CHECK(boundTextures[1] == 9u);
3096 DALI_TEST_CHECK(boundTextures[2] == 10u);
3099 // Now texture ids have been set, we can monitor their render order.
3100 // render a as an overlay (last), so order will be:
3104 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3105 application.GetGlAbstraction().ClearBoundTextures();
3107 application.SendNotification();
3108 application.Render(1);
3110 // Should be 3 texture changes.
3111 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3112 if(boundTextures.size() == 3)
3114 DALI_TEST_CHECK(boundTextures[0] == 9u);
3115 DALI_TEST_CHECK(boundTextures[1] == 10u);
3116 DALI_TEST_CHECK(boundTextures[2] == 8u);
3121 int UtcDaliActorGetCurrentWorldMatrix(void)
3123 TestApplication application;
3124 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3126 Actor parent = Actor::New();
3127 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3128 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3129 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3130 Radian rotationAngle(Degree(85.0f));
3131 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3132 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3133 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3134 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3135 parent.SetProperty(Actor::Property::SCALE, parentScale);
3136 application.GetScene().Add(parent);
3138 Actor child = Actor::New();
3139 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3140 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3141 Radian childRotationAngle(Degree(23.0f));
3142 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3143 Vector3 childScale(2.0f, 2.0f, 2.0f);
3144 child.SetProperty(Actor::Property::POSITION, childPosition);
3145 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3146 child.SetProperty(Actor::Property::SCALE, childScale);
3149 application.SendNotification();
3150 application.Render(0);
3151 application.Render();
3152 application.SendNotification();
3154 Matrix parentMatrix(false);
3155 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3157 Matrix childMatrix(false);
3158 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3160 //Child matrix should be the composition of child and parent
3161 Matrix childWorldMatrix(false);
3162 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3164 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3165 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3169 int UtcDaliActorConstrainedToWorldMatrix(void)
3171 TestApplication application;
3172 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3174 Actor parent = Actor::New();
3175 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3176 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3177 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3178 Radian rotationAngle(Degree(85.0f));
3179 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3180 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3181 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3182 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3183 parent.SetProperty(Actor::Property::SCALE, parentScale);
3184 application.GetScene().Add(parent);
3186 Actor child = Actor::New();
3187 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3188 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3189 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3190 posConstraint.Apply();
3192 application.GetScene().Add(child);
3194 application.SendNotification();
3195 application.Render(0);
3196 application.Render();
3197 application.SendNotification();
3199 Matrix parentMatrix(false);
3200 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3202 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3203 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3207 int UtcDaliActorConstrainedToOrientation(void)
3209 TestApplication application;
3210 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3212 Actor parent = Actor::New();
3213 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3214 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3215 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3216 Radian rotationAngle(Degree(85.0f));
3217 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3218 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3219 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3220 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3221 parent.SetProperty(Actor::Property::SCALE, parentScale);
3222 application.GetScene().Add(parent);
3224 Actor child = Actor::New();
3225 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3226 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3227 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3228 posConstraint.Apply();
3230 application.GetScene().Add(child);
3232 application.SendNotification();
3233 application.Render(0);
3234 application.Render();
3235 application.SendNotification();
3237 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3241 int UtcDaliActorConstrainedToOpacity(void)
3243 TestApplication application;
3244 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3246 Actor parent = Actor::New();
3247 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3248 application.GetScene().Add(parent);
3250 Actor child = Actor::New();
3251 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3252 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3253 opacityConstraint.Apply();
3255 application.GetScene().Add(child);
3257 application.SendNotification();
3258 application.Render(0);
3259 application.Render();
3260 application.SendNotification();
3262 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3264 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3266 application.SendNotification();
3267 application.Render(0);
3268 application.Render();
3269 application.SendNotification();
3271 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3276 int UtcDaliActorUnparent(void)
3278 TestApplication application;
3279 tet_infoline(" UtcDaliActorUnparent");
3281 Actor parent = Actor::New();
3282 application.GetScene().Add(parent);
3284 Actor child = Actor::New();
3286 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3287 DALI_TEST_CHECK(!child.GetParent());
3289 // Test that calling Unparent with no parent is a NOOP
3292 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3293 DALI_TEST_CHECK(!child.GetParent());
3295 // Test that Unparent works
3298 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3299 DALI_TEST_CHECK(parent == child.GetParent());
3303 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3304 DALI_TEST_CHECK(!child.GetParent());
3306 // Test that UnparentAndReset works
3309 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3310 DALI_TEST_CHECK(parent == child.GetParent());
3312 UnparentAndReset(child);
3314 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3315 DALI_TEST_CHECK(!child);
3317 // Test that UnparentAndReset is a NOOP with empty handle
3318 UnparentAndReset(child);
3320 DALI_TEST_CHECK(!child);
3324 int UtcDaliActorGetChildAt(void)
3326 TestApplication application;
3327 tet_infoline(" UtcDaliActorGetChildAt");
3329 Actor parent = Actor::New();
3330 application.GetScene().Add(parent);
3332 Actor child0 = Actor::New();
3335 Actor child1 = Actor::New();
3338 Actor child2 = Actor::New();
3341 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3342 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3343 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3347 int UtcDaliActorSetGetOverlay(void)
3349 TestApplication application;
3350 tet_infoline(" UtcDaliActorSetGetOverlay");
3352 Actor parent = Actor::New();
3353 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3354 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3358 int UtcDaliActorCreateDestroy(void)
3360 Actor* actor = new Actor;
3361 DALI_TEST_CHECK(actor);
3368 struct PropertyStringIndex
3370 const char* const name;
3371 const Property::Index index;
3372 const Property::Type type;
3375 const PropertyStringIndex PROPERTY_TABLE[] =
3377 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3378 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3379 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3380 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3381 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3382 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3383 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3384 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3385 {"size", Actor::Property::SIZE, Property::VECTOR3},
3386 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3387 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3388 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3389 {"position", Actor::Property::POSITION, Property::VECTOR3},
3390 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3391 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3392 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3393 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3394 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3395 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
3396 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
3397 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
3398 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
3399 {"scale", Actor::Property::SCALE, Property::VECTOR3},
3400 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
3401 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
3402 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
3403 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
3404 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
3405 {"color", Actor::Property::COLOR, Property::VECTOR4},
3406 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
3407 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
3408 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
3409 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
3410 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
3411 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
3412 {"name", Actor::Property::NAME, Property::STRING},
3413 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
3414 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
3415 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
3416 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
3417 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
3418 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
3419 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
3420 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
3421 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
3422 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
3423 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
3424 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
3425 {"padding", Actor::Property::PADDING, Property::VECTOR4},
3426 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
3427 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
3428 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
3429 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
3430 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
3432 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
3433 } // unnamed namespace
3435 int UtcDaliActorProperties(void)
3437 TestApplication application;
3439 Actor actor = Actor::New();
3441 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
3443 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
3444 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
3445 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
3446 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
3451 int UtcDaliRelayoutProperties_ResizePolicies(void)
3453 TestApplication application;
3455 Actor actor = Actor::New();
3458 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3459 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3461 // Set resize policy for all dimensions
3462 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
3463 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3465 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
3468 // Set individual dimensions
3469 const char* const widthPolicy = "FILL_TO_PARENT";
3470 const char* const heightPolicy = "FIXED";
3472 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
3473 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
3475 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
3476 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
3478 // Set individual dimensions using enums
3479 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
3480 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3482 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
3483 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
3485 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
3486 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
3491 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3493 TestApplication application;
3495 Actor actor = Actor::New();
3498 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
3500 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3501 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
3502 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
3505 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
3506 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3508 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
3509 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
3511 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
3512 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
3517 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3519 TestApplication application;
3521 Actor actor = Actor::New();
3524 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3525 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3527 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
3528 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
3529 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
3532 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
3534 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
3535 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
3540 int UtcDaliRelayoutProperties_DimensionDependency(void)
3542 TestApplication application;
3544 Actor actor = Actor::New();
3547 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3548 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
3551 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
3552 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
3554 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
3555 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
3557 // Test setting another resize policy
3558 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
3559 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
3564 int UtcDaliRelayoutProperties_Padding(void)
3566 TestApplication application;
3568 Actor actor = Actor::New();
3571 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
3574 actor.SetProperty(Actor::Property::PADDING, padding);
3575 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
3577 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3582 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3584 TestApplication application;
3586 Actor actor = Actor::New();
3589 Vector2 minSize(1.0f, 2.0f);
3591 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
3592 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
3594 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3596 Vector2 maxSize(3.0f, 4.0f);
3598 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
3599 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
3601 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
3606 int UtcDaliActorGetHeightForWidth(void)
3608 TestApplication application;
3610 Actor actor = Actor::New();
3612 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
3617 int UtcDaliActorGetWidthForHeight(void)
3619 TestApplication application;
3621 Actor actor = Actor::New();
3623 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
3628 int UtcDaliActorGetRelayoutSize(void)
3630 TestApplication application;
3632 Actor actor = Actor::New();
3634 // Add actor to stage
3635 application.GetScene().Add(actor);
3637 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
3639 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
3640 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
3642 // Flush the queue and render once
3643 application.SendNotification();
3644 application.Render();
3646 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
3651 int UtcDaliActorSetPadding(void)
3653 TestApplication application;
3655 Actor actor = Actor::New();
3658 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3660 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
3661 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
3662 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
3663 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
3665 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
3666 actor.SetProperty(Actor::Property::PADDING, padding2);
3668 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
3670 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
3671 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
3672 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
3673 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
3678 int UtcDaliActorSetMinimumSize(void)
3680 TestApplication application;
3682 Actor actor = Actor::New();
3684 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3686 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
3687 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
3689 Vector2 size2(1.0f, 2.0f);
3690 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
3692 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
3694 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3695 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3700 int UtcDaliActorSetMaximumSize(void)
3702 TestApplication application;
3704 Actor actor = Actor::New();
3706 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3708 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
3709 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
3711 Vector2 size2(1.0f, 2.0f);
3712 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
3714 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
3716 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
3717 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
3722 int UtcDaliActorOnRelayoutSignal(void)
3724 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3726 TestApplication application;
3729 gOnRelayoutCallBackCalled = false;
3730 gActorNamesRelayout.clear();
3732 Actor actor = Actor::New();
3733 actor.SetProperty(Actor::Property::NAME, "actor");
3734 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
3737 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
3739 // Add actor to stage
3740 application.GetScene().Add(actor);
3742 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
3743 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
3745 // Flush the queue and render once
3746 application.SendNotification();
3747 application.Render();
3749 // OnRelayout emitted
3750 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
3751 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
3756 int UtcDaliActorGetHierachyDepth(void)
3758 TestApplication application;
3759 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3761 /* Build tree of actors:
3771 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3773 Integration::Scene stage(application.GetScene());
3775 Actor actorA = Actor::New();
3776 Actor actorB = Actor::New();
3777 Actor actorC = Actor::New();
3778 Actor actorD = Actor::New();
3779 Actor actorE = Actor::New();
3780 Actor actorF = Actor::New();
3782 //Test that root actor has depth equal 0
3783 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3785 //Test actors return depth -1 when not connected to the tree
3786 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3787 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3788 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3789 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3790 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3791 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3793 //Create the hierarchy
3801 //Test actors return correct depth
3802 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3803 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3804 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3805 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3806 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3807 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3809 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3810 actorA.Remove(actorB);
3812 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3813 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3814 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3816 //Removing actorA from the stage. All actors should have depth equal -1
3817 stage.Remove(actorA);
3819 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3820 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3821 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3822 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3823 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3824 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
3829 int UtcDaliActorAnchorPointPropertyAsString(void)
3831 TestApplication application;
3833 Actor actor = Actor::New();
3835 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
3836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3838 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
3839 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3841 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
3842 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3844 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
3845 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3847 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
3848 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
3850 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
3851 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3853 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
3854 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3856 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
3857 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3859 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
3860 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3862 // Invalid should not change anything
3863 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
3864 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3869 int UtcDaliActorParentOriginPropertyAsString(void)
3871 TestApplication application;
3873 Actor actor = Actor::New();
3875 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
3876 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
3878 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
3879 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
3881 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
3882 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
3884 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
3885 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
3887 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
3888 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
3890 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
3891 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
3893 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
3894 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
3896 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
3897 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
3899 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
3900 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3902 // Invalid should not change anything
3903 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
3904 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
3909 int UtcDaliActorColorModePropertyAsString(void)
3911 TestApplication application;
3913 Actor actor = Actor::New();
3915 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
3916 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3918 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
3919 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3921 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
3922 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3924 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
3925 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3927 // Invalid should not change anything
3928 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
3929 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3934 int UtcDaliActorDrawModePropertyAsString(void)
3936 TestApplication application;
3938 Actor actor = Actor::New();
3940 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
3941 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3943 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
3944 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3946 // Invalid should not change anything
3947 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
3948 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3953 int UtcDaliActorColorModePropertyAsEnum(void)
3955 TestApplication application;
3957 Actor actor = Actor::New();
3959 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
3960 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
3962 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
3963 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
3965 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
3966 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
3968 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
3969 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
3974 int UtcDaliActorDrawModePropertyAsEnum(void)
3976 TestApplication application;
3978 Actor actor = Actor::New();
3980 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3981 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
3983 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3984 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
3989 int UtcDaliActorAddRendererP(void)
3991 tet_infoline("Testing Actor::AddRenderer");
3992 TestApplication application;
3994 Actor actor = Actor::New();
3996 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
3998 Geometry geometry = CreateQuadGeometry();
3999 Shader shader = CreateShader();
4000 Renderer renderer = Renderer::New(geometry, shader);
4002 actor.AddRenderer(renderer);
4003 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4004 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4009 int UtcDaliActorAddRendererN01(void)
4011 tet_infoline("Testing Actor::AddRenderer");
4012 TestApplication application;
4014 Actor actor = Actor::New();
4020 actor.AddRenderer(renderer);
4021 tet_printf("Assertion test failed - no Exception\n");
4022 tet_result(TET_FAIL);
4024 catch(Dali::DaliException& e)
4026 DALI_TEST_PRINT_ASSERT(e);
4027 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
4028 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4032 tet_printf("Assertion test failed - wrong Exception\n");
4033 tet_result(TET_FAIL);
4039 int UtcDaliActorAddRendererN02(void)
4041 tet_infoline("UtcDaliActorAddRendererN02");
4047 TestApplication application;
4049 Geometry geometry = CreateQuadGeometry();
4050 Shader shader = CreateShader();
4051 renderer = Renderer::New(geometry, shader);
4053 actor = Actor::New();
4056 // try illegal AddRenderer
4059 actor.AddRenderer(renderer);
4060 tet_printf("Assertion test failed - no Exception\n");
4061 tet_result(TET_FAIL);
4063 catch(Dali::DaliException& e)
4065 DALI_TEST_PRINT_ASSERT(e);
4066 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
4070 tet_printf("Assertion test failed - wrong Exception\n");
4071 tet_result(TET_FAIL);
4077 int UtcDaliActorAddRendererOnScene(void)
4079 tet_infoline("Testing Actor::AddRenderer");
4080 TestApplication application;
4082 Actor actor = Actor::New();
4083 application.GetScene().Add(actor);
4085 application.SendNotification();
4086 application.Render(0);
4088 Geometry geometry = CreateQuadGeometry();
4089 Shader shader = CreateShader();
4090 Renderer renderer = Renderer::New(geometry, shader);
4092 application.SendNotification();
4093 application.Render(0);
4097 actor.AddRenderer(renderer);
4098 tet_result(TET_PASS);
4102 tet_result(TET_FAIL);
4108 int UtcDaliActorRemoveRendererP1(void)
4110 tet_infoline("Testing Actor::RemoveRenderer");
4111 TestApplication application;
4113 Actor actor = Actor::New();
4115 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4118 Geometry geometry = CreateQuadGeometry();
4119 Shader shader = CreateShader();
4120 Renderer renderer = Renderer::New(geometry, shader);
4122 actor.AddRenderer(renderer);
4123 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4124 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4126 application.SendNotification();
4127 application.Render();
4131 Renderer renderer = actor.GetRendererAt(0);
4132 actor.RemoveRenderer(renderer);
4133 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4135 application.SendNotification();
4136 application.Render();
4139 // Call one final time to ensure that the renderer is actually removed after
4140 // the handle goes out of scope, and excercises the deletion code path in
4141 // scene graph and render.
4142 application.SendNotification();
4143 application.Render();
4148 int UtcDaliActorRemoveRendererP2(void)
4150 tet_infoline("Testing Actor::RemoveRenderer");
4151 TestApplication application;
4153 Actor actor = Actor::New();
4155 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4157 Geometry geometry = CreateQuadGeometry();
4158 Shader shader = CreateShader();
4159 Renderer renderer = Renderer::New(geometry, shader);
4161 actor.AddRenderer(renderer);
4162 application.SendNotification();
4163 application.Render();
4165 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4166 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4168 actor.RemoveRenderer(0);
4169 application.SendNotification();
4170 application.Render();
4172 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4174 // Shut down whilst holding onto the renderer handle.
4178 int UtcDaliActorRemoveRendererN(void)
4180 tet_infoline("Testing Actor::RemoveRenderer");
4181 TestApplication application;
4183 Actor actor = Actor::New();
4185 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4187 Geometry geometry = CreateQuadGeometry();
4188 Shader shader = CreateShader();
4189 Renderer renderer = Renderer::New(geometry, shader);
4191 actor.AddRenderer(renderer);
4192 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4193 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4195 actor.RemoveRenderer(10);
4196 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4197 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4202 // Clipping test helper functions:
4203 Actor CreateActorWithContent(uint32_t width, uint32_t height)
4205 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
4206 Actor actor = CreateRenderableActor(image);
4208 // Setup dimensions and position so actor is not skipped by culling.
4209 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4210 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
4211 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4212 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4217 Actor CreateActorWithContent16x16()
4219 return CreateActorWithContent(16, 16);
4222 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
4224 enabledDisableTrace.Reset();
4225 stencilTrace.Reset();
4226 enabledDisableTrace.Enable(true);
4227 stencilTrace.Enable(true);
4229 application.SendNotification();
4230 application.Render();
4232 enabledDisableTrace.Enable(false);
4233 stencilTrace.Enable(false);
4236 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
4238 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4240 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
4241 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
4242 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
4244 // @todo only test alpha if the framebuffer has an alpha channel
4245 //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
4248 int UtcDaliActorPropertyClippingP(void)
4250 // This test checks the clippingMode property.
4251 tet_infoline("Testing Actor::Property::ClippingMode: P");
4252 TestApplication application;
4254 Actor actor = Actor::New();
4256 // Check default clippingEnabled value.
4257 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4260 bool getValueResult = getValue.Get(value);
4261 DALI_TEST_CHECK(getValueResult);
4265 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4268 // Check setting the property to the stencil mode.
4269 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4271 // Check the new value was set.
4272 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4273 getValueResult = getValue.Get(value);
4274 DALI_TEST_CHECK(getValueResult);
4278 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4281 // Check setting the property to the scissor mode.
4282 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4284 // Check the new value was set.
4285 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4286 getValueResult = getValue.Get(value);
4287 DALI_TEST_CHECK(getValueResult);
4291 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4296 int UtcDaliActorPropertyClippingN(void)
4298 // Negative test case for Clipping.
4299 tet_infoline("Testing Actor::Property::ClippingMode: N");
4300 TestApplication application;
4302 Actor actor = Actor::New();
4304 // Check default clippingEnabled value.
4305 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4308 bool getValueResult = getValue.Get(value);
4309 DALI_TEST_CHECK(getValueResult);
4313 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4316 // Check setting an invalid property value won't change the current property value.
4317 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4319 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4320 getValueResult = getValue.Get(value);
4321 DALI_TEST_CHECK(getValueResult);
4325 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4331 int UtcDaliActorPropertyClippingActor(void)
4333 // This test checks that an actor is correctly setup for clipping.
4334 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4335 TestApplication application;
4337 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4338 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4339 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4340 size_t startIndex = 0u;
4342 // Create a clipping actor.
4343 Actor actorDepth1Clip = CreateActorWithContent16x16();
4344 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4345 application.GetScene().Add(actorDepth1Clip);
4347 // Gather the call trace.
4348 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4350 // Check we are writing to the color buffer.
4351 CheckColorMask(glAbstraction, true);
4353 // Check the stencil buffer was enabled.
4354 std::ostringstream oss;
4355 oss << std::hex << GL_STENCIL_TEST;
4356 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4358 // Check the stencil buffer was cleared.
4359 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4361 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4362 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4363 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4364 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4369 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4371 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4372 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
4373 TestApplication application;
4375 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4376 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4377 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4378 size_t startIndex = 0u;
4380 // Create a clipping actor.
4381 Actor actorDepth1Clip = CreateActorWithContent16x16();
4382 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4383 application.GetScene().Add(actorDepth1Clip);
4385 // Gather the call trace.
4386 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4388 // Check we are writing to the color buffer.
4389 CheckColorMask(glAbstraction, true);
4391 // Check the stencil buffer was enabled.
4392 std::ostringstream oss;
4393 oss << std::hex << GL_STENCIL_TEST;
4394 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4396 // Check the stencil buffer was cleared.
4397 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4399 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4400 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4401 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4402 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4404 // Now disable the clipping
4405 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4407 // Gather the call trace.
4408 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4410 // Check the stencil buffer was disabled.
4411 std::ostringstream stencil;
4412 stencil << std::hex << GL_STENCIL_TEST;
4413 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", stencil.str()));
4415 // Ensure all values in stencil-mask are set to 1.
4417 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
4422 int UtcDaliActorPropertyClippingNestedChildren(void)
4424 // This test checks that a hierarchy of actors are clipped correctly by
4425 // writing to and reading from the correct bit-planes of the stencil buffer.
4426 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
4427 TestApplication application;
4428 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4429 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4430 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4432 // Create a clipping actor.
4433 Actor actorDepth1Clip = CreateActorWithContent16x16();
4434 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4435 application.GetScene().Add(actorDepth1Clip);
4437 // Create a child actor.
4438 Actor childDepth2 = CreateActorWithContent16x16();
4439 actorDepth1Clip.Add(childDepth2);
4441 // Create another clipping actor.
4442 Actor childDepth2Clip = CreateActorWithContent16x16();
4443 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4444 childDepth2.Add(childDepth2Clip);
4446 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4447 // This tests the sort algorithm.
4448 Actor childDepth3 = CreateActorWithContent16x16();
4449 childDepth2Clip.Add(childDepth3);
4450 Actor childDepth4 = CreateActorWithContent16x16();
4451 childDepth3.Add(childDepth4);
4453 // Gather the call trace.
4454 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4456 // Check we are writing to the color buffer.
4457 CheckColorMask(glAbstraction, true);
4459 // Check the stencil buffer was enabled.
4460 std::ostringstream oss;
4461 oss << std::hex << GL_STENCIL_TEST;
4462 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4464 // Perform the test twice, once for 2D layer, and once for 3D.
4465 for(unsigned int i = 0u; i < 2u; ++i)
4467 size_t startIndex = 0u;
4469 // Check the stencil buffer was cleared.
4470 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4472 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4473 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4474 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
4475 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4477 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4478 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 1", startIndex)); // 514 is GL_EQUAL
4479 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4481 // Check we are set up to write to the second bitplane of the stencil buffer (only).
4482 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4483 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
4484 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4486 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4487 // (Both must be set to pass the check).
4488 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 3", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4489 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4491 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4494 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
4495 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4502 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4504 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4505 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
4506 TestApplication application;
4507 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4508 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4510 /* We create a small tree of actors as follows:
4514 Clipping enabled -> B D
4518 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4521 for(int i = 0; i < 5; ++i)
4523 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
4524 Actor actor = CreateRenderableActor(image);
4526 // Setup dimensions and position so actor is not skipped by culling.
4527 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4528 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
4532 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4536 float b = i > 2 ? 1.0f : -1.0f;
4537 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
4543 // Enable clipping on the actor at the top of the left branch.
4544 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4546 // Build the scene graph.
4547 application.GetScene().Add(actors[0]);
4550 actors[0].Add(actors[1]);
4551 actors[1].Add(actors[2]);
4554 actors[0].Add(actors[3]);
4555 actors[3].Add(actors[4]);
4557 // Gather the call trace.
4558 enabledDisableTrace.Reset();
4559 enabledDisableTrace.Enable(true);
4560 application.SendNotification();
4561 application.Render();
4562 enabledDisableTrace.Enable(false);
4564 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4566 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
4567 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4569 size_t startIndex = 0u;
4570 std::ostringstream blend;
4571 blend << std::hex << GL_BLEND;
4572 std::ostringstream stencil;
4573 stencil << std::hex << GL_STENCIL_TEST;
4575 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", blend.str(), startIndex));
4576 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
4577 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
4579 // Swap the clipping actor from top of left branch to top of right branch.
4580 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4581 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4583 // Gather the call trace.
4584 enabledDisableTrace.Reset();
4585 enabledDisableTrace.Enable(true);
4586 application.SendNotification();
4587 application.Render();
4588 enabledDisableTrace.Enable(false);
4590 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4591 // This proves the draw order has remained the same.
4593 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
4594 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
4599 int UtcDaliActorPropertyScissorClippingActor01(void)
4601 // This test checks that an actor is correctly setup for clipping.
4602 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
4603 TestApplication application;
4605 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4606 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4607 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4609 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4610 const Vector2 imageSize(16.0f, 16.0f);
4612 // Create a clipping actor.
4613 Actor clippingActorA = CreateActorWithContent16x16();
4614 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4615 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4616 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4617 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4618 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4619 application.GetScene().Add(clippingActorA);
4621 // Gather the call trace.
4622 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4624 // Check we are writing to the color buffer.
4625 CheckColorMask(glAbstraction, true);
4627 // Check scissor test was enabled.
4629 std::ostringstream scissor;
4630 scissor << std::hex << GL_SCISSOR_TEST;
4631 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4633 // Check the scissor was set, and the coordinates are correct.
4634 std::stringstream compareParametersString;
4635 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4636 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4638 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4639 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4641 // Gather the call trace.
4642 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4644 // Check the scissor was set, and the coordinates are correct.
4645 compareParametersString.str(std::string());
4646 compareParametersString.clear();
4647 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
4648 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4653 int UtcDaliActorPropertyScissorClippingActor02(void)
4655 // This test checks that an actor is correctly setup for clipping.
4656 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
4657 TestApplication application;
4659 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4660 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4661 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4663 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4664 const Vector2 actorSize(16.0f, 16.0f);
4666 // Create a clipping actor.
4667 Actor clippingActorA = CreateRenderableActor();
4668 clippingActorA[Actor::Property::SIZE] = actorSize;
4670 Renderer renderer = clippingActorA.GetRendererAt(0);
4671 DALI_TEST_CHECK(renderer);
4673 // Make Renderer opacity 0.
4674 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
4676 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4677 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4678 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
4679 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
4680 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4681 application.GetScene().Add(clippingActorA);
4683 // Gather the call trace.
4684 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4686 // Check we are writing to the color buffer.
4687 CheckColorMask(glAbstraction, true);
4689 // Check scissor test was enabled.
4691 std::ostringstream scissor;
4692 scissor << std::hex << GL_SCISSOR_TEST;
4693 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4695 // Check the scissor was set, and the coordinates are correct.
4696 std::stringstream compareParametersString;
4697 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
4698 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
4700 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
4701 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
4703 // Gather the call trace.
4704 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4706 // Check the scissor was set, and the coordinates are correct.
4707 compareParametersString.str(std::string());
4708 compareParametersString.clear();
4709 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
4710 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
4715 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4717 // This test checks that an actor is correctly setup for clipping.
4718 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
4719 TestApplication application;
4721 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4722 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4723 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4725 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4726 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4727 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4729 // Create a clipping actors.
4730 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4731 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4733 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4734 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4735 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4737 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4738 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4739 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4741 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4742 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4744 application.GetScene().Add(clippingActorA);
4745 application.GetScene().Add(clippingActorB);
4747 // Gather the call trace.
4748 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4750 // Check we are writing to the color buffer.
4751 CheckColorMask(glAbstraction, true);
4753 // Check scissor test was enabled.
4754 std::ostringstream scissor;
4755 scissor << std::hex << GL_SCISSOR_TEST;
4756 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4758 // Check the scissor was set, and the coordinates are correct.
4759 std::stringstream compareParametersString;
4761 std::string clipA("0, 500, 480, 200");
4762 std::string clipB("0, 380, 480, 40");
4764 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4765 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4770 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4772 // This test checks that an actor is correctly setup for clipping.
4773 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4774 TestApplication application;
4776 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4777 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4778 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4780 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4781 const Vector2 imageSize(16.0f, 16.0f);
4783 /* Create a nest of 2 scissors to test nesting (intersecting clips).
4785 A is drawn first - with scissor clipping on
4786 B is drawn second - also with scissor clipping on
4787 C is the generated clipping region, the intersection ( A ∩ B )
4791 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
4792 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
4793 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
4797 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4800 // Create a clipping actor.
4801 Actor clippingActorA = CreateActorWithContent16x16();
4802 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4803 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4804 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4805 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4806 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4807 application.GetScene().Add(clippingActorA);
4809 // Create a child clipping actor.
4810 Actor clippingActorB = CreateActorWithContent16x16();
4811 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
4812 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
4813 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4814 clippingActorA.Add(clippingActorB);
4816 // positionModifiers is an array of positions to position B around.
4817 // expect is an array of expected scissor clip coordinate results.
4818 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
4819 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
4821 // Loop through each overlap combination.
4822 for(unsigned int test = 0u; test < 4u; ++test)
4824 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4825 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
4826 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
4828 // Gather the call trace.
4829 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4831 // Check we are writing to the color buffer.
4832 CheckColorMask(glAbstraction, true);
4834 // Check scissor test was enabled.
4835 std::ostringstream scissor;
4836 scissor << std::hex << GL_SCISSOR_TEST;
4837 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4839 // Check the scissor was set, and the coordinates are correct.
4840 const Vector4& expectResults(expect[test]);
4841 std::stringstream compareParametersString;
4842 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4843 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
4849 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4851 // This test checks that an actor is correctly setup for clipping.
4852 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
4853 TestApplication application;
4855 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4856 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4857 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4859 /* Create a nest of 2 scissors and siblings of the parent.
4869 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
4870 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
4871 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
4872 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
4873 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
4874 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
4876 // Create a clipping actors.
4877 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
4878 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
4879 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
4880 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
4881 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
4883 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4884 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4885 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4887 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4888 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4889 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4891 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4892 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4893 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4895 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4896 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4897 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4899 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
4900 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
4902 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
4903 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4904 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
4905 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4906 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
4908 application.GetScene().Add(clippingActorA);
4909 clippingActorA.Add(clippingActorB);
4910 application.GetScene().Add(clippingActorC);
4911 application.GetScene().Add(clippingActorD);
4912 clippingActorD.Add(clippingActorE);
4914 // Gather the call trace.
4915 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4917 // Check we are writing to the color buffer.
4918 CheckColorMask(glAbstraction, true);
4920 // Check scissor test was enabled.
4921 std::ostringstream scissor;
4922 scissor << std::hex << GL_SCISSOR_TEST;
4923 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4925 // Check the scissor was set, and the coordinates are correct.
4926 std::string clipA("0, 500, 480, 200");
4927 std::string clipB("0, 580, 480, 40");
4928 std::string clipC("0, 200, 480, 200");
4929 std::string clipD("0, 300, 480, 200");
4931 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
4932 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
4933 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
4934 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
4935 DALI_TEST_EQUALS(scissorTrace.CountMethod("Scissor"), 4, TEST_LOCATION); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4940 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4942 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4943 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
4944 TestApplication application;
4946 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4947 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4948 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4950 // Create a clipping actor.
4951 Actor actorDepth1Clip = CreateActorWithContent16x16();
4952 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4953 application.GetScene().Add(actorDepth1Clip);
4955 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4956 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
4958 // Gather the call trace.
4959 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4961 // Check we are writing to the color buffer.
4962 CheckColorMask(glAbstraction, true);
4964 // Check the stencil buffer was not enabled.
4965 std::ostringstream stencil;
4966 stencil << std::hex << GL_STENCIL_TEST;
4967 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", stencil.str()));
4969 // Check stencil functions are not called.
4970 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
4971 // TODO: Temporarily commented out the line below when caching is disabled. Will need to add it back.
4972 // DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask"));
4973 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
4975 // Check that scissor clipping is overriden by the renderer properties.
4976 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4978 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4980 // Gather the call trace.
4981 GenerateTrace(application, enabledDisableTrace, scissorTrace);
4983 // Check the stencil buffer was not enabled.
4984 std::ostringstream scissor;
4985 scissor << std::hex << GL_SCISSOR_TEST;
4986 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
4988 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
4993 int UtcDaliActorPropertyClippingActorCulled(void)
4995 // This test checks that child actors are clipped by an culled parent actor.
4996 tet_infoline("Testing child actors are clipped by an culled parent actor");
4997 TestApplication application;
4999 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5000 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5001 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5003 const Vector2 actorSize(160.0f, 160.0f);
5005 // Create a clipping actor.
5006 Actor clippingActorA = CreateRenderableActor();
5007 clippingActorA[Actor::Property::SIZE] = actorSize;
5009 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5010 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5011 clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5012 clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5013 clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
5014 application.GetScene().Add(clippingActorA);
5016 // Create a child actor
5017 Actor childActor = CreateRenderableActor();
5018 childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5019 childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5020 childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
5021 childActor[Actor::Property::INHERIT_POSITION] = false;
5023 // Gather the call trace.
5024 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5026 // Check scissor test was enabled.
5027 std::ostringstream scissor;
5028 scissor << std::hex << GL_SCISSOR_TEST;
5029 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5031 // Check the scissor was set, and the coordinates are correct.
5032 std::stringstream compareParametersString;
5033 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5034 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5036 // Move the clipping actor out of screen
5037 clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
5039 // Gather the call trace.
5040 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5042 // Check the scissor was set, and the coordinates are correct.
5043 compareParametersString.str(std::string());
5044 compareParametersString.clear();
5045 compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
5046 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
5051 int UtcDaliGetPropertyN(void)
5053 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
5054 TestApplication application;
5056 Actor actor = Actor::New();
5058 unsigned int propertyCount = actor.GetPropertyCount();
5059 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
5063 int UtcDaliActorRaiseLower(void)
5065 tet_infoline("UtcDaliActor Raise and Lower test\n");
5067 TestApplication application;
5069 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5071 Integration::Scene stage(application.GetScene());
5073 Actor actorA = Actor::New();
5074 Actor actorB = Actor::New();
5075 Actor actorC = Actor::New();
5077 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5078 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5080 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5081 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5083 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5084 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5086 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5087 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5089 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5090 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5092 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5093 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5099 ResetTouchCallbacks();
5101 application.SendNotification();
5102 application.Render();
5104 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5105 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5106 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5108 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5109 // Only top actor will get touched.
5110 actorA.TouchedSignal().Connect(TestTouchCallback);
5111 actorB.TouchedSignal().Connect(TestTouchCallback2);
5112 actorC.TouchedSignal().Connect(TestTouchCallback3);
5114 // Connect ChildOrderChangedSignal
5115 bool orderChangedSignal(false);
5116 Actor orderChangedActor;
5117 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5118 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5120 Dali::Integration::Point point;
5121 point.SetDeviceId(1);
5122 point.SetState(PointState::DOWN);
5123 point.SetScreenPosition(Vector2(10.f, 10.f));
5124 Dali::Integration::TouchEvent touchEvent;
5125 touchEvent.AddPoint(point);
5127 application.ProcessEvent(touchEvent);
5129 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5130 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5131 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5133 ResetTouchCallbacks();
5135 tet_printf("Testing Raising of Actor\n");
5137 int preActorOrder(0);
5138 int postActorOrder(0);
5140 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5141 value.Get(preActorOrder);
5143 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5145 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5146 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5148 // Ensure sort order is calculated before next touch event
5149 application.SendNotification();
5151 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5152 value.Get(postActorOrder);
5154 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5156 application.ProcessEvent(touchEvent);
5158 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5159 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5160 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5162 ResetTouchCallbacks();
5164 tet_printf("Testing Lowering of Actor\n");
5166 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5167 value.Get(preActorOrder);
5169 orderChangedSignal = false;
5171 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5173 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5174 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5176 application.SendNotification(); // ensure sort order calculated before next touch event
5178 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5179 value.Get(postActorOrder);
5181 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5183 application.ProcessEvent(touchEvent);
5185 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5186 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5187 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5189 ResetTouchCallbacks();
5191 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
5196 int UtcDaliActorRaiseToTopLowerToBottom(void)
5198 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
5200 TestApplication application;
5202 Integration::Scene stage(application.GetScene());
5204 Actor actorA = Actor::New();
5205 Actor actorB = Actor::New();
5206 Actor actorC = Actor::New();
5208 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5209 // enables checking of which actor the uniform is assigned too
5210 Shader shaderA = CreateShader();
5211 shaderA.RegisterProperty("uRendererColor", 1.f);
5213 Shader shaderB = CreateShader();
5214 shaderB.RegisterProperty("uRendererColor", 2.f);
5216 Shader shaderC = CreateShader();
5217 shaderC.RegisterProperty("uRendererColor", 3.f);
5219 Geometry geometry = CreateQuadGeometry();
5221 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5222 Renderer rendererA = Renderer::New(geometry, shaderA);
5223 actorA.AddRenderer(rendererA);
5225 Renderer rendererB = Renderer::New(geometry, shaderB);
5226 actorB.AddRenderer(rendererB);
5228 Renderer rendererC = Renderer::New(geometry, shaderC);
5229 actorC.AddRenderer(rendererC);
5231 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5232 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5234 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5235 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5237 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5238 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5240 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5241 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5243 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5244 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5246 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5247 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5253 ResetTouchCallbacks();
5255 // Connect ChildOrderChangedSignal
5256 bool orderChangedSignal(false);
5257 Actor orderChangedActor;
5258 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5259 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5261 // Set up gl abstraction trace so can query the set uniform order
5262 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5263 glAbstraction.EnableSetUniformCallTrace(true);
5264 glAbstraction.ResetSetUniformCallStack();
5266 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5268 application.SendNotification();
5269 application.Render();
5271 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
5273 // Test order of uniforms in stack
5274 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5275 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5276 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5278 bool CBA = (indexC > indexB) && (indexB > indexA);
5280 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5282 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5283 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5284 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5286 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5287 // Only top actor will get touched.
5288 actorA.TouchedSignal().Connect(TestTouchCallback);
5289 actorB.TouchedSignal().Connect(TestTouchCallback2);
5290 actorC.TouchedSignal().Connect(TestTouchCallback3);
5292 Dali::Integration::Point point;
5293 point.SetDeviceId(1);
5294 point.SetState(PointState::DOWN);
5295 point.SetScreenPosition(Vector2(10.f, 10.f));
5296 Dali::Integration::TouchEvent touchEvent;
5297 touchEvent.AddPoint(point);
5299 application.ProcessEvent(touchEvent);
5301 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5302 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5303 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5305 ResetTouchCallbacks();
5307 tet_printf("RaiseToTop ActorA\n");
5309 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5310 actorA.RaiseToTop();
5311 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5312 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5314 application.SendNotification(); // ensure sorting order is calculated before next touch event
5316 application.ProcessEvent(touchEvent);
5318 glSetUniformStack.Reset();
5320 application.SendNotification();
5321 application.Render();
5323 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5325 // Test order of uniforms in stack
5326 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5327 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5328 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5330 tet_infoline("Testing A above C and B at bottom\n");
5331 bool ACB = (indexA > indexC) && (indexC > indexB);
5333 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
5335 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5336 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5337 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5339 ResetTouchCallbacks();
5341 tet_printf("RaiseToTop ActorB\n");
5343 orderChangedSignal = false;
5345 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5346 actorB.RaiseToTop();
5347 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5348 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5350 application.SendNotification(); // Ensure sort order is calculated before next touch event
5352 application.ProcessEvent(touchEvent);
5354 glSetUniformStack.Reset();
5356 application.SendNotification();
5357 application.Render();
5359 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5361 // Test order of uniforms in stack
5362 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5363 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5364 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5366 tet_infoline("Testing B above A and C at bottom\n");
5367 bool BAC = (indexB > indexA) && (indexA > indexC);
5369 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
5371 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5372 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5373 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5375 ResetTouchCallbacks();
5377 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
5379 orderChangedSignal = false;
5381 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5382 actorA.LowerToBottom();
5383 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5384 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5386 application.SendNotification();
5387 application.Render();
5389 orderChangedSignal = false;
5391 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5392 actorB.LowerToBottom();
5393 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5394 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5396 application.SendNotification();
5397 application.Render();
5399 application.ProcessEvent(touchEvent);
5401 glSetUniformStack.Reset();
5403 application.SendNotification();
5404 application.Render();
5406 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5408 // Test order of uniforms in stack
5409 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5410 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5411 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5413 tet_infoline("Testing C above A and B at bottom\n");
5414 bool CAB = (indexC > indexA) && (indexA > indexB);
5416 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
5418 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5419 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5420 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5422 ResetTouchCallbacks();
5427 int UtcDaliActorRaiseAbove(void)
5429 tet_infoline("UtcDaliActor RaiseToAbove test \n");
5431 TestApplication application;
5433 Integration::Scene stage(application.GetScene());
5435 Actor actorA = Actor::New();
5436 Actor actorB = Actor::New();
5437 Actor actorC = Actor::New();
5439 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5440 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5442 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5443 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5445 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5446 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5448 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5449 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5451 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5452 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5454 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5455 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5461 ResetTouchCallbacks();
5463 application.SendNotification();
5464 application.Render();
5466 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5467 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5468 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5470 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5471 // Only top actor will get touched.
5472 actorA.TouchedSignal().Connect(TestTouchCallback);
5473 actorB.TouchedSignal().Connect(TestTouchCallback2);
5474 actorC.TouchedSignal().Connect(TestTouchCallback3);
5476 bool orderChangedSignal(false);
5477 Actor orderChangedActor;
5478 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5479 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5481 Dali::Integration::Point point;
5482 point.SetDeviceId(1);
5483 point.SetState(PointState::DOWN);
5484 point.SetScreenPosition(Vector2(10.f, 10.f));
5485 Dali::Integration::TouchEvent touchEvent;
5486 touchEvent.AddPoint(point);
5488 application.ProcessEvent(touchEvent);
5490 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5491 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5492 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5494 ResetTouchCallbacks();
5496 tet_printf("Raise actor B Above Actor C\n");
5498 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5499 actorB.RaiseAbove(actorC);
5500 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5501 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5503 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5504 application.SendNotification();
5505 application.ProcessEvent(touchEvent);
5507 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5508 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5509 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5511 ResetTouchCallbacks();
5513 tet_printf("Raise actor A Above Actor B\n");
5515 orderChangedSignal = false;
5517 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5518 actorA.RaiseAbove(actorB);
5519 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5520 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5522 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5523 application.SendNotification();
5525 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5527 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5528 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5529 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5531 ResetTouchCallbacks();
5536 int UtcDaliActorRaiseAbove2(void)
5538 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
5540 TestApplication application;
5542 Integration::Scene stage(application.GetScene());
5544 Actor actorA = Actor::New();
5545 Actor actorB = Actor::New();
5546 Actor actorC = Actor::New();
5548 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5549 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5551 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5552 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5554 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5555 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5557 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5558 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5560 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5561 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5563 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5564 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5570 ResetTouchCallbacks();
5572 application.SendNotification();
5573 application.Render();
5575 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5576 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5577 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5579 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5580 // Only top actor will get touched.
5581 actorA.TouchedSignal().Connect(TestTouchCallback);
5582 actorB.TouchedSignal().Connect(TestTouchCallback2);
5583 actorC.TouchedSignal().Connect(TestTouchCallback3);
5585 bool orderChangedSignal(false);
5586 Actor orderChangedActor;
5587 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5588 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5590 Dali::Integration::Point point;
5591 point.SetDeviceId(1);
5592 point.SetState(PointState::DOWN);
5593 point.SetScreenPosition(Vector2(10.f, 10.f));
5594 Dali::Integration::TouchEvent touchEvent;
5595 touchEvent.AddPoint(point);
5597 application.ProcessEvent(touchEvent);
5599 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5600 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5601 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5603 ResetTouchCallbacks();
5605 tet_printf("Raise actor B Above Actor C\n");
5607 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5608 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
5609 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
5610 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5611 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5613 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5614 application.SendNotification();
5615 application.ProcessEvent(touchEvent);
5617 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5618 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5619 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5621 ResetTouchCallbacks();
5623 tet_printf("Raise actor A Above Actor B\n");
5625 orderChangedSignal = false;
5627 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5628 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
5629 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
5630 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5631 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5633 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5634 application.SendNotification();
5636 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
5638 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5639 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5640 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5642 ResetTouchCallbacks();
5647 int UtcDaliActorLowerBelow(void)
5649 tet_infoline("UtcDaliActor LowerBelow test \n");
5651 TestApplication application;
5653 Integration::Scene stage(application.GetScene());
5655 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5656 // enables checking of which actor the uniform is assigned too
5657 Shader shaderA = CreateShader();
5658 shaderA.RegisterProperty("uRendererColor", 1.f);
5660 Shader shaderB = CreateShader();
5661 shaderB.RegisterProperty("uRendererColor", 2.f);
5663 Shader shaderC = CreateShader();
5664 shaderC.RegisterProperty("uRendererColor", 3.f);
5666 Actor actorA = Actor::New();
5667 Actor actorB = Actor::New();
5668 Actor actorC = Actor::New();
5670 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5671 Geometry geometry = CreateQuadGeometry();
5673 Renderer rendererA = Renderer::New(geometry, shaderA);
5674 actorA.AddRenderer(rendererA);
5676 Renderer rendererB = Renderer::New(geometry, shaderB);
5677 actorB.AddRenderer(rendererB);
5679 Renderer rendererC = Renderer::New(geometry, shaderC);
5680 actorC.AddRenderer(rendererC);
5682 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5683 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5685 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5686 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5688 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5689 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5691 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5692 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5694 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5695 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5697 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5698 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5700 Actor container = Actor::New();
5701 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5702 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5703 stage.Add(container);
5705 container.Add(actorA);
5706 container.Add(actorB);
5707 container.Add(actorC);
5709 ResetTouchCallbacks();
5711 // Connect ChildOrderChangedSignal
5712 bool orderChangedSignal(false);
5713 Actor orderChangedActor;
5714 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5715 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5717 // Set up gl abstraction trace so can query the set uniform order
5718 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5719 glAbstraction.EnableSetUniformCallTrace(true);
5720 glAbstraction.ResetSetUniformCallStack();
5721 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5723 glAbstraction.ResetSetUniformCallStack();
5725 application.SendNotification();
5726 application.Render();
5728 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5730 // Test order of uniforms in stack
5731 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5732 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5733 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5735 tet_infoline("Testing C above B and A at bottom\n");
5736 bool CBA = (indexC > indexB) && (indexB > indexA);
5738 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5740 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5741 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5742 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5744 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5745 // Only top actor will get touched.
5746 actorA.TouchedSignal().Connect(TestTouchCallback);
5747 actorB.TouchedSignal().Connect(TestTouchCallback2);
5748 actorC.TouchedSignal().Connect(TestTouchCallback3);
5750 Dali::Integration::Point point;
5751 point.SetDeviceId(1);
5752 point.SetState(PointState::DOWN);
5753 point.SetScreenPosition(Vector2(10.f, 10.f));
5754 Dali::Integration::TouchEvent touchEvent;
5755 touchEvent.AddPoint(point);
5757 tet_infoline("UtcDaliActor Test Set up completed \n");
5759 application.ProcessEvent(touchEvent);
5761 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5762 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5763 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5765 ResetTouchCallbacks();
5767 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");
5769 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5770 actorC.LowerBelow(actorB);
5771 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5772 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5774 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5775 application.SendNotification();
5776 application.Render();
5778 application.ProcessEvent(touchEvent); // touch event
5780 glSetUniformStack.Reset();
5782 application.SendNotification();
5783 application.Render();
5785 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5787 // Test order of uniforms in stack
5788 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5789 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5790 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5792 tet_infoline("Testing render order is A, C, B");
5793 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
5794 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
5796 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5797 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5798 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5800 ResetTouchCallbacks();
5802 tet_printf("Lower actor C below Actor A leaving B on top\n");
5804 orderChangedSignal = false;
5806 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5807 actorC.LowerBelow(actorA);
5808 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5809 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5811 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5812 application.SendNotification();
5813 application.Render();
5815 application.ProcessEvent(touchEvent);
5817 glSetUniformStack.Reset();
5819 application.Render();
5820 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5822 // Test order of uniforms in stack
5823 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5824 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5825 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5827 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5828 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
5830 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5831 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5832 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5834 ResetTouchCallbacks();
5836 tet_printf("Lower actor B below Actor C leaving A on top\n");
5838 orderChangedSignal = false;
5840 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5841 actorB.LowerBelow(actorC);
5842 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5843 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5845 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5846 application.SendNotification();
5847 application.Render();
5849 application.ProcessEvent(touchEvent);
5851 glSetUniformStack.Reset();
5853 application.Render();
5854 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5856 // Test order of uniforms in stack
5857 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5858 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5859 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5861 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
5862 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
5867 int UtcDaliActorLowerBelow2(void)
5869 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
5871 TestApplication application;
5873 Integration::Scene stage(application.GetScene());
5875 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5876 // enables checking of which actor the uniform is assigned too
5877 Shader shaderA = CreateShader();
5878 shaderA.RegisterProperty("uRendererColor", 1.f);
5880 Shader shaderB = CreateShader();
5881 shaderB.RegisterProperty("uRendererColor", 2.f);
5883 Shader shaderC = CreateShader();
5884 shaderC.RegisterProperty("uRendererColor", 3.f);
5886 Actor actorA = Actor::New();
5887 Actor actorB = Actor::New();
5888 Actor actorC = Actor::New();
5890 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5891 Geometry geometry = CreateQuadGeometry();
5893 Renderer rendererA = Renderer::New(geometry, shaderA);
5894 actorA.AddRenderer(rendererA);
5896 Renderer rendererB = Renderer::New(geometry, shaderB);
5897 actorB.AddRenderer(rendererB);
5899 Renderer rendererC = Renderer::New(geometry, shaderC);
5900 actorC.AddRenderer(rendererC);
5902 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5903 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5905 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5906 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5908 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5909 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5911 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5912 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5914 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5915 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5917 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5918 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5920 Actor container = Actor::New();
5921 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5922 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
5923 stage.Add(container);
5925 container.Add(actorA);
5926 container.Add(actorB);
5927 container.Add(actorC);
5929 ResetTouchCallbacks();
5931 // Connect ChildOrderChangedSignal
5932 bool orderChangedSignal(false);
5933 Actor orderChangedActor;
5934 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5935 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
5937 // Set up gl abstraction trace so can query the set uniform order
5938 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5939 glAbstraction.EnableSetUniformCallTrace(true);
5940 glAbstraction.ResetSetUniformCallStack();
5941 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5943 glAbstraction.ResetSetUniformCallStack();
5945 application.SendNotification();
5946 application.Render();
5948 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5950 // Test order of uniforms in stack
5951 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5952 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5953 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5955 tet_infoline("Testing C above B and A at bottom\n");
5956 bool CBA = (indexC > indexB) && (indexB > indexA);
5958 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5960 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5961 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5962 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5964 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5965 // Only top actor will get touched.
5966 actorA.TouchedSignal().Connect(TestTouchCallback);
5967 actorB.TouchedSignal().Connect(TestTouchCallback2);
5968 actorC.TouchedSignal().Connect(TestTouchCallback3);
5970 Dali::Integration::Point point;
5971 point.SetDeviceId(1);
5972 point.SetState(PointState::DOWN);
5973 point.SetScreenPosition(Vector2(10.f, 10.f));
5974 Dali::Integration::TouchEvent touchEvent;
5975 touchEvent.AddPoint(point);
5977 tet_infoline("UtcDaliActor Test Set up completed \n");
5979 application.ProcessEvent(touchEvent);
5981 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5982 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5983 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5985 ResetTouchCallbacks();
5987 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");
5989 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5990 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
5991 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5992 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
5994 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5995 application.SendNotification();
5996 application.Render();
5998 application.ProcessEvent(touchEvent); // touch event
6000 glSetUniformStack.Reset();
6002 application.SendNotification();
6003 application.Render();
6005 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6007 // Test order of uniforms in stack
6008 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6009 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6010 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6012 tet_infoline("Testing render order is A, C, B");
6013 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
6014 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
6016 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6017 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6018 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6020 ResetTouchCallbacks();
6022 tet_printf("Lower actor C below Actor A leaving B on top\n");
6024 orderChangedSignal = false;
6026 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6027 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
6028 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6029 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6031 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6032 application.SendNotification();
6033 application.Render();
6035 application.ProcessEvent(touchEvent);
6037 glSetUniformStack.Reset();
6039 application.Render();
6040 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6042 // Test order of uniforms in stack
6043 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6044 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6045 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6047 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6048 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
6050 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6051 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6052 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6054 ResetTouchCallbacks();
6056 tet_printf("Lower actor B below Actor C leaving A on top\n");
6058 orderChangedSignal = false;
6060 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6061 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
6062 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6063 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6065 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6066 application.SendNotification();
6067 application.Render();
6069 application.ProcessEvent(touchEvent);
6071 glSetUniformStack.Reset();
6073 application.Render();
6074 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6076 // Test order of uniforms in stack
6077 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6078 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6079 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6081 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
6082 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6087 int UtcDaliActorRaiseAboveDifferentParentsN(void)
6089 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
6091 TestApplication application;
6093 Integration::Scene stage(application.GetScene());
6095 Actor parentA = Actor::New();
6096 Actor parentB = Actor::New();
6097 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6098 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6099 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6100 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6102 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6103 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6105 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6106 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6111 Actor actorA = Actor::New();
6112 Actor actorB = Actor::New();
6113 Actor actorC = Actor::New();
6115 parentA.Add(actorA);
6116 parentA.Add(actorB);
6118 tet_printf("Actor C added to different parent from A and B \n");
6119 parentB.Add(actorC);
6121 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6122 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6124 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6125 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6127 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6128 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6130 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6131 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6133 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6134 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6136 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6137 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6139 ResetTouchCallbacks();
6141 // Connect ChildOrderChangedSignal
6142 bool orderChangedSignal(false);
6143 Actor orderChangedActor;
6144 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6145 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6147 application.SendNotification();
6148 application.Render();
6150 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6151 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6152 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6154 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6155 // Only top actor will get touched.
6156 actorA.TouchedSignal().Connect(TestTouchCallback);
6157 actorB.TouchedSignal().Connect(TestTouchCallback2);
6158 actorC.TouchedSignal().Connect(TestTouchCallback3);
6160 Dali::Integration::Point point;
6161 point.SetDeviceId(1);
6162 point.SetState(PointState::DOWN);
6163 point.SetScreenPosition(Vector2(10.f, 10.f));
6164 Dali::Integration::TouchEvent touchEvent;
6165 touchEvent.AddPoint(point);
6167 application.ProcessEvent(touchEvent);
6169 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6170 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6171 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6173 ResetTouchCallbacks();
6175 tet_printf("Raise actor A Above Actor C which have different parents\n");
6177 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6178 actorA.RaiseAbove(actorC);
6179 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6181 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6182 application.SendNotification();
6184 application.ProcessEvent(touchEvent); // touch event
6186 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6187 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6188 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6190 ResetTouchCallbacks();
6195 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
6197 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
6199 TestApplication application;
6201 Integration::Scene stage(application.GetScene());
6203 Actor actorA = Actor::New();
6204 Actor actorB = Actor::New();
6205 Actor actorC = Actor::New();
6207 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6208 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6210 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6211 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6213 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6214 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6216 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6217 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6219 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6220 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6222 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6223 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6225 ResetTouchCallbacks();
6227 // Connect ChildOrderChangedSignal
6228 bool orderChangedSignal(false);
6229 Actor orderChangedActor;
6230 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6231 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6233 application.SendNotification();
6234 application.Render();
6236 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6237 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6238 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6240 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6241 // Only top actor will get touched.
6242 actorA.TouchedSignal().Connect(TestTouchCallback);
6243 actorB.TouchedSignal().Connect(TestTouchCallback2);
6244 actorC.TouchedSignal().Connect(TestTouchCallback3);
6246 Dali::Integration::Point point;
6247 point.SetDeviceId(1);
6248 point.SetState(PointState::DOWN);
6249 point.SetScreenPosition(Vector2(10.f, 10.f));
6250 Dali::Integration::TouchEvent touchEvent;
6251 touchEvent.AddPoint(point);
6253 tet_printf("Raise actor A Above Actor C which have no parents\n");
6255 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6256 actorA.RaiseAbove(actorC);
6257 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6259 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6260 application.SendNotification();
6262 application.ProcessEvent(touchEvent);
6264 tet_printf("Not parented so RaiseAbove should show no effect\n");
6266 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6267 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6268 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6270 ResetTouchCallbacks();
6272 orderChangedSignal = false;
6275 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
6277 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6278 actorA.LowerBelow(actorC);
6279 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6281 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6282 application.SendNotification();
6283 application.Render();
6285 application.ProcessEvent(touchEvent);
6287 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
6288 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6289 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6290 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6292 ResetTouchCallbacks();
6294 orderChangedSignal = false;
6296 tet_printf("Adding Actor A to stage, will be on top\n");
6299 application.SendNotification();
6300 application.Render();
6302 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
6304 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6305 actorB.RaiseAbove(actorC);
6306 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6308 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6309 application.SendNotification();
6311 application.ProcessEvent(touchEvent);
6313 tet_printf("C not parented so RaiseAbove should show no effect\n");
6314 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6315 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6316 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6318 ResetTouchCallbacks();
6320 orderChangedSignal = false;
6322 tet_printf("Lower actor A below Actor C when only A has a parent\n");
6324 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6325 actorA.LowerBelow(actorC);
6326 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6328 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6329 application.SendNotification();
6331 application.ProcessEvent(touchEvent);
6333 tet_printf("C not parented so LowerBelow should show no effect\n");
6334 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6335 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6336 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6338 ResetTouchCallbacks();
6340 orderChangedSignal = false;
6344 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6345 actorA.RaiseAbove(actorC);
6346 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6347 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6349 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6350 application.SendNotification();
6351 application.Render();
6353 application.ProcessEvent(touchEvent);
6355 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
6356 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6357 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6358 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6363 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
6365 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
6367 TestApplication application;
6369 Integration::Scene stage(application.GetScene());
6371 Actor actorA = Actor::New();
6372 Actor actorB = Actor::New();
6373 Actor actorC = Actor::New();
6375 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6376 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6378 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6379 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6381 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6382 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6384 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6385 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6387 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6388 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6390 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6391 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6393 ResetTouchCallbacks();
6395 // Connect ChildOrderChangedSignal
6396 bool orderChangedSignal(false);
6397 Actor orderChangedActor;
6398 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6399 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6401 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6402 // Only top actor will get touched.
6403 actorA.TouchedSignal().Connect(TestTouchCallback);
6404 actorB.TouchedSignal().Connect(TestTouchCallback2);
6405 actorC.TouchedSignal().Connect(TestTouchCallback3);
6407 Dali::Integration::Point point;
6408 point.SetDeviceId(1);
6409 point.SetState(PointState::DOWN);
6410 point.SetScreenPosition(Vector2(10.f, 10.f));
6411 Dali::Integration::TouchEvent touchEvent;
6412 touchEvent.AddPoint(point);
6415 tet_printf("Raise actor B Above Actor C but B not parented\n");
6417 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6419 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6421 application.SendNotification();
6422 application.Render();
6424 application.ProcessEvent(touchEvent);
6426 tet_printf("Not parented so RaiseAbove should show no effect\n");
6428 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6429 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6430 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6432 tet_printf("Raise actor B Above Actor C but B not parented\n");
6433 ResetTouchCallbacks();
6435 orderChangedSignal = false;
6437 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6439 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6441 // Sort actor tree before next touch event
6442 application.SendNotification();
6443 application.Render();
6445 application.ProcessEvent(touchEvent);
6447 tet_printf("Not parented so RaiseAbove should show no effect\n");
6449 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6450 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6451 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6452 ResetTouchCallbacks();
6454 orderChangedSignal = false;
6456 tet_printf("Lower actor C below B but C not parented\n");
6458 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6460 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6462 // Sort actor tree before next touch event
6463 application.SendNotification();
6464 application.Render();
6466 application.ProcessEvent(touchEvent);
6468 tet_printf("Not parented so Lower should show no effect\n");
6470 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6471 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6472 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6473 ResetTouchCallbacks();
6475 orderChangedSignal = false;
6477 tet_printf("Raise actor B to top\n");
6479 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6480 actorB.RaiseToTop();
6481 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6483 // Sort actor tree before next touch event
6484 application.SendNotification();
6485 application.Render();
6487 application.ProcessEvent(touchEvent);
6489 tet_printf("Not parented so RaiseToTop should show no effect\n");
6491 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6492 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6493 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6494 ResetTouchCallbacks();
6496 orderChangedSignal = false;
6498 tet_printf("Add ActorB to stage so only Actor C not parented\n");
6502 tet_printf("Lower actor C to Bottom, B stays at top\n");
6504 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6505 actorC.LowerToBottom();
6506 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6508 application.SendNotification();
6509 application.Render();
6511 application.ProcessEvent(touchEvent);
6513 tet_printf("Not parented so LowerToBottom should show no effect\n");
6515 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6516 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6517 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6518 ResetTouchCallbacks();
6523 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
6525 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
6527 TestApplication application;
6529 Integration::Scene stage(application.GetScene());
6531 Actor actorA = Actor::New();
6532 Actor actorB = Actor::New();
6533 Actor actorC = Actor::New();
6535 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6536 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6538 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6539 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6541 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6542 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6544 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6545 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6547 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6548 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6550 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6551 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6557 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6558 // Only top actor will get touched.
6559 actorA.TouchedSignal().Connect(TestTouchCallback);
6560 actorB.TouchedSignal().Connect(TestTouchCallback2);
6561 actorC.TouchedSignal().Connect(TestTouchCallback3);
6563 ResetTouchCallbacks();
6565 // Connect ChildOrderChangedSignal
6566 bool orderChangedSignal(false);
6567 Actor orderChangedActor;
6568 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6569 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6571 application.SendNotification();
6572 application.Render();
6574 Dali::Integration::Point point;
6575 point.SetDeviceId(1);
6576 point.SetState(PointState::DOWN);
6577 point.SetScreenPosition(Vector2(10.f, 10.f));
6578 Dali::Integration::TouchEvent touchEvent;
6579 touchEvent.AddPoint(point);
6581 application.ProcessEvent(touchEvent);
6583 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6584 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6585 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6587 ResetTouchCallbacks();
6589 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
6591 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6592 actorA.RaiseAbove(actorA);
6593 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6594 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6596 application.SendNotification();
6597 application.Render();
6599 application.ProcessEvent(touchEvent);
6601 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
6603 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6604 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6605 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6607 ResetTouchCallbacks();
6609 orderChangedSignal = false;
6611 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6612 actorA.RaiseAbove(actorC);
6613 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6614 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6616 application.SendNotification();
6617 application.Render();
6619 application.ProcessEvent(touchEvent);
6621 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
6622 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6623 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6624 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6629 int UtcDaliActorGetScreenPosition(void)
6631 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
6633 TestApplication application;
6635 Integration::Scene stage(application.GetScene());
6637 Actor actorA = Actor::New();
6638 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6640 Vector2 size2(10.0f, 20.0f);
6641 actorA.SetProperty(Actor::Property::SIZE, size2);
6643 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6645 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
6649 application.SendNotification();
6650 application.Render();
6652 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6653 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6655 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6656 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
6658 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6659 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6661 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
6663 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6665 application.SendNotification();
6666 application.Render();
6668 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6669 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6671 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6672 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
6674 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6675 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6677 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
6679 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6681 application.SendNotification();
6682 application.Render();
6684 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6685 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6687 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6688 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
6690 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6691 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6693 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
6695 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
6697 application.SendNotification();
6698 application.Render();
6700 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6701 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6703 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
6704 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6706 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6707 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6709 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
6711 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
6713 application.SendNotification();
6714 application.Render();
6716 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6717 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6719 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
6720 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
6722 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
6723 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
6725 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
6727 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6728 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
6730 Actor actorB = Actor::New();
6731 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6732 actorB.SetProperty(Actor::Property::SIZE, size2);
6733 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
6736 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
6738 application.SendNotification();
6739 application.Render();
6741 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6743 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
6744 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
6749 int UtcDaliActorGetScreenPositionAfterScaling(void)
6751 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
6753 TestApplication application;
6755 Integration::Scene stage(application.GetScene());
6757 Actor actorA = Actor::New();
6758 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6760 Vector2 size2(10.0f, 20.0f);
6761 actorA.SetProperty(Actor::Property::SIZE, size2);
6762 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
6763 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6765 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
6769 application.SendNotification();
6770 application.Render();
6772 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6773 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6775 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6776 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6778 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
6779 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
6781 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
6783 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6785 application.SendNotification();
6786 application.Render();
6788 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6789 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6791 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6792 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6794 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
6795 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6800 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6802 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
6804 TestApplication application;
6806 Integration::Scene stage(application.GetScene());
6808 Actor actorA = Actor::New();
6809 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6810 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6811 Vector2 size2(10.0f, 20.0f);
6812 actorA.SetProperty(Actor::Property::SIZE, size2);
6813 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6815 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6819 application.SendNotification();
6820 application.Render();
6822 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6823 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6825 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6826 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6828 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
6829 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
6831 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
6833 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
6834 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6836 application.SendNotification();
6837 application.Render();
6839 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6840 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6842 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
6843 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6845 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
6846 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
6852 int UtcDaliActorGetScreenPositionWithChildActors(void)
6854 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
6856 TestApplication application;
6858 Integration::Scene stage(application.GetScene());
6860 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6862 Actor actorA = Actor::New();
6863 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6864 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6865 Vector2 size1(10.0f, 20.0f);
6866 actorA.SetProperty(Actor::Property::SIZE, size1);
6867 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6869 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6871 Actor parentActorA = Actor::New();
6872 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6873 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6874 Vector2 size2(30.0f, 60.0f);
6875 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6876 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6878 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6880 stage.Add(parentActorA);
6881 parentActorA.Add(actorA);
6883 application.SendNotification();
6884 application.Render();
6886 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6887 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6889 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6890 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6892 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
6893 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
6895 tet_infoline("Test 2\n");
6897 tet_infoline("change parent anchor point and parent origin then check screen position \n");
6899 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6900 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
6902 application.SendNotification();
6903 application.Render();
6905 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6906 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6908 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
6909 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6911 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
6912 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
6917 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6919 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
6921 TestApplication application;
6923 Integration::Scene stage(application.GetScene());
6925 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6927 Actor actorA = Actor::New();
6928 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6929 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6930 Vector2 size1(10.0f, 20.0f);
6931 actorA.SetProperty(Actor::Property::SIZE, size1);
6932 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6934 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
6936 Actor parentActorA = Actor::New();
6937 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6938 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6939 Vector2 size2(30.0f, 60.0f);
6940 parentActorA.SetProperty(Actor::Property::SIZE, size2);
6941 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6943 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
6945 Actor grandParentActorA = Actor::New();
6946 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
6947 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
6948 Vector2 size3(60.0f, 120.0f);
6949 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
6950 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
6952 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
6954 stage.Add(grandParentActorA);
6955 grandParentActorA.Add(parentActorA);
6957 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
6959 parentActorA.Add(actorA);
6961 application.SendNotification();
6962 application.Render();
6964 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
6965 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
6967 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
6968 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
6970 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
6971 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
6976 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6978 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
6980 TestApplication application;
6982 Integration::Scene stage(application.GetScene());
6984 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6986 Actor actorA = Actor::New();
6987 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
6988 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6989 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6990 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
6993 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
6995 Actor actorB = Actor::New();
6996 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
6997 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6998 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
6999 Vector2 actorBSize(30.0f, 60.0f);
7000 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
7003 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
7005 Actor actorC = Actor::New();
7006 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7007 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7008 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7009 Vector2 actorCSize(60.0f, 120.0f);
7010 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
7013 application.SendNotification();
7014 application.Render();
7016 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
7018 Vector2 center(stage.GetSize() * 0.5f);
7020 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7021 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7022 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7024 tet_infoline("Add scale to all actors");
7026 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
7027 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
7028 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
7030 application.SendNotification();
7031 application.Render();
7033 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
7034 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
7035 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
7040 int utcDaliActorPositionUsesAnchorPoint(void)
7042 TestApplication application;
7043 tet_infoline("Check default behaviour\n");
7045 Actor actor = Actor::New();
7046 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7047 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7048 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7049 application.GetScene().Add(actor);
7051 application.SendNotification();
7052 application.Render();
7054 tet_infoline("Check that the world position is in the center\n");
7055 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7057 tet_infoline("Set the position uses anchor point property to false\n");
7058 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7060 application.SendNotification();
7061 application.Render();
7063 tet_infoline("Check that the world position has changed appropriately\n");
7064 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7069 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
7071 TestApplication application;
7072 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7074 Actor actor = Actor::New();
7075 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7076 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7077 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7078 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7079 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7080 application.GetScene().Add(actor);
7082 application.SendNotification();
7083 application.Render();
7085 tet_infoline("Check the world position is the same as it would be without a scale\n");
7086 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7088 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7089 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7090 application.SendNotification();
7091 application.Render();
7092 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
7094 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7095 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7096 application.SendNotification();
7097 application.Render();
7098 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7103 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
7105 TestApplication application;
7106 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7108 Actor actor = Actor::New();
7109 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7110 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7111 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7112 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7113 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7114 application.GetScene().Add(actor);
7116 application.SendNotification();
7117 application.Render();
7119 tet_infoline("Check the world position is the same as it would be without a rotation\n");
7120 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7122 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7123 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7124 application.SendNotification();
7125 application.Render();
7126 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
7128 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7129 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7130 application.SendNotification();
7131 application.Render();
7132 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
7137 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
7139 TestApplication application;
7140 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7142 Actor actor = Actor::New();
7143 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7144 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7145 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7146 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7147 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7148 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7149 application.GetScene().Add(actor);
7151 application.SendNotification();
7152 application.Render();
7154 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
7155 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7157 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7158 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7159 application.SendNotification();
7160 application.Render();
7161 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
7163 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7164 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7165 application.SendNotification();
7166 application.Render();
7167 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
7172 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
7174 TestApplication application;
7175 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7177 Actor parent = Actor::New();
7179 application.GetScene().Add(parent);
7180 Vector2 stageSize(application.GetScene().GetSize());
7182 Actor actor = Actor::New();
7183 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7184 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7185 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7186 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
7187 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
7188 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7191 application.SendNotification();
7192 application.Render();
7194 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
7196 tet_infoline("Check the world position is in the right place\n");
7197 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7199 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
7200 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7201 application.SendNotification();
7202 application.Render();
7203 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7205 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
7206 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7207 application.SendNotification();
7208 application.Render();
7209 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7214 int utcDaliActorVisibilityChangeSignalSelf(void)
7216 TestApplication application;
7217 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7219 Actor actor = Actor::New();
7221 VisibilityChangedFunctorData data;
7222 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7224 actor.SetProperty(Actor::Property::VISIBLE, false);
7226 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7228 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7231 actor.SetProperty(Actor::Property::VISIBLE, false);
7232 data.Check(false /* not called */, TEST_LOCATION);
7234 tet_infoline("Change the visibility using properties, ensure called");
7237 actor.SetProperty(Actor::Property::VISIBLE, true);
7238 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7240 tet_infoline("Set the visibility to current using properties, ensure not called");
7243 actor.SetProperty(Actor::Property::VISIBLE, true);
7244 data.Check(false /* not called */, TEST_LOCATION);
7249 int utcDaliActorVisibilityChangeSignalChildren(void)
7251 TestApplication application;
7252 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
7254 Actor parent = Actor::New();
7255 Actor child = Actor::New();
7258 Actor grandChild = Actor::New();
7259 child.Add(grandChild);
7261 VisibilityChangedFunctorData parentData;
7262 VisibilityChangedFunctorData childData;
7263 VisibilityChangedFunctorData grandChildData;
7265 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
7266 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
7267 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
7269 parent.SetProperty(Actor::Property::VISIBLE, false);
7270 parentData.Check(false /* not called */, TEST_LOCATION);
7271 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7272 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7274 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
7277 grandChildData.Reset();
7279 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
7281 parent.SetProperty(Actor::Property::VISIBLE, true);
7282 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7283 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7284 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7286 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
7289 grandChildData.Reset();
7291 parent.SetProperty(Actor::Property::VISIBLE, true);
7292 parentData.Check(false /* not called */, TEST_LOCATION);
7293 childData.Check(false /* not called */, TEST_LOCATION);
7294 grandChildData.Check(false /* not called */, TEST_LOCATION);
7299 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
7301 TestApplication application;
7302 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
7304 Actor actor = Actor::New();
7305 application.GetScene().Add(actor);
7307 application.SendNotification();
7308 application.Render();
7310 VisibilityChangedFunctorData data;
7311 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7313 Animation animation = Animation::New(1.0f);
7314 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
7316 data.Check(false, TEST_LOCATION);
7317 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7318 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7320 tet_infoline("Play the animation and check the property value");
7323 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7324 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7326 tet_infoline("Animation not currently finished, so the current visibility should still be true");
7327 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7329 application.SendNotification();
7330 application.Render(1100); // After the animation
7332 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7337 int utcDaliActorVisibilityChangeSignalByName(void)
7339 TestApplication application;
7340 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7342 Actor actor = Actor::New();
7344 bool signalCalled = false;
7345 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
7346 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7347 actor.SetProperty(Actor::Property::VISIBLE, false);
7348 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7350 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7351 signalCalled = false;
7352 actor.SetProperty(Actor::Property::VISIBLE, false);
7353 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7355 tet_infoline("Change the visibility using properties, ensure called");
7356 actor.SetProperty(Actor::Property::VISIBLE, true);
7357 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7359 tet_infoline("Set the visibility to current using properties, ensure not called");
7360 signalCalled = false;
7362 actor.SetProperty(Actor::Property::VISIBLE, true);
7363 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7368 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
7370 gLayoutDirectionType = type;
7373 int UtcDaliActorLayoutDirectionProperty(void)
7375 TestApplication application;
7376 tet_infoline("Check layout direction property");
7378 Actor actor0 = Actor::New();
7379 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7380 application.GetScene().Add(actor0);
7382 application.SendNotification();
7383 application.Render();
7385 Actor actor1 = Actor::New();
7386 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7387 Actor actor2 = Actor::New();
7388 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7389 Actor actor3 = Actor::New();
7390 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7391 Actor actor4 = Actor::New();
7392 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7393 Actor actor5 = Actor::New();
7394 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7395 Actor actor6 = Actor::New();
7396 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7397 Actor actor7 = Actor::New();
7398 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7399 Actor actor8 = Actor::New();
7400 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7401 Actor actor9 = Actor::New();
7402 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7405 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
7406 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
7408 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7409 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7410 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7412 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7413 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7414 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
7416 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7418 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7419 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7421 application.GetScene().Add(actor3);
7428 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7429 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7431 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
7432 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
7433 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
7435 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7437 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7438 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7439 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7440 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7441 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7442 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7443 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7445 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
7446 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7447 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7449 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7450 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7451 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7452 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
7454 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
7455 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7456 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7461 struct LayoutDirectionFunctor
7463 LayoutDirectionFunctor(bool& signalCalled)
7464 : mSignalCalled(signalCalled)
7468 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
7469 : mSignalCalled(rhs.mSignalCalled)
7475 mSignalCalled = true;
7478 bool& mSignalCalled;
7481 int UtcDaliActorLayoutDirectionSignal(void)
7483 TestApplication application;
7484 tet_infoline("Check changing layout direction property sends a signal");
7486 Actor actor = Actor::New();
7487 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7488 application.GetScene().Add(actor);
7489 bool signalCalled = false;
7490 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
7492 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
7493 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7495 // Test that writing the same value doesn't send a signal
7496 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
7497 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7499 // Test that writing a different value sends the signal
7500 signalCalled = false;
7501 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7502 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7504 signalCalled = false;
7505 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
7506 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7511 struct ChildAddedSignalCheck
7513 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
7514 : mSignalReceived(signalReceived),
7515 mChildHandle(childHandle)
7519 void operator()(Actor childHandle)
7521 mSignalReceived = true;
7522 mChildHandle = childHandle;
7526 mSignalReceived = true;
7527 mChildHandle = Actor();
7530 bool& mSignalReceived;
7531 Actor& mChildHandle;
7534 int UtcDaliChildAddedSignalP1(void)
7536 TestApplication application;
7537 auto stage = application.GetScene();
7539 bool signalReceived = false;
7542 ChildAddedSignalCheck signal(signalReceived, childActor);
7543 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7544 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7546 auto actorA = Actor::New();
7548 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7549 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7550 signalReceived = false;
7552 auto actorB = Actor::New();
7554 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7555 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7560 int UtcDaliChildAddedSignalP2(void)
7562 TestApplication application;
7563 auto stage = application.GetScene();
7565 bool signalReceived = false;
7568 ChildAddedSignalCheck signal(signalReceived, childActor);
7569 tet_infoline("Connect to childAdded signal by name");
7571 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
7572 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7574 auto actorA = Actor::New();
7576 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7578 // Can't test which actor was added; signal signature is void() when connecting via name.
7579 signalReceived = false;
7581 auto actorB = Actor::New();
7583 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7588 int UtcDaliChildAddedSignalN(void)
7590 TestApplication application;
7591 auto stage = application.GetScene();
7593 bool signalReceived = false;
7596 ChildAddedSignalCheck signal(signalReceived, childActor);
7597 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
7598 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7600 auto actorA = Actor::New();
7602 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7603 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7604 signalReceived = false;
7606 auto actorB = Actor::New();
7608 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7612 struct ChildRemovedSignalCheck
7614 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
7615 : mSignalReceived(signalReceived),
7616 mChildHandle(childHandle)
7620 void operator()(Actor childHandle)
7622 mSignalReceived = true;
7623 mChildHandle = childHandle;
7628 mSignalReceived = true;
7631 bool& mSignalReceived;
7632 Actor& mChildHandle;
7635 int UtcDaliChildRemovedSignalP1(void)
7637 TestApplication application;
7638 auto stage = application.GetScene();
7640 bool signalReceived = false;
7643 ChildRemovedSignalCheck signal(signalReceived, childActor);
7644 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7645 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7647 auto actorA = Actor::New();
7649 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7650 DALI_TEST_CHECK(!childActor);
7652 stage.Remove(actorA);
7653 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
7654 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7656 signalReceived = false;
7657 auto actorB = Actor::New();
7659 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7661 stage.Remove(actorB);
7662 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7663 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
7668 int UtcDaliChildRemovedSignalP2(void)
7670 TestApplication application;
7671 auto stage = application.GetScene();
7673 bool signalReceived = false;
7676 ChildAddedSignalCheck signal(signalReceived, childActor);
7677 tet_infoline("Connect to childRemoved signal by name");
7679 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
7680 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7682 auto actorA = Actor::New();
7684 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7686 stage.Remove(actorA);
7687 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7689 signalReceived = false;
7690 auto actorB = Actor::New();
7692 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7694 stage.Remove(actorB);
7695 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
7700 int UtcDaliChildRemovedSignalN(void)
7702 TestApplication application;
7703 auto stage = application.GetScene();
7705 bool signalReceived = false;
7708 ChildRemovedSignalCheck signal(signalReceived, childActor);
7709 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
7710 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7712 auto actorA = Actor::New();
7715 auto actorB = Actor::New();
7718 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7719 DALI_TEST_CHECK(!childActor);
7721 actorA.Remove(actorB);
7722 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
7726 int UtcDaliChildMovedSignalP(void)
7728 TestApplication application;
7729 auto stage = application.GetScene();
7731 bool addedASignalReceived = false;
7732 bool removedASignalReceived = false;
7733 bool addedBSignalReceived = false;
7734 bool removedBSignalReceived = false;
7737 auto actorA = Actor::New();
7738 auto actorB = Actor::New();
7742 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
7743 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
7744 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
7745 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
7747 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
7748 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
7749 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
7750 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
7752 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7753 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7754 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7755 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7757 // Create a child of A
7759 auto child = Actor::New();
7762 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7763 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7764 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7765 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7766 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
7769 addedASignalReceived = false;
7770 addedBSignalReceived = false;
7771 removedASignalReceived = false;
7772 removedBSignalReceived = false;
7774 actorB.Add(child); // Expect this child to be re-parented
7775 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
7776 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
7777 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
7778 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
7780 // Move child back to A:
7781 addedASignalReceived = false;
7782 addedBSignalReceived = false;
7783 removedASignalReceived = false;
7784 removedBSignalReceived = false;
7786 actorA.Add(child); // Expect this child to be re-parented
7787 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
7788 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
7789 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
7790 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
7795 int UtcDaliActorSwitchParentP(void)
7797 tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
7798 TestApplication application;
7800 Actor parent1 = Actor::New();
7801 Actor child = Actor::New();
7803 application.GetScene().Add(parent1);
7805 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
7807 child.OnSceneSignal().Connect(OnSceneCallback);
7808 child.OffSceneSignal().Connect(OffSceneCallback);
7811 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
7812 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7816 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
7818 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
7819 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7821 Actor parent2 = Actor::New();
7822 application.GetScene().Add(parent2);
7824 bool addSignalReceived = false;
7825 ChildAddedSignalCheck addedSignal(addSignalReceived, child);
7826 DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
7827 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
7829 bool removedSignalReceived = false;
7830 ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
7831 DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
7832 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
7834 DevelActor::SwitchParent(child, parent2);
7836 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
7837 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
7839 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
7840 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
7842 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
7843 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
7844 DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
7845 DALI_TEST_CHECK(child.GetParent() == parent2);
7850 int utcDaliActorCulled(void)
7852 TestApplication application;
7853 auto stage = application.GetScene();
7855 tet_infoline("Check that the actor is culled if the actor is out of the screen");
7857 Actor actor = Actor::New();
7858 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7860 Geometry geometry = CreateQuadGeometry();
7861 Shader shader = CreateShader();
7862 Renderer renderer = Renderer::New(geometry, shader);
7863 actor.AddRenderer(renderer);
7867 application.SendNotification();
7868 application.Render(0);
7870 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
7872 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
7873 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
7875 // Connect NotifySignal
7876 bool propertyNotificationSignal(false);
7877 PropertyNotification source;
7878 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
7879 notification.NotifySignal().Connect(&application, f);
7881 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
7883 application.SendNotification();
7884 application.Render();
7886 application.SendNotification();
7888 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
7890 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
7891 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
7892 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
7897 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7899 TestApplication application;
7900 auto stage = application.GetScene();
7902 tet_infoline("Ensure we clear the screen when the last actor is removed");
7904 Actor actor = CreateRenderableActor();
7905 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7908 application.SendNotification();
7909 application.Render();
7911 auto& glAbstraction = application.GetGlAbstraction();
7912 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7916 application.SendNotification();
7917 application.Render();
7919 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7924 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7926 TestApplication application;
7927 auto stage = application.GetScene();
7929 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
7931 Actor actor = CreateRenderableActor();
7932 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7935 application.SendNotification();
7936 application.Render();
7938 auto& glAbstraction = application.GetGlAbstraction();
7939 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7941 actor.SetProperty(Actor::Property::VISIBLE, false);
7943 application.SendNotification();
7944 application.Render();
7946 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
7951 int utcDaliActorGetSizeAfterAnimation(void)
7953 TestApplication application;
7954 tet_infoline("Check the actor size before / after an animation is finished");
7956 Vector3 actorSize(100.0f, 100.0f, 0.0f);
7958 Actor actor = Actor::New();
7959 actor.SetProperty(Actor::Property::SIZE, actorSize);
7960 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
7961 application.GetScene().Add(actor);
7963 // Size should be updated without rendering.
7964 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7965 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7967 application.SendNotification();
7968 application.Render();
7970 // Size and current size should be updated.
7971 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7972 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7973 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7974 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7975 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7977 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
7978 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7979 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
7980 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
7981 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
7984 actorSize = Vector3(200.0f, 200.0f, 0.0f);
7985 actor.SetProperty(Actor::Property::SIZE, actorSize);
7987 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7988 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
7990 Vector3 targetValue(10.0f, 20.0f, 0.0f);
7992 Animation animation = Animation::New(1.0f);
7993 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
7996 // Size should be updated without rendering.
7997 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
7998 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8000 application.SendNotification();
8001 application.Render(1100); // After the animation
8003 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8004 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8005 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8006 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8007 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8009 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8010 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8011 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8012 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8013 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8015 targetValue.width = 50.0f;
8018 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
8021 application.SendNotification();
8022 application.Render(1100); // After the animation
8024 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8025 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8026 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8027 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8028 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8030 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8031 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8032 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8033 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8034 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8036 targetValue.height = 70.0f;
8039 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
8042 application.SendNotification();
8043 application.Render(1100); // After the animation
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 Vector3 offset(10.0f, 20.0f, 0.0f);
8060 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
8063 application.SendNotification();
8064 application.Render(1100); // After the animation
8066 targetValue += offset;
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.width = 20.0f;
8083 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
8086 application.SendNotification();
8087 application.Render(1100); // After the animation
8089 targetValue.width += offset.width;
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);
8103 offset.height = 10.0f;
8106 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
8109 application.SendNotification();
8110 application.Render(1100); // After the animation
8112 targetValue.height += offset.height;
8114 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8115 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8116 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8117 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8118 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8120 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8121 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8122 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8123 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8124 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8127 actorSize = Vector3(300.0f, 300.0f, 0.0f);
8129 actor.SetProperty(Actor::Property::SIZE, actorSize);
8131 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8132 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8134 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8135 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8137 application.SendNotification();
8138 application.Render();
8140 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8141 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8143 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8144 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8149 int utcDaliActorRelayoutAndAnimation(void)
8151 TestApplication application;
8152 tet_infoline("Check the actor size when relayoutting and playing animation");
8154 Vector3 parentSize(300.0f, 300.0f, 0.0f);
8155 Vector3 actorSize(100.0f, 100.0f, 0.0f);
8158 Actor parentA = Actor::New();
8159 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8160 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8161 application.GetScene().Add(parentA);
8163 Actor parentB = Actor::New();
8164 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8165 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8166 application.GetScene().Add(parentB);
8168 Actor actor = Actor::New();
8169 actor.SetProperty(Actor::Property::SIZE, actorSize);
8170 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8173 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8174 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8176 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8178 Animation animation = Animation::New(1.0f);
8179 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8182 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8183 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8185 application.SendNotification();
8186 application.Render(1100); // After the animation
8188 // Size and current size should be updated.
8189 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8190 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8192 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8193 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8198 application.SendNotification();
8199 application.Render();
8201 // Size and current size should be same.
8202 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8203 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8205 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8206 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8214 Actor parentA = Actor::New();
8215 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8216 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8217 application.GetScene().Add(parentA);
8219 Actor parentB = Actor::New();
8220 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8221 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8222 application.GetScene().Add(parentB);
8224 Actor actor = Actor::New();
8225 actor.SetProperty(Actor::Property::SIZE, actorSize);
8226 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8229 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8230 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8232 application.SendNotification();
8233 application.Render();
8235 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8236 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8238 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8239 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8241 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8243 // Make an animation
8244 Animation animation = Animation::New(1.0f);
8245 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8248 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8249 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8251 application.SendNotification();
8252 application.Render(1100); // After the animation
8254 // Size and current size should be updated.
8255 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8256 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8258 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8259 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8264 application.SendNotification();
8265 application.Render();
8267 // Size and current size should be same.
8268 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8269 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8271 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8272 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8282 int utcDaliActorPartialUpdate(void)
8284 TestApplication application(
8285 TestApplication::DEFAULT_SURFACE_WIDTH,
8286 TestApplication::DEFAULT_SURFACE_HEIGHT,
8287 TestApplication::DEFAULT_HORIZONTAL_DPI,
8288 TestApplication::DEFAULT_VERTICAL_DPI,
8292 tet_infoline("Check the damaged area");
8294 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8296 std::vector<Rect<int>> damagedRects;
8297 Rect<int> clippingRect;
8298 application.SendNotification();
8299 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8301 // First render pass, nothing to render, adaptor would just do swap buffer.
8302 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8304 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8305 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8307 Actor actor = CreateRenderableActor();
8308 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8309 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8310 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8311 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8312 application.GetScene().Add(actor);
8314 application.SendNotification();
8316 // 1. Actor added, damaged rect is added size of actor
8317 damagedRects.clear();
8318 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8319 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8322 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8323 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8324 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8325 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8326 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8327 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8328 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8331 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
8332 application.SendNotification();
8334 damagedRects.clear();
8335 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8336 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8339 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates, includes 3 last frames updates
8340 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8341 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8342 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8343 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8344 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8345 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8347 // 3. Set new position
8348 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
8349 application.SendNotification();
8351 damagedRects.clear();
8352 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8353 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8356 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates, includes 3 last frames updates
8357 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8358 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8359 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8360 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8361 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8362 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8364 application.GetScene().Remove(actor);
8365 application.SendNotification();
8367 // Actor removed, last 3 dirty rects are reported. Adaptor would merge them together.
8368 damagedRects.clear();
8369 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8370 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
8372 clippingRect = damagedRects[0];
8373 clippingRect.Merge(damagedRects[1]);
8374 clippingRect.Merge(damagedRects[2]);
8376 DALI_TEST_EQUALS(clippingRect.IsEmpty(), false, TEST_LOCATION);
8377 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
8378 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(16, 736, 64, 64), TEST_LOCATION);
8380 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8381 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8382 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8383 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8384 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8389 int utcDaliActorPartialUpdateSetColor(void)
8391 TestApplication application(
8392 TestApplication::DEFAULT_SURFACE_WIDTH,
8393 TestApplication::DEFAULT_SURFACE_HEIGHT,
8394 TestApplication::DEFAULT_HORIZONTAL_DPI,
8395 TestApplication::DEFAULT_VERTICAL_DPI,
8399 tet_infoline("Check uniform update");
8401 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8403 std::vector<Rect<int>> damagedRects;
8404 Rect<int> clippingRect;
8405 application.SendNotification();
8406 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8408 // First render pass, nothing to render, adaptor would just do swap buffer.
8409 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8411 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8412 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8414 Actor actor = CreateRenderableActor();
8415 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8416 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8417 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8418 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8419 application.GetScene().Add(actor);
8421 application.SendNotification();
8423 // 1. Actor added, damaged rect is added size of actor
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);
8437 damagedRects.clear();
8438 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8440 damagedRects.clear();
8441 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8444 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
8445 application.SendNotification();
8447 damagedRects.clear();
8448 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8449 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8452 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8453 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8454 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8455 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8456 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8457 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8458 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8463 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
8464 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
8465 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
8466 const char* const RENDER_SHADOW_VERTEX_SOURCE =
8467 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
8468 " uniform mediump mat4 uLightCameraViewMatrix;\n"
8472 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
8473 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
8474 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
8477 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
8478 "uniform lowp vec4 uShadowColor;\n"
8481 " lowp float alpha;\n"
8482 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
8483 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
8486 int utcDaliActorPartialUpdateSetProperty(void)
8488 TestApplication application(
8489 TestApplication::DEFAULT_SURFACE_WIDTH,
8490 TestApplication::DEFAULT_SURFACE_HEIGHT,
8491 TestApplication::DEFAULT_HORIZONTAL_DPI,
8492 TestApplication::DEFAULT_VERTICAL_DPI,
8496 tet_infoline("Set/Update property with partial update");
8498 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8500 std::vector<Rect<int>> damagedRects;
8501 Rect<int> clippingRect;
8502 application.SendNotification();
8503 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8505 // First render pass, nothing to render, adaptor would just do swap buffer.
8506 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8508 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8509 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8511 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
8512 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
8513 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8514 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8515 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8516 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8517 application.GetScene().Add(actor);
8519 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
8521 damagedRects.clear();
8522 application.SendNotification();
8523 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8524 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8527 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8528 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8529 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8530 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8531 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8532 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8533 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8535 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
8536 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
8538 damagedRects.clear();
8539 application.SendNotification();
8540 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8541 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8543 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8544 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8545 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8546 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8547 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8548 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8550 // Should be no damage rects, nothing changed
8551 damagedRects.clear();
8552 application.SendNotification();
8553 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8554 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8556 // Should be 1 damage rect due to change in size
8557 damagedRects.clear();
8558 actor.SetProperty(Actor::Property::SIZE, Vector3(26.0f, 26.0f, 0.0f));
8559 application.SendNotification();
8560 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8561 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8563 clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
8564 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8565 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8566 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8567 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8568 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8569 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8571 damagedRects.clear();
8572 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8573 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8578 int utcDaliActorPartialUpdateTwoActors(void)
8580 TestApplication application(
8581 TestApplication::DEFAULT_SURFACE_WIDTH,
8582 TestApplication::DEFAULT_SURFACE_HEIGHT,
8583 TestApplication::DEFAULT_HORIZONTAL_DPI,
8584 TestApplication::DEFAULT_VERTICAL_DPI,
8588 tet_infoline("Check the damaged rects with partial update and two actors");
8590 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8592 Actor actor = CreateRenderableActor();
8593 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
8594 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
8595 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8596 application.GetScene().Add(actor);
8598 Actor actor2 = CreateRenderableActor();
8599 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
8600 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
8601 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8602 application.GetScene().Add(actor2);
8604 application.SendNotification();
8605 std::vector<Rect<int>> damagedRects;
8606 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8608 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
8609 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
8610 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(96, 592, 112, 112), damagedRects[1], TEST_LOCATION);
8612 // in screen coordinates, adaptor would calculate it using previous frames information
8613 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
8614 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8616 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8617 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8618 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8619 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8621 // Change a Renderer of actor1
8622 Geometry geometry = CreateQuadGeometry();
8623 Shader shader = CreateShader();
8624 Renderer newRenderer = Renderer::New(geometry, shader);
8625 Renderer renderer = actor.GetRendererAt(0);
8627 actor.RemoveRenderer(renderer);
8628 actor.AddRenderer(newRenderer);
8630 damagedRects.clear();
8632 application.SendNotification();
8633 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8635 DALI_TEST_CHECK(damagedRects.size() > 0);
8636 DALI_TEST_EQUALS<Rect<int>>(Rect<int>(64, 672, 64, 64), damagedRects[0], TEST_LOCATION);
8638 // in screen coordinates, adaptor would calculate it using previous frames information
8639 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8641 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8642 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8643 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8644 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8649 int utcDaliActorPartialUpdateActorsWithSizeHint(void)
8651 TestApplication application(
8652 TestApplication::DEFAULT_SURFACE_WIDTH,
8653 TestApplication::DEFAULT_SURFACE_HEIGHT,
8654 TestApplication::DEFAULT_HORIZONTAL_DPI,
8655 TestApplication::DEFAULT_VERTICAL_DPI,
8659 tet_infoline("Check the damaged rect with partial update and actor size hint");
8661 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8663 Actor actor = CreateRenderableActor();
8664 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
8665 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
8666 actor.SetProperty(DevelActor::Property::UPDATE_SIZE_HINT, Vector3(64.0f, 64.0f, 0.0f));
8667 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8668 application.GetScene().Add(actor);
8670 application.SendNotification();
8671 std::vector<Rect<int>> damagedRects;
8672 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
8674 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8676 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
8677 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8679 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8681 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8682 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8683 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8684 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8689 int utcDaliActorPartialUpdateAnimation(void)
8691 TestApplication application(
8692 TestApplication::DEFAULT_SURFACE_WIDTH,
8693 TestApplication::DEFAULT_SURFACE_HEIGHT,
8694 TestApplication::DEFAULT_HORIZONTAL_DPI,
8695 TestApplication::DEFAULT_VERTICAL_DPI,
8699 tet_infoline("Check the damaged area with partial update and animation");
8701 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
8702 drawTrace.Enable(true);
8705 Actor actor1 = CreateRenderableActor();
8706 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8707 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
8708 application.GetScene().Add(actor1);
8710 Actor actor2 = CreateRenderableActor();
8711 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8712 actor2.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8713 application.GetScene().Add(actor2);
8715 std::vector<Rect<int>> damagedRects;
8716 Rect<int> clippingRect;
8717 Rect<int> expectedRect1, expectedRect2;
8719 application.SendNotification();
8720 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8722 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
8725 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
8726 expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 3 last frames updates
8727 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
8728 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[1], TEST_LOCATION);
8730 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8731 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8733 damagedRects.clear();
8734 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8735 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8736 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8738 // Make an animation
8739 Animation animation = Animation::New(1.0f);
8740 animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
8743 application.SendNotification();
8745 damagedRects.clear();
8746 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8747 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8748 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8751 damagedRects.clear();
8753 // In animation deley time
8754 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8755 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8756 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8759 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
8762 damagedRects.clear();
8764 // Also in animation deley time
8765 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8766 application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
8767 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8770 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
8772 // Unparent 2 actors and make a new actor
8776 Actor actor3 = CreateRenderableActor();
8777 actor3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8778 actor3.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8779 application.GetScene().Add(actor3);
8781 application.SendNotification();
8783 // Started animation
8784 damagedRects.clear();
8785 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
8786 DALI_TEST_EQUALS(damagedRects.size(), 5, TEST_LOCATION);
8788 // The first dirty rect is actor3's.
8789 // We don't know the exact dirty rect of actor2
8790 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
8791 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[1], TEST_LOCATION);
8793 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8794 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8796 // Finished animation, but the actor was already unparented
8797 damagedRects.clear();
8798 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
8800 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8801 DALI_TEST_EQUALS<Rect<int>>(expectedRect2, damagedRects[0], TEST_LOCATION);
8803 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8804 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8809 int utcDaliActorPartialUpdateChangeVisibility(void)
8811 TestApplication application(
8812 TestApplication::DEFAULT_SURFACE_WIDTH,
8813 TestApplication::DEFAULT_SURFACE_HEIGHT,
8814 TestApplication::DEFAULT_HORIZONTAL_DPI,
8815 TestApplication::DEFAULT_VERTICAL_DPI,
8819 tet_infoline("Check the damaged rect with partial update and visibility change");
8821 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8823 Actor actor = CreateRenderableActor();
8824 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8825 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8826 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8827 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8828 application.GetScene().Add(actor);
8830 application.SendNotification();
8832 std::vector<Rect<int>> damagedRects;
8833 Rect<int> clippingRect;
8835 // 1. Actor added, damaged rect is added size of actor
8836 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8837 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8840 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8841 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8842 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8843 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8844 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8845 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8846 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8848 damagedRects.clear();
8849 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8850 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8852 damagedRects.clear();
8853 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8854 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8856 // Ensure the damaged rect is empty
8857 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8859 // 2. Make the Actor invisible
8860 actor.SetProperty(Actor::Property::VISIBLE, false);
8861 application.SendNotification();
8863 damagedRects.clear();
8864 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8865 DALI_TEST_CHECK(damagedRects.size() > 0);
8866 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8868 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8869 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8870 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8871 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8872 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8874 // 3. Make the Actor visible again
8875 actor.SetProperty(Actor::Property::VISIBLE, true);
8876 application.SendNotification();
8878 damagedRects.clear();
8879 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8880 DALI_TEST_CHECK(damagedRects.size() > 0);
8881 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8883 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8884 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8885 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8886 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8887 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8892 int utcDaliActorPartialUpdateOnOffScene(void)
8894 TestApplication application(
8895 TestApplication::DEFAULT_SURFACE_WIDTH,
8896 TestApplication::DEFAULT_SURFACE_HEIGHT,
8897 TestApplication::DEFAULT_HORIZONTAL_DPI,
8898 TestApplication::DEFAULT_VERTICAL_DPI,
8902 tet_infoline("Check the damaged rect with partial update and on/off scene");
8904 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8906 Actor actor = CreateRenderableActor();
8907 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8908 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8909 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8910 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8911 application.GetScene().Add(actor);
8913 application.SendNotification();
8915 std::vector<Rect<int>> damagedRects;
8916 Rect<int> clippingRect;
8918 // 1. Actor added, damaged rect is added size of actor
8919 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8920 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8923 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
8924 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8925 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8926 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8927 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8928 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8929 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8931 damagedRects.clear();
8932 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8933 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8935 damagedRects.clear();
8936 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8937 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8939 // Ensure the damaged rect is empty
8940 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8942 // 2. Remove the Actor from the Scene
8944 application.SendNotification();
8946 damagedRects.clear();
8947 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8948 DALI_TEST_CHECK(damagedRects.size() > 0);
8949 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8951 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8952 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8953 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8954 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8955 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8957 // 3. Add the Actor to the Scene again
8958 application.GetScene().Add(actor);
8959 application.SendNotification();
8961 damagedRects.clear();
8962 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8963 DALI_TEST_CHECK(damagedRects.size() > 0);
8964 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
8966 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8967 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8968 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8969 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8970 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8975 int utcDaliActorPartialUpdateSkipRendering(void)
8977 TestApplication application(
8978 TestApplication::DEFAULT_SURFACE_WIDTH,
8979 TestApplication::DEFAULT_SURFACE_HEIGHT,
8980 TestApplication::DEFAULT_HORIZONTAL_DPI,
8981 TestApplication::DEFAULT_VERTICAL_DPI,
8985 tet_infoline("Check to skip rendering in case of the empty damaged rect");
8987 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
8988 drawTrace.Enable(true);
8991 Actor actor1 = CreateRenderableActor();
8992 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8993 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
8994 application.GetScene().Add(actor1);
8996 std::vector<Rect<int>> damagedRects;
8997 Rect<int> clippingRect;
8998 Rect<int> expectedRect1;
9000 application.SendNotification();
9001 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9003 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9006 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 3 last frames updates
9007 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
9009 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9010 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9012 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9014 damagedRects.clear();
9015 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9016 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9017 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9022 application.SendNotification();
9024 damagedRects.clear();
9025 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9027 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
9029 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9030 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9032 // Render again without any change
9033 damagedRects.clear();
9035 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9037 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9039 clippingRect = Rect<int>();
9040 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9043 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
9045 // Add the actor again
9046 application.GetScene().Add(actor1);
9048 application.SendNotification();
9050 damagedRects.clear();
9052 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9054 DALI_TEST_EQUALS<Rect<int>>(expectedRect1, damagedRects[0], TEST_LOCATION);
9056 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9057 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9059 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9064 int utcDaliActorPartialUpdate3DNode(void)
9066 TestApplication application(
9067 TestApplication::DEFAULT_SURFACE_WIDTH,
9068 TestApplication::DEFAULT_SURFACE_HEIGHT,
9069 TestApplication::DEFAULT_HORIZONTAL_DPI,
9070 TestApplication::DEFAULT_VERTICAL_DPI,
9074 tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
9076 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
9077 drawTrace.Enable(true);
9080 Actor actor1 = CreateRenderableActor();
9081 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9082 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
9083 application.GetScene().Add(actor1);
9085 std::vector<Rect<int>> damagedRects;
9086 Rect<int> clippingRect;
9088 application.SendNotification();
9089 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9091 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9093 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9094 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9096 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9098 // Change the layer to 3D
9099 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
9101 application.SendNotification();
9103 damagedRects.clear();
9104 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9106 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9107 DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
9109 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9111 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9113 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9115 // Change the layer to 2D
9116 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
9118 application.SendNotification();
9120 damagedRects.clear();
9121 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9123 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9125 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9126 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9128 // Make 3D transform
9129 actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
9131 application.SendNotification();
9133 damagedRects.clear();
9134 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9136 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9137 DALI_TEST_EQUALS<Rect<int>>(TestApplication::DEFAULT_SURFACE_RECT, damagedRects[0], TEST_LOCATION);
9139 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9141 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9143 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9148 int utcDaliActorPartialUpdateNotRenderableActor(void)
9150 TestApplication application(
9151 TestApplication::DEFAULT_SURFACE_WIDTH,
9152 TestApplication::DEFAULT_SURFACE_HEIGHT,
9153 TestApplication::DEFAULT_HORIZONTAL_DPI,
9154 TestApplication::DEFAULT_VERTICAL_DPI,
9158 tet_infoline("Check the damaged rect with not renderable parent actor");
9160 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9162 Actor parent = Actor::New();
9163 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9164 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9165 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9166 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9167 application.GetScene().Add(parent);
9169 Actor child = CreateRenderableActor();
9170 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9171 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9172 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9175 application.SendNotification();
9177 std::vector<Rect<int>> damagedRects;
9179 // 1. Actor added, damaged rect is added size of actor
9180 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9181 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9184 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9185 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9187 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9188 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9189 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9190 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9191 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9193 damagedRects.clear();
9194 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9195 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9197 damagedRects.clear();
9198 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9199 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9201 // Ensure the damaged rect is empty
9202 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9207 int utcDaliActorPartialUpdateChangeTransparency(void)
9209 TestApplication application(
9210 TestApplication::DEFAULT_SURFACE_WIDTH,
9211 TestApplication::DEFAULT_SURFACE_HEIGHT,
9212 TestApplication::DEFAULT_HORIZONTAL_DPI,
9213 TestApplication::DEFAULT_VERTICAL_DPI,
9217 tet_infoline("Check the damaged rect with changing transparency");
9219 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9221 Actor actor = CreateRenderableActor();
9222 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9223 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9224 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9225 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9226 application.GetScene().Add(actor);
9228 application.SendNotification();
9230 std::vector<Rect<int>> damagedRects;
9232 // Actor added, damaged rect is added size of actor
9233 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9234 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9237 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9238 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9240 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9241 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9242 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9243 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9244 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9246 damagedRects.clear();
9247 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9248 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9250 damagedRects.clear();
9251 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9252 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9254 // Make the actor transparent by changing opacity of the Renderer
9255 // It changes a uniform value
9256 Renderer renderer = actor.GetRendererAt(0);
9257 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
9259 application.SendNotification();
9261 // The damaged rect should be same
9262 damagedRects.clear();
9263 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9264 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9265 DALI_TEST_CHECK(damagedRects.size() > 0);
9266 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9268 damagedRects.clear();
9269 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9270 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9272 // Ensure the damaged rect is empty
9273 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9275 // Make the actor opaque again
9276 renderer[DevelRenderer::Property::OPACITY] = 1.0f;
9278 application.SendNotification();
9280 // The damaged rect should not be empty
9281 damagedRects.clear();
9282 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9283 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9284 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9285 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9287 damagedRects.clear();
9288 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9289 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9291 damagedRects.clear();
9292 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9293 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9295 // Make the actor culled
9296 actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
9298 application.SendNotification();
9300 // The damaged rect should be same
9301 damagedRects.clear();
9302 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9303 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9304 DALI_TEST_CHECK(damagedRects.size() > 0);
9305 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9307 damagedRects.clear();
9308 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9309 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9311 // Ensure the damaged rect is empty
9312 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9314 // Make the actor not culled again
9315 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 16.0f);
9317 application.SendNotification();
9319 // The damaged rect should not be empty
9320 damagedRects.clear();
9321 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9322 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9323 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9324 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9329 int utcDaliActorPartialUpdateChangeParentOpacity(void)
9331 TestApplication application(
9332 TestApplication::DEFAULT_SURFACE_WIDTH,
9333 TestApplication::DEFAULT_SURFACE_HEIGHT,
9334 TestApplication::DEFAULT_HORIZONTAL_DPI,
9335 TestApplication::DEFAULT_VERTICAL_DPI,
9339 tet_infoline("Check the damaged rect with changing parent's opacity");
9341 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9343 Actor parent = Actor::New();
9344 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9345 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9346 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9347 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9348 application.GetScene().Add(parent);
9350 Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
9351 Actor child = CreateRenderableActor(texture);
9352 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9353 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9354 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9357 application.SendNotification();
9359 std::vector<Rect<int>> damagedRects;
9361 // Actor added, damaged rect is added size of actor
9362 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9363 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9366 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9367 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9369 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9370 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9371 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9372 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9373 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9375 damagedRects.clear();
9376 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9377 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9379 damagedRects.clear();
9380 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9381 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9383 // Ensure the damaged rect is empty
9384 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9386 // Change the parent's opacity
9387 parent[Actor::Property::OPACITY] = 0.5f;
9389 application.SendNotification();
9391 // The damaged rect should be same
9392 damagedRects.clear();
9393 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9394 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9395 DALI_TEST_CHECK(damagedRects.size() > 0);
9396 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9401 int utcDaliActorPartialAddRemoveRenderer(void)
9403 TestApplication application(
9404 TestApplication::DEFAULT_SURFACE_WIDTH,
9405 TestApplication::DEFAULT_SURFACE_HEIGHT,
9406 TestApplication::DEFAULT_HORIZONTAL_DPI,
9407 TestApplication::DEFAULT_VERTICAL_DPI,
9411 tet_infoline("Check the damaged rect with adding / removing renderer");
9413 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9415 Actor actor = CreateRenderableActor();
9416 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
9417 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
9418 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
9419 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9420 application.GetScene().Add(actor);
9422 application.SendNotification();
9424 std::vector<Rect<int>> damagedRects;
9426 // Actor added, damaged rect is added size of actor
9427 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9428 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9431 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
9432 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9434 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9435 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9436 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9437 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9438 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9440 damagedRects.clear();
9441 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9442 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9444 damagedRects.clear();
9445 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9446 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9448 // Remove the Renderer
9449 Renderer renderer = actor.GetRendererAt(0);
9450 actor.RemoveRenderer(renderer);
9452 application.SendNotification();
9454 // The damaged rect should be the actor area
9455 damagedRects.clear();
9456 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9457 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9458 DALI_TEST_CHECK(damagedRects.size() > 0);
9459 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9461 damagedRects.clear();
9462 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9463 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9465 // Ensure the damaged rect is empty
9466 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9468 // Add the Renderer again
9469 actor.AddRenderer(renderer);
9471 application.SendNotification();
9473 // The damaged rect should be the actor area
9474 damagedRects.clear();
9475 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9476 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9477 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9478 DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
9483 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
9485 TestApplication application;
9487 Actor actor = Actor::New();
9488 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
9489 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
9490 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
9491 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
9492 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
9493 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
9494 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
9495 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
9499 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
9501 TestApplication application;
9503 Actor actor = Actor::New();
9505 // Make sure setting invalid types does not cause a crash
9508 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
9509 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
9510 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
9511 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
9512 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
9513 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
9514 tet_result(TET_PASS);
9518 tet_result(TET_FAIL);
9523 int UtcDaliActorTouchAreaOffsetPropertyP(void)
9525 TestApplication application;
9527 Actor actor = Actor::New();
9528 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
9529 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
9530 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
9531 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
9532 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
9536 int UtcDaliActorTouchAreaOffsetPropertyN(void)
9538 TestApplication application;
9540 Actor actor = Actor::New();
9542 // Make sure setting invalid types does not cause a crash
9545 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
9546 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
9547 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
9548 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
9549 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
9550 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
9551 tet_result(TET_PASS);
9555 tet_result(TET_FAIL);
9560 int UtcDaliActorLowerBelowNegative(void)
9562 TestApplication application;
9563 Dali::Actor instance;
9567 instance.LowerBelow(arg1);
9568 DALI_TEST_CHECK(false); // Should not get here
9572 DALI_TEST_CHECK(true); // We expect an assert
9577 int UtcDaliActorRaiseAboveNegative(void)
9579 TestApplication application;
9580 Dali::Actor instance;
9584 instance.RaiseAbove(arg1);
9585 DALI_TEST_CHECK(false); // Should not get here
9589 DALI_TEST_CHECK(true); // We expect an assert
9594 int UtcDaliActorRaiseToTopNegative(void)
9596 TestApplication application;
9597 Dali::Actor instance;
9600 instance.RaiseToTop();
9601 DALI_TEST_CHECK(false); // Should not get here
9605 DALI_TEST_CHECK(true); // We expect an assert
9610 int UtcDaliActorAddRendererNegative(void)
9612 TestApplication application;
9613 Dali::Actor instance;
9616 Dali::Renderer arg1;
9617 instance.AddRenderer(arg1);
9618 DALI_TEST_CHECK(false); // Should not get here
9622 DALI_TEST_CHECK(true); // We expect an assert
9627 int UtcDaliActorTouchedSignalNegative(void)
9629 TestApplication application;
9630 Dali::Actor instance;
9633 instance.TouchedSignal();
9634 DALI_TEST_CHECK(false); // Should not get here
9638 DALI_TEST_CHECK(true); // We expect an assert
9643 int UtcDaliActorTranslateByNegative(void)
9645 TestApplication application;
9646 Dali::Actor instance;
9650 instance.TranslateBy(arg1);
9651 DALI_TEST_CHECK(false); // Should not get here
9655 DALI_TEST_CHECK(true); // We expect an assert
9660 int UtcDaliActorFindChildByIdNegative(void)
9662 TestApplication application;
9663 Dali::Actor instance;
9666 unsigned int arg1 = 0u;
9667 instance.FindChildById(arg1);
9668 DALI_TEST_CHECK(false); // Should not get here
9672 DALI_TEST_CHECK(true); // We expect an assert
9677 int UtcDaliActorGetRendererAtNegative(void)
9679 TestApplication application;
9680 Dali::Actor instance;
9683 unsigned int arg1 = 0u;
9684 instance.GetRendererAt(arg1);
9685 DALI_TEST_CHECK(false); // Should not get here
9689 DALI_TEST_CHECK(true); // We expect an assert
9694 int UtcDaliActorHoveredSignalNegative(void)
9696 TestApplication application;
9697 Dali::Actor instance;
9700 instance.HoveredSignal();
9701 DALI_TEST_CHECK(false); // Should not get here
9705 DALI_TEST_CHECK(true); // We expect an assert
9710 int UtcDaliActorLowerToBottomNegative(void)
9712 TestApplication application;
9713 Dali::Actor instance;
9716 instance.LowerToBottom();
9717 DALI_TEST_CHECK(false); // Should not get here
9721 DALI_TEST_CHECK(true); // We expect an assert
9726 int UtcDaliActorOnSceneSignalNegative(void)
9728 TestApplication application;
9729 Dali::Actor instance;
9732 instance.OnSceneSignal();
9733 DALI_TEST_CHECK(false); // Should not get here
9737 DALI_TEST_CHECK(true); // We expect an assert
9742 int UtcDaliActorOffSceneSignalNegative(void)
9744 TestApplication application;
9745 Dali::Actor instance;
9748 instance.OffSceneSignal();
9749 DALI_TEST_CHECK(false); // Should not get here
9753 DALI_TEST_CHECK(true); // We expect an assert
9758 int UtcDaliActorRemoveRendererNegative01(void)
9760 TestApplication application;
9761 Dali::Actor instance;
9764 unsigned int arg1 = 0u;
9765 instance.RemoveRenderer(arg1);
9766 DALI_TEST_CHECK(false); // Should not get here
9770 DALI_TEST_CHECK(true); // We expect an assert
9775 int UtcDaliActorRemoveRendererNegative02(void)
9777 TestApplication application;
9778 Dali::Actor instance;
9781 Dali::Renderer arg1;
9782 instance.RemoveRenderer(arg1);
9783 DALI_TEST_CHECK(false); // Should not get here
9787 DALI_TEST_CHECK(true); // We expect an assert
9792 int UtcDaliActorFindChildByNameNegative(void)
9794 TestApplication application;
9795 Dali::Actor instance;
9799 instance.FindChildByName(arg1);
9800 DALI_TEST_CHECK(false); // Should not get here
9804 DALI_TEST_CHECK(true); // We expect an assert
9809 int UtcDaliActorSetResizePolicyNegative(void)
9811 TestApplication application;
9812 Dali::Actor instance;
9815 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
9816 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
9817 instance.SetResizePolicy(arg1, arg2);
9818 DALI_TEST_CHECK(false); // Should not get here
9822 DALI_TEST_CHECK(true); // We expect an assert
9827 int UtcDaliActorOnRelayoutSignalNegative(void)
9829 TestApplication application;
9830 Dali::Actor instance;
9833 instance.OnRelayoutSignal();
9834 DALI_TEST_CHECK(false); // Should not get here
9838 DALI_TEST_CHECK(true); // We expect an assert
9843 int UtcDaliActorWheelEventSignalNegative(void)
9845 TestApplication application;
9846 Dali::Actor instance;
9849 instance.WheelEventSignal();
9850 DALI_TEST_CHECK(false); // Should not get here
9854 DALI_TEST_CHECK(true); // We expect an assert
9859 int UtcDaliActorGetHeightForWidthNegative(void)
9861 TestApplication application;
9862 Dali::Actor instance;
9866 instance.GetHeightForWidth(arg1);
9867 DALI_TEST_CHECK(false); // Should not get here
9871 DALI_TEST_CHECK(true); // We expect an assert
9876 int UtcDaliActorGetWidthForHeightNegative(void)
9878 TestApplication application;
9879 Dali::Actor instance;
9883 instance.GetWidthForHeight(arg1);
9884 DALI_TEST_CHECK(false); // Should not get here
9888 DALI_TEST_CHECK(true); // We expect an assert
9893 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
9895 TestApplication application;
9896 Dali::Actor instance;
9899 instance.LayoutDirectionChangedSignal();
9900 DALI_TEST_CHECK(false); // Should not get here
9904 DALI_TEST_CHECK(true); // We expect an assert
9909 int UtcDaliActorAddNegative(void)
9911 TestApplication application;
9912 Dali::Actor instance;
9917 DALI_TEST_CHECK(false); // Should not get here
9921 DALI_TEST_CHECK(true); // We expect an assert
9926 int UtcDaliActorLowerNegative(void)
9928 TestApplication application;
9929 Dali::Actor instance;
9933 DALI_TEST_CHECK(false); // Should not get here
9937 DALI_TEST_CHECK(true); // We expect an assert
9942 int UtcDaliActorRaiseNegative(void)
9944 TestApplication application;
9945 Dali::Actor instance;
9949 DALI_TEST_CHECK(false); // Should not get here
9953 DALI_TEST_CHECK(true); // We expect an assert
9958 int UtcDaliActorRemoveNegative(void)
9960 TestApplication application;
9961 Dali::Actor instance;
9965 instance.Remove(arg1);
9966 DALI_TEST_CHECK(false); // Should not get here
9970 DALI_TEST_CHECK(true); // We expect an assert
9975 int UtcDaliActorScaleByNegative(void)
9977 TestApplication application;
9978 Dali::Actor instance;
9982 instance.ScaleBy(arg1);
9983 DALI_TEST_CHECK(false); // Should not get here
9987 DALI_TEST_CHECK(true); // We expect an assert
9992 int UtcDaliActorGetLayerNegative(void)
9994 TestApplication application;
9995 Dali::Actor instance;
9998 instance.GetLayer();
9999 DALI_TEST_CHECK(false); // Should not get here
10003 DALI_TEST_CHECK(true); // We expect an assert
10008 int UtcDaliActorRotateByNegative01(void)
10010 TestApplication application;
10011 Dali::Actor instance;
10014 Dali::Quaternion arg1;
10015 instance.RotateBy(arg1);
10016 DALI_TEST_CHECK(false); // Should not get here
10020 DALI_TEST_CHECK(true); // We expect an assert
10025 int UtcDaliActorRotateByNegative02(void)
10027 TestApplication application;
10028 Dali::Actor instance;
10032 Dali::Vector3 arg2;
10033 instance.RotateBy(arg1, arg2);
10034 DALI_TEST_CHECK(false); // Should not get here
10038 DALI_TEST_CHECK(true); // We expect an assert
10043 int UtcDaliActorUnparentNegative(void)
10045 TestApplication application;
10046 Dali::Actor instance;
10049 instance.Unparent();
10050 DALI_TEST_CHECK(false); // Should not get here
10054 DALI_TEST_CHECK(true); // We expect an assert
10059 int UtcDaliActorGetChildAtNegative(void)
10061 TestApplication application;
10062 Dali::Actor instance;
10065 unsigned int arg1 = 0u;
10066 instance.GetChildAt(arg1);
10067 DALI_TEST_CHECK(false); // Should not get here
10071 DALI_TEST_CHECK(true); // We expect an assert
10076 int UtcDaliActorGetChildCountNegative(void)
10078 TestApplication application;
10079 Dali::Actor instance;
10082 instance.GetChildCount();
10083 DALI_TEST_CHECK(false); // Should not get here
10087 DALI_TEST_CHECK(true); // We expect an assert
10092 int UtcDaliActorGetTargetSizeNegative(void)
10094 TestApplication application;
10095 Dali::Actor instance;
10098 instance.GetTargetSize();
10099 DALI_TEST_CHECK(false); // Should not get here
10103 DALI_TEST_CHECK(true); // We expect an assert
10108 int UtcDaliActorScreenToLocalNegative(void)
10110 TestApplication application;
10111 Dali::Actor instance;
10118 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
10119 DALI_TEST_CHECK(false); // Should not get here
10123 DALI_TEST_CHECK(true); // We expect an assert
10128 int UtcDaliActorGetNaturalSizeNegative(void)
10130 TestApplication application;
10131 Dali::Actor instance;
10134 instance.GetNaturalSize();
10135 DALI_TEST_CHECK(false); // Should not get here
10139 DALI_TEST_CHECK(true); // We expect an assert
10144 int UtcDaliActorGetRelayoutSizeNegative(void)
10146 TestApplication application;
10147 Dali::Actor instance;
10150 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
10151 instance.GetRelayoutSize(arg1);
10152 DALI_TEST_CHECK(false); // Should not get here
10156 DALI_TEST_CHECK(true); // We expect an assert
10161 int UtcDaliActorGetResizePolicyNegative(void)
10163 TestApplication application;
10164 Dali::Actor instance;
10167 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
10168 instance.GetResizePolicy(arg1);
10169 DALI_TEST_CHECK(false); // Should not get here
10173 DALI_TEST_CHECK(true); // We expect an assert
10178 int UtcDaliActorGetRendererCountNegative(void)
10180 TestApplication application;
10181 Dali::Actor instance;
10184 instance.GetRendererCount();
10185 DALI_TEST_CHECK(false); // Should not get here
10189 DALI_TEST_CHECK(true); // We expect an assert
10194 int UtcDaliActorGetParentNegative(void)
10196 TestApplication application;
10197 Dali::Actor instance;
10200 instance.GetParent();
10201 DALI_TEST_CHECK(false); // Should not get here
10205 DALI_TEST_CHECK(true); // We expect an assert
10210 int UtcDaliActorPropertyBlendEquation(void)
10212 TestApplication application;
10214 tet_infoline("Test SetProperty AdvancedBlendEquation");
10216 Geometry geometry = CreateQuadGeometry();
10217 Shader shader = CreateShader();
10218 Renderer renderer1 = Renderer::New(geometry, shader);
10220 Actor actor = Actor::New();
10221 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
10223 actor.AddRenderer(renderer1);
10224 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
10225 application.GetScene().Add(actor);
10227 if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
10229 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
10230 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
10231 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
10234 if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
10236 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
10237 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
10238 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
10241 Renderer renderer2 = Renderer::New(geometry, shader);
10242 actor.AddRenderer(renderer2);
10247 int UtcDaliActorRegisterProperty(void)
10249 tet_infoline("Test property registration and uniform map update\n");
10251 TestApplication application;
10253 Geometry geometry = CreateQuadGeometry();
10254 Shader shader = CreateShader();
10255 Renderer renderer1 = Renderer::New(geometry, shader);
10256 Renderer renderer2 = Renderer::New(geometry, shader);
10258 Actor actor1 = Actor::New();
10259 actor1.AddRenderer(renderer1);
10260 actor1.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
10261 actor1.RegisterProperty("uCustom", 1);
10262 application.GetScene().Add(actor1);
10264 Actor actor2 = Actor::New();
10265 actor2.AddRenderer(renderer2);
10266 actor2.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
10267 application.GetScene().Add(actor2);
10269 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
10270 TraceCallStack& callStack = glAbstraction.GetSetUniformTrace();
10271 glAbstraction.EnableSetUniformCallTrace(true);
10273 application.SendNotification();
10274 application.Render();
10276 std::stringstream out;
10278 std::string params;
10280 // Test uniform value of the custom property
10281 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
10282 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
10285 actor1[Actor::Property::VISIBLE] = false;
10287 application.SendNotification();
10288 application.Render();
10290 // Make visible again
10291 actor1[Actor::Property::VISIBLE] = true;
10292 actor1["uCustom"] = 2;
10294 glAbstraction.ResetSetUniformCallStack();
10296 application.SendNotification();
10297 application.Render();
10301 // The uniform value should not be changed
10302 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
10303 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);