2 * Copyright (c) 2024 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>
30 #include <test-native-image.h>
32 #include <cfloat> // For FLT_MAX
42 void utc_dali_actor_startup(void)
44 test_return_value = TET_UNDEF;
47 void utc_dali_actor_cleanup(void)
49 test_return_value = TET_PASS;
54 bool gTouchCallBackCalled = false;
55 bool gTouchCallBackCalled2 = false;
56 bool gTouchCallBackCalled3 = false;
57 bool gHitTestTouchCallBackCalled = false;
59 bool gHoverCallBackCalled = false;
61 static bool gTestConstraintCalled;
63 LayoutDirection::Type gLayoutDirectionType;
67 void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
69 gTestConstraintCalled = true;
74 * TestConstraint reference.
75 * When constraint is called, the resultRef is updated
76 * with the value supplied.
79 struct TestConstraintRef
81 TestConstraintRef(unsigned int& resultRef, unsigned int value)
82 : mResultRef(resultRef),
87 void operator()(T& current, const PropertyInputContainer& /* inputs */)
92 unsigned int& mResultRef;
96 static bool TestTouchCallback(Actor, const TouchEvent&)
98 gTouchCallBackCalled = true;
103 static bool TestTouchCallback2(Actor, const TouchEvent&)
105 gTouchCallBackCalled2 = true;
110 static bool TestTouchCallback3(Actor, const TouchEvent&)
112 gTouchCallBackCalled3 = true;
117 static bool TestHitTestTouchCallback(Actor, const TouchEvent&)
119 gHitTestTouchCallBackCalled = true;
124 static void ResetTouchCallbacks()
126 gTouchCallBackCalled = false;
127 gTouchCallBackCalled2 = false;
128 gTouchCallBackCalled3 = false;
131 static void ResetTouchCallbacks(TestApplication& application)
134 Dali::Integration::Point point;
135 point.SetDeviceId(1);
136 point.SetState(PointState::UP);
137 point.SetScreenPosition(Vector2(10.f, 10.f));
138 Dali::Integration::TouchEvent touchEvent;
139 touchEvent.AddPoint(point);
140 application.ProcessEvent(touchEvent);
142 ResetTouchCallbacks();
145 static bool TestCallback3(Actor actor, const HoverEvent& event)
147 gHoverCallBackCalled = true;
152 // validation stuff for onstage & offstage signals
153 static std::vector<std::string> gActorNamesOnOffScene;
154 static int gOnSceneCallBackCalled;
155 void OnSceneCallback(Actor actor)
157 ++gOnSceneCallBackCalled;
158 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
159 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
161 static int gOffSceneCallBackCalled;
162 void OffSceneCallback(Actor actor)
164 ++gOffSceneCallBackCalled;
165 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
166 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
169 struct PositionComponentConstraint
171 PositionComponentConstraint()
175 void operator()(Vector3& pos, const PropertyInputContainer& inputs)
177 const Matrix& m = inputs[0]->GetMatrix();
180 m.GetTransformComponents(pos, rot, scale);
184 struct OrientationComponentConstraint
186 OrientationComponentConstraint()
190 void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
192 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
195 orientation = parentOrientation;
200 static bool gOnRelayoutCallBackCalled = false;
201 static std::vector<std::string> gActorNamesRelayout;
203 void OnRelayoutCallback(Actor actor)
205 gOnRelayoutCallBackCalled = true;
206 gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
209 struct VisibilityChangedFunctorData
211 VisibilityChangedFunctorData()
214 type(DevelActor::VisibilityChange::SELF),
223 type = DevelActor::VisibilityChange::SELF;
227 void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
229 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
230 DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
231 DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
232 DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
235 void Check(bool compareCalled, const std::string& location)
237 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
242 DevelActor::VisibilityChange::Type type;
246 struct VisibilityChangedFunctor
248 VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
253 void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
256 data.visible = visible;
261 VisibilityChangedFunctorData& data;
264 struct VisibilityChangedVoidFunctor
266 VisibilityChangedVoidFunctor(bool& signalCalled)
267 : mSignalCalled(signalCalled)
273 mSignalCalled = true;
279 struct InheritedVisibilityChangedFunctorData
281 InheritedVisibilityChangedFunctorData()
295 void Check(bool compareCalled, Actor compareActor, bool compareVisible, const char* location)
297 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
298 DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
299 DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
302 void Check(bool compareCalled, const std::string& location)
304 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
312 struct InheritedVisibilityChangedFunctor
314 InheritedVisibilityChangedFunctor(InheritedVisibilityChangedFunctorData& dataVar)
319 void operator()(Actor actor, bool visible)
322 data.visible = visible;
326 InheritedVisibilityChangedFunctorData& data;
329 struct ChildOrderChangedFunctor
331 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
332 : mSignalCalled(signalCalled),
337 void operator()(Actor actor)
339 mSignalCalled = true;
347 struct CulledPropertyNotificationFunctor
349 CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
350 : mSignalCalled(signalCalled),
351 mPropertyNotification(propertyNotification)
355 void operator()(PropertyNotification& source)
357 mSignalCalled = true;
358 mPropertyNotification = source;
362 PropertyNotification& mPropertyNotification;
365 // Clipping test helper functions:
366 Actor CreateActorWithContent(uint32_t width, uint32_t height)
368 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
369 Actor actor = CreateRenderableActor(image);
371 // Setup dimensions and position so actor is not skipped by culling.
372 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
373 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
374 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
375 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
380 Actor CreateActorWithContent16x16()
382 return CreateActorWithContent(16, 16);
385 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& callTrace)
387 enabledDisableTrace.Reset();
389 enabledDisableTrace.Enable(true);
390 callTrace.Enable(true);
392 application.SendNotification();
393 application.Render();
395 enabledDisableTrace.Enable(false);
396 callTrace.Enable(false);
399 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
401 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
403 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
404 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
405 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
407 // @todo only test alpha if the framebuffer has an alpha channel
408 //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
411 } // anonymous namespace
413 //& purpose: Testing New API
414 int UtcDaliActorNew(void)
416 TestApplication application;
418 Actor actor = Actor::New();
420 DALI_TEST_CHECK(actor);
424 //& purpose: Testing Dali::Actor::DownCast()
425 int UtcDaliActorDownCastP(void)
427 TestApplication application;
428 tet_infoline("Testing Dali::Actor::DownCast()");
430 Actor actor = Actor::New();
431 BaseHandle object(actor);
432 Actor actor2 = Actor::DownCast(object);
433 DALI_TEST_CHECK(actor2);
437 //& purpose: Testing Dali::Actor::DownCast()
438 int UtcDaliActorDownCastN(void)
440 TestApplication application;
441 tet_infoline("Testing Dali::Actor::DownCast()");
443 BaseHandle unInitializedObject;
444 Actor actor = Actor::DownCast(unInitializedObject);
445 DALI_TEST_CHECK(!actor);
449 int UtcDaliActorMoveConstructor(void)
451 TestApplication application;
453 Actor actor = Actor::New();
454 DALI_TEST_CHECK(actor);
456 int id = actor.GetProperty<int>(Actor::Property::ID);
458 Actor moved = std::move(actor);
459 DALI_TEST_CHECK(moved);
460 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
461 DALI_TEST_CHECK(!actor);
466 int UtcDaliActorMoveAssignment(void)
468 TestApplication application;
470 Actor actor = Actor::New();
471 DALI_TEST_CHECK(actor);
473 int id = actor.GetProperty<int>(Actor::Property::ID);
476 moved = std::move(actor);
477 DALI_TEST_CHECK(moved);
478 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
479 DALI_TEST_CHECK(!actor);
484 //& purpose: Testing Dali::Actor::GetName()
485 int UtcDaliActorGetName(void)
487 TestApplication application;
489 Actor actor = Actor::New();
491 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
495 //& purpose: Testing Dali::Actor::SetName()
496 int UtcDaliActorSetName(void)
498 TestApplication application;
500 string str("ActorName");
501 Actor actor = Actor::New();
503 actor.SetProperty(Actor::Property::NAME, str);
504 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
508 int UtcDaliActorGetId(void)
510 tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
511 TestApplication application;
513 Actor first = Actor::New();
514 Actor second = Actor::New();
515 Actor third = Actor::New();
517 DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
518 DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
522 int UtcDaliActorIsRoot(void)
524 TestApplication application;
526 Actor actor = Actor::New();
527 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
529 // get the root layer
530 actor = application.GetScene().GetLayer(0);
531 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
535 int UtcDaliActorOnScene(void)
537 TestApplication application;
539 Actor actor = Actor::New();
540 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
542 // get the root layer
543 actor = application.GetScene().GetLayer(0);
544 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
548 int UtcDaliActorIsLayer(void)
550 TestApplication application;
552 Actor actor = Actor::New();
553 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
555 // get the root layer
556 actor = application.GetScene().GetLayer(0);
557 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
561 int UtcDaliActorGetLayer(void)
563 TestApplication application;
565 Actor actor = Actor::New();
566 application.GetScene().Add(actor);
567 Layer layer = actor.GetLayer();
569 DALI_TEST_CHECK(layer);
571 // get the root layers layer
572 actor = application.GetScene().GetLayer(0);
573 DALI_TEST_CHECK(actor.GetLayer());
577 int UtcDaliActorAddP(void)
579 tet_infoline("Testing Actor::Add");
580 TestApplication application;
582 Actor parent = Actor::New();
583 Actor child = Actor::New();
585 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
589 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
591 Actor parent2 = Actor::New();
594 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
595 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
597 // try Adding to same parent again, works
599 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
601 // try reparenting an orphaned child
603 Actor temporaryParent = Actor::New();
604 temporaryParent.Add(child);
605 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
607 // temporaryParent has now died, reparent the orphaned child
609 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
614 int UtcDaliActorAddN(void)
616 tet_infoline("Testing Actor::Add");
617 TestApplication application;
619 Actor child = Actor::New();
621 Actor parent2 = Actor::New();
627 parent2.Add(parent2);
628 tet_printf("Assertion test failed - no Exception\n");
629 tet_result(TET_FAIL);
631 catch(Dali::DaliException& e)
633 DALI_TEST_PRINT_ASSERT(e);
634 DALI_TEST_ASSERT(e, "&mOwner != &child", TEST_LOCATION);
635 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
639 tet_printf("Assertion test failed - wrong Exception\n");
640 tet_result(TET_FAIL);
643 // try reparenting root
646 parent2.Add(application.GetScene().GetLayer(0));
647 tet_printf("Assertion test failed - no Exception\n");
648 tet_result(TET_FAIL);
650 catch(Dali::DaliException& e)
652 DALI_TEST_PRINT_ASSERT(e);
653 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
654 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
658 tet_printf("Assertion test failed - wrong Exception\n");
659 tet_result(TET_FAIL);
667 tet_printf("Assertion test failed - no Exception\n");
668 tet_result(TET_FAIL);
670 catch(Dali::DaliException& e)
672 DALI_TEST_PRINT_ASSERT(e);
673 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
674 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
678 tet_printf("Assertion test failed - wrong Exception\n");
679 tet_result(TET_FAIL);
685 int UtcDaliActorRemoveN(void)
687 tet_infoline("Testing Actor::Remove");
688 TestApplication application;
690 Actor parent = Actor::New();
691 Actor child = Actor::New();
692 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
695 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
697 parent.Remove(child);
698 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
700 // remove again, no problem
701 parent.Remove(child);
702 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
706 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
707 // try Remove self, its a no-op
708 parent.Remove(parent);
709 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
715 parent.Remove(empty);
716 tet_printf("Assertion test failed - no Exception\n");
717 tet_result(TET_FAIL);
719 catch(Dali::DaliException& e)
721 DALI_TEST_PRINT_ASSERT(e);
722 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
723 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
727 tet_printf("Assertion test failed - wrong Exception\n");
728 tet_result(TET_FAIL);
733 int UtcDaliActorRemoveP(void)
735 TestApplication application;
737 Actor parent = Actor::New();
738 Actor child = Actor::New();
739 Actor random = Actor::New();
741 application.GetScene().Add(parent);
743 DALI_TEST_CHECK(parent.GetChildCount() == 0);
747 DALI_TEST_CHECK(parent.GetChildCount() == 1);
749 parent.Remove(random);
751 DALI_TEST_CHECK(parent.GetChildCount() == 1);
753 application.GetScene().Remove(parent);
755 DALI_TEST_CHECK(parent.GetChildCount() == 1);
759 int UtcDaliActorSwitchParentN(void)
761 tet_infoline("Testing Actor::UtcDaliActorSwitchParentN");
762 TestApplication application;
764 Actor parent1 = Actor::New();
765 Actor child = Actor::New();
767 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
771 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
773 Actor parent2 = Actor::New();
775 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
777 // Try switch parent with that both of parent1 and parent2 are off scene.
778 DevelActor::SwitchParent(child, parent2);
780 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
781 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
785 int UtcDaliActorGetChildCount(void)
787 TestApplication application;
789 Actor parent = Actor::New();
790 Actor child = Actor::New();
792 DALI_TEST_CHECK(parent.GetChildCount() == 0);
796 DALI_TEST_CHECK(parent.GetChildCount() == 1);
800 int UtcDaliActorGetChildren01(void)
802 TestApplication application;
804 Actor parent = Actor::New();
805 Actor first = Actor::New();
806 Actor second = Actor::New();
807 Actor third = Actor::New();
813 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
814 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
815 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
819 int UtcDaliActorGetChildren02(void)
821 TestApplication application;
823 Actor parent = Actor::New();
824 Actor first = Actor::New();
825 Actor second = Actor::New();
826 Actor third = Actor::New();
832 const Actor& constParent = parent;
834 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
835 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
836 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
840 int UtcDaliActorGetParent01(void)
842 TestApplication application;
844 Actor parent = Actor::New();
845 Actor child = Actor::New();
849 DALI_TEST_CHECK(child.GetParent() == parent);
853 int UtcDaliActorGetParent02(void)
855 TestApplication application;
857 Actor actor = Actor::New();
859 DALI_TEST_CHECK(!actor.GetParent());
863 int UtcDaliActorCustomProperty(void)
865 TestApplication application;
867 Actor actor = Actor::New();
868 application.GetScene().Add(actor);
870 float startValue(1.0f);
871 Property::Index index = actor.RegisterProperty("testProperty", startValue);
872 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
874 application.SendNotification();
875 application.Render(0);
876 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
878 actor.SetProperty(index, 5.0f);
880 application.SendNotification();
881 application.Render(0);
882 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
886 int UtcDaliActorCustomPropertyIntToFloat(void)
888 TestApplication application;
890 Actor actor = Actor::New();
891 application.GetScene().Add(actor);
893 float startValue(5.0f);
894 Property::Index index = actor.RegisterProperty("testProperty", startValue);
895 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
897 application.SendNotification();
898 application.Render(0);
899 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
901 actor.SetProperty(index, int(1));
903 application.SendNotification();
904 application.Render(0);
905 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
909 int UtcDaliActorCustomPropertyFloatToInt(void)
911 TestApplication application;
913 Actor actor = Actor::New();
914 application.GetScene().Add(actor);
917 Property::Index index = actor.RegisterProperty("testProperty", startValue);
918 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
920 application.SendNotification();
921 application.Render(0);
922 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
924 actor.SetProperty(index, float(1.5));
926 application.SendNotification();
927 application.Render(0);
928 DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
932 int UtcDaliActorSetParentOrigin(void)
934 TestApplication application;
936 Actor actor = Actor::New();
938 Vector3 vector(0.7f, 0.8f, 0.9f);
939 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
941 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
943 // flush the queue and render once
944 application.SendNotification();
945 application.Render();
947 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
949 application.GetScene().Add(actor);
951 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
953 // flush the queue and render once
954 application.SendNotification();
955 application.Render();
957 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
959 application.GetScene().Remove(actor);
963 int UtcDaliActorSetParentOriginIndividual(void)
965 TestApplication application;
967 Actor actor = Actor::New();
969 Vector3 vector(0.7f, 0.8f, 0.9f);
970 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
972 actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
974 // flush the queue and render once
975 application.SendNotification();
976 application.Render();
978 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
980 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
982 // flush the queue and render once
983 application.SendNotification();
984 application.Render();
986 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
988 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
990 // flush the queue and render once
991 application.SendNotification();
992 application.Render();
994 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
999 int UtcDaliActorGetCurrentParentOrigin(void)
1001 TestApplication application;
1003 Actor actor = Actor::New();
1005 Vector3 vector(0.7f, 0.8f, 0.9f);
1006 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
1008 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
1010 // flush the queue and render once
1011 application.SendNotification();
1012 application.Render();
1014 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
1018 int UtcDaliActorSetAnchorPoint(void)
1020 TestApplication application;
1022 Actor actor = Actor::New();
1024 Vector3 vector(0.7f, 0.8f, 0.9f);
1025 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1027 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
1029 // flush the queue and render once
1030 application.SendNotification();
1031 application.Render();
1033 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1035 application.GetScene().Add(actor);
1037 actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
1038 // flush the queue and render once
1039 application.SendNotification();
1040 application.Render();
1042 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
1044 application.GetScene().Remove(actor);
1048 int UtcDaliActorSetAnchorPointIndividual(void)
1050 TestApplication application;
1052 Actor actor = Actor::New();
1054 Vector3 vector(0.7f, 0.8f, 0.9f);
1055 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1057 actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
1059 // flush the queue and render once
1060 application.SendNotification();
1061 application.Render();
1063 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
1065 actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
1067 // flush the queue and render once
1068 application.SendNotification();
1069 application.Render();
1071 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
1073 actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
1075 // flush the queue and render once
1076 application.SendNotification();
1077 application.Render();
1079 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
1084 int UtcDaliActorGetCurrentAnchorPoint(void)
1086 TestApplication application;
1088 Actor actor = Actor::New();
1090 Vector3 vector(0.7f, 0.8f, 0.9f);
1091 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1093 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
1095 // flush the queue and render once
1096 application.SendNotification();
1097 application.Render();
1099 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1103 int UtcDaliActorSetSize01(void)
1105 TestApplication application;
1107 Actor actor = Actor::New();
1108 Vector3 vector(100.0f, 100.0f, 0.0f);
1110 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1112 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1114 // Immediately retrieve the size after setting
1115 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1116 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1117 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1118 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1119 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1121 // Flush the queue and render once
1122 application.SendNotification();
1123 application.Render();
1125 // Check the size in the new frame
1126 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1128 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1129 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1130 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1131 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1132 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1134 // Check async behaviour
1135 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
1136 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1137 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1138 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1139 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1141 // Change the resize policy and check whether the size stays the same
1142 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1144 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1145 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1147 // Set a new size after resize policy is changed and check the new size
1148 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1150 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1151 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1153 // Change the resize policy again and check whether the new size stays the same
1154 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1156 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1157 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1159 // Set another new size after resize policy is changed and check the new size
1160 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1162 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1163 DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1168 int UtcDaliActorSetSize02(void)
1170 TestApplication application;
1172 Actor actor = Actor::New();
1173 Vector3 vector(100.0f, 100.0f, 100.0f);
1175 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1177 actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1179 // Immediately check the size after setting
1180 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1181 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1183 // flush the queue and render once
1184 application.SendNotification();
1185 application.Render();
1187 // Check the size in the new frame
1188 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1190 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1191 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1196 // SetSize(Vector2 size)
1197 int UtcDaliActorSetSize03(void)
1199 TestApplication application;
1201 Actor actor = Actor::New();
1202 Vector3 vector(100.0f, 100.0f, 0.0f);
1204 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1206 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1208 // Immediately check the size after setting
1209 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1210 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1212 // flush the queue and render once
1213 application.SendNotification();
1214 application.Render();
1216 // Check the size in the new frame
1217 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1219 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1220 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1225 // SetSize(Vector3 size)
1226 int UtcDaliActorSetSize04(void)
1228 TestApplication application;
1230 Actor actor = Actor::New();
1231 Vector3 vector(100.0f, 100.0f, 100.0f);
1233 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1235 actor.SetProperty(Actor::Property::SIZE, vector);
1237 // Immediately check the size after setting
1238 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1239 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1241 // flush the queue and render once
1242 application.SendNotification();
1243 application.Render();
1245 // Check the size in the new frame
1246 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1248 application.GetScene().Add(actor);
1249 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1251 // Immediately check the size after setting
1252 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1253 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1255 // flush the queue and render once
1256 application.SendNotification();
1257 application.Render();
1259 // Check the size in the new frame
1260 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1262 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1263 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1265 application.GetScene().Remove(actor);
1269 int UtcDaliActorSetSize05(void)
1271 TestApplication application;
1273 Actor parent = Actor::New();
1274 Vector2 vector(200.0f, 200.0f);
1275 DALI_TEST_CHECK(vector != parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1277 parent.SetProperty(Actor::Property::SIZE, vector);
1278 Vector2 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1279 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1281 Actor child = Actor::New();
1282 DALI_TEST_CHECK(vector != child.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1283 child.SetProperty(Actor::Property::SIZE, vector);
1284 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1285 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1287 // flush the queue and render once
1288 application.SendNotification();
1289 application.Render();
1291 DALI_TEST_CHECK(vector == parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1296 int UtcDaliActorSetSizeIndividual(void)
1298 TestApplication application;
1300 Actor actor = Actor::New();
1302 Vector3 vector(0.7f, 0.8f, 0.9f);
1303 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1305 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1307 // Immediately check the width after setting
1308 float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1309 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1311 // flush the queue and render once
1312 application.SendNotification();
1313 application.Render();
1315 // Check the width in the new frame
1316 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1318 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1319 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1321 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1323 // Immediately check the height after setting
1324 float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1325 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1327 // flush the queue and render once
1328 application.SendNotification();
1329 application.Render();
1331 // Check the height in the new frame
1332 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1334 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1335 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1337 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1339 // Immediately check the depth after setting
1340 float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1341 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1343 // flush the queue and render once
1344 application.SendNotification();
1345 application.Render();
1347 // Check the depth in the new frame
1348 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1350 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1351 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1353 // Change the resize policy and check whether the size stays the same
1354 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1356 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1357 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1359 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1360 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1362 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1363 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1365 // Change the resize policy again and check whether the size stays the same
1366 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1368 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1369 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1371 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1372 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1374 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1375 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1380 int UtcDaliActorSetSizeIndividual02(void)
1382 TestApplication application;
1384 Actor actor = Actor::New();
1385 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1386 application.GetScene().Add(actor);
1388 Vector3 vector(100.0f, 200.0f, 400.0f);
1389 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1391 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1392 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1394 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1395 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1397 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1398 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1400 // flush the queue and render once
1401 application.SendNotification();
1402 application.Render();
1404 // Check the width in the new frame
1405 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1406 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1411 int UtcDaliActorGetCurrentSize(void)
1413 TestApplication application;
1415 Actor actor = Actor::New();
1416 Vector3 vector(100.0f, 100.0f, 20.0f);
1418 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1420 actor.SetProperty(Actor::Property::SIZE, vector);
1422 // flush the queue and render once
1423 application.SendNotification();
1424 application.Render();
1426 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1430 int UtcDaliActorGetNaturalSize(void)
1432 TestApplication application;
1434 Actor actor = Actor::New();
1435 Vector3 vector(0.0f, 0.0f, 0.0f);
1437 DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1442 int UtcDaliActorGetCurrentSizeImmediate(void)
1444 TestApplication application;
1446 Actor actor = Actor::New();
1447 Vector3 vector(100.0f, 100.0f, 20.0f);
1449 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1450 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1452 actor.SetProperty(Actor::Property::SIZE, vector);
1454 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1455 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1457 // flush the queue and render once
1458 application.SendNotification();
1459 application.Render();
1461 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1462 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1465 // Build the animation
1466 const float durationSeconds = 2.0f;
1467 Animation animation = Animation::New(durationSeconds);
1468 const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1469 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1471 DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1473 application.GetScene().Add(actor);
1475 // Start the animation
1478 application.SendNotification();
1479 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1481 DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1486 int UtcDaliActorCalculateScreenExtents(void)
1488 TestApplication application;
1490 Actor actor = Actor::New();
1492 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1493 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1495 application.GetScene().Add(actor);
1497 application.SendNotification();
1498 application.Render();
1500 auto expectedExtent = Rect<>{1.5f, 1.5f, 1.0f, 1.0f};
1501 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1502 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1503 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1504 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1505 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1507 application.GetScene().Remove(actor);
1511 int UtcDaliActorCalculateCurrentScreenExtents(void)
1513 TestApplication application;
1515 Actor actor = Actor::New();
1517 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1518 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1520 application.GetScene().Add(actor);
1522 application.SendNotification();
1523 application.Render();
1525 auto expectedPosition = Vector2(2.0f, 2.0f);
1526 auto actualPosition = DevelActor::CalculateScreenPosition(actor);
1527 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1528 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1530 auto expectedExtent = Rect<>{1.5f, 1.5f, 1.0f, 1.0f};
1531 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1532 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1533 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1534 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1535 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1537 Animation animation = Animation::New(1.0f);
1538 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(6.0f, 4.0f, 0.0f));
1539 animation.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(3.0f, 7.0f, 1.0f));
1542 application.SendNotification();
1543 application.Render(500u);
1546 expectedPosition = Vector2(6.0f, 4.0f);
1547 actualPosition = DevelActor::CalculateScreenPosition(actor);
1548 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1549 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1551 expectedExtent = Rect<>(4.5f, 0.5f, 3.0f, 7.0f);
1552 actualExtent = DevelActor::CalculateScreenExtents(actor);
1553 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1554 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1555 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1556 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1558 expectedPosition = Vector2(4.0f, 3.0f);
1559 actualPosition = actor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1560 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1561 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1563 expectedExtent = Rect<>(3.0f, 1.0f, 2.0f, 4.0f);
1564 actualExtent = DevelActor::CalculateCurrentScreenExtents(actor);
1565 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1566 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1567 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1568 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1570 application.GetScene().Remove(actor);
1574 int UtcDaliActorCalculateScreenExtentsInCustomCameraAndLayer3D(void)
1576 TestApplication application;
1577 Integration::Scene scene = application.GetScene();
1580 Layer layer = Layer::New();
1581 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1582 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1583 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1587 // Build custom camera with top-view
1588 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
1590 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1591 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1592 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1595 std::ostringstream oss;
1596 oss << cameraPos << "\n";
1597 oss << cameraOrient << "\n";
1598 tet_printf("%s\n", oss.str().c_str());
1601 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1602 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1604 // Now, upside : -Z, leftside : -X, foward : +Y
1606 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1607 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1609 std::ostringstream oss;
1610 oss << cameraPos << "\n";
1611 oss << cameraOrient << "\n";
1612 tet_printf("%s\n", oss.str().c_str());
1616 Actor actor = Actor::New();
1617 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1618 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1619 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 0.0f, 16.0f));
1620 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 0.0f, 3.0f});
1624 application.SendNotification();
1625 application.Render();
1627 Vector2 sceneSize = scene.GetSize();
1629 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + 1.5f, sceneSize.y * 0.5f + 14.5f, 1.0f, 3.0f};
1630 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1631 auto actualPosition = DevelActor::CalculateScreenPosition(actor);
1633 std::ostringstream oss;
1634 oss << expectedExtent << "\n";
1635 oss << actualExtent << "\n";
1636 oss << actualPosition << "\n";
1637 tet_printf("%s\n", oss.str().c_str());
1640 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1641 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1642 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1643 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1645 // Since anchor point is center, screen position is same as center of expect extents
1646 DALI_TEST_EQUALS(expectedExtent.x + expectedExtent.width * 0.5f, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1647 DALI_TEST_EQUALS(expectedExtent.y + expectedExtent.height * 0.5f, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1652 int UtcDaliActorCalculateScreenInCustomCameraAndOffscreenLayer3D(void)
1654 TestApplication application;
1655 Integration::Scene scene = application.GetScene();
1656 Vector2 sceneSize = scene.GetSize();
1659 Layer layer = Layer::New();
1660 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1661 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1662 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1663 layer.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1664 layer.SetProperty(Actor::Property::SIZE, sceneSize);
1668 // Build custom camera with top-view
1669 CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
1671 offscreenCameraActor.SetPerspectiveProjection(sceneSize);
1672 offscreenCameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1673 offscreenCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1675 scene.Add(offscreenCameraActor);
1677 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1678 Vector3 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1679 Quaternion cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1682 std::ostringstream oss;
1683 oss << cameraPos << "\n";
1684 oss << cameraOrient << "\n";
1685 tet_printf("%s\n", oss.str().c_str());
1688 offscreenCameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1689 offscreenCameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1691 // Now, upside : -Z, leftside : -X, foward : +Y
1693 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1694 cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1696 std::ostringstream oss;
1697 oss << cameraPos << "\n";
1698 oss << cameraOrient << "\n";
1699 tet_printf("%s\n", oss.str().c_str());
1702 Vector3 sourcePosition{2.0f, 0.0f, 16.0f};
1703 Vector3 sourceSize{1.0f, 0.0f, 3.0f};
1705 Actor sourceActor = Actor::New();
1706 sourceActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1707 sourceActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1708 sourceActor.SetProperty(Actor::Property::POSITION, sourcePosition);
1709 sourceActor.SetProperty(Actor::Property::SIZE, sourceSize);
1711 layer.Add(sourceActor);
1713 // Create framebuffer
1714 unsigned int width(64);
1715 unsigned int height(64);
1716 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
1717 FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
1718 frameBuffer.AttachColorTexture(texture);
1720 Actor rootActor = Actor::New();
1721 rootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1722 rootActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1723 rootActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1724 rootActor.SetProperty(Actor::Property::SIZE, sceneSize);
1725 scene.Add(rootActor);
1727 RenderTaskList taskList = scene.GetRenderTaskList();
1728 RenderTask newTask = taskList.CreateTask();
1729 newTask.SetCameraActor(offscreenCameraActor);
1730 newTask.SetSourceActor(layer);
1731 newTask.SetInputEnabled(false);
1732 newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
1733 newTask.SetClearEnabled(true);
1734 newTask.SetExclusive(true);
1735 newTask.SetFrameBuffer(frameBuffer);
1736 newTask.SetScreenToFrameBufferMappingActor(rootActor);
1738 application.SendNotification();
1739 application.Render(16u);
1741 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + sourcePosition.x - sourceSize.x * 0.5f,
1742 sceneSize.y * 0.5f + sourcePosition.z - sourceSize.z * 0.5f,
1745 auto actualExtent = DevelActor::CalculateCurrentScreenExtents(sourceActor);
1747 std::ostringstream oss;
1748 oss << expectedExtent << "\n";
1749 oss << actualExtent << "\n";
1750 tet_printf("%s\n", oss.str().c_str());
1753 auto expectedScreen = Vector2{sceneSize.x * 0.5f + sourcePosition.x, sceneSize.y * 0.5f + sourcePosition.z};
1754 auto actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1756 std::ostringstream oss;
1757 oss << expectedScreen << "\n";
1758 oss << actualScreen << "\n";
1759 tet_printf("%s\n", oss.str().c_str());
1762 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1763 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1764 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1765 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1767 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1768 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1770 // Change rootActor's size and position
1772 Vector3 rootPosition{100.0f, 200.0f, 0.0f};
1773 Vector3 rootSize{200.0f, 100.0f, 0.0f};
1775 rootActor.SetProperty(Actor::Property::POSITION, rootPosition);
1776 rootActor.SetProperty(Actor::Property::SIZE, rootSize);
1778 application.SendNotification();
1779 application.Render(16u);
1781 expectedExtent = Rect<>{sceneSize.x * 0.5f + rootPosition.x + (sourcePosition.x - sourceSize.x * 0.5f) * rootSize.x / sceneSize.x,
1782 sceneSize.y * 0.5f + rootPosition.y + (sourcePosition.z - sourceSize.z * 0.5f) * rootSize.y / sceneSize.y,
1783 sourceSize.x * rootSize.x / sceneSize.x,
1784 sourceSize.z * rootSize.y / sceneSize.y};
1785 actualExtent = DevelActor::CalculateCurrentScreenExtents(sourceActor);
1787 std::ostringstream oss;
1788 oss << expectedExtent << "\n";
1789 oss << actualExtent << "\n";
1790 tet_printf("%s\n", oss.str().c_str());
1793 expectedScreen = Vector2{sceneSize.x * 0.5f + rootPosition.x + sourcePosition.x * rootSize.x / sceneSize.x, sceneSize.y * 0.5f + rootPosition.y + sourcePosition.z * rootSize.y / sceneSize.y};
1794 actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1796 std::ostringstream oss;
1797 oss << expectedScreen << "\n";
1798 oss << actualScreen << "\n";
1799 tet_printf("%s\n", oss.str().c_str());
1802 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1803 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1804 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1805 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1807 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1808 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1813 // SetPosition(float x, float y)
1814 int UtcDaliActorSetPosition01(void)
1816 TestApplication application;
1818 Actor actor = Actor::New();
1820 // Set to random to start off with
1821 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1823 Vector3 vector(100.0f, 100.0f, 0.0f);
1825 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1827 actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1828 // flush the queue and render once
1829 application.SendNotification();
1830 application.Render();
1831 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1833 application.GetScene().Add(actor);
1834 actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1835 // flush the queue and render once
1836 application.SendNotification();
1837 application.Render();
1838 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1840 actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1841 actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1842 actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1843 // flush the queue and render once
1844 application.SendNotification();
1845 application.Render();
1846 DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1848 actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1849 // flush the queue and render once
1850 application.SendNotification();
1851 application.Render();
1852 DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1854 application.GetScene().Remove(actor);
1858 // SetPosition(float x, float y, float z)
1859 int UtcDaliActorSetPosition02(void)
1861 TestApplication application;
1863 Actor actor = Actor::New();
1865 // Set to random to start off with
1866 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1868 Vector3 vector(100.0f, 100.0f, 100.0f);
1870 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1872 actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1874 // flush the queue and render once
1875 application.SendNotification();
1876 application.Render();
1878 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1882 // SetPosition(Vector3 position)
1883 int UtcDaliActorSetPosition03(void)
1885 TestApplication application;
1887 Actor actor = Actor::New();
1889 // Set to random to start off with
1890 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1892 Vector3 vector(100.0f, 100.0f, 100.0f);
1894 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1896 actor.SetProperty(Actor::Property::POSITION, vector);
1898 // flush the queue and render once
1899 application.SendNotification();
1900 application.Render();
1902 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1906 int UtcDaliActorSetX(void)
1908 TestApplication application;
1910 Actor actor = Actor::New();
1912 Vector3 vector(100.0f, 0.0f, 0.0f);
1914 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1916 actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1918 // flush the queue and render once
1919 application.SendNotification();
1920 application.Render();
1922 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1926 int UtcDaliActorSetY(void)
1928 TestApplication application;
1930 Actor actor = Actor::New();
1932 Vector3 vector(0.0f, 100.0f, 0.0f);
1934 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1936 actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1938 // flush the queue and render once
1939 application.SendNotification();
1940 application.Render();
1942 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1946 int UtcDaliActorSetZ(void)
1948 TestApplication application;
1950 Actor actor = Actor::New();
1952 Vector3 vector(0.0f, 0.0f, 100.0f);
1954 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1956 actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1958 // flush the queue and render once
1959 application.SendNotification();
1960 application.Render();
1962 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1966 int UtcDaliActorSetPositionProperties(void)
1968 TestApplication application;
1970 Actor actor = Actor::New();
1972 Vector3 vector(0.7f, 0.8f, 0.9f);
1973 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1975 actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1976 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1977 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1979 // flush the queue and render once
1980 application.SendNotification();
1981 application.Render();
1983 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1984 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1985 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1986 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1987 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1989 actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1990 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1991 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1993 // flush the queue and render once
1994 application.SendNotification();
1995 application.Render();
1997 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1998 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1999 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
2000 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
2001 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
2003 actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
2004 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
2005 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
2007 // flush the queue and render once
2008 application.SendNotification();
2009 application.Render();
2011 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
2012 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
2013 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
2014 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
2015 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
2020 int UtcDaliActorTranslateBy(void)
2022 TestApplication application;
2024 Actor actor = Actor::New();
2025 Vector3 vector(100.0f, 100.0f, 100.0f);
2027 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
2029 actor.SetProperty(Actor::Property::POSITION, vector);
2031 // flush the queue and render once
2032 application.SendNotification();
2033 application.Render();
2035 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
2037 actor.TranslateBy(vector);
2039 // flush the queue and render once
2040 application.SendNotification();
2041 application.Render();
2043 DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
2047 int UtcDaliActorGetCurrentPosition(void)
2049 TestApplication application;
2051 Actor actor = Actor::New();
2052 Vector3 setVector(100.0f, 100.0f, 0.0f);
2053 actor.SetProperty(Actor::Property::POSITION, setVector);
2055 // flush the queue and render once
2056 application.SendNotification();
2057 application.Render();
2059 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
2063 int UtcDaliActorGetCurrentWorldPosition(void)
2065 TestApplication application;
2067 Actor parent = Actor::New();
2068 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
2069 parent.SetProperty(Actor::Property::POSITION, parentPosition);
2070 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2071 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2072 application.GetScene().Add(parent);
2074 Actor child = Actor::New();
2075 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2076 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2077 Vector3 childPosition(6.0f, 6.0f, 6.0f);
2078 child.SetProperty(Actor::Property::POSITION, childPosition);
2081 // The actors should not have a world position yet
2082 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2083 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2085 application.SendNotification();
2086 application.Render(0);
2088 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2089 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2091 // The actors should have a world position now
2092 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2093 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2097 int UtcDaliActorSetInheritPosition(void)
2099 tet_infoline("Testing Actor::SetInheritPosition");
2100 TestApplication application;
2102 Actor parent = Actor::New();
2103 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
2104 parent.SetProperty(Actor::Property::POSITION, parentPosition);
2105 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2106 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2107 application.GetScene().Add(parent);
2109 Actor child = Actor::New();
2110 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2111 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2112 Vector3 childPosition(10.0f, 11.0f, 12.0f);
2113 child.SetProperty(Actor::Property::POSITION, childPosition);
2116 // The actors should not have a world position yet
2117 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2118 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2120 // first test default, which is to inherit position
2121 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2122 application.SendNotification();
2123 application.Render(0); // should only really call Update as Render is not required to update scene
2124 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2125 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2126 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2127 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2129 //Change child position
2130 Vector3 childOffset(-1.0f, 1.0f, 0.0f);
2131 child.SetProperty(Actor::Property::POSITION, childOffset);
2133 // Use local position as world postion
2134 child.SetProperty(Actor::Property::INHERIT_POSITION, false);
2135 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
2136 application.SendNotification();
2137 application.Render(0); // should only really call Update as Render is not required to update scene
2138 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2139 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2140 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2141 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
2143 //Change back to inherit position from parent
2144 child.SetProperty(Actor::Property::INHERIT_POSITION, true);
2145 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2146 application.SendNotification();
2147 application.Render(0); // should only really call Update as Render is not required to update scene
2148 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2149 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2150 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2151 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
2155 int UtcDaliActorInheritOpacity(void)
2157 tet_infoline("Testing Actor::Inherit Opacity");
2158 TestApplication application;
2160 Actor parent = Actor::New();
2161 Actor child = Actor::New();
2163 application.GetScene().Add(parent);
2165 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2166 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2168 // flush the queue and render once
2169 application.SendNotification();
2170 application.Render();
2172 parent.SetProperty(Actor::Property::OPACITY, 0.1f);
2174 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2175 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2177 application.SendNotification();
2178 application.Render();
2180 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2181 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2182 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2183 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2184 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2185 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
2190 // SetOrientation(float angleRadians, Vector3 axis)
2191 int UtcDaliActorSetOrientation01(void)
2193 TestApplication application;
2195 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2196 Actor actor = Actor::New();
2198 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2200 // flush the queue and render once
2201 application.SendNotification();
2202 application.Render();
2204 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2208 int UtcDaliActorSetOrientation02(void)
2210 TestApplication application;
2212 Actor actor = Actor::New();
2214 Radian angle(0.785f);
2215 Vector3 axis(1.0f, 1.0f, 0.0f);
2217 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2218 Quaternion rotation(angle, axis);
2219 // flush the queue and render once
2220 application.SendNotification();
2221 application.Render();
2222 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2224 application.GetScene().Add(actor);
2225 actor.RotateBy(Degree(360), axis);
2226 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2228 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
2229 Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
2230 // flush the queue and render once
2231 application.SendNotification();
2232 application.Render();
2233 DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2235 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2236 // flush the queue and render once
2237 application.SendNotification();
2238 application.Render();
2239 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2241 application.GetScene().Remove(actor);
2245 // SetOrientation(float angleRadians, Vector3 axis)
2246 int UtcDaliActorSetOrientationProperty(void)
2248 TestApplication application;
2250 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2251 Actor actor = Actor::New();
2253 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2254 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2256 // flush the queue and render once
2257 application.SendNotification();
2258 application.Render();
2260 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2261 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2262 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2266 // RotateBy(float angleRadians, Vector3 axis)
2267 int UtcDaliActorRotateBy01(void)
2269 TestApplication application;
2271 Actor actor = Actor::New();
2273 Radian angle(M_PI * 0.25f);
2274 actor.RotateBy((angle), Vector3::ZAXIS);
2275 // flush the queue and render once
2276 application.SendNotification();
2277 application.Render();
2278 DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2280 application.GetScene().Add(actor);
2282 actor.RotateBy(angle, Vector3::ZAXIS);
2283 // flush the queue and render once
2284 application.SendNotification();
2285 application.Render();
2286 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2288 application.GetScene().Remove(actor);
2292 // RotateBy(Quaternion relativeRotation)
2293 int UtcDaliActorRotateBy02(void)
2295 TestApplication application;
2297 Actor actor = Actor::New();
2299 Radian angle(M_PI * 0.25f);
2300 Quaternion rotation(angle, Vector3::ZAXIS);
2301 actor.RotateBy(rotation);
2302 // flush the queue and render once
2303 application.SendNotification();
2304 application.Render();
2305 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2307 actor.RotateBy(rotation);
2308 // flush the queue and render once
2309 application.SendNotification();
2310 application.Render();
2311 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2315 int UtcDaliActorGetCurrentOrientation(void)
2317 TestApplication application;
2318 Actor actor = Actor::New();
2320 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2321 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2322 // flush the queue and render once
2323 application.SendNotification();
2324 application.Render();
2325 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2329 int UtcDaliActorGetCurrentWorldOrientation(void)
2331 tet_infoline("Testing Actor::GetCurrentWorldRotation");
2332 TestApplication application;
2334 Actor parent = Actor::New();
2335 Radian rotationAngle(Degree(90.0f));
2336 Quaternion rotation(rotationAngle, Vector3::YAXIS);
2337 parent.SetProperty(Actor::Property::ORIENTATION, rotation);
2338 application.GetScene().Add(parent);
2340 Actor child = Actor::New();
2341 child.SetProperty(Actor::Property::ORIENTATION, rotation);
2344 // The actors should not have a world rotation yet
2345 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2346 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2348 application.SendNotification();
2349 application.Render(0);
2351 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2352 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2354 // The actors should have a world rotation now
2355 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2356 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
2358 // turn off child rotation inheritance
2359 child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
2360 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
2361 application.SendNotification();
2362 application.Render(0);
2364 // The actors should have a world rotation now
2365 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2366 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
2370 // SetScale(float scale)
2371 int UtcDaliActorSetScale01(void)
2373 TestApplication application;
2375 Actor actor = Actor::New();
2377 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2378 actor.SetProperty(Actor::Property::SCALE, 0.25f);
2380 Vector3 scale(10.0f, 10.0f, 10.0f);
2381 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2383 actor.SetProperty(Actor::Property::SCALE, scale.x);
2385 // flush the queue and render once
2386 application.SendNotification();
2387 application.Render();
2389 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2393 // SetScale(float scaleX, float scaleY, float scaleZ)
2394 int UtcDaliActorSetScale02(void)
2396 TestApplication application;
2397 Vector3 scale(10.0f, 10.0f, 10.0f);
2399 Actor actor = Actor::New();
2401 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2402 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2404 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2406 actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
2407 // flush the queue and render once
2408 application.SendNotification();
2409 application.Render();
2410 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2412 // add to stage and test
2413 application.GetScene().Add(actor);
2414 actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
2415 // flush the queue and render once
2416 application.SendNotification();
2417 application.Render();
2418 DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
2420 application.GetScene().Remove(actor);
2425 // SetScale(Vector3 scale)
2426 int UtcDaliActorSetScale03(void)
2428 TestApplication application;
2429 Vector3 scale(10.0f, 10.0f, 10.0f);
2431 Actor actor = Actor::New();
2433 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2434 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2436 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2438 actor.SetProperty(Actor::Property::SCALE, scale);
2440 // flush the queue and render once
2441 application.SendNotification();
2442 application.Render();
2444 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2448 int UtcDaliActorSetScaleIndividual(void)
2450 TestApplication application;
2452 Actor actor = Actor::New();
2454 Vector3 vector(0.7f, 0.8f, 0.9f);
2455 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2457 actor.SetProperty(Actor::Property::SCALE_X, vector.x);
2458 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2460 // flush the queue and render once
2461 application.SendNotification();
2462 application.Render();
2464 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
2465 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2466 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2468 actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
2469 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2471 // flush the queue and render once
2472 application.SendNotification();
2473 application.Render();
2475 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
2476 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2477 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2479 actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2480 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2482 // flush the queue and render once
2483 application.SendNotification();
2484 application.Render();
2486 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2487 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2488 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2490 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2491 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2496 int UtcDaliActorScaleBy(void)
2498 TestApplication application;
2499 Actor actor = Actor::New();
2500 Vector3 vector(100.0f, 100.0f, 100.0f);
2502 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2504 actor.SetProperty(Actor::Property::SCALE, vector);
2506 // flush the queue and render once
2507 application.SendNotification();
2508 application.Render();
2510 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2512 actor.ScaleBy(vector);
2514 // flush the queue and render once
2515 application.SendNotification();
2516 application.Render();
2518 DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2522 int UtcDaliActorGetCurrentScale(void)
2524 TestApplication application;
2525 Vector3 scale(12.0f, 1.0f, 2.0f);
2527 Actor actor = Actor::New();
2529 actor.SetProperty(Actor::Property::SCALE, scale);
2531 // flush the queue and render once
2532 application.SendNotification();
2533 application.Render();
2535 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2539 int UtcDaliActorGetCurrentWorldScale(void)
2541 TestApplication application;
2543 Actor parent = Actor::New();
2544 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2545 parent.SetProperty(Actor::Property::SCALE, parentScale);
2546 application.GetScene().Add(parent);
2548 Actor child = Actor::New();
2549 Vector3 childScale(2.0f, 2.0f, 2.0f);
2550 child.SetProperty(Actor::Property::SCALE, childScale);
2553 // The actors should not have a scale yet
2554 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2555 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2557 // The actors should not have a world scale yet
2558 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2559 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2561 application.SendNotification();
2562 application.Render(0);
2564 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2565 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2567 // The actors should have a world scale now
2568 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2569 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2573 int UtcDaliActorInheritScale(void)
2575 tet_infoline("Testing Actor::SetInheritScale");
2576 TestApplication application;
2578 Actor parent = Actor::New();
2579 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2580 parent.SetProperty(Actor::Property::SCALE, parentScale);
2581 application.GetScene().Add(parent);
2583 Actor child = Actor::New();
2584 Vector3 childScale(2.0f, 2.0f, 2.0f);
2585 child.SetProperty(Actor::Property::SCALE, childScale);
2588 application.SendNotification();
2589 application.Render(0);
2591 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2592 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2594 child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2595 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2597 application.SendNotification();
2598 application.Render(0);
2600 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2604 int UtcDaliActorSetVisible(void)
2606 TestApplication application;
2608 Actor actor = Actor::New();
2609 actor.SetProperty(Actor::Property::VISIBLE, false);
2610 // flush the queue and render once
2611 application.SendNotification();
2612 application.Render();
2613 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2615 actor.SetProperty(Actor::Property::VISIBLE, true);
2616 // flush the queue and render once
2617 application.SendNotification();
2618 application.Render();
2619 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2621 // put actor on stage
2622 application.GetScene().Add(actor);
2623 actor.SetProperty(Actor::Property::VISIBLE, false);
2624 // flush the queue and render once
2625 application.SendNotification();
2626 application.Render();
2627 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2631 int UtcDaliActorIsVisible(void)
2633 TestApplication application;
2635 Actor actor = Actor::New();
2637 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2641 int UtcDaliActorSetOpacity(void)
2643 TestApplication application;
2645 Actor actor = Actor::New();
2646 // initial opacity is 1
2647 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2649 actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2650 // flush the queue and render once
2651 application.SendNotification();
2652 application.Render();
2653 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2655 // change opacity, actor is on stage to change is not immediate
2656 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2657 // flush the queue and render once
2658 application.SendNotification();
2659 application.Render();
2660 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2662 // put actor on stage
2663 application.GetScene().Add(actor);
2665 // change opacity, actor is on stage to change is not immediate
2666 actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2667 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2668 // flush the queue and render once
2669 application.SendNotification();
2670 application.Render();
2671 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2673 // change opacity, actor is on stage to change is not immediate
2674 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2675 // flush the queue and render once
2676 application.SendNotification();
2677 application.Render();
2678 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2682 int UtcDaliActorGetCurrentOpacity(void)
2684 TestApplication application;
2686 Actor actor = Actor::New();
2687 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2689 actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2690 // flush the queue and render once
2691 application.SendNotification();
2692 application.Render();
2693 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2697 int UtcDaliActorSetSensitive(void)
2699 TestApplication application;
2700 Actor actor = Actor::New();
2702 bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2704 actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2706 DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2710 int UtcDaliActorIsSensitive(void)
2712 TestApplication application;
2713 Actor actor = Actor::New();
2714 actor.SetProperty(Actor::Property::SENSITIVE, false);
2716 DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2720 int UtcDaliActorSetColor(void)
2722 TestApplication application;
2723 Actor actor = Actor::New();
2724 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2726 DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2728 actor.SetProperty(Actor::Property::COLOR, color);
2729 // flush the queue and render once
2730 application.SendNotification();
2731 application.Render();
2732 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2734 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2735 // flush the queue and render once
2736 application.SendNotification();
2737 application.Render();
2738 DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2740 application.GetScene().Add(actor);
2741 actor.SetProperty(Actor::Property::COLOR, color);
2742 // flush the queue and render once
2743 application.SendNotification();
2744 application.Render();
2745 DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2747 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2748 // flush the queue and render once
2749 application.SendNotification();
2750 application.Render();
2751 // Actor color is not clamped
2752 DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2753 // world color is clamped
2754 DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2756 actor.SetProperty(Actor::Property::COLOR, color);
2757 DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2759 Vector3 newColor(1.0f, 0.0f, 0.0f);
2760 actor.SetProperty(Actor::Property::COLOR, newColor);
2761 DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2763 application.GetScene().Remove(actor);
2767 int UtcDaliActorSetColorIndividual(void)
2769 TestApplication application;
2771 Actor actor = Actor::New();
2773 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2774 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2776 actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2777 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2779 // flush the queue and render once
2780 application.SendNotification();
2781 application.Render();
2783 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2784 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2785 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2787 actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2788 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2790 // flush the queue and render once
2791 application.SendNotification();
2792 application.Render();
2794 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2795 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2796 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2798 actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2799 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2801 // flush the queue and render once
2802 application.SendNotification();
2803 application.Render();
2805 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2806 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2807 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2809 actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2810 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2812 // flush the queue and render once
2813 application.SendNotification();
2814 application.Render();
2816 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2817 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2818 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2820 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2821 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2823 actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2825 // flush the queue and render once
2826 application.SendNotification();
2827 application.Render();
2829 DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2834 int UtcDaliActorGetCurrentColor(void)
2836 TestApplication application;
2837 Actor actor = Actor::New();
2838 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2840 actor.SetProperty(Actor::Property::COLOR, color);
2841 // flush the queue and render once
2842 application.SendNotification();
2843 application.Render();
2844 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2848 int UtcDaliActorGetCurrentWorldColor(void)
2850 tet_infoline("Actor::GetCurrentWorldColor");
2851 TestApplication application;
2853 Actor parent = Actor::New();
2854 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2855 parent.SetProperty(Actor::Property::COLOR, parentColor);
2856 application.GetScene().Add(parent);
2858 Actor child = Actor::New();
2859 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2860 child.SetProperty(Actor::Property::COLOR, childColor);
2863 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2864 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2866 // verify the default color mode
2867 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2869 // The actors should not have a world color yet
2870 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2871 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2873 application.SendNotification();
2874 application.Render(0);
2876 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2877 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2879 // The actors should have a world color now
2880 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2881 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2884 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2885 application.SendNotification();
2886 application.Render(0);
2887 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2890 child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2891 application.SendNotification();
2892 application.Render(0);
2893 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2894 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2897 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2898 application.SendNotification();
2899 application.Render(0);
2900 Vector4 expectedColor(childColor);
2901 expectedColor.a *= parentColor.a;
2902 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2903 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2907 int UtcDaliActorSetColorMode(void)
2909 tet_infoline("Actor::SetColorMode");
2910 TestApplication application;
2911 Actor actor = Actor::New();
2912 Actor child = Actor::New();
2915 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2916 DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2918 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2919 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2921 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2922 DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2924 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2925 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2929 int UtcDaliActorScreenToLocal(void)
2931 TestApplication application;
2932 Actor actor = Actor::New();
2933 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2934 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2935 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2936 application.GetScene().Add(actor);
2938 // flush the queue and render once
2939 application.SendNotification();
2940 application.Render();
2945 application.SendNotification();
2946 application.Render();
2948 DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2950 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2951 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2955 int UtcDaliActorSetLeaveRequired(void)
2957 TestApplication application;
2959 Actor actor = Actor::New();
2961 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2962 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2964 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2965 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2969 int UtcDaliActorGetLeaveRequired(void)
2971 TestApplication application;
2973 Actor actor = Actor::New();
2975 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2979 int UtcDaliActorSetKeyboardFocusable(void)
2981 TestApplication application;
2983 Actor actor = Actor::New();
2985 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2986 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2988 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2989 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2993 int UtcDaliActorIsKeyboardFocusable(void)
2995 TestApplication application;
2997 Actor actor = Actor::New();
2999 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
3003 int UtcDaliActorSetKeyboardFocusableChildren(void)
3005 TestApplication application;
3007 Actor actor = Actor::New();
3009 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
3010 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
3012 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
3013 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
3017 int UtcDaliActorAreChildrenKeyBoardFocusable(void)
3019 TestApplication application;
3021 Actor actor = Actor::New();
3023 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
3027 int UtcDaliActorSetTouchFocusable(void)
3029 TestApplication application;
3031 Actor actor = Actor::New();
3033 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
3034 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
3036 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
3037 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
3041 int UtcDaliActorIsTouchFocusable(void)
3043 TestApplication application;
3045 Actor actor = Actor::New();
3047 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
3051 int UtcDaliActorSetUserInteractionEnabled(void)
3053 TestApplication application;
3054 Actor actor = Actor::New();
3056 bool enabled = !actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED);
3058 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, enabled);
3060 DALI_TEST_CHECK(enabled == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
3064 int UtcDaliActorIsUserInteractionEnabled(void)
3066 TestApplication application;
3067 Actor actor = Actor::New();
3068 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
3070 DALI_TEST_CHECK(true == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
3074 int UtcDaliActorRemoveConstraints(void)
3076 tet_infoline(" UtcDaliActorRemoveConstraints");
3077 TestApplication application;
3079 gTestConstraintCalled = false;
3081 Actor actor = Actor::New();
3083 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
3085 actor.RemoveConstraints();
3087 DALI_TEST_CHECK(gTestConstraintCalled == false);
3089 application.GetScene().Add(actor);
3092 // flush the queue and render once
3093 application.SendNotification();
3094 application.Render();
3096 actor.RemoveConstraints();
3098 DALI_TEST_CHECK(gTestConstraintCalled == true);
3102 int UtcDaliActorRemoveConstraintTag(void)
3104 tet_infoline(" UtcDaliActorRemoveConstraintTag");
3105 TestApplication application;
3107 Actor actor = Actor::New();
3109 // 1. Apply Constraint1 and Constraint2, and test...
3110 unsigned int result1 = 0u;
3111 unsigned int result2 = 0u;
3113 unsigned constraint1Tag = 1u;
3114 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
3115 constraint1.SetTag(constraint1Tag);
3116 constraint1.Apply();
3118 unsigned constraint2Tag = 2u;
3119 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
3120 constraint2.SetTag(constraint2Tag);
3121 constraint2.Apply();
3123 application.GetScene().Add(actor);
3124 // flush the queue and render once
3125 application.SendNotification();
3126 application.Render();
3128 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3129 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3131 // 2. Remove Constraint1 and test...
3134 actor.RemoveConstraints(constraint1Tag);
3135 // make color property dirty, which will trigger constraints to be reapplied.
3136 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3137 // flush the queue and render once
3138 application.SendNotification();
3139 application.Render();
3141 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3142 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3144 // 3. Re-Apply Constraint1 and test...
3147 constraint1.Apply();
3148 // make color property dirty, which will trigger constraints to be reapplied.
3149 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3150 // flush the queue and render once
3151 application.SendNotification();
3152 application.Render();
3154 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3155 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3157 // 2. Remove Constraint2 and test...
3160 actor.RemoveConstraints(constraint2Tag);
3161 // make color property dirty, which will trigger constraints to be reapplied.
3162 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3163 // flush the queue and render once
3164 application.SendNotification();
3165 application.Render();
3167 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3168 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3170 // 2. Remove Constraint1 as well and test...
3173 actor.RemoveConstraints(constraint1Tag);
3174 // make color property dirty, which will trigger constraints to be reapplied.
3175 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3176 // flush the queue and render once
3177 application.SendNotification();
3178 application.Render();
3180 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3181 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3185 int UtcDaliActorTouchedSignal(void)
3187 TestApplication application;
3189 ResetTouchCallbacks();
3191 // get the root layer
3192 Actor actor = application.GetScene().GetRootLayer();
3193 DALI_TEST_CHECK(gTouchCallBackCalled == false);
3195 application.SendNotification();
3196 application.Render();
3198 // connect to its touch signal
3199 actor.TouchedSignal().Connect(TestTouchCallback);
3201 // simulate a touch event in the middle of the screen
3202 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3203 Dali::Integration::Point point;
3204 point.SetDeviceId(1);
3205 point.SetState(PointState::DOWN);
3206 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3207 Dali::Integration::TouchEvent touchEvent;
3208 touchEvent.AddPoint(point);
3209 application.ProcessEvent(touchEvent);
3211 DALI_TEST_CHECK(gTouchCallBackCalled == true);
3215 int UtcDaliActorGeoTouchedSignal(void)
3217 TestApplication application;
3219 application.GetScene().SetGeometryHittestEnabled(true);
3220 ResetTouchCallbacks(application);
3222 // get the root layer
3223 Actor actor = application.GetScene().GetRootLayer();
3224 DALI_TEST_CHECK(gTouchCallBackCalled == false);
3226 application.SendNotification();
3227 application.Render();
3229 // connect to its touch signal
3230 actor.TouchedSignal().Connect(TestTouchCallback);
3232 // simulate a touch event in the middle of the screen
3233 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3234 Dali::Integration::Point point;
3235 point.SetDeviceId(1);
3236 point.SetState(PointState::DOWN);
3237 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3238 Dali::Integration::TouchEvent touchEvent;
3239 touchEvent.AddPoint(point);
3240 application.ProcessEvent(touchEvent);
3242 DALI_TEST_CHECK(gTouchCallBackCalled == true);
3246 int UtcDaliActorHoveredSignal(void)
3248 TestApplication application;
3250 gHoverCallBackCalled = false;
3252 // get the root layer
3253 Actor actor = application.GetScene().GetRootLayer();
3254 DALI_TEST_CHECK(gHoverCallBackCalled == false);
3256 application.SendNotification();
3257 application.Render();
3259 // connect to its hover signal
3260 actor.HoveredSignal().Connect(TestCallback3);
3262 // simulate a hover event in the middle of the screen
3263 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3264 Dali::Integration::Point point;
3265 point.SetDeviceId(1);
3266 point.SetState(PointState::MOTION);
3267 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3268 Dali::Integration::HoverEvent hoverEvent;
3269 hoverEvent.AddPoint(point);
3270 application.ProcessEvent(hoverEvent);
3272 DALI_TEST_CHECK(gHoverCallBackCalled == true);
3276 int UtcDaliActorOnOffSceneSignal(void)
3278 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
3280 TestApplication application;
3283 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3284 gActorNamesOnOffScene.clear();
3286 Actor parent = Actor::New();
3287 parent.SetProperty(Actor::Property::NAME, "parent");
3288 parent.OnSceneSignal().Connect(OnSceneCallback);
3289 parent.OffSceneSignal().Connect(OffSceneCallback);
3291 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
3292 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
3294 // add parent to the scene
3295 application.GetScene().Add(parent);
3296 // onstage emitted, offstage not
3297 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3298 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3299 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3301 // test adding a child, should get onstage emitted
3303 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3304 gActorNamesOnOffScene.clear();
3306 Actor child = Actor::New();
3307 child.SetProperty(Actor::Property::NAME, "child");
3308 child.OnSceneSignal().Connect(OnSceneCallback);
3309 child.OffSceneSignal().Connect(OffSceneCallback);
3310 parent.Add(child); // add child
3311 // onscene emitted, offscene not
3312 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3313 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3314 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3316 // test removing parent from the scene
3318 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3319 gActorNamesOnOffScene.clear();
3321 application.GetScene().Remove(parent);
3322 // onscene not emitted, offscene is
3323 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3324 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
3325 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3326 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
3328 // test adding parent back to the scene
3330 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3331 gActorNamesOnOffScene.clear();
3333 application.GetScene().Add(parent);
3334 // onscene emitted, offscene not
3335 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
3336 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3337 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3338 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
3340 // test removing child
3342 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3343 gActorNamesOnOffScene.clear();
3345 parent.Remove(child);
3346 // onscene not emitted, offscene is
3347 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3348 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3349 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3351 // test removing parent
3353 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3354 gActorNamesOnOffScene.clear();
3356 application.GetScene().Remove(parent);
3357 // onscene not emitted, offscene is
3358 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3359 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3360 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3364 int UtcDaliActorFindChildByName(void)
3366 tet_infoline("Testing Dali::Actor::FindChildByName()");
3367 TestApplication application;
3369 Actor parent = Actor::New();
3370 parent.SetProperty(Actor::Property::NAME, "parent");
3371 Actor first = Actor::New();
3372 first.SetProperty(Actor::Property::NAME, "first");
3373 Actor second = Actor::New();
3374 second.SetProperty(Actor::Property::NAME, "second");
3379 Actor found = parent.FindChildByName("foo");
3380 DALI_TEST_CHECK(!found);
3382 found = parent.FindChildByName("parent");
3383 DALI_TEST_CHECK(found == parent);
3385 found = parent.FindChildByName("first");
3386 DALI_TEST_CHECK(found == first);
3388 found = parent.FindChildByName("second");
3389 DALI_TEST_CHECK(found == second);
3393 int UtcDaliActorFindChildById(void)
3395 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
3396 TestApplication application;
3398 Actor parent = Actor::New();
3399 Actor first = Actor::New();
3400 Actor second = Actor::New();
3405 Actor found = parent.FindChildById(100000);
3406 DALI_TEST_CHECK(!found);
3408 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
3409 DALI_TEST_CHECK(found == parent);
3411 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
3412 DALI_TEST_CHECK(found == first);
3414 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
3415 DALI_TEST_CHECK(found == second);
3419 int UtcDaliActorHitTest(void)
3424 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
3426 mTouchPoint(touchPoint),
3432 Vector2 mTouchPoint;
3436 TestApplication application;
3437 tet_infoline(" UtcDaliActorHitTest");
3439 // Fill a vector with different hit tests.
3440 struct HitTestData* hitTestData[] = {
3441 // scale touch point result
3442 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
3443 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
3444 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.
3445 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
3446 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.
3450 // get the root layer
3451 Actor actor = Actor::New();
3452 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3453 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3455 application.GetScene().Add(actor);
3457 ResetTouchCallbacks();
3459 unsigned int index = 0;
3460 while(NULL != hitTestData[index])
3462 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
3463 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
3465 // flush the queue and render once
3466 application.SendNotification();
3467 application.Render();
3469 DALI_TEST_CHECK(!gTouchCallBackCalled);
3471 // connect to its touch signal
3472 actor.TouchedSignal().Connect(TestTouchCallback);
3474 Dali::Integration::Point point;
3475 point.SetState(PointState::DOWN);
3476 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
3477 Dali::Integration::TouchEvent event;
3478 event.AddPoint(point);
3480 // flush the queue and render once
3481 application.SendNotification();
3482 application.Render();
3483 application.ProcessEvent(event);
3485 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3487 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3488 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3489 hitTestData[index]->mScale.x,
3490 hitTestData[index]->mScale.y,
3491 hitTestData[index]->mScale.z,
3492 hitTestData[index]->mTouchPoint.x,
3493 hitTestData[index]->mTouchPoint.y,
3494 hitTestData[index]->mResult);
3496 ResetTouchCallbacks();
3502 int UtcDaliActorGeoHitTest(void)
3507 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
3509 mTouchPoint(touchPoint),
3515 Vector2 mTouchPoint;
3519 TestApplication application;
3520 tet_infoline(" UtcDaliActorHitTest");
3522 // Fill a vector with different hit tests.
3523 struct HitTestData* hitTestData[] = {
3524 // scale touch point result
3525 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
3526 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
3527 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.
3528 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
3529 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.
3533 // get the root layer
3534 Actor actor = Actor::New();
3535 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3536 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3538 application.GetScene().Add(actor);
3539 application.GetScene().SetGeometryHittestEnabled(true);
3541 ResetTouchCallbacks(application);
3543 unsigned int index = 0;
3544 while(NULL != hitTestData[index])
3546 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
3547 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
3549 // flush the queue and render once
3550 application.SendNotification();
3551 application.Render();
3553 DALI_TEST_CHECK(!gTouchCallBackCalled);
3555 // connect to its touch signal
3556 actor.TouchedSignal().Connect(TestTouchCallback);
3558 Dali::Integration::Point point;
3559 point.SetState(PointState::DOWN);
3560 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
3561 Dali::Integration::TouchEvent event;
3562 event.AddPoint(point);
3564 // flush the queue and render once
3565 application.SendNotification();
3566 application.Render();
3567 application.ProcessEvent(event);
3569 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3571 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3572 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3573 hitTestData[index]->mScale.x,
3574 hitTestData[index]->mScale.y,
3575 hitTestData[index]->mScale.z,
3576 hitTestData[index]->mTouchPoint.x,
3577 hitTestData[index]->mTouchPoint.y,
3578 hitTestData[index]->mResult);
3580 ResetTouchCallbacks(application);
3586 int UtcDaliActorSetDrawMode(void)
3588 TestApplication application;
3589 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
3591 Actor a = Actor::New();
3593 application.GetScene().Add(a);
3594 application.SendNotification();
3595 application.Render(0);
3596 application.SendNotification();
3597 application.Render(1);
3599 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
3601 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3602 application.SendNotification();
3603 application.Render(1);
3605 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
3607 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3608 application.SendNotification();
3609 application.Render(1);
3611 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
3615 int UtcDaliActorSetDrawModeOverlayRender(void)
3617 TestApplication application;
3618 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
3620 application.SendNotification();
3621 application.Render(1);
3623 std::vector<GLuint> ids;
3624 ids.push_back(8); // first rendered actor
3625 ids.push_back(9); // second rendered actor
3626 ids.push_back(10); // third rendered actor
3627 application.GetGlAbstraction().SetNextTextureIds(ids);
3629 Texture imageA = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3630 Texture imageB = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3631 Texture imageC = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3632 Actor a = CreateRenderableActor(imageA);
3633 Actor b = CreateRenderableActor(imageB);
3634 Actor c = CreateRenderableActor(imageC);
3636 application.SendNotification();
3637 application.Render(1);
3639 //Textures are bound when first created. Clear bound textures vector
3640 application.GetGlAbstraction().ClearBoundTextures();
3642 // Render a,b,c as regular non-overlays. so order will be:
3646 application.GetScene().Add(a);
3647 application.GetScene().Add(b);
3648 application.GetScene().Add(c);
3650 application.SendNotification();
3651 application.Render(1);
3653 // Should be 3 textures changes.
3654 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3655 typedef std::vector<GLuint>::size_type TextureSize;
3656 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3657 if(boundTextures.size() == 3)
3659 DALI_TEST_CHECK(boundTextures[0] == 8u);
3660 DALI_TEST_CHECK(boundTextures[1] == 9u);
3661 DALI_TEST_CHECK(boundTextures[2] == 10u);
3664 // Now texture ids have been set, we can monitor their render order.
3665 // render a as an overlay (last), so order will be:
3669 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3670 application.GetGlAbstraction().ClearBoundTextures();
3672 application.SendNotification();
3673 application.Render(1);
3675 // Should be 3 texture changes.
3676 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3677 if(boundTextures.size() == 3)
3679 DALI_TEST_CHECK(boundTextures[0] == 9u);
3680 DALI_TEST_CHECK(boundTextures[1] == 10u);
3681 DALI_TEST_CHECK(boundTextures[2] == 8u);
3686 int UtcDaliActorSetDrawModeOverlayWithClipping(void)
3688 TestApplication application;
3689 tet_infoline(" UtcDaliActorSetDrawModeOverlayWithClipping");
3691 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3692 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
3693 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3695 const Vector2 surfaceSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
3696 const Vector2 imageSize(16.0f, 16.0f);
3698 std::vector<GLuint> ids;
3699 ids.push_back(8); // first rendered actor
3700 ids.push_back(9); // second rendered actor
3701 ids.push_back(10); // third rendered actor
3702 ids.push_back(11); // forth rendered actor
3703 application.GetGlAbstraction().SetNextTextureIds(ids);
3705 Actor a = CreateActorWithContent16x16();
3706 Actor b = CreateActorWithContent16x16();
3707 Actor c = CreateActorWithContent16x16();
3708 Actor d = CreateActorWithContent16x16();
3710 application.SendNotification();
3711 application.Render();
3713 //Textures are bound when first created. Clear bound textures vector
3714 application.GetGlAbstraction().ClearBoundTextures();
3716 b[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3717 b[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3718 b[Actor::Property::DRAW_MODE] = DrawMode::OVERLAY_2D;
3719 b[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3721 c[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3722 c[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3723 c[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3724 c[Actor::Property::POSITION] = Vector2(100.0f, -100.0f);
3726 application.GetScene().Add(a);
3727 application.GetScene().Add(b);
3728 application.GetScene().Add(c);
3731 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3733 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3734 typedef std::vector<GLuint>::size_type TextureSize;
3735 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(4), TEST_LOCATION);
3736 if(boundTextures.size() == 4)
3738 DALI_TEST_CHECK(boundTextures[0] == 8u);
3739 DALI_TEST_CHECK(boundTextures[1] == 10u);
3740 DALI_TEST_CHECK(boundTextures[2] == 9u);
3741 DALI_TEST_CHECK(boundTextures[3] == 11u);
3744 // Check scissor test was enabled.
3745 std::ostringstream scissor;
3746 scissor << std::hex << GL_SCISSOR_TEST;
3747 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
3749 // Check the scissor was set, and the coordinates are correct.
3750 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3751 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3753 application.GetGlAbstraction().ClearBoundTextures();
3755 // Remove a Renderer of overlay actor
3756 Renderer renderer = b.GetRendererAt(0);
3757 b.RemoveRenderer(renderer);
3759 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3761 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3762 if(boundTextures.size() == 3)
3764 DALI_TEST_CHECK(boundTextures[0] == 8u);
3765 DALI_TEST_CHECK(boundTextures[1] == 10u);
3766 DALI_TEST_CHECK(boundTextures[2] == 11u);
3769 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3770 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3775 int UtcDaliActorGetCurrentWorldMatrix(void)
3777 TestApplication application;
3778 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3780 Actor parent = Actor::New();
3781 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3782 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3783 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3784 Radian rotationAngle(Degree(85.0f));
3785 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3786 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3787 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3788 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3789 parent.SetProperty(Actor::Property::SCALE, parentScale);
3790 application.GetScene().Add(parent);
3792 Actor child = Actor::New();
3793 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3794 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3795 Radian childRotationAngle(Degree(23.0f));
3796 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3797 Vector3 childScale(2.0f, 2.0f, 2.0f);
3798 child.SetProperty(Actor::Property::POSITION, childPosition);
3799 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3800 child.SetProperty(Actor::Property::SCALE, childScale);
3803 application.SendNotification();
3804 application.Render(0);
3805 application.Render();
3806 application.SendNotification();
3808 Matrix parentMatrix(false);
3809 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3811 Matrix childMatrix(false);
3812 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3814 //Child matrix should be the composition of child and parent
3815 Matrix childWorldMatrix(false);
3816 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3818 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3819 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3823 int UtcDaliActorConstrainedToWorldMatrix(void)
3825 TestApplication application;
3826 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3828 Actor parent = Actor::New();
3829 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3830 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3831 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3832 Radian rotationAngle(Degree(85.0f));
3833 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3834 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3835 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3836 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3837 parent.SetProperty(Actor::Property::SCALE, parentScale);
3838 application.GetScene().Add(parent);
3840 Actor child = Actor::New();
3841 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3842 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3843 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3844 posConstraint.Apply();
3846 application.GetScene().Add(child);
3848 application.SendNotification();
3849 application.Render(0);
3850 application.Render();
3851 application.SendNotification();
3853 Matrix parentMatrix(false);
3854 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3856 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3857 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3861 int UtcDaliActorConstrainedToOrientation(void)
3863 TestApplication application;
3864 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3866 Actor parent = Actor::New();
3867 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3868 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3869 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3870 Radian rotationAngle(Degree(85.0f));
3871 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3872 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3873 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3874 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3875 parent.SetProperty(Actor::Property::SCALE, parentScale);
3876 application.GetScene().Add(parent);
3878 Actor child = Actor::New();
3879 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3880 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3881 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3882 posConstraint.Apply();
3884 application.GetScene().Add(child);
3886 application.SendNotification();
3887 application.Render(0);
3888 application.Render();
3889 application.SendNotification();
3891 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3895 int UtcDaliActorConstrainedToOpacity(void)
3897 TestApplication application;
3898 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3900 Actor parent = Actor::New();
3901 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3902 application.GetScene().Add(parent);
3904 Actor child = Actor::New();
3905 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3906 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3907 opacityConstraint.Apply();
3909 application.GetScene().Add(child);
3911 application.SendNotification();
3912 application.Render(0);
3913 application.Render();
3914 application.SendNotification();
3916 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3918 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3920 application.SendNotification();
3921 application.Render(0);
3922 application.Render();
3923 application.SendNotification();
3925 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3930 int UtcDaliActorUnparent(void)
3932 TestApplication application;
3933 tet_infoline(" UtcDaliActorUnparent");
3935 Actor parent = Actor::New();
3936 application.GetScene().Add(parent);
3938 Actor child = Actor::New();
3940 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3941 DALI_TEST_CHECK(!child.GetParent());
3943 // Test that calling Unparent with no parent is a NOOP
3946 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3947 DALI_TEST_CHECK(!child.GetParent());
3949 // Test that Unparent works
3952 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3953 DALI_TEST_CHECK(parent == child.GetParent());
3957 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3958 DALI_TEST_CHECK(!child.GetParent());
3960 // Test that UnparentAndReset works
3963 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3964 DALI_TEST_CHECK(parent == child.GetParent());
3966 UnparentAndReset(child);
3968 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3969 DALI_TEST_CHECK(!child);
3971 // Test that UnparentAndReset is a NOOP with empty handle
3972 UnparentAndReset(child);
3974 DALI_TEST_CHECK(!child);
3978 int UtcDaliActorGetChildAt(void)
3980 TestApplication application;
3981 tet_infoline(" UtcDaliActorGetChildAt");
3983 Actor parent = Actor::New();
3984 application.GetScene().Add(parent);
3986 Actor child0 = Actor::New();
3989 Actor child1 = Actor::New();
3992 Actor child2 = Actor::New();
3995 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3996 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3997 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
4001 int UtcDaliActorSetGetOverlay(void)
4003 TestApplication application;
4004 tet_infoline(" UtcDaliActorSetGetOverlay");
4006 Actor parent = Actor::New();
4007 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
4008 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
4012 int UtcDaliActorCreateDestroy(void)
4014 Actor* actor = new Actor;
4015 DALI_TEST_CHECK(actor);
4022 struct PropertyStringIndex
4024 const char* const name;
4025 const Property::Index index;
4026 const Property::Type type;
4029 const PropertyStringIndex PROPERTY_TABLE[] =
4031 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
4032 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
4033 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
4034 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
4035 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
4036 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
4037 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
4038 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
4039 {"size", Actor::Property::SIZE, Property::VECTOR3},
4040 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
4041 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
4042 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
4043 {"position", Actor::Property::POSITION, Property::VECTOR3},
4044 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
4045 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
4046 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
4047 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
4048 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
4049 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
4050 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
4051 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
4052 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
4053 {"scale", Actor::Property::SCALE, Property::VECTOR3},
4054 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
4055 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
4056 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
4057 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
4058 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
4059 {"color", Actor::Property::COLOR, Property::VECTOR4},
4060 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
4061 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
4062 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
4063 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
4064 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
4065 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
4066 {"name", Actor::Property::NAME, Property::STRING},
4067 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
4068 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
4069 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
4070 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
4071 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
4072 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
4073 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
4074 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
4075 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
4076 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
4077 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
4078 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
4079 {"padding", Actor::Property::PADDING, Property::VECTOR4},
4080 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
4081 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
4082 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
4083 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
4084 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
4086 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
4087 } // unnamed namespace
4089 int UtcDaliActorProperties(void)
4091 TestApplication application;
4093 Actor actor = Actor::New();
4095 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
4097 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
4098 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
4099 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
4100 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
4105 int UtcDaliRelayoutProperties_ResizePolicies(void)
4107 TestApplication application;
4109 Actor actor = Actor::New();
4112 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
4113 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
4115 // Set resize policy for all dimensions
4116 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
4117 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
4119 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
4122 // Set individual dimensions
4123 const char* const widthPolicy = "FILL_TO_PARENT";
4124 const char* const heightPolicy = "FIXED";
4126 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
4127 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
4129 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
4130 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
4132 // Set individual dimensions using enums
4133 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
4134 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
4136 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
4137 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
4139 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
4140 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
4145 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
4147 TestApplication application;
4149 Actor actor = Actor::New();
4152 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
4154 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
4155 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
4156 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
4159 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
4160 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
4162 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
4163 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
4165 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
4166 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
4171 int UtcDaliRelayoutProperties_SizeModeFactor(void)
4173 TestApplication application;
4175 Actor actor = Actor::New();
4178 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
4179 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
4181 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
4182 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
4183 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
4186 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
4188 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
4189 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
4194 int UtcDaliRelayoutProperties_DimensionDependency(void)
4196 TestApplication application;
4198 Actor actor = Actor::New();
4201 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4202 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
4205 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
4206 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
4208 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
4209 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
4211 // Test setting another resize policy
4212 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
4213 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4218 int UtcDaliRelayoutProperties_Padding(void)
4220 TestApplication application;
4222 Actor actor = Actor::New();
4225 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
4228 actor.SetProperty(Actor::Property::PADDING, padding);
4229 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
4231 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4236 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
4238 TestApplication application;
4240 Actor actor = Actor::New();
4243 Vector2 minSize(1.0f, 2.0f);
4245 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
4246 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
4248 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4250 Vector2 maxSize(3.0f, 4.0f);
4252 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
4253 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
4255 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4260 int UtcDaliActorGetHeightForWidth(void)
4262 TestApplication application;
4264 Actor actor = Actor::New();
4266 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
4271 int UtcDaliActorGetWidthForHeight(void)
4273 TestApplication application;
4275 Actor actor = Actor::New();
4277 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
4282 int UtcDaliActorGetRelayoutSize(void)
4284 TestApplication application;
4286 Actor actor = Actor::New();
4288 // Add actor to stage
4289 application.GetScene().Add(actor);
4291 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
4293 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
4294 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
4296 // Flush the queue and render once
4297 application.SendNotification();
4298 application.Render();
4300 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
4305 int UtcDaliActorSetPadding(void)
4307 TestApplication application;
4309 Actor actor = Actor::New();
4312 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4314 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
4315 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
4316 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
4317 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
4319 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
4320 actor.SetProperty(Actor::Property::PADDING, padding2);
4322 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4324 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
4325 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
4326 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
4327 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
4332 int UtcDaliActorSetMinimumSize(void)
4334 TestApplication application;
4336 Actor actor = Actor::New();
4338 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4340 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
4341 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
4343 Vector2 size2(1.0f, 2.0f);
4344 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
4346 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4348 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4349 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4354 int UtcDaliActorSetMaximumSize(void)
4356 TestApplication application;
4358 Actor actor = Actor::New();
4360 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4362 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
4363 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
4365 Vector2 size2(1.0f, 2.0f);
4366 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
4368 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4370 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4371 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4376 int UtcDaliActorOnRelayoutSignal(void)
4378 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
4380 TestApplication application;
4383 gOnRelayoutCallBackCalled = false;
4384 gActorNamesRelayout.clear();
4386 Actor actor = Actor::New();
4387 actor.SetProperty(Actor::Property::NAME, "actor");
4388 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
4391 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
4393 // Add actor to stage
4394 application.GetScene().Add(actor);
4396 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4397 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
4399 // Flush the queue and render once
4400 application.SendNotification();
4401 application.Render();
4403 // OnRelayout emitted
4404 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
4405 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
4410 int UtcDaliActorGetHierachyDepth(void)
4412 TestApplication application;
4413 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
4415 /* Build tree of actors:
4425 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
4427 Integration::Scene stage(application.GetScene());
4429 Actor actorA = Actor::New();
4430 Actor actorB = Actor::New();
4431 Actor actorC = Actor::New();
4432 Actor actorD = Actor::New();
4433 Actor actorE = Actor::New();
4434 Actor actorF = Actor::New();
4436 //Test that root actor has depth equal 0
4437 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4439 //Test actors return depth -1 when not connected to the tree
4440 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4441 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4442 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4443 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4444 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4445 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4447 //Create the hierarchy
4455 //Test actors return correct depth
4456 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4457 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4458 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4459 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4460 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4461 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4463 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
4464 actorA.Remove(actorB);
4466 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4467 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4468 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4470 //Removing actorA from the stage. All actors should have depth equal -1
4471 stage.Remove(actorA);
4473 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4474 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4475 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4476 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4477 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4478 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4483 int UtcDaliActorAnchorPointPropertyAsString(void)
4485 TestApplication application;
4487 Actor actor = Actor::New();
4489 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
4490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4492 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
4493 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4495 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
4496 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4498 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
4499 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4501 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
4502 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
4504 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
4505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4507 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
4508 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4510 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
4511 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4513 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
4514 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4516 // Invalid should not change anything
4517 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
4518 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4523 int UtcDaliActorParentOriginPropertyAsString(void)
4525 TestApplication application;
4527 Actor actor = Actor::New();
4529 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
4530 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4532 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
4533 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4535 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
4536 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4538 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
4539 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4541 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
4542 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
4544 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
4545 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4547 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
4548 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4550 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
4551 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4553 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
4554 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4556 // Invalid should not change anything
4557 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
4558 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4563 int UtcDaliActorColorModePropertyAsString(void)
4565 TestApplication application;
4567 Actor actor = Actor::New();
4569 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
4570 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4572 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
4573 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4575 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
4576 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4578 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
4579 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4581 // Invalid should not change anything
4582 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
4583 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4588 int UtcDaliActorDrawModePropertyAsString(void)
4590 TestApplication application;
4592 Actor actor = Actor::New();
4594 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
4595 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4597 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
4598 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4600 // Invalid should not change anything
4601 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
4602 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4607 int UtcDaliActorColorModePropertyAsEnum(void)
4609 TestApplication application;
4611 Actor actor = Actor::New();
4613 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
4614 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4616 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
4617 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4619 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
4620 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4622 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
4623 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4628 int UtcDaliActorDrawModePropertyAsEnum(void)
4630 TestApplication application;
4632 Actor actor = Actor::New();
4634 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
4635 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4637 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
4638 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4643 int UtcDaliActorAddRendererP(void)
4645 tet_infoline("Testing Actor::AddRenderer");
4646 TestApplication application;
4648 Actor actor = Actor::New();
4650 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4652 Geometry geometry = CreateQuadGeometry();
4653 Shader shader = CreateShader();
4654 Renderer renderer = Renderer::New(geometry, shader);
4656 actor.AddRenderer(renderer);
4657 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4658 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4663 int UtcDaliActorAddSameRenderer(void)
4665 tet_infoline("Testing Actor::AddRenderer");
4666 TestApplication application;
4668 Actor actor = Actor::New();
4670 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4672 Geometry geometry = CreateQuadGeometry();
4673 Shader shader = CreateShader();
4674 Renderer renderer1 = Renderer::New(geometry, shader);
4675 Renderer renderer2 = Renderer::New(geometry, shader);
4676 Renderer renderer3 = Renderer::New(geometry, shader);
4678 DALI_TEST_EQUALS(actor.AddRenderer(renderer1), 0U, TEST_LOCATION);
4679 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4680 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer1, TEST_LOCATION);
4682 DALI_TEST_EQUALS(actor.AddRenderer(renderer2), 1U, TEST_LOCATION);
4683 DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
4684 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer1, TEST_LOCATION);
4685 DALI_TEST_EQUALS(actor.GetRendererAt(1), renderer2, TEST_LOCATION);
4687 DALI_TEST_EQUALS(actor.AddRenderer(renderer1), 0U, TEST_LOCATION);
4688 DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
4689 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer1, TEST_LOCATION);
4690 DALI_TEST_EQUALS(actor.GetRendererAt(1), renderer2, TEST_LOCATION);
4692 DALI_TEST_EQUALS(actor.AddRenderer(renderer3), 2U, TEST_LOCATION);
4693 DALI_TEST_EQUALS(actor.GetRendererCount(), 3u, TEST_LOCATION);
4694 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer1, TEST_LOCATION);
4695 DALI_TEST_EQUALS(actor.GetRendererAt(1), renderer2, TEST_LOCATION);
4696 DALI_TEST_EQUALS(actor.GetRendererAt(2), renderer3, TEST_LOCATION);
4698 DALI_TEST_EQUALS(actor.AddRenderer(renderer2), 1U, TEST_LOCATION);
4699 DALI_TEST_EQUALS(actor.GetRendererCount(), 3u, TEST_LOCATION);
4700 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer1, TEST_LOCATION);
4701 DALI_TEST_EQUALS(actor.GetRendererAt(1), renderer2, TEST_LOCATION);
4702 DALI_TEST_EQUALS(actor.GetRendererAt(2), renderer3, TEST_LOCATION);
4707 int UtcDaliActorAddRendererN01(void)
4709 tet_infoline("Testing Actor::AddRenderer");
4710 TestApplication application;
4712 Actor actor = Actor::New();
4718 actor.AddRenderer(renderer);
4719 tet_printf("Assertion test failed - no Exception\n");
4720 tet_result(TET_FAIL);
4722 catch(Dali::DaliException& e)
4724 DALI_TEST_PRINT_ASSERT(e);
4725 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
4726 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4730 tet_printf("Assertion test failed - wrong Exception\n");
4731 tet_result(TET_FAIL);
4737 int UtcDaliActorAddRendererN02(void)
4739 tet_infoline("UtcDaliActorAddRendererN02");
4745 TestApplication application;
4747 Geometry geometry = CreateQuadGeometry();
4748 Shader shader = CreateShader();
4749 renderer = Renderer::New(geometry, shader);
4751 actor = Actor::New();
4754 // try illegal AddRenderer
4757 actor.AddRenderer(renderer);
4758 tet_printf("Assertion test failed - no Exception\n");
4759 tet_result(TET_FAIL);
4761 catch(Dali::DaliException& e)
4763 DALI_TEST_PRINT_ASSERT(e);
4764 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
4768 tet_printf("Assertion test failed - wrong Exception\n");
4769 tet_result(TET_FAIL);
4775 int UtcDaliActorAddRendererOnScene(void)
4777 tet_infoline("Testing Actor::AddRenderer");
4778 TestApplication application;
4780 Actor actor = Actor::New();
4781 application.GetScene().Add(actor);
4783 application.SendNotification();
4784 application.Render(0);
4786 Geometry geometry = CreateQuadGeometry();
4787 Shader shader = CreateShader();
4788 Renderer renderer = Renderer::New(geometry, shader);
4790 application.SendNotification();
4791 application.Render(0);
4795 actor.AddRenderer(renderer);
4796 tet_result(TET_PASS);
4800 tet_result(TET_FAIL);
4806 int UtcDaliActorRemoveRendererP1(void)
4808 tet_infoline("Testing Actor::RemoveRenderer");
4809 TestApplication application;
4811 Actor actor = Actor::New();
4813 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4816 Geometry geometry = CreateQuadGeometry();
4817 Shader shader = CreateShader();
4818 Renderer renderer = Renderer::New(geometry, shader);
4820 actor.AddRenderer(renderer);
4821 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4822 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4824 application.SendNotification();
4825 application.Render();
4829 Renderer renderer = actor.GetRendererAt(0);
4830 actor.RemoveRenderer(renderer);
4831 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4833 application.SendNotification();
4834 application.Render();
4837 // Call one final time to ensure that the renderer is actually removed after
4838 // the handle goes out of scope, and excercises the deletion code path in
4839 // scene graph and render.
4840 application.SendNotification();
4841 application.Render();
4846 int UtcDaliActorRemoveRendererP2(void)
4848 tet_infoline("Testing Actor::RemoveRenderer");
4849 TestApplication application;
4851 Actor actor = Actor::New();
4853 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4855 Geometry geometry = CreateQuadGeometry();
4856 Shader shader = CreateShader();
4857 Renderer renderer = Renderer::New(geometry, shader);
4859 actor.AddRenderer(renderer);
4860 application.SendNotification();
4861 application.Render();
4863 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4864 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4866 actor.RemoveRenderer(0);
4867 application.SendNotification();
4868 application.Render();
4870 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4872 // Shut down whilst holding onto the renderer handle.
4876 int UtcDaliActorRemoveRendererP3(void)
4878 tet_infoline("Testing Actor::RemoveRenderer");
4879 TestApplication application;
4881 Actor actor1 = Actor::New();
4882 Actor actor2 = Actor::New();
4883 Actor actor3 = Actor::New();
4885 application.GetScene().Add(actor1);
4886 application.GetScene().Add(actor2);
4887 application.GetScene().Add(actor3);
4889 // Make each actors size bigger than zero, so we can assuem that actor is rendered
4890 actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4891 actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4892 actor3.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4894 // Register some dummy property to seperate actor1 and actor2 in Render::Renderer
4895 actor1.RegisterProperty("dummy1", 1);
4896 actor2.RegisterProperty("dummy2", 2.0f);
4897 actor3.RegisterProperty("dummy3", Vector2(3.0f, 4.0f));
4899 DALI_TEST_EQUALS(actor1.GetRendererCount(), 0u, TEST_LOCATION);
4900 DALI_TEST_EQUALS(actor2.GetRendererCount(), 0u, TEST_LOCATION);
4901 DALI_TEST_EQUALS(actor3.GetRendererCount(), 0u, TEST_LOCATION);
4903 Geometry geometry = CreateQuadGeometry();
4904 Shader shader = CreateShader();
4905 Renderer renderer1 = Renderer::New(geometry, shader);
4906 Renderer renderer2 = Renderer::New(geometry, shader);
4908 actor1.AddRenderer(renderer1);
4909 actor1.AddRenderer(renderer2);
4910 actor2.AddRenderer(renderer1);
4911 actor2.AddRenderer(renderer2);
4912 actor3.AddRenderer(renderer1);
4913 actor3.AddRenderer(renderer2);
4914 application.SendNotification();
4915 application.Render();
4917 DALI_TEST_EQUALS(actor1.GetRendererCount(), 2u, TEST_LOCATION);
4918 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer1, TEST_LOCATION);
4919 DALI_TEST_EQUALS(actor1.GetRendererAt(1), renderer2, TEST_LOCATION);
4921 DALI_TEST_EQUALS(actor2.GetRendererCount(), 2u, TEST_LOCATION);
4922 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4923 DALI_TEST_EQUALS(actor2.GetRendererAt(1), renderer2, TEST_LOCATION);
4925 DALI_TEST_EQUALS(actor3.GetRendererCount(), 2u, TEST_LOCATION);
4926 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer1, TEST_LOCATION);
4927 DALI_TEST_EQUALS(actor3.GetRendererAt(1), renderer2, TEST_LOCATION);
4929 actor1.RemoveRenderer(0);
4930 actor2.RemoveRenderer(1);
4931 actor3.RemoveRenderer(0);
4932 application.SendNotification();
4933 application.Render();
4935 DALI_TEST_EQUALS(actor1.GetRendererCount(), 1u, TEST_LOCATION);
4936 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer2, TEST_LOCATION);
4937 DALI_TEST_EQUALS(actor2.GetRendererCount(), 1u, TEST_LOCATION);
4938 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4939 DALI_TEST_EQUALS(actor3.GetRendererCount(), 1u, TEST_LOCATION);
4940 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer2, TEST_LOCATION);
4942 // Shut down whilst holding onto the renderer handle.
4946 int UtcDaliActorRemoveRendererN(void)
4948 tet_infoline("Testing Actor::RemoveRenderer");
4949 TestApplication application;
4951 Actor actor = Actor::New();
4953 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4955 Geometry geometry = CreateQuadGeometry();
4956 Shader shader = CreateShader();
4957 Renderer renderer = Renderer::New(geometry, shader);
4959 actor.AddRenderer(renderer);
4960 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4961 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4963 actor.RemoveRenderer(10);
4964 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4965 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4970 int UtcDaliActorPropertyClippingP(void)
4972 // This test checks the clippingMode property.
4973 tet_infoline("Testing Actor::Property::ClippingMode: P");
4974 TestApplication application;
4976 Actor actor = Actor::New();
4978 // Check default clippingEnabled value.
4979 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4982 bool getValueResult = getValue.Get(value);
4983 DALI_TEST_CHECK(getValueResult);
4987 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4990 // Check setting the property to the stencil mode.
4991 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4993 // Check the new value was set.
4994 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4995 getValueResult = getValue.Get(value);
4996 DALI_TEST_CHECK(getValueResult);
5000 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
5003 // Check setting the property to the scissor mode.
5004 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5006 // Check the new value was set.
5007 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
5008 getValueResult = getValue.Get(value);
5009 DALI_TEST_CHECK(getValueResult);
5013 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
5018 int UtcDaliActorPropertyClippingN(void)
5020 // Negative test case for Clipping.
5021 tet_infoline("Testing Actor::Property::ClippingMode: N");
5022 TestApplication application;
5024 Actor actor = Actor::New();
5026 // Check default clippingEnabled value.
5027 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
5030 bool getValueResult = getValue.Get(value);
5031 DALI_TEST_CHECK(getValueResult);
5035 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
5038 // Check setting an invalid property value won't change the current property value.
5039 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
5041 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
5042 getValueResult = getValue.Get(value);
5043 DALI_TEST_CHECK(getValueResult);
5047 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
5053 int UtcDaliActorPropertyClippingActor(void)
5055 // This test checks that an actor is correctly setup for clipping.
5056 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
5057 TestApplication application;
5059 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5060 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5061 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5062 size_t startIndex = 0u;
5064 // Create a clipping actor.
5065 Actor actorDepth1Clip = CreateActorWithContent16x16();
5066 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5067 application.GetScene().Add(actorDepth1Clip);
5069 // Gather the call trace.
5070 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5072 // Check we are writing to the color buffer.
5073 CheckColorMask(glAbstraction, true);
5075 // Check the stencil buffer was enabled.
5076 std::ostringstream oss;
5077 oss << std::hex << GL_STENCIL_TEST;
5078 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
5080 // Check the stencil buffer was cleared.
5081 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
5083 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
5084 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
5085 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
5086 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5091 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
5093 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
5094 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
5095 TestApplication application;
5097 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5098 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5099 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5100 size_t startIndex = 0u;
5102 // Create a clipping actor.
5103 Actor actorDepth1Clip = CreateActorWithContent16x16();
5104 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5105 application.GetScene().Add(actorDepth1Clip);
5107 // Gather the call trace.
5108 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5110 // Check we are writing to the color buffer.
5111 CheckColorMask(glAbstraction, true);
5113 // Check the stencil buffer was enabled.
5114 std::ostringstream oss;
5115 oss << std::hex << GL_STENCIL_TEST;
5116 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
5118 // Check the stencil buffer was cleared.
5119 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
5121 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
5122 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
5123 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
5124 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5126 // Now disable the clipping
5127 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
5129 // Gather the call trace.
5130 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5132 // Check the stencil buffer was disabled.
5133 std::ostringstream stencil;
5134 stencil << std::hex << GL_STENCIL_TEST;
5135 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", stencil.str()));
5137 // Ensure all values in stencil-mask are set to 1.
5139 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
5144 int UtcDaliActorPropertyClippingNestedChildren(void)
5146 // This test checks that a hierarchy of actors are clipped correctly by
5147 // writing to and reading from the correct bit-planes of the stencil buffer.
5148 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
5149 TestApplication application;
5150 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5151 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5152 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5154 // Create a clipping actor.
5155 Actor actorDepth1Clip = CreateActorWithContent16x16();
5156 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5157 application.GetScene().Add(actorDepth1Clip);
5159 // Create a child actor.
5160 Actor childDepth2 = CreateActorWithContent16x16();
5161 actorDepth1Clip.Add(childDepth2);
5163 // Create another clipping actor.
5164 Actor childDepth2Clip = CreateActorWithContent16x16();
5165 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5166 childDepth2.Add(childDepth2Clip);
5168 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
5169 // This tests the sort algorithm.
5170 Actor childDepth3 = CreateActorWithContent16x16();
5171 childDepth2Clip.Add(childDepth3);
5172 Actor childDepth4 = CreateActorWithContent16x16();
5173 childDepth3.Add(childDepth4);
5175 // Gather the call trace.
5176 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5178 // Check we are writing to the color buffer.
5179 CheckColorMask(glAbstraction, true);
5181 // Check the stencil buffer was enabled.
5182 std::ostringstream oss;
5183 oss << std::hex << GL_STENCIL_TEST;
5184 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
5186 // Perform the test twice, once for 2D layer, and once for 3D.
5187 for(unsigned int i = 0u; i < 2u; ++i)
5189 size_t startIndex = 0u;
5191 // Check the stencil buffer was cleared.
5192 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
5194 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
5195 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
5196 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
5197 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5199 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
5200 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 1", startIndex)); // 514 is GL_EQUAL
5201 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
5203 // Check we are set up to write to the second bitplane of the stencil buffer (only).
5204 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
5205 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
5206 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5208 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
5209 // (Both must be set to pass the check).
5210 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 3", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
5211 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
5213 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
5216 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
5217 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5224 int UtcDaliActorPropertyClippingActorDrawOrder(void)
5226 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
5227 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
5228 TestApplication application;
5229 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5230 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5232 /* We create a small tree of actors as follows:
5236 Clipping enabled -> B D
5240 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
5243 for(int i = 0; i < 5; ++i)
5245 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
5246 Actor actor = CreateRenderableActor(image);
5248 // Setup dimensions and position so actor is not skipped by culling.
5249 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
5250 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
5254 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5258 float b = i > 2 ? 1.0f : -1.0f;
5259 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
5265 // Enable clipping on the actor at the top of the left branch.
5266 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5268 // Build the scene graph.
5269 application.GetScene().Add(actors[0]);
5272 actors[0].Add(actors[1]);
5273 actors[1].Add(actors[2]);
5276 actors[0].Add(actors[3]);
5277 actors[3].Add(actors[4]);
5279 // Gather the call trace.
5280 enabledDisableTrace.Reset();
5281 enabledDisableTrace.Enable(true);
5282 application.SendNotification();
5283 application.Render();
5284 enabledDisableTrace.Enable(false);
5286 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
5288 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
5289 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
5291 size_t startIndex = 0u;
5292 std::ostringstream blend;
5293 blend << std::hex << GL_BLEND;
5294 std::ostringstream stencil;
5295 stencil << std::hex << GL_STENCIL_TEST;
5297 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", blend.str(), startIndex));
5298 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5299 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5301 // Swap the clipping actor from top of left branch to top of right branch.
5302 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
5303 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5305 // Gather the call trace.
5306 enabledDisableTrace.Reset();
5307 enabledDisableTrace.Enable(true);
5308 application.SendNotification();
5309 application.Render();
5310 enabledDisableTrace.Enable(false);
5312 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
5313 // This proves the draw order has remained the same.
5315 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5316 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5321 int UtcDaliActorPropertyScissorClippingActor01(void)
5323 // This test checks that an actor is correctly setup for clipping.
5324 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
5325 TestApplication application;
5327 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5328 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5329 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5331 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5332 const Vector2 imageSize(16.0f, 16.0f);
5334 // Create a clipping actor.
5335 Actor clippingActorA = CreateActorWithContent16x16();
5336 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5337 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5338 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5339 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5340 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5341 application.GetScene().Add(clippingActorA);
5343 // Gather the call trace.
5344 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5346 // Check we are writing to the color buffer.
5347 CheckColorMask(glAbstraction, true);
5349 // Check scissor test was enabled.
5351 std::ostringstream scissor;
5352 scissor << std::hex << GL_SCISSOR_TEST;
5353 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5355 // Check the scissor was set, and the coordinates are correct.
5356 std::stringstream compareParametersString;
5357 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
5358 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5360 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5361 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5363 // Gather the call trace.
5364 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5366 // Check the scissor was set, and the coordinates are correct.
5367 compareParametersString.str(std::string());
5368 compareParametersString.clear();
5369 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
5370 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5375 int UtcDaliActorPropertyScissorClippingActor02(void)
5377 // This test checks that an actor is correctly setup for clipping.
5378 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
5379 TestApplication application;
5381 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5382 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5383 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5385 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5386 const Vector2 actorSize(16.0f, 16.0f);
5388 // Create a clipping actor.
5389 Actor clippingActorA = CreateRenderableActor();
5390 clippingActorA[Actor::Property::SIZE] = actorSize;
5392 Renderer renderer = clippingActorA.GetRendererAt(0);
5393 DALI_TEST_CHECK(renderer);
5395 // Make Renderer opacity 0.
5396 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
5398 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5399 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5400 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5401 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5402 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5403 application.GetScene().Add(clippingActorA);
5405 // Gather the call trace.
5406 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5408 // Check we are writing to the color buffer.
5409 CheckColorMask(glAbstraction, true);
5411 // Check scissor test was enabled.
5413 std::ostringstream scissor;
5414 scissor << std::hex << GL_SCISSOR_TEST;
5415 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5417 // Check the scissor was set, and the coordinates are correct.
5418 std::stringstream compareParametersString;
5419 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5420 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5422 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5423 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5425 // Gather the call trace.
5426 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5428 // Check the scissor was set, and the coordinates are correct.
5429 compareParametersString.str(std::string());
5430 compareParametersString.clear();
5431 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5432 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5436 int UtcDaliActorPropertyScissorClippingActorWihtoutRenderer(void)
5438 // This test checks that an actor is correctly setup for clipping.
5439 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor without renderer");
5440 TestApplication application;
5442 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5443 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5444 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5446 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5447 const Vector2 actorSize(16.0f, 16.0f);
5449 // Create a clipping actor without renderer
5450 Actor clippingActorA = Actor::New();
5451 clippingActorA[Actor::Property::SIZE] = actorSize;
5453 // Add dummy actor, to make application would be rendering.
5454 Actor dummyActor = CreateRenderableActor();
5455 dummyActor[Actor::Property::SIZE] = actorSize;
5456 clippingActorA.Add(dummyActor);
5458 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5459 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5460 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5461 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5462 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5463 application.GetScene().Add(clippingActorA);
5465 // Gather the call trace.
5466 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5468 // Check we are writing to the color buffer.
5469 CheckColorMask(glAbstraction, true);
5471 // Check scissor test was enabled.
5473 std::ostringstream scissor;
5474 scissor << std::hex << GL_SCISSOR_TEST;
5475 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5477 // Check the scissor was set, and the coordinates are correct.
5478 std::stringstream compareParametersString;
5479 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5480 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5482 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5483 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5485 // Gather the call trace.
5486 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5488 // Check the scissor was set, and the coordinates are correct.
5489 compareParametersString.str(std::string());
5490 compareParametersString.clear();
5491 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5492 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5497 int UtcDaliActorPropertyScissorClippingActorWihtoutRendererUnderLayer3D(void)
5499 // This test checks that an actor is correctly setup for clipping.
5500 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor without renderer under layer 3d");
5501 TestApplication application;
5503 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5504 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5505 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5507 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5508 const Vector2 actorSize(16.0f, 16.0f);
5510 // Make root layer as LAYER_3D, to make we follow 3d flow.
5511 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
5513 // Create a clipping actor without renderer
5514 Actor clippingActorA = Actor::New();
5515 clippingActorA[Actor::Property::SIZE] = actorSize;
5517 // Add dummy actor, to make application would be rendering.
5518 Actor dummyActor = CreateRenderableActor();
5519 dummyActor[Actor::Property::SIZE] = actorSize;
5520 clippingActorA.Add(dummyActor);
5522 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5523 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5524 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5525 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5526 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5527 application.GetScene().Add(clippingActorA);
5529 // Gather the call trace.
5530 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5532 // Check we are writing to the color buffer.
5533 CheckColorMask(glAbstraction, true);
5535 // Check scissor test was enabled.
5537 std::ostringstream scissor;
5538 scissor << std::hex << GL_SCISSOR_TEST;
5539 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5541 // Check the scissor was set, and the coordinates are correct.
5542 std::stringstream compareParametersString;
5543 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5544 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5546 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5547 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5549 // Gather the call trace.
5550 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5552 // Check the scissor was set, and the coordinates are correct.
5553 compareParametersString.str(std::string());
5554 compareParametersString.clear();
5555 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5556 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5561 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
5563 // This test checks that an actor is correctly setup for clipping.
5564 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
5565 TestApplication application;
5567 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5568 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5569 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5571 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5572 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5573 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5575 // Create a clipping actors.
5576 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5577 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5579 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5580 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5581 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5583 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5584 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5585 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5587 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5588 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5590 application.GetScene().Add(clippingActorA);
5591 application.GetScene().Add(clippingActorB);
5593 // Gather the call trace.
5594 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5596 // Check we are writing to the color buffer.
5597 CheckColorMask(glAbstraction, true);
5599 // Check scissor test was enabled.
5600 std::ostringstream scissor;
5601 scissor << std::hex << GL_SCISSOR_TEST;
5602 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5604 // Check the scissor was set, and the coordinates are correct.
5605 std::stringstream compareParametersString;
5607 std::string clipA("0, 500, 480, 200");
5608 std::string clipB("0, 380, 480, 40");
5610 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5611 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5616 int UtcDaliActorPropertyScissorClippingActorNested01(void)
5618 // This test checks that an actor is correctly setup for clipping.
5619 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5620 TestApplication application;
5622 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5623 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5624 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5626 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5627 const Vector2 imageSize(16.0f, 16.0f);
5629 /* Create a nest of 2 scissors to test nesting (intersecting clips).
5631 A is drawn first - with scissor clipping on
5632 B is drawn second - also with scissor clipping on
5633 C is the generated clipping region, the intersection ( A ∩ B )
5637 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
5638 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
5639 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
5643 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
5646 // Create a clipping actor.
5647 Actor clippingActorA = CreateActorWithContent16x16();
5648 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5649 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5650 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5651 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5652 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5653 application.GetScene().Add(clippingActorA);
5655 // Create a child clipping actor.
5656 Actor clippingActorB = CreateActorWithContent16x16();
5657 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5658 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5659 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5660 clippingActorA.Add(clippingActorB);
5662 // positionModifiers is an array of positions to position B around.
5663 // expect is an array of expected scissor clip coordinate results.
5664 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
5665 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
5667 // Loop through each overlap combination.
5668 for(unsigned int test = 0u; test < 4u; ++test)
5670 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
5671 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
5672 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
5674 // Gather the call trace.
5675 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5677 // Check we are writing to the color buffer.
5678 CheckColorMask(glAbstraction, true);
5680 // Check scissor test was enabled.
5681 std::ostringstream scissor;
5682 scissor << std::hex << GL_SCISSOR_TEST;
5683 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5685 // Check the scissor was set, and the coordinates are correct.
5686 const Vector4& expectResults(expect[test]);
5687 std::stringstream compareParametersString;
5688 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
5689 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
5695 int UtcDaliActorPropertyScissorClippingActorNested02(void)
5697 // This test checks that an actor is correctly setup for clipping.
5698 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5699 TestApplication application;
5701 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5702 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5703 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5705 /* Create a nest of 2 scissors and siblings of the parent.
5715 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5716 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5717 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5718 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
5719 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
5720 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
5722 // Create a clipping actors.
5723 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5724 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5725 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
5726 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
5727 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
5729 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5730 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5731 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5733 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5734 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5735 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5737 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5738 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5739 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5741 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5742 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5743 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5745 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5746 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5748 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5749 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5750 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
5751 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5752 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5754 application.GetScene().Add(clippingActorA);
5755 clippingActorA.Add(clippingActorB);
5756 application.GetScene().Add(clippingActorC);
5757 application.GetScene().Add(clippingActorD);
5758 clippingActorD.Add(clippingActorE);
5760 // Gather the call trace.
5761 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5763 // Check we are writing to the color buffer.
5764 CheckColorMask(glAbstraction, true);
5766 // Check scissor test was enabled.
5767 std::ostringstream scissor;
5768 scissor << std::hex << GL_SCISSOR_TEST;
5769 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5771 // Check the scissor was set, and the coordinates are correct.
5772 std::string clipA("0, 500, 480, 200");
5773 std::string clipB("0, 580, 480, 40");
5774 std::string clipC("0, 200, 480, 200");
5775 std::string clipD("0, 300, 480, 200");
5777 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5778 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5779 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
5780 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
5781 DALI_TEST_EQUALS(scissorTrace.CountMethod("Scissor"), 4, TEST_LOCATION); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
5786 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
5788 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
5789 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
5790 TestApplication application;
5792 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5793 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5794 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5796 // Create a clipping actor.
5797 Actor actorDepth1Clip = CreateActorWithContent16x16();
5798 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5799 application.GetScene().Add(actorDepth1Clip);
5801 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
5802 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
5804 // Gather the call trace.
5805 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5807 // Check we are writing to the color buffer.
5808 CheckColorMask(glAbstraction, true);
5810 // Check the stencil buffer was not enabled.
5811 std::ostringstream stencil;
5812 stencil << std::hex << GL_STENCIL_TEST;
5813 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", stencil.str()));
5815 // Check stencil functions are not called.
5816 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
5817 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
5819 // Check that scissor clipping is overriden by the renderer properties.
5820 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5822 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5824 // Gather the call trace.
5825 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5827 // Check the stencil buffer was not enabled.
5828 std::ostringstream scissor;
5829 scissor << std::hex << GL_SCISSOR_TEST;
5830 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5832 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
5837 int UtcDaliActorPropertyClippingActorCulled(void)
5839 // This test checks that child actors are clipped by an culled parent actor.
5840 tet_infoline("Testing child actors are clipped by an culled parent actor");
5841 TestApplication application;
5843 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5844 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5845 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5847 const Vector2 actorSize(160.0f, 160.0f);
5849 // Create a clipping actor.
5850 Actor clippingActorA = CreateRenderableActor();
5851 clippingActorA[Actor::Property::SIZE] = actorSize;
5853 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5854 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5855 clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5856 clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5857 clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
5858 application.GetScene().Add(clippingActorA);
5860 // Create a child actor
5861 Actor childActor = CreateRenderableActor();
5862 childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5863 childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5864 childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
5865 childActor[Actor::Property::INHERIT_POSITION] = false;
5867 // Gather the call trace.
5868 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5870 // Check scissor test was enabled.
5871 std::ostringstream scissor;
5872 scissor << std::hex << GL_SCISSOR_TEST;
5873 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5875 // Check the scissor was set, and the coordinates are correct.
5876 std::stringstream compareParametersString;
5877 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5878 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5880 // Move the clipping actor out of screen
5881 clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
5883 // Gather the call trace.
5884 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5886 // Check the scissor was set, and the coordinates are correct.
5887 compareParametersString.str(std::string());
5888 compareParametersString.clear();
5889 compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
5890 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
5895 int UtcDaliGetPropertyN(void)
5897 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
5898 TestApplication application;
5900 Actor actor = Actor::New();
5902 unsigned int propertyCount = actor.GetPropertyCount();
5903 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
5907 int UtcDaliActorRaiseLower(void)
5909 tet_infoline("UtcDaliActor Raise and Lower test\n");
5911 TestApplication application;
5913 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5914 Debug::Filter::EnableGlobalTrace();
5916 Integration::Scene stage(application.GetScene());
5918 Actor actorA = Actor::New();
5919 Actor actorB = Actor::New();
5920 Actor actorC = Actor::New();
5922 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5923 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5925 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5926 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5928 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5929 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5931 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5932 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5934 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5935 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5937 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5938 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5944 ResetTouchCallbacks();
5946 application.SendNotification();
5947 application.Render();
5949 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5950 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5951 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5953 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5954 // Only top actor will get touched.
5955 actorA.TouchedSignal().Connect(TestTouchCallback);
5956 actorB.TouchedSignal().Connect(TestTouchCallback2);
5957 actorC.TouchedSignal().Connect(TestTouchCallback3);
5959 // Connect ChildOrderChangedSignal
5960 bool orderChangedSignal(false);
5961 Actor orderChangedActor;
5962 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5963 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5965 Dali::Integration::Point point;
5966 point.SetDeviceId(1);
5967 point.SetState(PointState::DOWN);
5968 point.SetScreenPosition(Vector2(10.f, 10.f));
5969 Dali::Integration::TouchEvent touchEvent;
5970 touchEvent.AddPoint(point);
5972 application.ProcessEvent(touchEvent);
5974 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5975 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5976 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5978 ResetTouchCallbacks();
5980 tet_printf("Testing Raising of Actor\n");
5982 int preActorOrder(0);
5983 int postActorOrder(0);
5985 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5986 value.Get(preActorOrder);
5988 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5990 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5991 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5993 // Ensure sort order is calculated before next touch event
5994 application.SendNotification();
5996 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5997 value.Get(postActorOrder);
5999 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6001 application.ProcessEvent(touchEvent);
6003 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6004 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6005 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6007 ResetTouchCallbacks();
6009 tet_printf("Testing Lowering of Actor\n");
6011 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6012 value.Get(preActorOrder);
6014 orderChangedSignal = false;
6016 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6018 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6019 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6021 application.SendNotification(); // ensure sort order calculated before next touch event
6023 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6024 value.Get(postActorOrder);
6026 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6028 application.ProcessEvent(touchEvent);
6030 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6031 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6032 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6034 ResetTouchCallbacks();
6036 Debug::Filter::DisableGlobalTrace();
6037 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
6042 int UtcDaliActorGeoTouchRaiseLower(void)
6044 tet_infoline("UtcDaliActor Raise and Lower test\n");
6046 TestApplication application;
6048 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
6049 Debug::Filter::EnableGlobalTrace();
6051 Integration::Scene stage(application.GetScene());
6053 Actor actorA = Actor::New();
6054 Actor actorB = Actor::New();
6055 Actor actorC = Actor::New();
6057 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6058 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6060 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6061 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6063 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6064 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6066 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6067 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6069 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6070 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6072 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6073 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6079 application.GetScene().SetGeometryHittestEnabled(true);
6080 ResetTouchCallbacks(application);
6082 application.SendNotification();
6083 application.Render();
6085 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6086 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6087 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6089 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6090 // Only top actor will get touched.
6091 actorA.TouchedSignal().Connect(TestTouchCallback);
6092 actorB.TouchedSignal().Connect(TestTouchCallback2);
6093 actorC.TouchedSignal().Connect(TestTouchCallback3);
6095 // Connect ChildOrderChangedSignal
6096 bool orderChangedSignal(false);
6097 Actor orderChangedActor;
6098 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6099 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6101 Dali::Integration::Point point;
6102 point.SetDeviceId(1);
6103 point.SetState(PointState::DOWN);
6104 point.SetScreenPosition(Vector2(10.f, 10.f));
6105 Dali::Integration::TouchEvent touchEvent;
6106 touchEvent.AddPoint(point);
6108 application.ProcessEvent(touchEvent);
6110 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6111 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6112 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6114 ResetTouchCallbacks(application);
6116 tet_printf("Testing Raising of Actor\n");
6118 int preActorOrder(0);
6119 int postActorOrder(0);
6121 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6122 value.Get(preActorOrder);
6124 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6126 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6127 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6129 // Ensure sort order is calculated before next touch event
6130 application.SendNotification();
6132 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6133 value.Get(postActorOrder);
6135 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6137 application.ProcessEvent(touchEvent);
6139 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6140 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6141 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6143 ResetTouchCallbacks(application);
6145 tet_printf("Testing Lowering of Actor\n");
6147 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6148 value.Get(preActorOrder);
6150 orderChangedSignal = false;
6152 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6154 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6155 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6157 application.SendNotification(); // ensure sort order calculated before next touch event
6159 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6160 value.Get(postActorOrder);
6162 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6164 application.ProcessEvent(touchEvent);
6166 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6167 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6168 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6170 ResetTouchCallbacks(application);
6172 Debug::Filter::DisableGlobalTrace();
6173 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
6178 int UtcDaliActorRaiseToTopLowerToBottom(void)
6180 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
6182 TestApplication application;
6184 Integration::Scene stage(application.GetScene());
6186 Actor actorA = Actor::New();
6187 Actor actorB = Actor::New();
6188 Actor actorC = Actor::New();
6190 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6191 // enables checking of which actor the uniform is assigned too
6192 Shader shaderA = CreateShader();
6193 shaderA.RegisterProperty("uRendererColor", 1.f);
6195 Shader shaderB = CreateShader();
6196 shaderB.RegisterProperty("uRendererColor", 2.f);
6198 Shader shaderC = CreateShader();
6199 shaderC.RegisterProperty("uRendererColor", 3.f);
6201 Geometry geometry = CreateQuadGeometry();
6203 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6204 Renderer rendererA = Renderer::New(geometry, shaderA);
6205 actorA.AddRenderer(rendererA);
6207 Renderer rendererB = Renderer::New(geometry, shaderB);
6208 actorB.AddRenderer(rendererB);
6210 Renderer rendererC = Renderer::New(geometry, shaderC);
6211 actorC.AddRenderer(rendererC);
6213 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6214 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6216 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6217 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6219 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6220 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6222 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6223 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6225 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6226 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6228 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6229 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6235 ResetTouchCallbacks();
6237 // Connect ChildOrderChangedSignal
6238 bool orderChangedSignal(false);
6239 Actor orderChangedActor;
6240 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6241 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6243 // Set up gl abstraction trace so can query the set uniform order
6244 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6245 glAbstraction.EnableSetUniformCallTrace(true);
6246 glAbstraction.ResetSetUniformCallStack();
6248 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6250 application.SendNotification();
6251 application.Render();
6253 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
6255 // Test order of uniforms in stack
6256 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6257 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6258 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6260 bool CBA = (indexC > indexB) && (indexB > indexA);
6262 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6264 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6265 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6266 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6268 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6269 // Only top actor will get touched.
6270 actorA.TouchedSignal().Connect(TestTouchCallback);
6271 actorB.TouchedSignal().Connect(TestTouchCallback2);
6272 actorC.TouchedSignal().Connect(TestTouchCallback3);
6274 Dali::Integration::Point point;
6275 point.SetDeviceId(1);
6276 point.SetState(PointState::DOWN);
6277 point.SetScreenPosition(Vector2(10.f, 10.f));
6278 Dali::Integration::TouchEvent touchEvent;
6279 touchEvent.AddPoint(point);
6281 application.ProcessEvent(touchEvent);
6283 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6284 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6285 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6287 ResetTouchCallbacks();
6289 tet_printf("RaiseToTop ActorA\n");
6291 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6292 actorA.RaiseToTop();
6293 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6294 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6296 application.SendNotification(); // ensure sorting order is calculated before next touch event
6298 application.ProcessEvent(touchEvent);
6300 glSetUniformStack.Reset();
6302 application.SendNotification();
6303 application.Render();
6305 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6307 // Test order of uniforms in stack
6308 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6309 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6310 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6312 tet_infoline("Testing A above C and B at bottom\n");
6313 bool ACB = (indexA > indexC) && (indexC > indexB);
6315 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
6317 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6318 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6319 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6321 ResetTouchCallbacks();
6323 tet_printf("RaiseToTop ActorB\n");
6325 orderChangedSignal = false;
6327 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6328 actorB.RaiseToTop();
6329 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6330 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6332 application.SendNotification(); // Ensure sort order is calculated before next touch event
6334 application.ProcessEvent(touchEvent);
6336 glSetUniformStack.Reset();
6338 application.SendNotification();
6339 application.Render();
6341 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6343 // Test order of uniforms in stack
6344 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6345 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6346 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6348 tet_infoline("Testing B above A and C at bottom\n");
6349 bool BAC = (indexB > indexA) && (indexA > indexC);
6351 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
6353 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6354 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6355 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6357 ResetTouchCallbacks();
6359 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
6361 orderChangedSignal = false;
6363 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6364 actorA.LowerToBottom();
6365 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6366 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6368 application.SendNotification();
6369 application.Render();
6371 orderChangedSignal = false;
6373 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6374 actorB.LowerToBottom();
6375 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6376 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6378 application.SendNotification();
6379 application.Render();
6381 application.ProcessEvent(touchEvent);
6383 glSetUniformStack.Reset();
6385 application.SendNotification();
6386 application.Render();
6388 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6390 // Test order of uniforms in stack
6391 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6392 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6393 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6395 tet_infoline("Testing C above A and B at bottom\n");
6396 bool CAB = (indexC > indexA) && (indexA > indexB);
6398 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
6400 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6401 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6402 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6404 ResetTouchCallbacks();
6409 int UtcDaliActorGeoTouchRaiseToTopLowerToBottom(void)
6411 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
6413 TestApplication application;
6415 Integration::Scene stage(application.GetScene());
6417 Actor actorA = Actor::New();
6418 Actor actorB = Actor::New();
6419 Actor actorC = Actor::New();
6421 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6422 // enables checking of which actor the uniform is assigned too
6423 Shader shaderA = CreateShader();
6424 shaderA.RegisterProperty("uRendererColor", 1.f);
6426 Shader shaderB = CreateShader();
6427 shaderB.RegisterProperty("uRendererColor", 2.f);
6429 Shader shaderC = CreateShader();
6430 shaderC.RegisterProperty("uRendererColor", 3.f);
6432 Geometry geometry = CreateQuadGeometry();
6434 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6435 Renderer rendererA = Renderer::New(geometry, shaderA);
6436 actorA.AddRenderer(rendererA);
6438 Renderer rendererB = Renderer::New(geometry, shaderB);
6439 actorB.AddRenderer(rendererB);
6441 Renderer rendererC = Renderer::New(geometry, shaderC);
6442 actorC.AddRenderer(rendererC);
6444 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6445 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6447 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6448 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6450 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6451 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6453 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6454 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6456 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6457 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6459 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6460 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6466 application.GetScene().SetGeometryHittestEnabled(true);
6467 ResetTouchCallbacks(application);
6469 // Connect ChildOrderChangedSignal
6470 bool orderChangedSignal(false);
6471 Actor orderChangedActor;
6472 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6473 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6475 // Set up gl abstraction trace so can query the set uniform order
6476 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6477 glAbstraction.EnableSetUniformCallTrace(true);
6478 glAbstraction.ResetSetUniformCallStack();
6480 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6482 application.SendNotification();
6483 application.Render();
6485 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
6487 // Test order of uniforms in stack
6488 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6489 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6490 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6492 bool CBA = (indexC > indexB) && (indexB > indexA);
6494 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6496 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6497 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6498 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6500 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6501 // Only top actor will get touched.
6502 actorA.TouchedSignal().Connect(TestTouchCallback);
6503 actorB.TouchedSignal().Connect(TestTouchCallback2);
6504 actorC.TouchedSignal().Connect(TestTouchCallback3);
6506 Dali::Integration::Point point;
6507 point.SetDeviceId(1);
6508 point.SetState(PointState::DOWN);
6509 point.SetScreenPosition(Vector2(10.f, 10.f));
6510 Dali::Integration::TouchEvent touchEvent;
6511 touchEvent.AddPoint(point);
6513 application.ProcessEvent(touchEvent);
6515 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6516 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6517 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6519 ResetTouchCallbacks(application);
6521 tet_printf("RaiseToTop ActorA\n");
6523 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6524 actorA.RaiseToTop();
6525 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6526 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6528 application.SendNotification(); // ensure sorting order is calculated before next touch event
6530 application.ProcessEvent(touchEvent);
6532 glSetUniformStack.Reset();
6534 application.SendNotification();
6535 application.Render();
6537 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6539 // Test order of uniforms in stack
6540 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6541 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6542 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6544 tet_infoline("Testing A above C and B at bottom\n");
6545 bool ACB = (indexA > indexC) && (indexC > indexB);
6547 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
6549 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6550 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6551 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6553 ResetTouchCallbacks(application);
6555 tet_printf("RaiseToTop ActorB\n");
6557 orderChangedSignal = false;
6559 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6560 actorB.RaiseToTop();
6561 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6562 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6564 application.SendNotification(); // Ensure sort order is calculated before next touch event
6566 application.ProcessEvent(touchEvent);
6568 glSetUniformStack.Reset();
6570 application.SendNotification();
6571 application.Render();
6573 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6575 // Test order of uniforms in stack
6576 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6577 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6578 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6580 tet_infoline("Testing B above A and C at bottom\n");
6581 bool BAC = (indexB > indexA) && (indexA > indexC);
6583 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
6585 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6586 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6587 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6589 ResetTouchCallbacks(application);
6591 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
6593 orderChangedSignal = false;
6595 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6596 actorA.LowerToBottom();
6597 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6598 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6600 application.SendNotification();
6601 application.Render();
6603 orderChangedSignal = false;
6605 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6606 actorB.LowerToBottom();
6607 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6608 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6610 application.SendNotification();
6611 application.Render();
6613 application.ProcessEvent(touchEvent);
6615 glSetUniformStack.Reset();
6617 application.SendNotification();
6618 application.Render();
6620 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6622 // Test order of uniforms in stack
6623 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6624 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6625 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6627 tet_infoline("Testing C above A and B at bottom\n");
6628 bool CAB = (indexC > indexA) && (indexA > indexB);
6630 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
6632 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6633 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6634 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6636 ResetTouchCallbacks(application);
6641 int UtcDaliActorRaiseAbove(void)
6643 tet_infoline("UtcDaliActor RaiseToAbove test \n");
6645 TestApplication application;
6647 Integration::Scene stage(application.GetScene());
6649 Actor actorA = Actor::New();
6650 Actor actorB = Actor::New();
6651 Actor actorC = Actor::New();
6653 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6654 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6656 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6657 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6659 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6660 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6662 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6663 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6665 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6666 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6668 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6669 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6675 ResetTouchCallbacks();
6677 application.SendNotification();
6678 application.Render();
6680 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6681 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6682 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6684 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6685 // Only top actor will get touched.
6686 actorA.TouchedSignal().Connect(TestTouchCallback);
6687 actorB.TouchedSignal().Connect(TestTouchCallback2);
6688 actorC.TouchedSignal().Connect(TestTouchCallback3);
6690 bool orderChangedSignal(false);
6691 Actor orderChangedActor;
6692 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6693 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6695 Dali::Integration::Point point;
6696 point.SetDeviceId(1);
6697 point.SetState(PointState::DOWN);
6698 point.SetScreenPosition(Vector2(10.f, 10.f));
6699 Dali::Integration::TouchEvent touchEvent;
6700 touchEvent.AddPoint(point);
6702 application.ProcessEvent(touchEvent);
6704 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6705 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6706 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6708 ResetTouchCallbacks();
6710 tet_printf("Raise actor B Above Actor C\n");
6712 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6713 actorB.RaiseAbove(actorC);
6714 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6715 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6717 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6718 application.SendNotification();
6719 application.ProcessEvent(touchEvent);
6721 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6722 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6723 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6725 ResetTouchCallbacks();
6727 tet_printf("Raise actor A Above Actor B\n");
6729 orderChangedSignal = false;
6731 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6732 actorA.RaiseAbove(actorB);
6733 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6734 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6736 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6737 application.SendNotification();
6739 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6741 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6742 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6743 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6745 ResetTouchCallbacks();
6750 int UtcDaliActorGeoTouchRaiseAbove(void)
6752 tet_infoline("UtcDaliActor RaiseToAbove test \n");
6754 TestApplication application;
6756 Integration::Scene stage(application.GetScene());
6758 Actor actorA = Actor::New();
6759 Actor actorB = Actor::New();
6760 Actor actorC = Actor::New();
6762 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6763 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6765 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6766 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6768 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6769 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6771 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6772 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6774 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6775 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6777 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6778 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6784 application.GetScene().SetGeometryHittestEnabled(true);
6785 ResetTouchCallbacks(application);
6787 application.SendNotification();
6788 application.Render();
6790 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6791 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6792 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6794 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6795 // Only top actor will get touched.
6796 actorA.TouchedSignal().Connect(TestTouchCallback);
6797 actorB.TouchedSignal().Connect(TestTouchCallback2);
6798 actorC.TouchedSignal().Connect(TestTouchCallback3);
6800 bool orderChangedSignal(false);
6801 Actor orderChangedActor;
6802 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6803 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6805 Dali::Integration::Point point;
6806 point.SetDeviceId(1);
6807 point.SetState(PointState::DOWN);
6808 point.SetScreenPosition(Vector2(10.f, 10.f));
6809 Dali::Integration::TouchEvent touchEvent;
6810 touchEvent.AddPoint(point);
6812 application.ProcessEvent(touchEvent);
6814 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6815 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6816 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6818 ResetTouchCallbacks(application);
6820 tet_printf("Raise actor B Above Actor C\n");
6822 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6823 actorB.RaiseAbove(actorC);
6824 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6825 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6827 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6828 application.SendNotification();
6829 application.ProcessEvent(touchEvent);
6831 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6832 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6833 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6835 ResetTouchCallbacks(application);
6837 tet_printf("Raise actor A Above Actor B\n");
6839 orderChangedSignal = false;
6841 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6842 actorA.RaiseAbove(actorB);
6843 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6844 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6846 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6847 application.SendNotification();
6849 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6851 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6852 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6853 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6855 ResetTouchCallbacks(application);
6860 int UtcDaliActorRaiseAbove2(void)
6862 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
6864 TestApplication application;
6866 Integration::Scene stage(application.GetScene());
6868 Actor actorA = Actor::New();
6869 Actor actorB = Actor::New();
6870 Actor actorC = Actor::New();
6872 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6873 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6875 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6876 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6878 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6879 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6881 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6882 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6884 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6885 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6887 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6888 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6894 ResetTouchCallbacks();
6896 application.SendNotification();
6897 application.Render();
6899 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6900 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6901 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6903 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6904 // Only top actor will get touched.
6905 actorA.TouchedSignal().Connect(TestTouchCallback);
6906 actorB.TouchedSignal().Connect(TestTouchCallback2);
6907 actorC.TouchedSignal().Connect(TestTouchCallback3);
6909 bool orderChangedSignal(false);
6910 Actor orderChangedActor;
6911 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6912 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6914 Dali::Integration::Point point;
6915 point.SetDeviceId(1);
6916 point.SetState(PointState::DOWN);
6917 point.SetScreenPosition(Vector2(10.f, 10.f));
6918 Dali::Integration::TouchEvent touchEvent;
6919 touchEvent.AddPoint(point);
6921 application.ProcessEvent(touchEvent);
6923 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6924 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6925 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6927 ResetTouchCallbacks();
6929 tet_printf("Raise actor B Above Actor C\n");
6931 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6932 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
6933 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
6934 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6935 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6937 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6938 application.SendNotification();
6939 application.ProcessEvent(touchEvent);
6941 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6942 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6943 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6945 ResetTouchCallbacks();
6947 tet_printf("Raise actor A Above Actor B\n");
6949 orderChangedSignal = false;
6951 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6952 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
6953 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
6954 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6955 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6957 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6958 application.SendNotification();
6960 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6962 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6963 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6964 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6966 ResetTouchCallbacks();
6971 int UtcDaliActorGeoTouchRaiseAbove2(void)
6973 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
6975 TestApplication application;
6977 Integration::Scene stage(application.GetScene());
6979 Actor actorA = Actor::New();
6980 Actor actorB = Actor::New();
6981 Actor actorC = Actor::New();
6983 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6984 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6986 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6987 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6989 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6990 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6992 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6993 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6995 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6996 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6998 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6999 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7005 application.GetScene().SetGeometryHittestEnabled(true);
7006 ResetTouchCallbacks(application);
7008 application.SendNotification();
7009 application.Render();
7011 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7012 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7013 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7015 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7016 // Only top actor will get touched.
7017 actorA.TouchedSignal().Connect(TestTouchCallback);
7018 actorB.TouchedSignal().Connect(TestTouchCallback2);
7019 actorC.TouchedSignal().Connect(TestTouchCallback3);
7021 bool orderChangedSignal(false);
7022 Actor orderChangedActor;
7023 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7024 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
7026 Dali::Integration::Point point;
7027 point.SetDeviceId(1);
7028 point.SetState(PointState::DOWN);
7029 point.SetScreenPosition(Vector2(10.f, 10.f));
7030 Dali::Integration::TouchEvent touchEvent;
7031 touchEvent.AddPoint(point);
7033 application.ProcessEvent(touchEvent);
7035 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7036 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7037 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7039 ResetTouchCallbacks(application);
7041 tet_printf("Raise actor B Above Actor C\n");
7043 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7044 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
7045 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
7046 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7047 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7049 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7050 application.SendNotification();
7051 application.ProcessEvent(touchEvent);
7053 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7054 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7055 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7057 ResetTouchCallbacks(application);
7059 tet_printf("Raise actor A Above Actor B\n");
7061 orderChangedSignal = false;
7063 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7064 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
7065 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
7066 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7067 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
7069 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7070 application.SendNotification();
7072 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
7074 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
7075 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7076 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7078 ResetTouchCallbacks(application);
7083 int UtcDaliActorLowerBelow(void)
7085 tet_infoline("UtcDaliActor LowerBelow test \n");
7087 TestApplication application;
7089 Integration::Scene stage(application.GetScene());
7091 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7092 // enables checking of which actor the uniform is assigned too
7093 Shader shaderA = CreateShader();
7094 shaderA.RegisterProperty("uRendererColor", 1.f);
7096 Shader shaderB = CreateShader();
7097 shaderB.RegisterProperty("uRendererColor", 2.f);
7099 Shader shaderC = CreateShader();
7100 shaderC.RegisterProperty("uRendererColor", 3.f);
7102 Actor actorA = Actor::New();
7103 Actor actorB = Actor::New();
7104 Actor actorC = Actor::New();
7106 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7107 Geometry geometry = CreateQuadGeometry();
7109 Renderer rendererA = Renderer::New(geometry, shaderA);
7110 actorA.AddRenderer(rendererA);
7112 Renderer rendererB = Renderer::New(geometry, shaderB);
7113 actorB.AddRenderer(rendererB);
7115 Renderer rendererC = Renderer::New(geometry, shaderC);
7116 actorC.AddRenderer(rendererC);
7118 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7119 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7121 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7122 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7124 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7125 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7127 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7128 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7130 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7131 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7133 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7134 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7136 Actor container = Actor::New();
7137 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7138 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7139 stage.Add(container);
7141 container.Add(actorA);
7142 container.Add(actorB);
7143 container.Add(actorC);
7145 ResetTouchCallbacks();
7147 // Connect ChildOrderChangedSignal
7148 bool orderChangedSignal(false);
7149 Actor orderChangedActor;
7150 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7151 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7153 // Set up gl abstraction trace so can query the set uniform order
7154 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7155 glAbstraction.EnableSetUniformCallTrace(true);
7156 glAbstraction.ResetSetUniformCallStack();
7157 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7159 glAbstraction.ResetSetUniformCallStack();
7161 application.SendNotification();
7162 application.Render();
7164 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7166 // Test order of uniforms in stack
7167 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7168 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7169 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7171 tet_infoline("Testing C above B and A at bottom\n");
7172 bool CBA = (indexC > indexB) && (indexB > indexA);
7174 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7176 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7177 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7178 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7180 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7181 // Only top actor will get touched.
7182 actorA.TouchedSignal().Connect(TestTouchCallback);
7183 actorB.TouchedSignal().Connect(TestTouchCallback2);
7184 actorC.TouchedSignal().Connect(TestTouchCallback3);
7186 Dali::Integration::Point point;
7187 point.SetDeviceId(1);
7188 point.SetState(PointState::DOWN);
7189 point.SetScreenPosition(Vector2(10.f, 10.f));
7190 Dali::Integration::TouchEvent touchEvent;
7191 touchEvent.AddPoint(point);
7193 tet_infoline("UtcDaliActor Test Set up completed \n");
7195 application.ProcessEvent(touchEvent);
7197 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7198 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7199 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7201 ResetTouchCallbacks();
7203 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");
7205 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7206 actorC.LowerBelow(actorB);
7207 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7208 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7210 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7211 application.SendNotification();
7212 application.Render();
7214 application.ProcessEvent(touchEvent); // touch event
7216 glSetUniformStack.Reset();
7218 application.SendNotification();
7219 application.Render();
7221 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7223 // Test order of uniforms in stack
7224 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7225 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7226 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7228 tet_infoline("Testing render order is A, C, B");
7229 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7230 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7232 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7233 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7234 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7236 ResetTouchCallbacks();
7238 tet_printf("Lower actor C below Actor A leaving B on top\n");
7240 orderChangedSignal = false;
7242 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7243 actorC.LowerBelow(actorA);
7244 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7245 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7247 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7248 application.SendNotification();
7249 application.Render();
7251 application.ProcessEvent(touchEvent);
7253 glSetUniformStack.Reset();
7255 application.Render();
7256 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7258 // Test order of uniforms in stack
7259 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7260 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7261 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7263 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7264 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7266 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7267 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7268 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7270 ResetTouchCallbacks();
7272 tet_printf("Lower actor B below Actor C leaving A on top\n");
7274 orderChangedSignal = false;
7276 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7277 actorB.LowerBelow(actorC);
7278 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7279 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7281 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7282 application.SendNotification();
7283 application.Render();
7285 application.ProcessEvent(touchEvent);
7287 glSetUniformStack.Reset();
7289 application.Render();
7290 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7292 // Test order of uniforms in stack
7293 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7294 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7295 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7297 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7298 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7303 int UtcDaliActorGeoTouchLowerBelow(void)
7305 tet_infoline("UtcDaliActor LowerBelow test \n");
7307 TestApplication application;
7309 Integration::Scene stage(application.GetScene());
7311 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7312 // enables checking of which actor the uniform is assigned too
7313 Shader shaderA = CreateShader();
7314 shaderA.RegisterProperty("uRendererColor", 1.f);
7316 Shader shaderB = CreateShader();
7317 shaderB.RegisterProperty("uRendererColor", 2.f);
7319 Shader shaderC = CreateShader();
7320 shaderC.RegisterProperty("uRendererColor", 3.f);
7322 Actor actorA = Actor::New();
7323 Actor actorB = Actor::New();
7324 Actor actorC = Actor::New();
7326 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7327 Geometry geometry = CreateQuadGeometry();
7329 Renderer rendererA = Renderer::New(geometry, shaderA);
7330 actorA.AddRenderer(rendererA);
7332 Renderer rendererB = Renderer::New(geometry, shaderB);
7333 actorB.AddRenderer(rendererB);
7335 Renderer rendererC = Renderer::New(geometry, shaderC);
7336 actorC.AddRenderer(rendererC);
7338 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7339 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7341 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7342 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7344 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7345 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7347 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7348 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7350 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7351 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7353 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7354 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7356 Actor container = Actor::New();
7357 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7358 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7359 stage.Add(container);
7361 container.Add(actorA);
7362 container.Add(actorB);
7363 container.Add(actorC);
7365 application.GetScene().SetGeometryHittestEnabled(true);
7366 ResetTouchCallbacks(application);
7368 // Connect ChildOrderChangedSignal
7369 bool orderChangedSignal(false);
7370 Actor orderChangedActor;
7371 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7372 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7374 // Set up gl abstraction trace so can query the set uniform order
7375 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7376 glAbstraction.EnableSetUniformCallTrace(true);
7377 glAbstraction.ResetSetUniformCallStack();
7378 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7380 glAbstraction.ResetSetUniformCallStack();
7382 application.SendNotification();
7383 application.Render();
7385 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7387 // Test order of uniforms in stack
7388 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7389 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7390 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7392 tet_infoline("Testing C above B and A at bottom\n");
7393 bool CBA = (indexC > indexB) && (indexB > indexA);
7395 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7397 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7398 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7399 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7401 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7402 // Only top actor will get touched.
7403 actorA.TouchedSignal().Connect(TestTouchCallback);
7404 actorB.TouchedSignal().Connect(TestTouchCallback2);
7405 actorC.TouchedSignal().Connect(TestTouchCallback3);
7407 Dali::Integration::Point point;
7408 point.SetDeviceId(1);
7409 point.SetState(PointState::DOWN);
7410 point.SetScreenPosition(Vector2(10.f, 10.f));
7411 Dali::Integration::TouchEvent touchEvent;
7412 touchEvent.AddPoint(point);
7414 tet_infoline("UtcDaliActor Test Set up completed \n");
7416 application.ProcessEvent(touchEvent);
7418 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7419 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7420 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7422 ResetTouchCallbacks(application);
7424 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");
7426 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7427 actorC.LowerBelow(actorB);
7428 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7429 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7431 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7432 application.SendNotification();
7433 application.Render();
7435 application.ProcessEvent(touchEvent); // touch event
7437 glSetUniformStack.Reset();
7439 application.SendNotification();
7440 application.Render();
7442 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7444 // Test order of uniforms in stack
7445 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7446 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7447 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7449 tet_infoline("Testing render order is A, C, B");
7450 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7451 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7453 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7454 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7455 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7457 ResetTouchCallbacks(application);
7459 tet_printf("Lower actor C below Actor A leaving B on top\n");
7461 orderChangedSignal = false;
7463 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7464 actorC.LowerBelow(actorA);
7465 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7466 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7468 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7469 application.SendNotification();
7470 application.Render();
7472 application.ProcessEvent(touchEvent);
7474 glSetUniformStack.Reset();
7476 application.Render();
7477 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7479 // Test order of uniforms in stack
7480 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7481 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7482 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7484 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7485 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7487 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7488 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7489 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7491 ResetTouchCallbacks(application);
7493 tet_printf("Lower actor B below Actor C leaving A on top\n");
7495 orderChangedSignal = false;
7497 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7498 actorB.LowerBelow(actorC);
7499 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7500 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7502 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7503 application.SendNotification();
7504 application.Render();
7506 application.ProcessEvent(touchEvent);
7508 glSetUniformStack.Reset();
7510 application.Render();
7511 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7513 // Test order of uniforms in stack
7514 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7515 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7516 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7518 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7519 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7524 int UtcDaliActorLowerBelow2(void)
7526 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
7528 TestApplication application;
7530 Integration::Scene stage(application.GetScene());
7532 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7533 // enables checking of which actor the uniform is assigned too
7534 Shader shaderA = CreateShader();
7535 shaderA.RegisterProperty("uRendererColor", 1.f);
7537 Shader shaderB = CreateShader();
7538 shaderB.RegisterProperty("uRendererColor", 2.f);
7540 Shader shaderC = CreateShader();
7541 shaderC.RegisterProperty("uRendererColor", 3.f);
7543 Actor actorA = Actor::New();
7544 Actor actorB = Actor::New();
7545 Actor actorC = Actor::New();
7547 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7548 Geometry geometry = CreateQuadGeometry();
7550 Renderer rendererA = Renderer::New(geometry, shaderA);
7551 actorA.AddRenderer(rendererA);
7553 Renderer rendererB = Renderer::New(geometry, shaderB);
7554 actorB.AddRenderer(rendererB);
7556 Renderer rendererC = Renderer::New(geometry, shaderC);
7557 actorC.AddRenderer(rendererC);
7559 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7560 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7562 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7563 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7565 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7566 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7568 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7569 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7571 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7572 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7574 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7575 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7577 Actor container = Actor::New();
7578 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7579 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7580 stage.Add(container);
7582 container.Add(actorA);
7583 container.Add(actorB);
7584 container.Add(actorC);
7586 ResetTouchCallbacks();
7588 // Connect ChildOrderChangedSignal
7589 bool orderChangedSignal(false);
7590 Actor orderChangedActor;
7591 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7592 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7594 // Set up gl abstraction trace so can query the set uniform order
7595 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7596 glAbstraction.EnableSetUniformCallTrace(true);
7597 glAbstraction.ResetSetUniformCallStack();
7598 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7600 glAbstraction.ResetSetUniformCallStack();
7602 application.SendNotification();
7603 application.Render();
7605 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7607 // Test order of uniforms in stack
7608 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7609 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7610 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7612 tet_infoline("Testing C above B and A at bottom\n");
7613 bool CBA = (indexC > indexB) && (indexB > indexA);
7615 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7617 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7618 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7619 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7621 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7622 // Only top actor will get touched.
7623 actorA.TouchedSignal().Connect(TestTouchCallback);
7624 actorB.TouchedSignal().Connect(TestTouchCallback2);
7625 actorC.TouchedSignal().Connect(TestTouchCallback3);
7627 Dali::Integration::Point point;
7628 point.SetDeviceId(1);
7629 point.SetState(PointState::DOWN);
7630 point.SetScreenPosition(Vector2(10.f, 10.f));
7631 Dali::Integration::TouchEvent touchEvent;
7632 touchEvent.AddPoint(point);
7634 tet_infoline("UtcDaliActor Test Set up completed \n");
7636 application.ProcessEvent(touchEvent);
7638 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7639 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7640 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7642 ResetTouchCallbacks();
7644 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");
7646 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7647 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
7648 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7649 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7651 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7652 application.SendNotification();
7653 application.Render();
7655 application.ProcessEvent(touchEvent); // touch event
7657 glSetUniformStack.Reset();
7659 application.SendNotification();
7660 application.Render();
7662 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7664 // Test order of uniforms in stack
7665 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7666 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7667 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7669 tet_infoline("Testing render order is A, C, B");
7670 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7671 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7673 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7674 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7675 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7677 ResetTouchCallbacks();
7679 tet_printf("Lower actor C below Actor A leaving B on top\n");
7681 orderChangedSignal = false;
7683 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7684 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
7685 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7686 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7688 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7689 application.SendNotification();
7690 application.Render();
7692 application.ProcessEvent(touchEvent);
7694 glSetUniformStack.Reset();
7696 application.Render();
7697 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7699 // Test order of uniforms in stack
7700 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7701 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7702 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7704 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7705 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7707 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7708 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7709 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7711 ResetTouchCallbacks();
7713 tet_printf("Lower actor B below Actor C leaving A on top\n");
7715 orderChangedSignal = false;
7717 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7718 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
7719 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7720 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7722 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7723 application.SendNotification();
7724 application.Render();
7726 application.ProcessEvent(touchEvent);
7728 glSetUniformStack.Reset();
7730 application.Render();
7731 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7733 // Test order of uniforms in stack
7734 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7735 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7736 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7738 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7739 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7744 int UtcDaliActorGeoTouchLowerBelow2(void)
7746 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
7748 TestApplication application;
7750 Integration::Scene stage(application.GetScene());
7752 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7753 // enables checking of which actor the uniform is assigned too
7754 Shader shaderA = CreateShader();
7755 shaderA.RegisterProperty("uRendererColor", 1.f);
7757 Shader shaderB = CreateShader();
7758 shaderB.RegisterProperty("uRendererColor", 2.f);
7760 Shader shaderC = CreateShader();
7761 shaderC.RegisterProperty("uRendererColor", 3.f);
7763 Actor actorA = Actor::New();
7764 Actor actorB = Actor::New();
7765 Actor actorC = Actor::New();
7767 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7768 Geometry geometry = CreateQuadGeometry();
7770 Renderer rendererA = Renderer::New(geometry, shaderA);
7771 actorA.AddRenderer(rendererA);
7773 Renderer rendererB = Renderer::New(geometry, shaderB);
7774 actorB.AddRenderer(rendererB);
7776 Renderer rendererC = Renderer::New(geometry, shaderC);
7777 actorC.AddRenderer(rendererC);
7779 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7780 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7782 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7783 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7785 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7786 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7788 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7789 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7791 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7792 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7794 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7795 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7797 Actor container = Actor::New();
7798 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7799 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7800 stage.Add(container);
7802 container.Add(actorA);
7803 container.Add(actorB);
7804 container.Add(actorC);
7806 application.GetScene().SetGeometryHittestEnabled(true);
7807 ResetTouchCallbacks(application);
7809 // Connect ChildOrderChangedSignal
7810 bool orderChangedSignal(false);
7811 Actor orderChangedActor;
7812 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7813 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7815 // Set up gl abstraction trace so can query the set uniform order
7816 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7817 glAbstraction.EnableSetUniformCallTrace(true);
7818 glAbstraction.ResetSetUniformCallStack();
7819 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7821 glAbstraction.ResetSetUniformCallStack();
7823 application.SendNotification();
7824 application.Render();
7826 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7828 // Test order of uniforms in stack
7829 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7830 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7831 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7833 tet_infoline("Testing C above B and A at bottom\n");
7834 bool CBA = (indexC > indexB) && (indexB > indexA);
7836 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7838 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7839 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7840 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7842 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7843 // Only top actor will get touched.
7844 actorA.TouchedSignal().Connect(TestTouchCallback);
7845 actorB.TouchedSignal().Connect(TestTouchCallback2);
7846 actorC.TouchedSignal().Connect(TestTouchCallback3);
7848 Dali::Integration::Point point;
7849 point.SetDeviceId(1);
7850 point.SetState(PointState::DOWN);
7851 point.SetScreenPosition(Vector2(10.f, 10.f));
7852 Dali::Integration::TouchEvent touchEvent;
7853 touchEvent.AddPoint(point);
7855 tet_infoline("UtcDaliActor Test Set up completed \n");
7857 application.ProcessEvent(touchEvent);
7859 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7860 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7861 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7863 ResetTouchCallbacks(application);
7865 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");
7867 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7868 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
7869 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7870 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7872 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7873 application.SendNotification();
7874 application.Render();
7876 application.ProcessEvent(touchEvent); // touch event
7878 glSetUniformStack.Reset();
7880 application.SendNotification();
7881 application.Render();
7883 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7885 // Test order of uniforms in stack
7886 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7887 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7888 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7890 tet_infoline("Testing render order is A, C, B");
7891 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7892 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7894 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7895 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7896 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7898 ResetTouchCallbacks(application);
7900 tet_printf("Lower actor C below Actor A leaving B on top\n");
7902 orderChangedSignal = false;
7904 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7905 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
7906 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7907 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7909 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7910 application.SendNotification();
7911 application.Render();
7913 application.ProcessEvent(touchEvent);
7915 glSetUniformStack.Reset();
7917 application.Render();
7918 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7920 // Test order of uniforms in stack
7921 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7922 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7923 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7925 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7926 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7928 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7929 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7930 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7932 ResetTouchCallbacks(application);
7934 tet_printf("Lower actor B below Actor C leaving A on top\n");
7936 orderChangedSignal = false;
7938 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7939 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
7940 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7941 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7943 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7944 application.SendNotification();
7945 application.Render();
7947 application.ProcessEvent(touchEvent);
7949 glSetUniformStack.Reset();
7951 application.Render();
7952 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7954 // Test order of uniforms in stack
7955 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7956 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7957 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7959 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7960 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7965 int UtcDaliActorRaiseAboveDifferentParentsN(void)
7967 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
7969 TestApplication application;
7971 Integration::Scene stage(application.GetScene());
7973 Actor parentA = Actor::New();
7974 Actor parentB = Actor::New();
7975 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7976 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7977 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7978 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7980 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7981 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7983 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7984 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7989 Actor actorA = Actor::New();
7990 Actor actorB = Actor::New();
7991 Actor actorC = Actor::New();
7993 parentA.Add(actorA);
7994 parentA.Add(actorB);
7996 tet_printf("Actor C added to different parent from A and B \n");
7997 parentB.Add(actorC);
7999 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8000 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8002 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8003 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8005 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8006 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8008 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8009 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8011 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8012 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8014 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8015 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8017 ResetTouchCallbacks();
8019 // Connect ChildOrderChangedSignal
8020 bool orderChangedSignal(false);
8021 Actor orderChangedActor;
8022 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8023 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8025 application.SendNotification();
8026 application.Render();
8028 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8029 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8030 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8032 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8033 // Only top actor will get touched.
8034 actorA.TouchedSignal().Connect(TestTouchCallback);
8035 actorB.TouchedSignal().Connect(TestTouchCallback2);
8036 actorC.TouchedSignal().Connect(TestTouchCallback3);
8038 Dali::Integration::Point point;
8039 point.SetDeviceId(1);
8040 point.SetState(PointState::DOWN);
8041 point.SetScreenPosition(Vector2(10.f, 10.f));
8042 Dali::Integration::TouchEvent touchEvent;
8043 touchEvent.AddPoint(point);
8045 application.ProcessEvent(touchEvent);
8047 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8048 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8049 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8051 ResetTouchCallbacks();
8053 tet_printf("Raise actor A Above Actor C which have different parents\n");
8055 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8056 actorA.RaiseAbove(actorC);
8057 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8059 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8060 application.SendNotification();
8062 application.ProcessEvent(touchEvent); // touch event
8064 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8065 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8066 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8068 ResetTouchCallbacks();
8073 int UtcDaliActorGeoTouchRaiseAboveDifferentParentsN(void)
8075 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
8077 TestApplication application;
8079 Integration::Scene stage(application.GetScene());
8081 Actor parentA = Actor::New();
8082 Actor parentB = Actor::New();
8083 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8084 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8085 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8086 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8088 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8089 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8091 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8092 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8097 Actor actorA = Actor::New();
8098 Actor actorB = Actor::New();
8099 Actor actorC = Actor::New();
8101 parentA.Add(actorA);
8102 parentA.Add(actorB);
8104 tet_printf("Actor C added to different parent from A and B \n");
8105 parentB.Add(actorC);
8107 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8108 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8110 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8111 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8113 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8114 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8116 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8117 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8119 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8120 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8122 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8123 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8125 application.GetScene().SetGeometryHittestEnabled(true);
8126 ResetTouchCallbacks(application);
8128 // Connect ChildOrderChangedSignal
8129 bool orderChangedSignal(false);
8130 Actor orderChangedActor;
8131 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8132 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8134 application.SendNotification();
8135 application.Render();
8137 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8138 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8139 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8141 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8142 // Only top actor will get touched.
8143 actorA.TouchedSignal().Connect(TestTouchCallback);
8144 actorB.TouchedSignal().Connect(TestTouchCallback2);
8145 actorC.TouchedSignal().Connect(TestTouchCallback3);
8147 Dali::Integration::Point point;
8148 point.SetDeviceId(1);
8149 point.SetState(PointState::DOWN);
8150 point.SetScreenPosition(Vector2(10.f, 10.f));
8151 Dali::Integration::TouchEvent touchEvent;
8152 touchEvent.AddPoint(point);
8154 application.ProcessEvent(touchEvent);
8156 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8157 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8158 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8160 ResetTouchCallbacks(application);
8162 tet_printf("Raise actor A Above Actor C which have different parents\n");
8164 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8165 actorA.RaiseAbove(actorC);
8166 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8168 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8169 application.SendNotification();
8171 application.ProcessEvent(touchEvent); // touch event
8173 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8174 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8175 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8177 ResetTouchCallbacks(application);
8182 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
8184 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
8186 TestApplication application;
8188 Integration::Scene stage(application.GetScene());
8190 Actor actorA = Actor::New();
8191 Actor actorB = Actor::New();
8192 Actor actorC = Actor::New();
8194 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8195 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8197 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8198 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8200 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8201 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8203 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8204 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8206 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8207 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8209 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8210 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8212 ResetTouchCallbacks();
8214 // Connect ChildOrderChangedSignal
8215 bool orderChangedSignal(false);
8216 Actor orderChangedActor;
8217 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8218 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8220 application.SendNotification();
8221 application.Render();
8223 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8224 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8225 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8227 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8228 // Only top actor will get touched.
8229 actorA.TouchedSignal().Connect(TestTouchCallback);
8230 actorB.TouchedSignal().Connect(TestTouchCallback2);
8231 actorC.TouchedSignal().Connect(TestTouchCallback3);
8233 Dali::Integration::Point point;
8234 point.SetDeviceId(1);
8235 point.SetState(PointState::DOWN);
8236 point.SetScreenPosition(Vector2(10.f, 10.f));
8237 Dali::Integration::TouchEvent touchEvent;
8238 touchEvent.AddPoint(point);
8240 tet_printf("Raise actor A Above Actor C which have no parents\n");
8242 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8243 actorA.RaiseAbove(actorC);
8244 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8246 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8247 application.SendNotification();
8249 application.ProcessEvent(touchEvent);
8251 tet_printf("Not parented so RaiseAbove should show no effect\n");
8253 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8254 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8255 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8257 ResetTouchCallbacks();
8259 orderChangedSignal = false;
8262 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
8264 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8265 actorA.LowerBelow(actorC);
8266 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8268 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8269 application.SendNotification();
8270 application.Render();
8272 application.ProcessEvent(touchEvent);
8274 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
8275 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8276 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8277 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8279 ResetTouchCallbacks();
8281 orderChangedSignal = false;
8283 tet_printf("Adding Actor A to stage, will be on top\n");
8286 application.SendNotification();
8287 application.Render();
8289 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
8291 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8292 actorB.RaiseAbove(actorC);
8293 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8295 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8296 application.SendNotification();
8298 application.ProcessEvent(touchEvent);
8300 tet_printf("C not parented so RaiseAbove should show no effect\n");
8301 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8302 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8303 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8305 ResetTouchCallbacks();
8307 orderChangedSignal = false;
8309 tet_printf("Lower actor A below Actor C when only A has a parent\n");
8311 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8312 actorA.LowerBelow(actorC);
8313 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8315 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8316 application.SendNotification();
8318 application.ProcessEvent(touchEvent);
8320 tet_printf("C not parented so LowerBelow should show no effect\n");
8321 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8322 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8323 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8325 ResetTouchCallbacks();
8327 orderChangedSignal = false;
8331 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8332 actorA.RaiseAbove(actorC);
8333 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8334 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8336 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8337 application.SendNotification();
8338 application.Render();
8340 application.ProcessEvent(touchEvent);
8342 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
8343 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8344 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8345 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8350 int UtcDaliActorGeoTouchRaiseLowerWhenUnparentedTargetN(void)
8352 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
8354 TestApplication application;
8356 Integration::Scene stage(application.GetScene());
8358 Actor actorA = Actor::New();
8359 Actor actorB = Actor::New();
8360 Actor actorC = Actor::New();
8362 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8363 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8365 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8366 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8368 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8369 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8371 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8372 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8374 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8375 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8377 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8378 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8380 application.GetScene().SetGeometryHittestEnabled(true);
8381 ResetTouchCallbacks(application);
8383 // Connect ChildOrderChangedSignal
8384 bool orderChangedSignal(false);
8385 Actor orderChangedActor;
8386 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8387 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8389 application.SendNotification();
8390 application.Render();
8392 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8393 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8394 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8396 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8397 // Only top actor will get touched.
8398 actorA.TouchedSignal().Connect(TestTouchCallback);
8399 actorB.TouchedSignal().Connect(TestTouchCallback2);
8400 actorC.TouchedSignal().Connect(TestTouchCallback3);
8402 Dali::Integration::Point point;
8403 point.SetDeviceId(1);
8404 point.SetState(PointState::DOWN);
8405 point.SetScreenPosition(Vector2(10.f, 10.f));
8406 Dali::Integration::TouchEvent touchEvent;
8407 touchEvent.AddPoint(point);
8409 tet_printf("Raise actor A Above Actor C which have no parents\n");
8411 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8412 actorA.RaiseAbove(actorC);
8413 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8415 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8416 application.SendNotification();
8418 application.ProcessEvent(touchEvent);
8420 tet_printf("Not parented so RaiseAbove should show no effect\n");
8422 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8423 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8424 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8426 ResetTouchCallbacks(application);
8428 orderChangedSignal = false;
8431 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
8433 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8434 actorA.LowerBelow(actorC);
8435 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8437 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8438 application.SendNotification();
8439 application.Render();
8441 application.ProcessEvent(touchEvent);
8443 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
8444 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8445 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8446 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8448 ResetTouchCallbacks(application);
8450 orderChangedSignal = false;
8452 tet_printf("Adding Actor A to stage, will be on top\n");
8455 application.SendNotification();
8456 application.Render();
8458 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
8460 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8461 actorB.RaiseAbove(actorC);
8462 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8464 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8465 application.SendNotification();
8467 application.ProcessEvent(touchEvent);
8469 tet_printf("C not parented so RaiseAbove should show no effect\n");
8470 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8471 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8472 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8474 ResetTouchCallbacks(application);
8476 orderChangedSignal = false;
8478 tet_printf("Lower actor A below Actor C when only A has a parent\n");
8480 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8481 actorA.LowerBelow(actorC);
8482 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8484 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8485 application.SendNotification();
8487 application.ProcessEvent(touchEvent);
8489 tet_printf("C not parented so LowerBelow should show no effect\n");
8490 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8491 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8492 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8494 ResetTouchCallbacks(application);
8496 orderChangedSignal = false;
8500 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8501 actorA.RaiseAbove(actorC);
8502 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8503 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8505 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8506 application.SendNotification();
8507 application.Render();
8509 application.ProcessEvent(touchEvent);
8511 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
8512 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8513 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8514 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8519 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
8521 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
8523 TestApplication application;
8525 Integration::Scene stage(application.GetScene());
8527 Actor actorA = Actor::New();
8528 Actor actorB = Actor::New();
8529 Actor actorC = Actor::New();
8531 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8532 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8534 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8535 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8537 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8538 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8540 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8541 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8543 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8544 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8546 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8547 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8549 ResetTouchCallbacks();
8551 // Connect ChildOrderChangedSignal
8552 bool orderChangedSignal(false);
8553 Actor orderChangedActor;
8554 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8555 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8557 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8558 // Only top actor will get touched.
8559 actorA.TouchedSignal().Connect(TestTouchCallback);
8560 actorB.TouchedSignal().Connect(TestTouchCallback2);
8561 actorC.TouchedSignal().Connect(TestTouchCallback3);
8563 Dali::Integration::Point point;
8564 point.SetDeviceId(1);
8565 point.SetState(PointState::DOWN);
8566 point.SetScreenPosition(Vector2(10.f, 10.f));
8567 Dali::Integration::TouchEvent touchEvent;
8568 touchEvent.AddPoint(point);
8571 tet_printf("Raise actor B Above Actor C but B not parented\n");
8573 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8575 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8577 application.SendNotification();
8578 application.Render();
8580 application.ProcessEvent(touchEvent);
8582 tet_printf("Not parented so RaiseAbove should show no effect\n");
8584 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8585 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8586 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8588 tet_printf("Raise actor B Above Actor C but B not parented\n");
8589 ResetTouchCallbacks();
8591 orderChangedSignal = false;
8593 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8595 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8597 // Sort actor tree before next touch event
8598 application.SendNotification();
8599 application.Render();
8601 application.ProcessEvent(touchEvent);
8603 tet_printf("Not parented so RaiseAbove should show no effect\n");
8605 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8606 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8607 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8608 ResetTouchCallbacks();
8610 orderChangedSignal = false;
8612 tet_printf("Lower actor C below B but C not parented\n");
8614 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8616 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8618 // Sort actor tree before next touch event
8619 application.SendNotification();
8620 application.Render();
8622 application.ProcessEvent(touchEvent);
8624 tet_printf("Not parented so Lower should show no effect\n");
8626 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8627 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8628 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8629 ResetTouchCallbacks();
8631 orderChangedSignal = false;
8633 tet_printf("Raise actor B to top\n");
8635 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8636 actorB.RaiseToTop();
8637 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8639 // Sort actor tree before next touch event
8640 application.SendNotification();
8641 application.Render();
8643 application.ProcessEvent(touchEvent);
8645 tet_printf("Not parented so RaiseToTop should show no effect\n");
8647 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8648 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8649 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8650 ResetTouchCallbacks();
8652 orderChangedSignal = false;
8654 tet_printf("Add ActorB to stage so only Actor C not parented\n");
8658 tet_printf("Lower actor C to Bottom, B stays at top\n");
8660 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8661 actorC.LowerToBottom();
8662 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8664 application.SendNotification();
8665 application.Render();
8667 application.ProcessEvent(touchEvent);
8669 tet_printf("Not parented so LowerToBottom should show no effect\n");
8671 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8672 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8673 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8674 ResetTouchCallbacks();
8679 int UtcDaliActorGeoTouchTestAllAPIwhenActorNotParented(void)
8681 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
8683 TestApplication application;
8685 Integration::Scene stage(application.GetScene());
8687 Actor actorA = Actor::New();
8688 Actor actorB = Actor::New();
8689 Actor actorC = Actor::New();
8691 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8692 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8694 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8695 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8697 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8698 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8700 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8701 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8703 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8704 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8706 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8707 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8709 application.GetScene().SetGeometryHittestEnabled(true);
8710 ResetTouchCallbacks(application);
8712 // Connect ChildOrderChangedSignal
8713 bool orderChangedSignal(false);
8714 Actor orderChangedActor;
8715 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8716 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8718 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8719 // Only top actor will get touched.
8720 actorA.TouchedSignal().Connect(TestTouchCallback);
8721 actorB.TouchedSignal().Connect(TestTouchCallback2);
8722 actorC.TouchedSignal().Connect(TestTouchCallback3);
8724 Dali::Integration::Point point;
8725 point.SetDeviceId(1);
8726 point.SetState(PointState::DOWN);
8727 point.SetScreenPosition(Vector2(10.f, 10.f));
8728 Dali::Integration::TouchEvent touchEvent;
8729 touchEvent.AddPoint(point);
8732 tet_printf("Raise actor B Above Actor C but B not parented\n");
8734 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8736 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8738 application.SendNotification();
8739 application.Render();
8741 application.ProcessEvent(touchEvent);
8743 tet_printf("Not parented so RaiseAbove should show no effect\n");
8745 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8746 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8747 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8749 tet_printf("Raise actor B Above Actor C but B not parented\n");
8750 ResetTouchCallbacks(application);
8752 orderChangedSignal = false;
8754 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8756 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8758 // Sort actor tree before next touch event
8759 application.SendNotification();
8760 application.Render();
8762 application.ProcessEvent(touchEvent);
8764 tet_printf("Not parented so RaiseAbove should show no effect\n");
8766 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8767 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8768 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8769 ResetTouchCallbacks(application);
8771 orderChangedSignal = false;
8773 tet_printf("Lower actor C below B but C not parented\n");
8775 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8777 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8779 // Sort actor tree before next touch event
8780 application.SendNotification();
8781 application.Render();
8783 application.ProcessEvent(touchEvent);
8785 tet_printf("Not parented so Lower should show no effect\n");
8787 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8788 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8789 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8790 ResetTouchCallbacks(application);
8792 orderChangedSignal = false;
8794 tet_printf("Raise actor B to top\n");
8796 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8797 actorB.RaiseToTop();
8798 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8800 // Sort actor tree before next touch event
8801 application.SendNotification();
8802 application.Render();
8804 application.ProcessEvent(touchEvent);
8806 tet_printf("Not parented so RaiseToTop should show no effect\n");
8808 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8809 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8810 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8811 ResetTouchCallbacks(application);
8813 orderChangedSignal = false;
8815 tet_printf("Add ActorB to stage so only Actor C not parented\n");
8819 tet_printf("Lower actor C to Bottom, B stays at top\n");
8821 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8822 actorC.LowerToBottom();
8823 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8825 application.SendNotification();
8826 application.Render();
8828 application.ProcessEvent(touchEvent);
8830 tet_printf("Not parented so LowerToBottom should show no effect\n");
8832 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8833 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8834 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8835 ResetTouchCallbacks(application);
8840 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
8842 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
8844 TestApplication application;
8846 Integration::Scene stage(application.GetScene());
8848 Actor actorA = Actor::New();
8849 Actor actorB = Actor::New();
8850 Actor actorC = Actor::New();
8852 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8853 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8855 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8856 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8858 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8859 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8861 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8862 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8864 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8865 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8867 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8868 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8874 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8875 // Only top actor will get touched.
8876 actorA.TouchedSignal().Connect(TestTouchCallback);
8877 actorB.TouchedSignal().Connect(TestTouchCallback2);
8878 actorC.TouchedSignal().Connect(TestTouchCallback3);
8880 ResetTouchCallbacks();
8882 // Connect ChildOrderChangedSignal
8883 bool orderChangedSignal(false);
8884 Actor orderChangedActor;
8885 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8886 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8888 application.SendNotification();
8889 application.Render();
8891 Dali::Integration::Point point;
8892 point.SetDeviceId(1);
8893 point.SetState(PointState::DOWN);
8894 point.SetScreenPosition(Vector2(10.f, 10.f));
8895 Dali::Integration::TouchEvent touchEvent;
8896 touchEvent.AddPoint(point);
8898 application.ProcessEvent(touchEvent);
8900 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8901 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8902 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8904 ResetTouchCallbacks();
8906 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
8908 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8909 actorA.RaiseAbove(actorA);
8910 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8911 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8913 application.SendNotification();
8914 application.Render();
8916 application.ProcessEvent(touchEvent);
8918 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
8920 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8921 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8922 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8924 ResetTouchCallbacks();
8926 orderChangedSignal = false;
8928 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8929 actorA.RaiseAbove(actorC);
8930 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8931 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8933 application.SendNotification();
8934 application.Render();
8936 application.ProcessEvent(touchEvent);
8938 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
8939 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8940 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8941 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8946 int UtcDaliActorGeoTouchRaiseAboveActorAndTargetTheSameN(void)
8948 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
8950 TestApplication application;
8952 Integration::Scene stage(application.GetScene());
8954 Actor actorA = Actor::New();
8955 Actor actorB = Actor::New();
8956 Actor actorC = Actor::New();
8958 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8959 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8961 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8962 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8964 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8965 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8967 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8968 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8970 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8971 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8973 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8974 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8980 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8981 // Only top actor will get touched.
8982 actorA.TouchedSignal().Connect(TestTouchCallback);
8983 actorB.TouchedSignal().Connect(TestTouchCallback2);
8984 actorC.TouchedSignal().Connect(TestTouchCallback3);
8986 application.GetScene().SetGeometryHittestEnabled(true);
8987 ResetTouchCallbacks(application);
8989 // Connect ChildOrderChangedSignal
8990 bool orderChangedSignal(false);
8991 Actor orderChangedActor;
8992 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8993 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8995 application.SendNotification();
8996 application.Render();
8998 Dali::Integration::Point point;
8999 point.SetDeviceId(1);
9000 point.SetState(PointState::DOWN);
9001 point.SetScreenPosition(Vector2(10.f, 10.f));
9002 Dali::Integration::TouchEvent touchEvent;
9003 touchEvent.AddPoint(point);
9005 application.ProcessEvent(touchEvent);
9007 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
9008 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
9009 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
9011 ResetTouchCallbacks(application);
9013 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
9015 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
9016 actorA.RaiseAbove(actorA);
9017 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
9018 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
9020 application.SendNotification();
9021 application.Render();
9023 application.ProcessEvent(touchEvent);
9025 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
9027 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
9028 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
9029 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
9031 ResetTouchCallbacks(application);
9033 orderChangedSignal = false;
9035 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
9036 actorA.RaiseAbove(actorC);
9037 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
9038 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
9040 application.SendNotification();
9041 application.Render();
9043 application.ProcessEvent(touchEvent);
9045 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
9046 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
9047 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
9048 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
9053 int UtcDaliActorGetScreenPosition(void)
9055 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
9057 TestApplication application;
9059 Integration::Scene stage(application.GetScene());
9061 Actor actorA = Actor::New();
9062 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9064 Vector2 size2(10.0f, 20.0f);
9065 actorA.SetProperty(Actor::Property::SIZE, size2);
9067 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9069 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
9073 application.SendNotification();
9074 application.Render();
9076 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9077 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9079 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9080 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
9082 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9083 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9085 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
9087 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9089 application.SendNotification();
9090 application.Render();
9092 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9093 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9095 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9096 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
9098 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9099 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9101 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
9103 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9105 application.SendNotification();
9106 application.Render();
9108 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9109 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9111 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9112 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
9114 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9115 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9117 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
9119 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
9121 application.SendNotification();
9122 application.Render();
9124 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9125 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9127 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
9128 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
9130 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
9131 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9133 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
9135 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
9137 application.SendNotification();
9138 application.Render();
9140 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9141 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9143 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
9144 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
9146 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
9147 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
9149 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
9151 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9152 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
9154 Actor actorB = Actor::New();
9155 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9156 actorB.SetProperty(Actor::Property::SIZE, size2);
9157 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
9160 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
9162 application.SendNotification();
9163 application.Render();
9165 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9167 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
9168 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
9173 int UtcDaliActorGetScreenPositionAfterScaling(void)
9175 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
9177 TestApplication application;
9179 Integration::Scene stage(application.GetScene());
9181 Actor actorA = Actor::New();
9182 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9184 Vector2 size2(10.0f, 20.0f);
9185 actorA.SetProperty(Actor::Property::SIZE, size2);
9186 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
9187 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9189 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
9193 application.SendNotification();
9194 application.Render();
9196 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9197 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9199 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9200 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9202 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9203 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9205 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
9207 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9209 application.SendNotification();
9210 application.Render();
9212 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9213 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9215 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9216 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9218 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
9219 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
9224 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
9226 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
9228 TestApplication application;
9230 Integration::Scene stage(application.GetScene());
9232 Actor actorA = Actor::New();
9233 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9234 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9235 Vector2 size2(10.0f, 20.0f);
9236 actorA.SetProperty(Actor::Property::SIZE, size2);
9237 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9239 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9243 application.SendNotification();
9244 application.Render();
9246 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9247 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9249 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9250 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9252 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
9253 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
9255 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
9257 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
9258 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9260 application.SendNotification();
9261 application.Render();
9263 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9264 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9266 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9267 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9269 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
9270 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
9276 int UtcDaliActorGetScreenPositionWithChildActors(void)
9278 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
9280 TestApplication application;
9282 Integration::Scene stage(application.GetScene());
9284 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9286 Actor actorA = Actor::New();
9287 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9288 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9289 Vector2 size1(10.0f, 20.0f);
9290 actorA.SetProperty(Actor::Property::SIZE, size1);
9291 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9293 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9295 Actor parentActorA = Actor::New();
9296 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9297 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9298 Vector2 size2(30.0f, 60.0f);
9299 parentActorA.SetProperty(Actor::Property::SIZE, size2);
9300 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9302 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
9304 stage.Add(parentActorA);
9305 parentActorA.Add(actorA);
9307 application.SendNotification();
9308 application.Render();
9310 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9311 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9313 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9314 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9316 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
9317 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
9319 tet_infoline("Test 2\n");
9321 tet_infoline("change parent anchor point and parent origin then check screen position \n");
9323 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
9324 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
9326 application.SendNotification();
9327 application.Render();
9329 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9330 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9332 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9333 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9335 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
9336 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
9341 int UtcDaliActorGetScreenPositionWithChildActors02(void)
9343 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
9345 TestApplication application;
9347 Integration::Scene stage(application.GetScene());
9349 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9351 Actor actorA = Actor::New();
9352 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9353 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9354 Vector2 size1(10.0f, 20.0f);
9355 actorA.SetProperty(Actor::Property::SIZE, size1);
9356 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9358 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9360 Actor parentActorA = Actor::New();
9361 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9362 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9363 Vector2 size2(30.0f, 60.0f);
9364 parentActorA.SetProperty(Actor::Property::SIZE, size2);
9365 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9367 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
9369 Actor grandParentActorA = Actor::New();
9370 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
9371 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
9372 Vector2 size3(60.0f, 120.0f);
9373 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
9374 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9376 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
9378 stage.Add(grandParentActorA);
9379 grandParentActorA.Add(parentActorA);
9381 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
9383 parentActorA.Add(actorA);
9385 application.SendNotification();
9386 application.Render();
9388 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9389 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9391 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9392 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9394 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
9395 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
9400 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
9402 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
9404 TestApplication application;
9406 Integration::Scene stage(application.GetScene());
9408 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9410 Actor actorA = Actor::New();
9411 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9412 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9413 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9414 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
9417 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9419 Actor actorB = Actor::New();
9420 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9421 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9422 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9423 Vector2 actorBSize(30.0f, 60.0f);
9424 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
9427 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9429 Actor actorC = Actor::New();
9430 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9431 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9432 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9433 Vector2 actorCSize(60.0f, 120.0f);
9434 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
9437 application.SendNotification();
9438 application.Render();
9440 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
9442 Vector2 center(stage.GetSize() * 0.5f);
9444 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9445 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9446 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9448 tet_infoline("Add scale to all actors");
9450 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
9451 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
9452 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
9454 application.SendNotification();
9455 application.Render();
9457 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
9458 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
9459 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
9464 int UtcDaliActorGetScreenPositionResizeScene(void)
9466 tet_infoline("UtcDaliActorGetScreenPositionResizeScene Check screen position after resizing the scene size");
9468 TestApplication application;
9469 Integration::Scene scene = application.GetScene();
9471 Actor actorA = Actor::New();
9472 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9473 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9474 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
9478 application.SendNotification();
9479 application.Render();
9481 Vector2 sceneSize = scene.GetSize();
9482 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9484 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9487 Vector2 newSize(1000.0f, 2000.0f);
9488 DALI_TEST_CHECK(scene.GetSize() != newSize);
9490 scene.SurfaceResized(newSize.width, newSize.height);
9492 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9494 // The screen position should not be updated yet
9495 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9497 application.SendNotification();
9498 application.Render();
9500 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9502 // The screen position should be updated
9503 sceneSize = scene.GetSize();
9504 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9509 int UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D(void)
9511 tet_infoline("UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D Check screen position under LAYER_3D and custom camera");
9513 TestApplication application;
9514 Integration::Scene scene = application.GetScene();
9517 Layer layer = scene.GetRootLayer();
9518 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
9520 // Build custom camera with top-view
9521 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
9523 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
9524 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
9525 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
9528 std::ostringstream oss;
9529 oss << cameraPos << "\n";
9530 oss << cameraOrient << "\n";
9531 tet_printf("%s\n", oss.str().c_str());
9534 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
9535 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
9537 // Now, upside : -Z, leftside : -X, foward : +Y
9539 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
9540 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
9542 std::ostringstream oss;
9543 oss << cameraPos << "\n";
9544 oss << cameraOrient << "\n";
9545 tet_printf("%s\n", oss.str().c_str());
9549 Actor actorA = Actor::New();
9550 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9551 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9552 actorA.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
9553 actorA.SetProperty(Actor::Property::POSITION, Vector3(20.0f, 0.0f, 10.0f));
9555 Actor actorB = Actor::New();
9556 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9557 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9558 actorB.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
9559 actorB.SetProperty(Actor::Property::POSITION, Vector3(-20.0f, 0.0f, -10.0f));
9564 application.SendNotification();
9565 application.Render();
9567 Vector2 sceneSize = scene.GetSize();
9568 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9570 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 + Vector2(20.0f, 10.0f), TEST_LOCATION);
9572 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9574 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 - Vector2(20.0f, 10.0f), TEST_LOCATION);
9579 int utcDaliActorPositionUsesAnchorPoint(void)
9581 TestApplication application;
9582 tet_infoline("Check default behaviour\n");
9584 Actor actor = Actor::New();
9585 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9586 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9587 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9588 application.GetScene().Add(actor);
9590 application.SendNotification();
9591 application.Render();
9593 tet_infoline("Check that the world position is in the center\n");
9594 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
9596 tet_infoline("Set the position uses anchor point property to false\n");
9597 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9599 application.SendNotification();
9600 application.Render();
9602 tet_infoline("Check that the world position has changed appropriately\n");
9603 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9608 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
9610 TestApplication application;
9611 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9613 Actor actor = Actor::New();
9614 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9615 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9616 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9617 actor.SetProperty(Actor::Property::SCALE, 2.0f);
9618 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9619 application.GetScene().Add(actor);
9621 application.SendNotification();
9622 application.Render();
9624 tet_infoline("Check the world position is the same as it would be without a scale\n");
9625 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9627 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9628 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9629 application.SendNotification();
9630 application.Render();
9631 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
9633 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9634 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9635 application.SendNotification();
9636 application.Render();
9637 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
9642 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
9644 TestApplication application;
9645 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9647 Actor actor = Actor::New();
9648 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9649 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9650 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9651 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
9652 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9653 application.GetScene().Add(actor);
9655 application.SendNotification();
9656 application.Render();
9658 tet_infoline("Check the world position is the same as it would be without a rotation\n");
9659 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9661 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9662 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9663 application.SendNotification();
9664 application.Render();
9665 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
9667 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9668 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9669 application.SendNotification();
9670 application.Render();
9671 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
9676 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
9678 TestApplication application;
9679 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9681 Actor actor = Actor::New();
9682 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9683 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9684 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9685 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
9686 actor.SetProperty(Actor::Property::SCALE, 2.0f);
9687 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9688 application.GetScene().Add(actor);
9690 application.SendNotification();
9691 application.Render();
9693 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
9694 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9696 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9697 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9698 application.SendNotification();
9699 application.Render();
9700 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
9702 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9703 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9704 application.SendNotification();
9705 application.Render();
9706 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
9711 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
9713 TestApplication application;
9714 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9716 Actor parent = Actor::New();
9718 application.GetScene().Add(parent);
9719 Vector2 stageSize(application.GetScene().GetSize());
9721 Actor actor = Actor::New();
9722 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9723 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9724 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9725 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
9726 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
9727 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9730 application.SendNotification();
9731 application.Render();
9733 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
9735 tet_infoline("Check the world position is in the right place\n");
9736 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9738 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
9739 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9740 application.SendNotification();
9741 application.Render();
9742 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9744 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
9745 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9746 application.SendNotification();
9747 application.Render();
9748 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9753 int utcDaliActorVisibilityChangeSignalSelf(void)
9755 TestApplication application;
9756 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
9758 Actor actor = Actor::New();
9760 VisibilityChangedFunctorData data;
9761 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
9763 actor.SetProperty(Actor::Property::VISIBLE, false);
9765 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9767 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
9770 actor.SetProperty(Actor::Property::VISIBLE, false);
9771 data.Check(false /* not called */, TEST_LOCATION);
9773 tet_infoline("Change the visibility using properties, ensure called");
9776 actor.SetProperty(Actor::Property::VISIBLE, true);
9777 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9779 tet_infoline("Set the visibility to current using properties, ensure not called");
9782 actor.SetProperty(Actor::Property::VISIBLE, true);
9783 data.Check(false /* not called */, TEST_LOCATION);
9788 int utcDaliActorVisibilityChangeSignalChildren(void)
9790 TestApplication application;
9791 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
9793 Actor parent = Actor::New();
9794 Actor child = Actor::New();
9797 Actor grandChild = Actor::New();
9798 child.Add(grandChild);
9800 VisibilityChangedFunctorData parentData;
9801 VisibilityChangedFunctorData childData;
9802 VisibilityChangedFunctorData grandChildData;
9804 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
9805 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
9806 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
9808 parent.SetProperty(Actor::Property::VISIBLE, false);
9809 parentData.Check(false /* not called */, TEST_LOCATION);
9810 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9811 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9813 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
9816 grandChildData.Reset();
9818 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
9820 parent.SetProperty(Actor::Property::VISIBLE, true);
9821 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9822 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9823 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9825 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
9828 grandChildData.Reset();
9830 parent.SetProperty(Actor::Property::VISIBLE, true);
9831 parentData.Check(false /* not called */, TEST_LOCATION);
9832 childData.Check(false /* not called */, TEST_LOCATION);
9833 grandChildData.Check(false /* not called */, TEST_LOCATION);
9838 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
9840 TestApplication application;
9841 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
9843 Actor actor = Actor::New();
9844 application.GetScene().Add(actor);
9846 application.SendNotification();
9847 application.Render();
9849 VisibilityChangedFunctorData data;
9850 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
9852 Animation animation = Animation::New(1.0f);
9853 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
9855 data.Check(false, TEST_LOCATION);
9856 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9857 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9859 tet_infoline("Play the animation and check the property value");
9862 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9863 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
9865 tet_infoline("Animation not currently finished, so the current visibility should still be true");
9866 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9868 application.SendNotification();
9869 application.Render(1100); // After the animation
9871 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
9876 int utcDaliActorVisibilityChangeSignalByName(void)
9878 TestApplication application;
9879 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
9881 Actor actor = Actor::New();
9883 bool signalCalled = false;
9884 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
9885 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9886 actor.SetProperty(Actor::Property::VISIBLE, false);
9887 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
9889 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
9890 signalCalled = false;
9891 actor.SetProperty(Actor::Property::VISIBLE, false);
9892 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9894 tet_infoline("Change the visibility using properties, ensure called");
9895 actor.SetProperty(Actor::Property::VISIBLE, true);
9896 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
9898 tet_infoline("Set the visibility to current using properties, ensure not called");
9899 signalCalled = false;
9901 actor.SetProperty(Actor::Property::VISIBLE, true);
9902 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9907 int utcDaliActorInheritedVisibilityChangeSignal1(void)
9909 TestApplication application;
9910 tet_infoline("Check that the inherited visibility change signal is called when the visibility changes for the actor itself");
9912 Actor parentActor = Actor::New();
9913 Actor actor = Actor::New();
9915 InheritedVisibilityChangedFunctorData data;
9916 actor.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(data));
9918 parentActor.Add(actor);
9919 data.Check(false, TEST_LOCATION);
9922 application.GetScene().Add(parentActor);
9923 data.Check(true, actor, true, TEST_LOCATION);
9926 actor.SetProperty(Actor::Property::VISIBLE, false);
9927 data.Check(true, actor, false, TEST_LOCATION);
9930 actor.SetProperty(Actor::Property::VISIBLE, false);
9931 data.Check(false, TEST_LOCATION);
9934 actor.SetProperty(Actor::Property::VISIBLE, true);
9935 data.Check(true, actor, true, TEST_LOCATION);
9938 actor.SetProperty(Actor::Property::VISIBLE, true);
9939 data.Check(false, TEST_LOCATION);
9944 int utcDaliActorInheritedVisibilityChangeSignal2(void)
9946 TestApplication application;
9947 tet_infoline("Check that the inherited visibility change signal is called when the actor or one of the parent become on scene or off scene");
9949 Actor parentActor = Actor::New();
9950 Actor childActor = Actor::New();
9952 InheritedVisibilityChangedFunctorData dataP, dataC;
9953 parentActor.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataP));
9954 childActor.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataC));
9958 parentActor.Add(childActor);
9959 dataP.Check(false, TEST_LOCATION);
9960 dataC.Check(false, TEST_LOCATION);
9964 application.GetScene().Add(parentActor);
9965 dataP.Check(true, parentActor, true, TEST_LOCATION);
9966 dataC.Check(true, childActor, true, TEST_LOCATION);
9970 childActor.Unparent();
9971 dataP.Check(false, TEST_LOCATION);
9972 dataC.Check(true, childActor, false, TEST_LOCATION);
9976 childActor.SetProperty(Actor::Property::VISIBLE, false);
9977 dataP.Check(false, TEST_LOCATION);
9978 dataC.Check(false, TEST_LOCATION);
9982 parentActor.Add(childActor);
9983 dataP.Check(false, TEST_LOCATION);
9984 dataC.Check(false, TEST_LOCATION);
9988 childActor.SetProperty(Actor::Property::VISIBLE, true);
9989 dataP.Check(false, TEST_LOCATION);
9990 dataC.Check(true, childActor, true, TEST_LOCATION);
9994 parentActor.SetProperty(Actor::Property::VISIBLE, false);
9995 dataP.Check(true, parentActor, false, TEST_LOCATION);
9996 dataC.Check(true, childActor, false, TEST_LOCATION);
10000 childActor.Unparent();
10001 dataP.Check(false, TEST_LOCATION);
10002 dataC.Check(false, TEST_LOCATION);
10006 parentActor.SetProperty(Actor::Property::VISIBLE, true);
10007 dataP.Check(true, parentActor, true, TEST_LOCATION);
10008 dataC.Check(false, TEST_LOCATION);
10012 parentActor.Add(childActor);
10013 dataP.Check(false, TEST_LOCATION);
10014 dataC.Check(true, childActor, true, TEST_LOCATION);
10018 parentActor.Remove(childActor);
10019 dataP.Check(false, TEST_LOCATION);
10020 dataC.Check(true, childActor, false, TEST_LOCATION);
10025 int utcDaliActorInheritedVisibilityChangeSignal3(void)
10027 TestApplication application;
10028 tet_infoline("Check that the inherited visibility change signal is called when the visibility changes for the parent actor");
10030 Actor parentActor = Actor::New();
10031 Actor actor = Actor::New();
10032 parentActor.Add(actor);
10034 InheritedVisibilityChangedFunctorData data;
10035 actor.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(data));
10037 application.GetScene().Add(parentActor);
10038 data.Check(true, actor, true, TEST_LOCATION);
10041 // Parent true -> false : called
10042 // actor true -> false : not called
10043 // actor false -> true : not called
10045 parentActor.SetProperty(Actor::Property::VISIBLE, false);
10046 data.Check(true, actor, false, TEST_LOCATION);
10049 actor.SetProperty(Actor::Property::VISIBLE, false);
10050 data.Check(false, TEST_LOCATION);
10053 actor.SetProperty(Actor::Property::VISIBLE, true);
10054 data.Check(false, TEST_LOCATION);
10060 actor.SetProperty(Actor::Property::VISIBLE, false);
10061 data.Check(false, TEST_LOCATION);
10065 // parent false -> true : not called
10067 parentActor.SetProperty(Actor::Property::VISIBLE, true);
10068 data.Check(false, TEST_LOCATION);
10074 parentActor.SetProperty(Actor::Property::VISIBLE, false);
10075 data.Check(false, TEST_LOCATION);
10078 actor.SetProperty(Actor::Property::VISIBLE, true);
10079 data.Check(false, TEST_LOCATION);
10083 // parent false -> true : called
10084 parentActor.SetProperty(Actor::Property::VISIBLE, true);
10085 data.Check(true, actor, true, TEST_LOCATION);
10092 InheritedVisibilityChangedFunctorData dataPA, dataPB, dataCA, dataCB, dataCC;
10093 void ResetInheritedVisibilityChangedFunctorData()
10103 int utcDaliActorInheritedVisibilityChangeSignal4(void)
10105 TestApplication application;
10106 tet_infoline("Check that the inherited visibility change signal is in tree");
10113 * ChildA ChildB ChildC
10116 Actor parentA = Actor::New();
10117 Actor parentB = Actor::New();
10118 Actor childA = Actor::New();
10119 Actor childB = Actor::New();
10120 Actor childC = Actor::New();
10121 parentA.Add(parentB);
10122 parentB.Add(childA);
10123 parentB.Add(childB);
10124 parentB.Add(childC);
10126 parentA.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataPA));
10127 parentB.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataPB));
10128 childA.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataCA));
10129 childB.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataCB));
10130 childC.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(dataCC));
10132 ResetInheritedVisibilityChangedFunctorData();
10133 application.GetScene().Add(parentA);
10134 dataPA.Check(true, parentA, true, TEST_LOCATION);
10135 dataPB.Check(true, parentB, true, TEST_LOCATION);
10136 dataCA.Check(true, childA, true, TEST_LOCATION);
10137 dataCB.Check(true, childB, true, TEST_LOCATION);
10138 dataCC.Check(true, childC, true, TEST_LOCATION);
10140 ResetInheritedVisibilityChangedFunctorData();
10141 parentA.SetProperty(Actor::Property::VISIBLE, false);
10142 dataPA.Check(true, parentA, false, TEST_LOCATION);
10143 dataPB.Check(true, parentB, false, TEST_LOCATION);
10144 dataCA.Check(true, childA, false, TEST_LOCATION);
10145 dataCB.Check(true, childB, false, TEST_LOCATION);
10146 dataCC.Check(true, childC, false, TEST_LOCATION);
10148 ResetInheritedVisibilityChangedFunctorData();
10149 childA.SetProperty(Actor::Property::VISIBLE, false);
10150 dataPA.Check(false, TEST_LOCATION);
10151 dataPB.Check(false, TEST_LOCATION);
10152 dataCA.Check(false, TEST_LOCATION);
10153 dataCB.Check(false, TEST_LOCATION);
10154 dataCC.Check(false, TEST_LOCATION);
10156 ResetInheritedVisibilityChangedFunctorData();
10157 parentB.SetProperty(Actor::Property::VISIBLE, false);
10158 dataPA.Check(false, TEST_LOCATION);
10159 dataPB.Check(false, TEST_LOCATION);
10160 dataCA.Check(false, TEST_LOCATION);
10161 dataCB.Check(false, TEST_LOCATION);
10162 dataCC.Check(false, TEST_LOCATION);
10164 ResetInheritedVisibilityChangedFunctorData();
10165 parentA.SetProperty(Actor::Property::VISIBLE, true);
10166 dataPA.Check(true, parentA, true, TEST_LOCATION);
10167 dataPB.Check(false, TEST_LOCATION);
10168 dataCA.Check(false, TEST_LOCATION);
10169 dataCB.Check(false, TEST_LOCATION);
10170 dataCC.Check(false, TEST_LOCATION);
10172 ResetInheritedVisibilityChangedFunctorData();
10173 parentB.SetProperty(Actor::Property::VISIBLE, true);
10174 dataPA.Check(false, TEST_LOCATION);
10175 dataPB.Check(true, parentB, true, TEST_LOCATION);
10176 dataCA.Check(false, TEST_LOCATION);
10177 dataCB.Check(true, childB, true, TEST_LOCATION);
10178 dataCC.Check(true, childC, true, TEST_LOCATION);
10183 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
10185 gLayoutDirectionType = type;
10188 int UtcDaliActorLayoutDirectionProperty(void)
10190 TestApplication application;
10191 tet_infoline("Check layout direction property");
10193 Actor actor0 = Actor::New();
10194 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10195 application.GetScene().Add(actor0);
10197 application.SendNotification();
10198 application.Render();
10200 Actor actor1 = Actor::New();
10201 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10202 Actor actor2 = Actor::New();
10203 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10204 Actor actor3 = Actor::New();
10205 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10206 Actor actor4 = Actor::New();
10207 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10208 Actor actor5 = Actor::New();
10209 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10210 Actor actor6 = Actor::New();
10211 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10212 Actor actor7 = Actor::New();
10213 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10214 Actor actor8 = Actor::New();
10215 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10216 Actor actor9 = Actor::New();
10217 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10219 actor1.Add(actor2);
10220 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
10221 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
10223 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
10224 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
10225 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
10227 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10228 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10229 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
10231 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
10232 actor0.Add(actor1);
10233 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10234 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10236 application.GetScene().Add(actor3);
10237 actor3.Add(actor4);
10238 actor4.Add(actor5);
10239 actor5.Add(actor6);
10240 actor5.Add(actor7);
10241 actor7.Add(actor8);
10242 actor8.Add(actor9);
10243 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
10244 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
10246 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
10247 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
10248 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
10250 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
10252 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10253 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10254 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10255 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10256 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10257 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10258 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10260 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
10261 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10262 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10264 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
10265 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10266 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10267 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
10269 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
10270 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10271 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10276 struct LayoutDirectionFunctor
10278 LayoutDirectionFunctor(bool& signalCalled)
10279 : mSignalCalled(signalCalled)
10283 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
10284 : mSignalCalled(rhs.mSignalCalled)
10290 mSignalCalled = true;
10293 bool& mSignalCalled;
10296 int UtcDaliActorLayoutDirectionSignal(void)
10298 TestApplication application;
10299 tet_infoline("Check changing layout direction property sends a signal");
10301 Actor actor = Actor::New();
10302 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
10303 application.GetScene().Add(actor);
10304 bool signalCalled = false;
10305 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
10307 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
10308 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
10310 // Test that writing the same value doesn't send a signal
10311 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
10312 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
10314 // Test that writing a different value sends the signal
10315 signalCalled = false;
10316 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
10317 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
10319 signalCalled = false;
10320 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
10321 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
10326 struct ChildAddedSignalCheck
10328 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
10329 : mSignalReceived(signalReceived),
10330 mChildHandle(childHandle)
10334 void operator()(Actor childHandle)
10336 mSignalReceived = true;
10337 mChildHandle = childHandle;
10341 mSignalReceived = true;
10342 mChildHandle = Actor();
10345 bool& mSignalReceived;
10346 Actor& mChildHandle;
10349 int UtcDaliChildAddedSignalP1(void)
10351 TestApplication application;
10352 auto stage = application.GetScene();
10354 bool signalReceived = false;
10357 ChildAddedSignalCheck signal(signalReceived, childActor);
10358 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
10359 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10361 auto actorA = Actor::New();
10363 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10364 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
10365 signalReceived = false;
10367 auto actorB = Actor::New();
10369 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10370 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
10375 int UtcDaliChildAddedSignalP2(void)
10377 TestApplication application;
10378 auto stage = application.GetScene();
10380 bool signalReceived = false;
10383 ChildAddedSignalCheck signal(signalReceived, childActor);
10384 tet_infoline("Connect to childAdded signal by name");
10386 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
10387 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10389 auto actorA = Actor::New();
10391 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10393 // Can't test which actor was added; signal signature is void() when connecting via name.
10394 signalReceived = false;
10396 auto actorB = Actor::New();
10398 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10403 int UtcDaliChildAddedSignalN(void)
10405 TestApplication application;
10406 auto stage = application.GetScene();
10408 bool signalReceived = false;
10411 ChildAddedSignalCheck signal(signalReceived, childActor);
10412 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
10413 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10415 auto actorA = Actor::New();
10417 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10418 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
10419 signalReceived = false;
10421 auto actorB = Actor::New();
10422 actorA.Add(actorB);
10423 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10427 struct ChildRemovedSignalCheck
10429 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
10430 : mSignalReceived(signalReceived),
10431 mChildHandle(childHandle)
10435 void operator()(Actor childHandle)
10437 mSignalReceived = true;
10438 mChildHandle = childHandle;
10443 mSignalReceived = true;
10446 bool& mSignalReceived;
10447 Actor& mChildHandle;
10450 int UtcDaliChildRemovedSignalP1(void)
10452 TestApplication application;
10453 auto stage = application.GetScene();
10455 bool signalReceived = false;
10458 ChildRemovedSignalCheck signal(signalReceived, childActor);
10459 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
10460 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10462 auto actorA = Actor::New();
10464 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10465 DALI_TEST_CHECK(!childActor);
10467 stage.Remove(actorA);
10468 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
10469 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10471 signalReceived = false;
10472 auto actorB = Actor::New();
10474 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10476 stage.Remove(actorB);
10477 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10478 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
10483 int UtcDaliChildRemovedSignalP2(void)
10485 TestApplication application;
10486 auto stage = application.GetScene();
10488 bool signalReceived = false;
10491 ChildAddedSignalCheck signal(signalReceived, childActor);
10492 tet_infoline("Connect to childRemoved signal by name");
10494 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
10495 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10497 auto actorA = Actor::New();
10499 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10501 stage.Remove(actorA);
10502 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10504 signalReceived = false;
10505 auto actorB = Actor::New();
10507 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10509 stage.Remove(actorB);
10510 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10515 int UtcDaliChildRemovedSignalN(void)
10517 TestApplication application;
10518 auto stage = application.GetScene();
10520 bool signalReceived = false;
10523 ChildRemovedSignalCheck signal(signalReceived, childActor);
10524 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
10525 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10527 auto actorA = Actor::New();
10530 auto actorB = Actor::New();
10531 actorA.Add(actorB);
10533 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10534 DALI_TEST_CHECK(!childActor);
10536 actorA.Remove(actorB);
10537 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10541 int UtcDaliChildMovedSignalP(void)
10543 TestApplication application;
10544 auto stage = application.GetScene();
10546 bool addedASignalReceived = false;
10547 bool removedASignalReceived = false;
10548 bool addedBSignalReceived = false;
10549 bool removedBSignalReceived = false;
10552 auto actorA = Actor::New();
10553 auto actorB = Actor::New();
10557 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
10558 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
10559 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
10560 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
10562 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
10563 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
10564 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
10565 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
10567 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
10568 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10569 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10570 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10572 // Create a child of A
10574 auto child = Actor::New();
10577 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
10578 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10579 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10580 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10581 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
10583 // Move child to B:
10584 addedASignalReceived = false;
10585 addedBSignalReceived = false;
10586 removedASignalReceived = false;
10587 removedBSignalReceived = false;
10589 actorB.Add(child); // Expect this child to be re-parented
10590 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
10591 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
10592 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
10593 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10595 // Move child back to A:
10596 addedASignalReceived = false;
10597 addedBSignalReceived = false;
10598 removedASignalReceived = false;
10599 removedBSignalReceived = false;
10601 actorA.Add(child); // Expect this child to be re-parented
10602 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
10603 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10604 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10605 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
10610 int UtcDaliActorSwitchParentP(void)
10612 tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
10613 TestApplication application;
10615 Actor parent1 = Actor::New();
10616 Actor child = Actor::New();
10618 application.GetScene().Add(parent1);
10620 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
10622 child.OnSceneSignal().Connect(OnSceneCallback);
10623 child.OffSceneSignal().Connect(OffSceneCallback);
10626 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
10627 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10629 parent1.Add(child);
10631 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
10633 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
10634 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10636 Actor parent2 = Actor::New();
10637 application.GetScene().Add(parent2);
10639 bool addSignalReceived = false;
10640 ChildAddedSignalCheck addedSignal(addSignalReceived, child);
10641 DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
10642 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
10644 bool removedSignalReceived = false;
10645 ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
10646 DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
10647 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
10649 DevelActor::SwitchParent(child, parent2);
10651 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
10652 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
10654 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
10655 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
10657 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
10658 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10659 DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
10660 DALI_TEST_CHECK(child.GetParent() == parent2);
10665 int utcDaliActorCulled(void)
10667 TestApplication application;
10668 auto stage = application.GetScene();
10670 tet_infoline("Check that the actor is culled if the actor is out of the screen");
10672 Actor actor = Actor::New();
10673 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
10675 Geometry geometry = CreateQuadGeometry();
10676 Shader shader = CreateShader();
10677 Renderer renderer = Renderer::New(geometry, shader);
10678 actor.AddRenderer(renderer);
10682 application.SendNotification();
10683 application.Render(0);
10685 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
10687 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
10688 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
10690 // Connect NotifySignal
10691 bool propertyNotificationSignal(false);
10692 PropertyNotification source;
10693 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
10694 notification.NotifySignal().Connect(&application, f);
10696 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
10698 application.SendNotification();
10699 application.Render();
10701 application.SendNotification();
10703 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
10705 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
10706 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
10707 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
10712 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
10714 TestApplication application;
10715 auto stage = application.GetScene();
10717 tet_infoline("Ensure we clear the screen when the last actor is removed");
10719 Actor actor = CreateRenderableActor();
10720 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
10723 application.SendNotification();
10724 application.Render();
10726 auto& glAbstraction = application.GetGlAbstraction();
10727 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
10731 application.SendNotification();
10732 application.Render();
10734 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
10739 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
10741 TestApplication application;
10742 auto stage = application.GetScene();
10744 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
10746 Actor actor = CreateRenderableActor();
10747 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
10750 application.SendNotification();
10751 application.Render();
10753 auto& glAbstraction = application.GetGlAbstraction();
10754 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
10756 actor.SetProperty(Actor::Property::VISIBLE, false);
10758 application.SendNotification();
10759 application.Render();
10761 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
10766 int utcDaliActorGetSizeAfterAnimation(void)
10768 TestApplication application;
10769 tet_infoline("Check the actor size before / after an animation is finished");
10771 Vector3 actorSize(100.0f, 100.0f, 0.0f);
10773 Actor actor = Actor::New();
10774 actor.SetProperty(Actor::Property::SIZE, actorSize);
10775 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10776 application.GetScene().Add(actor);
10778 // Size should be updated without rendering.
10779 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10780 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10782 application.SendNotification();
10783 application.Render();
10785 // Size and current size should be updated.
10786 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10787 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10788 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10789 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10790 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10792 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10793 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10794 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10795 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10796 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10799 actorSize = Vector3(200.0f, 200.0f, 0.0f);
10800 actor.SetProperty(Actor::Property::SIZE, actorSize);
10802 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10803 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10805 Vector3 targetValue(10.0f, 20.0f, 0.0f);
10807 Animation animation = Animation::New(1.0f);
10808 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
10811 // Size should be updated without rendering.
10812 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10813 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10815 application.SendNotification();
10816 application.Render(1100); // After the animation
10818 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10819 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10820 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10821 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10822 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10824 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10825 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10826 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10827 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10828 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10830 targetValue.width = 50.0f;
10833 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
10836 application.SendNotification();
10837 application.Render(1100); // After the animation
10839 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10840 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10841 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10842 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10843 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10845 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10846 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10847 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10848 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10849 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10851 targetValue.height = 70.0f;
10854 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
10857 application.SendNotification();
10858 application.Render(1100); // After the animation
10860 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10861 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10862 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10863 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10864 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10866 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10867 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10868 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10869 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10870 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10872 Vector3 offset(10.0f, 20.0f, 0.0f);
10875 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
10878 application.SendNotification();
10879 application.Render(1100); // After the animation
10881 targetValue += offset;
10883 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10884 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10885 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10886 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10887 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10889 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10890 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10891 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10892 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10893 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10895 offset.width = 20.0f;
10898 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
10901 application.SendNotification();
10902 application.Render(1100); // After the animation
10904 targetValue.width += offset.width;
10906 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10907 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10908 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10909 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10910 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10912 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10913 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10914 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10915 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10916 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10918 offset.height = 10.0f;
10921 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
10924 application.SendNotification();
10925 application.Render(1100); // After the animation
10927 targetValue.height += offset.height;
10929 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10930 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10931 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10932 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10933 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10935 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10936 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10937 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10938 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10939 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10942 actorSize = Vector3(300.0f, 300.0f, 0.0f);
10944 actor.SetProperty(Actor::Property::SIZE, actorSize);
10946 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10947 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10949 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10950 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10952 application.SendNotification();
10953 application.Render();
10955 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10956 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10958 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10959 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10964 int utcDaliActorGetSizeAfterAnimation2(void)
10966 TestApplication application;
10967 tet_infoline("Check the actor size before / after an animation is finished if before size is equal to animation target size");
10969 Vector3 actorSize(100.0f, 100.0f, 0.0f);
10971 Actor actor = Actor::New();
10972 actor.SetProperty(Actor::Property::SIZE, actorSize);
10973 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10974 application.GetScene().Add(actor);
10976 // Size should be updated without rendering.
10977 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10978 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10980 application.SendNotification();
10981 application.Render();
10983 // Size and current size should be updated.
10984 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10985 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10986 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10987 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10988 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10990 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10991 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10992 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10993 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10994 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10997 actorSize = Vector3(200.0f, 200.0f, 0.0f);
10998 actor.SetProperty(Actor::Property::SIZE, actorSize);
11000 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11001 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11003 Vector3 targetValue(actorSize);
11005 Animation animation = Animation::New(1.0f);
11006 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
11009 // Size should be updated without rendering.
11010 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11011 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11013 application.SendNotification();
11014 application.Render(100); // During the animation
11016 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11017 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11018 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
11019 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
11020 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
11022 // We should get target value because targetValue is equal to current actor size.
11023 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11024 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11025 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
11026 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
11027 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
11029 application.SendNotification();
11030 application.Render(1000); // After animation finished
11032 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11033 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11035 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11036 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11041 int utcDaliActorRelayoutAndAnimation(void)
11043 TestApplication application;
11044 tet_infoline("Check the actor size when relayoutting and playing animation");
11046 Vector3 parentSize(300.0f, 300.0f, 0.0f);
11047 Vector3 actorSize(100.0f, 100.0f, 0.0f);
11050 Actor parentA = Actor::New();
11051 parentA.SetProperty(Actor::Property::SIZE, parentSize);
11052 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11053 application.GetScene().Add(parentA);
11055 Actor parentB = Actor::New();
11056 parentB.SetProperty(Actor::Property::SIZE, parentSize);
11057 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11058 application.GetScene().Add(parentB);
11060 Actor actor = Actor::New();
11061 actor.SetProperty(Actor::Property::SIZE, actorSize);
11062 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11063 parentA.Add(actor);
11065 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11066 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11068 Vector3 targetValue(200.0f, 200.0f, 0.0f);
11070 Animation animation = Animation::New(1.0f);
11071 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
11074 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11075 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11077 application.SendNotification();
11078 application.Render(1100); // After the animation
11080 // Size and current size should be updated.
11081 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11082 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11084 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11085 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11087 // Trigger relayout
11088 parentB.Add(actor);
11090 application.SendNotification();
11091 application.Render();
11093 // Size and current size should be same.
11094 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11095 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11097 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11098 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11101 parentA.Unparent();
11102 parentB.Unparent();
11106 Actor parentA = Actor::New();
11107 parentA.SetProperty(Actor::Property::SIZE, parentSize);
11108 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11109 application.GetScene().Add(parentA);
11111 Actor parentB = Actor::New();
11112 parentB.SetProperty(Actor::Property::SIZE, parentSize);
11113 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11114 application.GetScene().Add(parentB);
11116 Actor actor = Actor::New();
11117 actor.SetProperty(Actor::Property::SIZE, actorSize);
11118 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11119 parentA.Add(actor);
11121 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11122 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11124 application.SendNotification();
11125 application.Render();
11127 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11128 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11130 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11131 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11133 Vector3 targetValue(200.0f, 200.0f, 0.0f);
11135 // Make an animation
11136 Animation animation = Animation::New(1.0f);
11137 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
11140 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11141 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11143 application.SendNotification();
11144 application.Render(1100); // After the animation
11146 // Size and current size should be updated.
11147 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11148 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11150 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11151 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11153 // Trigger relayout
11154 parentB.Add(actor);
11156 application.SendNotification();
11157 application.Render();
11159 // Size and current size should be same.
11160 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
11161 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11163 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
11164 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
11167 parentA.Unparent();
11168 parentB.Unparent();
11174 int utcDaliActorPartialUpdate(void)
11176 TestApplication application(
11177 TestApplication::DEFAULT_SURFACE_WIDTH,
11178 TestApplication::DEFAULT_SURFACE_HEIGHT,
11179 TestApplication::DEFAULT_HORIZONTAL_DPI,
11180 TestApplication::DEFAULT_VERTICAL_DPI,
11184 tet_infoline("Check the damaged area");
11186 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11188 std::vector<Rect<int>> damagedRects;
11189 Rect<int> clippingRect;
11190 application.SendNotification();
11191 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11193 // First render pass, nothing to render, adaptor would just do swap buffer.
11194 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11196 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11197 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11199 Actor actor = CreateRenderableActor();
11200 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11201 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11202 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11203 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11204 application.GetScene().Add(actor);
11206 application.SendNotification();
11208 // 1. Actor added, damaged rect is added size of actor
11209 damagedRects.clear();
11210 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11211 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11214 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11215 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11216 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11217 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11218 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11219 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11220 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11223 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
11224 application.SendNotification();
11226 damagedRects.clear();
11227 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11228 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11231 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
11232 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11233 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11234 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11235 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11236 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11237 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11239 // 3. Set new position
11240 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
11241 application.SendNotification();
11243 damagedRects.clear();
11244 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11245 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11248 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
11249 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11250 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11251 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11252 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11253 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11254 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11256 application.GetScene().Remove(actor);
11257 application.SendNotification();
11259 // Actor removed, last a dirty rect is reported.
11260 damagedRects.clear();
11261 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11262 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11264 clippingRect = damagedRects[0];
11266 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
11267 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(32, 736, 48, 48), TEST_LOCATION);
11269 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11270 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11271 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11272 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11273 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11278 int utcDaliActorPartialUpdateSetColor(void)
11280 TestApplication application(
11281 TestApplication::DEFAULT_SURFACE_WIDTH,
11282 TestApplication::DEFAULT_SURFACE_HEIGHT,
11283 TestApplication::DEFAULT_HORIZONTAL_DPI,
11284 TestApplication::DEFAULT_VERTICAL_DPI,
11288 tet_infoline("Check uniform update");
11290 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11292 std::vector<Rect<int>> damagedRects;
11293 Rect<int> clippingRect;
11294 application.SendNotification();
11295 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11297 // First render pass, nothing to render, adaptor would just do swap buffer.
11298 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11300 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11301 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11303 Actor actor = CreateRenderableActor();
11304 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11305 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11306 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11307 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11308 application.GetScene().Add(actor);
11310 application.SendNotification();
11312 // 1. Actor added, damaged rect is added size of actor
11313 damagedRects.clear();
11314 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11315 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11318 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11319 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11320 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11321 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11322 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11323 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11324 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11326 damagedRects.clear();
11327 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11328 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11330 damagedRects.clear();
11331 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11332 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11334 // 2. Set new color
11335 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
11336 application.SendNotification();
11338 damagedRects.clear();
11339 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11340 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11343 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11344 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11345 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11346 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11347 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11348 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11349 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11354 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
11355 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
11356 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
11357 const char* const RENDER_SHADOW_VERTEX_SOURCE =
11358 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
11359 " uniform mediump mat4 uLightCameraViewMatrix;\n"
11363 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
11364 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
11365 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
11368 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
11369 "uniform lowp vec4 uShadowColor;\n"
11372 " lowp float alpha;\n"
11373 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
11374 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
11377 int utcDaliActorPartialUpdateSetProperty(void)
11379 TestApplication application(
11380 TestApplication::DEFAULT_SURFACE_WIDTH,
11381 TestApplication::DEFAULT_SURFACE_HEIGHT,
11382 TestApplication::DEFAULT_HORIZONTAL_DPI,
11383 TestApplication::DEFAULT_VERTICAL_DPI,
11387 tet_infoline("Set/Update property with partial update");
11389 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11391 std::vector<Rect<int>> damagedRects;
11392 Rect<int> clippingRect;
11393 application.SendNotification();
11394 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11396 // First render pass, nothing to render, adaptor would just do swap buffer.
11397 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11399 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11400 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11402 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
11403 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
11404 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11405 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11406 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11407 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11408 application.GetScene().Add(actor);
11410 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
11412 damagedRects.clear();
11413 application.SendNotification();
11414 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11415 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11418 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11419 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11420 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11421 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11422 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11423 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11424 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11426 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
11427 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
11429 damagedRects.clear();
11430 application.SendNotification();
11431 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11432 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11434 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11435 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11436 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11437 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11438 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11439 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11441 // Should be no damage rects, nothing changed
11442 damagedRects.clear();
11443 application.SendNotification();
11444 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11445 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11447 // Should be 1 damage rect due to change in size
11448 damagedRects.clear();
11449 actor.SetProperty(Actor::Property::SIZE, Vector3(26.0f, 26.0f, 0.0f));
11450 application.SendNotification();
11451 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11452 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11454 clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
11455 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11456 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11457 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11458 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11459 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11460 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11462 damagedRects.clear();
11463 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11464 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11469 int utcDaliActorPartialUpdateTwoActors(void)
11471 TestApplication application(
11472 TestApplication::DEFAULT_SURFACE_WIDTH,
11473 TestApplication::DEFAULT_SURFACE_HEIGHT,
11474 TestApplication::DEFAULT_HORIZONTAL_DPI,
11475 TestApplication::DEFAULT_VERTICAL_DPI,
11479 tet_infoline("Check the damaged rects with partial update and two actors");
11481 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11483 Actor actor = CreateRenderableActor();
11484 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
11485 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
11486 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11487 application.GetScene().Add(actor);
11489 Actor actor2 = CreateRenderableActor();
11490 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
11491 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
11492 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11493 application.GetScene().Add(actor2);
11495 application.SendNotification();
11496 std::vector<Rect<int>> damagedRects;
11497 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11499 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
11500 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64), Rect<int>(96, 592, 112, 112)}, true, TEST_LOCATION);
11502 // in screen coordinates, adaptor would calculate it using previous frames information
11503 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
11504 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11506 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11507 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11508 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11509 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11511 // Change a Renderer of actor1
11512 Geometry geometry = CreateQuadGeometry();
11513 Shader shader = CreateShader();
11514 Renderer newRenderer = Renderer::New(geometry, shader);
11515 Renderer renderer = actor.GetRendererAt(0);
11517 actor.RemoveRenderer(renderer);
11518 actor.AddRenderer(newRenderer);
11520 damagedRects.clear();
11522 application.SendNotification();
11523 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11525 DALI_TEST_CHECK(damagedRects.size() > 0);
11526 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64)}, false, TEST_LOCATION);
11528 // in screen coordinates, adaptor would calculate it using previous frames information
11529 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11531 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11532 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11533 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11534 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11539 int utcDaliActorPartialUpdateActorsWithSizeHint01(void)
11541 TestApplication application(
11542 TestApplication::DEFAULT_SURFACE_WIDTH,
11543 TestApplication::DEFAULT_SURFACE_HEIGHT,
11544 TestApplication::DEFAULT_HORIZONTAL_DPI,
11545 TestApplication::DEFAULT_VERTICAL_DPI,
11549 tet_infoline("Check the damaged rect with partial update and update area hint");
11551 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11553 Actor actor = CreateRenderableActor();
11554 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11555 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11556 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11557 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11558 application.GetScene().Add(actor);
11560 application.SendNotification();
11561 std::vector<Rect<int>> damagedRects;
11562 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11564 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11566 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
11567 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11569 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11571 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11572 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11573 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11574 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11579 damagedRects.clear();
11580 application.SendNotification();
11581 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11583 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11584 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11586 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11588 damagedRects.clear();
11589 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11590 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11592 // Ensure the damaged rect is empty
11593 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11595 // Change UPDATE_AREA_HINT
11596 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 32.0f, 32.0f));
11597 application.GetScene().Add(actor);
11599 application.SendNotification();
11600 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11602 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11604 clippingRect = Rect<int>(64, 704, 48, 48);
11605 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11607 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11609 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11610 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11611 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11612 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11617 damagedRects.clear();
11618 application.SendNotification();
11619 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11621 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11622 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11624 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11626 damagedRects.clear();
11627 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11628 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11630 // Ensure the damaged rect is empty
11631 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11633 // Change UPDATE_AREA_HINT
11634 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(-32.0f, -16.0f, 64.0f, 64.0f));
11635 application.GetScene().Add(actor);
11637 application.SendNotification();
11638 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11640 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11642 clippingRect = Rect<int>(0, 720, 80, 80);
11643 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11645 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11647 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11648 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11649 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11650 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11655 int utcDaliActorPartialUpdateActorsWithSizeHint02(void)
11657 TestApplication application(
11658 TestApplication::DEFAULT_SURFACE_WIDTH,
11659 TestApplication::DEFAULT_SURFACE_HEIGHT,
11660 TestApplication::DEFAULT_HORIZONTAL_DPI,
11661 TestApplication::DEFAULT_VERTICAL_DPI,
11665 tet_infoline("Check the damaged rect with partial update and update area hint");
11667 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11669 Actor actor = CreateRenderableActor();
11670 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11671 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11672 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11673 application.GetScene().Add(actor);
11675 application.SendNotification();
11676 std::vector<Rect<int>> damagedRects;
11677 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11679 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11681 Rect<int> clippingRect = Rect<int>(48, 720, 48, 48);
11682 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11684 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11686 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11687 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11688 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11689 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11691 damagedRects.clear();
11692 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11693 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11695 // Ensure the damaged rect is empty
11696 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11698 // Change UPDATE_AREA_HINT
11699 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11701 application.SendNotification();
11702 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11704 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11706 clippingRect = Rect<int>(32, 704, 80, 80);
11707 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11709 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11711 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11712 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11713 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11714 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11716 damagedRects.clear();
11717 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11718 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11720 // Ensure the damaged rect is empty
11721 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11723 // Change UPDATE_AREA_HINT
11724 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 64.0f, 64.0f));
11725 application.GetScene().Add(actor);
11727 application.SendNotification();
11728 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11730 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11732 clippingRect = Rect<int>(32, 688, 96, 96);
11733 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11735 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11737 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11738 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11739 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11740 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11745 int utcDaliActorPartialUpdateActorsWithSizeHint03(void)
11747 TestApplication application(
11748 TestApplication::DEFAULT_SURFACE_WIDTH,
11749 TestApplication::DEFAULT_SURFACE_HEIGHT,
11750 TestApplication::DEFAULT_HORIZONTAL_DPI,
11751 TestApplication::DEFAULT_VERTICAL_DPI,
11755 tet_infoline("Check the damaged rect with partial update and update area hint");
11757 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11759 Actor actor = CreateRenderableActor();
11760 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11761 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11762 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11763 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11764 application.GetScene().Add(actor);
11766 application.SendNotification();
11767 std::vector<Rect<int>> damagedRects;
11768 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11770 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11772 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
11773 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11775 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11777 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11778 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11779 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11780 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11782 damagedRects.clear();
11783 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11784 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11786 // Ensure the damaged rect is empty
11787 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11789 // Set UPDATE_AREA_HINT twice before rendering
11790 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 32.0f, 32.0f));
11791 application.SendNotification();
11793 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(32.0f, -32.0f, 32.0f, 32.0f));
11794 application.SendNotification();
11796 damagedRects.clear();
11797 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11799 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11801 clippingRect = Rect<int>(32, 704, 96, 96);
11802 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11804 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11806 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11807 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11808 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11809 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11814 int utcDaliActorPartialUpdateAnimation01(void)
11816 TestApplication application(
11817 TestApplication::DEFAULT_SURFACE_WIDTH,
11818 TestApplication::DEFAULT_SURFACE_HEIGHT,
11819 TestApplication::DEFAULT_HORIZONTAL_DPI,
11820 TestApplication::DEFAULT_VERTICAL_DPI,
11824 tet_infoline("Check the damaged area with partial update and animation");
11826 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11827 drawTrace.Enable(true);
11830 Actor actor1 = CreateRenderableActor();
11831 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11832 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
11833 application.GetScene().Add(actor1);
11835 Actor actor2 = CreateRenderableActor();
11836 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11837 actor2.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11838 application.GetScene().Add(actor2);
11840 std::vector<Rect<int>> damagedRects;
11841 Rect<int> clippingRect;
11842 Rect<int> expectedRect1, expectedRect2;
11844 application.SendNotification();
11845 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11847 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
11850 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 1 last frames updates
11851 expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
11852 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2}, true, TEST_LOCATION);
11854 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11855 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11857 // Make an animation
11858 Animation animation = Animation::New(1.0f);
11859 animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
11862 application.SendNotification();
11864 damagedRects.clear();
11865 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11866 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11867 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11870 damagedRects.clear();
11872 // In animation deley time
11873 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11874 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11875 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11878 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
11881 damagedRects.clear();
11883 // Also in animation deley time
11884 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11885 application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
11886 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11889 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
11891 // Unparent 2 actors and make a new actor
11895 Actor actor3 = CreateRenderableActor();
11896 actor3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11897 actor3.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11898 application.GetScene().Add(actor3);
11900 application.SendNotification();
11902 // Started animation
11903 damagedRects.clear();
11904 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11905 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
11907 // One of dirty rect is actor3's.
11908 // We don't know the exact dirty rect of actor1 and actor2.
11909 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2, expectedRect2}, true, TEST_LOCATION);
11911 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11912 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11914 // Finished animation, but the actor was already unparented
11915 damagedRects.clear();
11916 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11918 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11920 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11921 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11926 int utcDaliActorPartialUpdateAnimation02(void)
11928 TestApplication application(
11929 TestApplication::DEFAULT_SURFACE_WIDTH,
11930 TestApplication::DEFAULT_SURFACE_HEIGHT,
11931 TestApplication::DEFAULT_HORIZONTAL_DPI,
11932 TestApplication::DEFAULT_VERTICAL_DPI,
11936 tet_infoline("Check the damaged area with partial update and animation delay");
11938 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11939 drawTrace.Enable(true);
11942 Actor actor = CreateRenderableActor();
11943 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11944 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11945 application.GetScene().Add(actor);
11947 std::vector<Rect<int>> damagedRects;
11948 Rect<int> clippingRect;
11950 application.SendNotification();
11951 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11953 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11956 clippingRect = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
11957 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11959 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11961 // Make an animation
11962 Renderer renderer = actor.GetRendererAt(0);
11963 Animation animation = Animation::New(1.0f);
11964 animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f, TimePeriod(0.5f, 0.5f));
11965 animation.SetLoopCount(3);
11968 application.SendNotification();
11970 damagedRects.clear();
11971 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11972 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11975 damagedRects.clear();
11976 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11977 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11979 clippingRect = Rect<int>(0, 784, 32, 32);
11980 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11982 // Started animation
11983 damagedRects.clear();
11984 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11985 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11987 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11990 damagedRects.clear();
11991 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11993 // The property is reset to base value. Should be updated
11994 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11996 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11998 // Next render during delay time
11999 damagedRects.clear();
12000 application.PreRenderWithPartialUpdate(50, nullptr, damagedRects);
12002 // Should not be updated
12003 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12005 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12010 int utcDaliActorPartialUpdateChangeVisibility(void)
12012 TestApplication application(
12013 TestApplication::DEFAULT_SURFACE_WIDTH,
12014 TestApplication::DEFAULT_SURFACE_HEIGHT,
12015 TestApplication::DEFAULT_HORIZONTAL_DPI,
12016 TestApplication::DEFAULT_VERTICAL_DPI,
12020 tet_infoline("Check the damaged rect with partial update and visibility change");
12022 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12024 Actor actor = CreateRenderableActor();
12025 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
12026 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
12027 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
12028 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12029 application.GetScene().Add(actor);
12031 application.SendNotification();
12033 std::vector<Rect<int>> damagedRects;
12034 Rect<int> clippingRect;
12036 // 1. Actor added, damaged rect is added size of actor
12037 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12038 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12041 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12042 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12043 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12044 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12045 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12046 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12047 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12049 damagedRects.clear();
12050 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12051 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12053 // Ensure the damaged rect is empty
12054 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12056 // 2. Make the Actor invisible
12057 actor.SetProperty(Actor::Property::VISIBLE, false);
12058 application.SendNotification();
12060 damagedRects.clear();
12061 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12062 DALI_TEST_CHECK(damagedRects.size() > 0);
12063 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12065 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12066 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12067 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12068 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12069 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12071 // 3. Make the Actor visible again
12072 actor.SetProperty(Actor::Property::VISIBLE, true);
12073 application.SendNotification();
12075 damagedRects.clear();
12076 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12077 DALI_TEST_CHECK(damagedRects.size() > 0);
12078 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12080 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12081 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12082 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12083 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12084 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12089 int utcDaliActorPartialUpdateOnOffScene(void)
12091 TestApplication application(
12092 TestApplication::DEFAULT_SURFACE_WIDTH,
12093 TestApplication::DEFAULT_SURFACE_HEIGHT,
12094 TestApplication::DEFAULT_HORIZONTAL_DPI,
12095 TestApplication::DEFAULT_VERTICAL_DPI,
12099 tet_infoline("Check the damaged rect with partial update and on/off scene");
12101 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12103 Actor actor = CreateRenderableActor();
12104 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
12105 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
12106 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
12107 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12108 application.GetScene().Add(actor);
12110 application.SendNotification();
12112 std::vector<Rect<int>> damagedRects;
12113 Rect<int> clippingRect;
12115 // 1. Actor added, damaged rect is added size of actor
12116 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12117 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12120 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12121 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12122 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12123 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12124 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12125 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12126 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12128 damagedRects.clear();
12129 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12130 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12132 damagedRects.clear();
12133 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12134 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12136 // Ensure the damaged rect is empty
12137 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12139 // 2. Remove the Actor from the Scene
12141 application.SendNotification();
12143 damagedRects.clear();
12144 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12145 DALI_TEST_CHECK(damagedRects.size() > 0);
12146 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12148 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12149 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12150 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12151 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12152 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12154 // 3. Add the Actor to the Scene again
12155 application.GetScene().Add(actor);
12156 application.SendNotification();
12158 damagedRects.clear();
12159 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12160 DALI_TEST_CHECK(damagedRects.size() > 0);
12161 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12163 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12164 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12165 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12166 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12167 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12172 int utcDaliActorPartialUpdateSkipRendering(void)
12174 TestApplication application(
12175 TestApplication::DEFAULT_SURFACE_WIDTH,
12176 TestApplication::DEFAULT_SURFACE_HEIGHT,
12177 TestApplication::DEFAULT_HORIZONTAL_DPI,
12178 TestApplication::DEFAULT_VERTICAL_DPI,
12182 tet_infoline("Check to skip rendering in case of the empty damaged rect");
12184 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
12185 drawTrace.Enable(true);
12188 Actor actor1 = CreateRenderableActor();
12189 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
12190 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
12191 application.GetScene().Add(actor1);
12193 std::vector<Rect<int>> damagedRects;
12194 Rect<int> clippingRect;
12195 Rect<int> expectedRect1;
12197 application.SendNotification();
12198 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12200 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12203 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates
12204 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
12206 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12207 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12209 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
12211 damagedRects.clear();
12212 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12213 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12214 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12216 // Remove the actor
12219 application.SendNotification();
12221 damagedRects.clear();
12222 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12224 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
12226 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12227 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12229 // Render again without any change
12230 damagedRects.clear();
12232 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12234 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12236 clippingRect = Rect<int>();
12237 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12240 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
12242 // Add the actor again
12243 application.GetScene().Add(actor1);
12245 application.SendNotification();
12247 damagedRects.clear();
12249 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12251 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
12253 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12254 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12256 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
12261 int utcDaliActorPartialUpdate3DNode(void)
12263 TestApplication application(
12264 TestApplication::DEFAULT_SURFACE_WIDTH,
12265 TestApplication::DEFAULT_SURFACE_HEIGHT,
12266 TestApplication::DEFAULT_HORIZONTAL_DPI,
12267 TestApplication::DEFAULT_VERTICAL_DPI,
12271 tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
12273 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
12274 drawTrace.Enable(true);
12277 Actor actor1 = CreateRenderableActor();
12278 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
12279 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
12280 application.GetScene().Add(actor1);
12282 std::vector<Rect<int>> damagedRects;
12283 Rect<int> clippingRect;
12285 application.SendNotification();
12286 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12288 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12290 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12291 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12293 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
12295 // Change the layer to 3D
12296 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
12298 application.SendNotification();
12300 damagedRects.clear();
12301 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12303 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12304 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
12306 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12308 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12310 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
12312 // Change the layer to 2D
12313 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
12315 application.SendNotification();
12317 damagedRects.clear();
12318 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12320 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12322 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12323 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12325 // Make 3D transform
12326 actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
12328 application.SendNotification();
12330 damagedRects.clear();
12331 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12333 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12334 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
12336 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
12338 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12340 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
12345 int utcDaliActorPartialUpdateNotRenderableActor(void)
12347 TestApplication application(
12348 TestApplication::DEFAULT_SURFACE_WIDTH,
12349 TestApplication::DEFAULT_SURFACE_HEIGHT,
12350 TestApplication::DEFAULT_HORIZONTAL_DPI,
12351 TestApplication::DEFAULT_VERTICAL_DPI,
12355 tet_infoline("Check the damaged rect with not renderable parent actor");
12357 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12359 Actor parent = Actor::New();
12360 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12361 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12362 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12363 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12364 application.GetScene().Add(parent);
12366 Actor child = CreateRenderableActor();
12367 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12368 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12369 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12372 application.SendNotification();
12374 std::vector<Rect<int>> damagedRects;
12376 // 1. Actor added, damaged rect is added size of actor
12377 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12378 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12381 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12382 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12384 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12385 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12386 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12387 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12388 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12390 damagedRects.clear();
12391 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12392 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12394 damagedRects.clear();
12395 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12396 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12398 // Ensure the damaged rect is empty
12399 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12404 int utcDaliActorPartialUpdateChangeTransparency(void)
12406 TestApplication application(
12407 TestApplication::DEFAULT_SURFACE_WIDTH,
12408 TestApplication::DEFAULT_SURFACE_HEIGHT,
12409 TestApplication::DEFAULT_HORIZONTAL_DPI,
12410 TestApplication::DEFAULT_VERTICAL_DPI,
12414 tet_infoline("Check the damaged rect with changing transparency");
12416 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12418 Actor actor = CreateRenderableActor();
12419 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12420 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12421 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12422 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12423 application.GetScene().Add(actor);
12425 application.SendNotification();
12427 std::vector<Rect<int>> damagedRects;
12429 // Actor added, damaged rect is added size of actor
12430 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12431 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12434 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12435 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12437 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12438 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12439 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12440 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12441 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12443 damagedRects.clear();
12444 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12445 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12447 // Ensure the damaged rect is empty
12448 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12450 // Make the actor transparent by changing opacity of the Renderer
12451 // It changes a uniform value
12452 Renderer renderer = actor.GetRendererAt(0);
12453 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
12455 application.SendNotification();
12457 // The damaged rect should be same
12458 damagedRects.clear();
12459 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12460 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12461 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12462 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12464 damagedRects.clear();
12465 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12466 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12468 // Ensure the damaged rect is empty
12469 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12471 // Make the actor opaque again
12472 renderer[DevelRenderer::Property::OPACITY] = 1.0f;
12474 application.SendNotification();
12476 // The damaged rect should not be empty
12477 damagedRects.clear();
12478 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12479 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12480 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12481 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12483 damagedRects.clear();
12484 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12485 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12487 // Ensure the damaged rect is empty
12488 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12490 // Make the actor translucent
12491 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
12493 application.SendNotification();
12495 // The damaged rect should not be empty
12496 damagedRects.clear();
12497 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12498 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12499 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12500 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12502 damagedRects.clear();
12503 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12504 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12506 // Ensure the damaged rect is empty
12507 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12509 // Change Renderer opacity - also translucent
12510 renderer[DevelRenderer::Property::OPACITY] = 0.2f;
12512 application.SendNotification();
12514 // The damaged rect should not be empty
12515 damagedRects.clear();
12516 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12517 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12518 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12519 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12521 damagedRects.clear();
12522 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12523 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12525 // Ensure the damaged rect is empty
12526 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12528 // Make the actor culled
12529 actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
12531 application.SendNotification();
12533 // The damaged rect should be same
12534 damagedRects.clear();
12535 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12536 DALI_TEST_CHECK(damagedRects.size() > 0);
12537 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12538 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12540 damagedRects.clear();
12541 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12542 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12544 // Ensure the damaged rect is empty
12545 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12547 // Make the actor not culled again
12548 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 16.0f);
12550 application.SendNotification();
12552 // The damaged rect should not be empty
12553 damagedRects.clear();
12554 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12555 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12556 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12557 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12562 int utcDaliActorPartialUpdateChangeParentOpacity(void)
12564 TestApplication application(
12565 TestApplication::DEFAULT_SURFACE_WIDTH,
12566 TestApplication::DEFAULT_SURFACE_HEIGHT,
12567 TestApplication::DEFAULT_HORIZONTAL_DPI,
12568 TestApplication::DEFAULT_VERTICAL_DPI,
12572 tet_infoline("Check the damaged rect with changing parent's opacity");
12574 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12576 Actor parent = Actor::New();
12577 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12578 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12579 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12580 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12581 application.GetScene().Add(parent);
12583 Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
12584 Actor child = CreateRenderableActor(texture);
12585 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12586 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12587 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12590 application.SendNotification();
12592 std::vector<Rect<int>> damagedRects;
12594 // Actor added, damaged rect is added size of actor
12595 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12596 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12599 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12600 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12602 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12603 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12604 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12605 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12606 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12608 damagedRects.clear();
12609 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12610 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12612 damagedRects.clear();
12613 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12614 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12616 // Ensure the damaged rect is empty
12617 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12619 // Change the parent's opacity
12620 parent[Actor::Property::OPACITY] = 0.5f;
12622 application.SendNotification();
12624 // The damaged rect should be same
12625 damagedRects.clear();
12626 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12627 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12628 DALI_TEST_CHECK(damagedRects.size() > 0);
12629 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12634 int utcDaliActorPartialUpdateAddRemoveRenderer(void)
12636 TestApplication application(
12637 TestApplication::DEFAULT_SURFACE_WIDTH,
12638 TestApplication::DEFAULT_SURFACE_HEIGHT,
12639 TestApplication::DEFAULT_HORIZONTAL_DPI,
12640 TestApplication::DEFAULT_VERTICAL_DPI,
12644 tet_infoline("Check the damaged rect with adding / removing renderer");
12646 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12648 Actor actor = CreateRenderableActor();
12649 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12650 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12651 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12652 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12653 application.GetScene().Add(actor);
12655 application.SendNotification();
12657 std::vector<Rect<int>> damagedRects;
12659 // Actor added, damaged rect is added size of actor
12660 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12661 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12664 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12665 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12667 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12668 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12669 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12670 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12671 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12673 damagedRects.clear();
12674 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12675 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12677 damagedRects.clear();
12678 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12679 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12681 // Remove the Renderer
12682 Renderer renderer = actor.GetRendererAt(0);
12683 actor.RemoveRenderer(renderer);
12685 application.SendNotification();
12687 // The damaged rect should be the actor area
12688 damagedRects.clear();
12689 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12690 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12691 DALI_TEST_CHECK(damagedRects.size() > 0);
12692 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12694 damagedRects.clear();
12695 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12696 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12698 // Ensure the damaged rect is empty
12699 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12701 // Add the Renderer again
12702 actor.AddRenderer(renderer);
12704 application.SendNotification();
12706 // The damaged rect should be the actor area
12707 damagedRects.clear();
12708 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12709 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12710 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12711 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12716 int utcDaliActorPartialUpdate3DTransform(void)
12718 TestApplication application(
12719 TestApplication::DEFAULT_SURFACE_WIDTH,
12720 TestApplication::DEFAULT_SURFACE_HEIGHT,
12721 TestApplication::DEFAULT_HORIZONTAL_DPI,
12722 TestApplication::DEFAULT_VERTICAL_DPI,
12726 tet_infoline("Check the damaged rect with 3D transformed actors");
12728 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12730 Actor actor1 = CreateRenderableActor();
12731 actor1[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12732 actor1[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12733 actor1[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12734 actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12735 application.GetScene().Add(actor1);
12738 Actor actor2 = CreateRenderableActor();
12739 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12740 actor2[Actor::Property::POSITION] = Vector3(160.0f, 160.0f, 0.0f);
12741 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12742 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12743 application.GetScene().Add(actor2);
12745 application.SendNotification();
12747 std::vector<Rect<int>> damagedRects;
12749 // Actor added, damaged rect is added size of actor
12750 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12751 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12754 Rect<int> clippingRect1 = Rect<int>(16, 768, 32, 32); // in screen coordinates
12755 Rect<int> clippingRect2 = Rect<int>(160, 624, 32, 32);
12756 DirtyRectChecker(damagedRects, {clippingRect1, clippingRect2}, true, TEST_LOCATION);
12758 Rect<int> surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12759 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12761 damagedRects.clear();
12762 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12763 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12764 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12766 damagedRects.clear();
12767 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12768 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12769 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12771 // Rotate actor1 on y axis
12772 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
12777 application.SendNotification();
12779 damagedRects.clear();
12780 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12782 // Should update full area
12783 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12784 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12785 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12786 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12788 // Add actor2 again
12789 application.GetScene().Add(actor2);
12791 application.SendNotification();
12793 damagedRects.clear();
12794 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12796 // Should update full area
12797 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12798 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12799 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12800 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12802 // Reset the orientation of actor1
12803 actor1[Actor::Property::ORIENTATION] = Quaternion::IDENTITY;
12805 application.SendNotification();
12807 damagedRects.clear();
12808 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12810 // Should update full area
12811 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12812 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12813 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12814 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12816 // Make actor2 dirty
12817 actor2[Actor::Property::SIZE] = Vector3(32.0f, 32.0f, 0.0f);
12819 application.SendNotification();
12821 damagedRects.clear();
12822 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12824 clippingRect2 = Rect<int>(160, 608, 48, 48);
12825 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12826 DirtyRectChecker(damagedRects, {clippingRect2}, true, TEST_LOCATION);
12828 application.RenderWithPartialUpdate(damagedRects, clippingRect2);
12829 DALI_TEST_EQUALS(clippingRect2.x, glScissorParams.x, TEST_LOCATION);
12830 DALI_TEST_EQUALS(clippingRect2.y, glScissorParams.y, TEST_LOCATION);
12831 DALI_TEST_EQUALS(clippingRect2.width, glScissorParams.width, TEST_LOCATION);
12832 DALI_TEST_EQUALS(clippingRect2.height, glScissorParams.height, TEST_LOCATION);
12837 application.SendNotification();
12839 damagedRects.clear();
12840 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12841 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12842 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12844 // Rotate actor1 on y axis
12845 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
12847 // Add actor1 again
12848 application.GetScene().Add(actor1);
12850 application.SendNotification();
12852 damagedRects.clear();
12853 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12855 // Should update full area
12856 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12857 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12858 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12859 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12864 int utcDaliActorPartialUpdateOneActorMultipleRenderers(void)
12866 TestApplication application(
12867 TestApplication::DEFAULT_SURFACE_WIDTH,
12868 TestApplication::DEFAULT_SURFACE_HEIGHT,
12869 TestApplication::DEFAULT_HORIZONTAL_DPI,
12870 TestApplication::DEFAULT_VERTICAL_DPI,
12874 tet_infoline("Check the damaged rect with one actor which has multiple renderers");
12876 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12878 Actor actor = CreateRenderableActor();
12880 // Create another renderer
12881 Geometry geometry = CreateQuadGeometry();
12882 Shader shader = CreateShader();
12883 Renderer renderer2 = Renderer::New(geometry, shader);
12884 actor.AddRenderer(renderer2);
12886 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12887 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12888 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12889 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12890 application.GetScene().Add(actor);
12892 application.SendNotification();
12894 DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
12896 std::vector<Rect<int>> damagedRects;
12898 // Actor added, damaged rect is added size of actor
12899 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12900 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12903 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12904 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
12906 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12907 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12908 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12909 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12910 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12912 damagedRects.clear();
12913 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12914 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12916 // Ensure the damaged rect is empty
12917 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12919 // Make renderer2 dirty
12920 renderer2[DevelRenderer::Property::OPACITY] = 0.5f;
12922 application.SendNotification();
12924 // The damaged rect should be the actor area
12925 damagedRects.clear();
12926 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12928 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12929 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12930 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12932 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12934 damagedRects.clear();
12935 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12936 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12938 // Ensure the damaged rect is empty
12939 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12941 // Make renderer2 dirty
12942 renderer2[Renderer::Property::FACE_CULLING_MODE] = FaceCullingMode::BACK;
12944 application.SendNotification();
12946 // The damaged rect should be the actor area
12947 damagedRects.clear();
12948 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12950 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12951 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12952 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12954 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12956 damagedRects.clear();
12957 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12958 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12960 // Ensure the damaged rect is empty
12961 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12966 int utcDaliActorPartialUpdateMultipleActorsOneRenderer(void)
12968 TestApplication application(
12969 TestApplication::DEFAULT_SURFACE_WIDTH,
12970 TestApplication::DEFAULT_SURFACE_HEIGHT,
12971 TestApplication::DEFAULT_HORIZONTAL_DPI,
12972 TestApplication::DEFAULT_VERTICAL_DPI,
12976 tet_infoline("Check the damaged rect with multiple actors which share a same renderer");
12978 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12980 Actor actor = CreateRenderableActor();
12981 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12982 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12983 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12984 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12985 application.GetScene().Add(actor);
12987 // Create another actor which has the same renderer with actor1
12988 Actor actor2 = Actor::New();
12989 Renderer renderer = actor.GetRendererAt(0);
12990 actor2.AddRenderer(renderer);
12991 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12992 actor2[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12993 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12994 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12995 application.GetScene().Add(actor2);
12997 application.SendNotification();
12999 std::vector<Rect<int>> damagedRects;
13001 // Actor added, damaged rect is added size of actor
13002 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13003 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
13006 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
13007 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
13009 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13010 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
13011 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
13012 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
13013 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
13015 damagedRects.clear();
13016 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13017 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13019 // Ensure the damaged rect is empty
13020 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
13022 // Make renderer dirty
13023 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
13025 application.SendNotification();
13027 // The damaged rect should be the actor area
13028 damagedRects.clear();
13029 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13031 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
13032 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
13033 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
13035 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13037 damagedRects.clear();
13038 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13039 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13041 // Ensure the damaged rect is empty
13042 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
13047 int utcDaliActorPartialUpdateUseTextureUpdateArea01(void)
13049 TestApplication application(
13050 TestApplication::DEFAULT_SURFACE_WIDTH,
13051 TestApplication::DEFAULT_SURFACE_HEIGHT,
13052 TestApplication::DEFAULT_HORIZONTAL_DPI,
13053 TestApplication::DEFAULT_VERTICAL_DPI,
13057 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property");
13059 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
13061 Actor actor = CreateRenderableActor();
13062 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13063 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13064 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
13065 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
13066 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
13068 // Create a native image source.
13069 TestNativeImagePointer testNativeImage = TestNativeImage::New(64u, 64u);
13070 Texture texture = Texture::New(*testNativeImage);
13071 TextureSet textureSet = TextureSet::New();
13072 textureSet.SetTexture(0u, texture);
13073 actor.GetRendererAt(0).SetTextures(textureSet);
13075 application.GetScene().Add(actor);
13077 application.SendNotification();
13079 std::vector<Rect<int>> damagedRects;
13081 // Actor added, damaged rect is added size of actor
13082 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13083 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13086 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
13087 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13089 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13090 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
13091 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
13092 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
13093 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
13095 // Set USE_TEXTURE_UPDATE_AREA
13096 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
13098 // Set updated area of native image
13099 testNativeImage->SetUpdatedArea(Rect<uint32_t>(16, 16, 48, 48));
13101 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13102 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
13104 application.SendNotification();
13106 damagedRects.clear();
13107 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13108 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13109 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13112 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
13113 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13115 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13120 int utcDaliActorPartialUpdateUseTextureUpdateArea02(void)
13122 TestApplication application(
13123 TestApplication::DEFAULT_SURFACE_WIDTH,
13124 TestApplication::DEFAULT_SURFACE_HEIGHT,
13125 TestApplication::DEFAULT_HORIZONTAL_DPI,
13126 TestApplication::DEFAULT_VERTICAL_DPI,
13130 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property and multiple native textures");
13132 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
13134 Actor actor = CreateRenderableActor();
13135 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13136 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13137 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
13138 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
13139 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
13141 // Create a native image source.
13142 TestNativeImagePointer testNativeImage1 = TestNativeImage::New(64u, 64u);
13143 Texture texture1 = Texture::New(*testNativeImage1);
13144 TestNativeImagePointer testNativeImage2 = TestNativeImage::New(64u, 64u);
13145 Texture texture2 = Texture::New(*testNativeImage2);
13147 TextureSet textureSet = TextureSet::New();
13148 textureSet.SetTexture(0u, texture1);
13149 textureSet.SetTexture(1u, texture2);
13150 actor.GetRendererAt(0).SetTextures(textureSet);
13152 application.GetScene().Add(actor);
13154 application.SendNotification();
13156 std::vector<Rect<int>> damagedRects;
13158 // Actor added, damaged rect is added size of actor
13159 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13160 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13163 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
13164 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13166 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13167 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
13168 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
13169 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
13170 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
13172 // Set USE_TEXTURE_UPDATE_AREA
13173 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
13175 // Set updated area of native image
13176 testNativeImage1->SetUpdatedArea(Rect<uint32_t>(0, 0, 32, 32));
13177 testNativeImage2->SetUpdatedArea(Rect<uint32_t>(32, 0, 32, 32));
13179 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13180 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
13182 application.SendNotification();
13184 damagedRects.clear();
13185 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13186 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13187 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13190 clippingRect = Rect<int>(0, 752, 80, 64); // in screen coordinates
13191 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13193 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13198 int utcDaliActorPartialUpdateUseTextureUpdateArea03(void)
13200 TestApplication application(
13201 TestApplication::DEFAULT_SURFACE_WIDTH,
13202 TestApplication::DEFAULT_SURFACE_HEIGHT,
13203 TestApplication::DEFAULT_HORIZONTAL_DPI,
13204 TestApplication::DEFAULT_VERTICAL_DPI,
13208 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property and multiple normal textures");
13210 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
13212 uint32_t width = 64, height = 64;
13214 Texture texture1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, width, height);
13215 Texture texture2 = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, width, height);
13216 Actor actor = CreateRenderableActor(texture1);
13217 actor.GetRendererAt(0).GetTextures().SetTexture(1u, texture2);
13219 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13220 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13221 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
13222 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
13223 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
13225 application.GetScene().Add(actor);
13227 application.SendNotification();
13229 std::vector<Rect<int>> damagedRects;
13231 // Actor added, damaged rect is added size of actor
13232 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13233 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13236 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
13237 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13239 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13240 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
13241 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
13242 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
13243 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
13245 // Set USE_TEXTURE_UPDATE_AREA
13246 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
13248 int bufferSize = width * height * 4;
13249 uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(bufferSize));
13250 PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::Format::RGBA8888, PixelData::FREE);
13253 texture1.Upload(pixelData, 0u, 0u, 0u, 0u, 32u, 32u);
13254 texture2.Upload(pixelData, 0u, 0u, 32u, 0u, 32u, 32u);
13256 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13257 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
13259 application.SendNotification();
13261 damagedRects.clear();
13262 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13263 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13264 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13267 clippingRect = Rect<int>(0, 752, 80, 64); // in screen coordinates
13268 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13270 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
13272 // Update full area of the texture
13273 texture1.Upload(pixelData);
13275 application.SendNotification();
13277 damagedRects.clear();
13278 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
13279 application.RenderWithPartialUpdate(damagedRects, clippingRect);
13280 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
13283 clippingRect = Rect<int>(0, 736, 80, 80); // in screen coordinates
13284 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
13289 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
13291 TestApplication application;
13293 Actor actor = Actor::New();
13294 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
13295 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
13296 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
13297 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
13298 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
13299 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
13300 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
13301 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
13305 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
13307 TestApplication application;
13309 Actor actor = Actor::New();
13311 // Make sure setting invalid types does not cause a crash
13314 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
13315 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
13316 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
13317 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
13318 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
13319 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
13320 tet_result(TET_PASS);
13324 tet_result(TET_FAIL);
13329 int UtcDaliActorTouchAreaOffsetPropertyP(void)
13331 TestApplication application;
13333 Actor actor = Actor::New();
13334 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
13335 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
13336 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
13337 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
13338 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
13342 int UtcDaliActorTouchAreaOffsetPropertyN(void)
13344 TestApplication application;
13346 Actor actor = Actor::New();
13348 // Make sure setting invalid types does not cause a crash
13351 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
13352 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
13353 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
13354 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
13355 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
13356 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
13357 tet_result(TET_PASS);
13361 tet_result(TET_FAIL);
13366 int UtcDaliActorLowerBelowNegative(void)
13368 TestApplication application;
13369 Dali::Actor instance;
13373 instance.LowerBelow(arg1);
13374 DALI_TEST_CHECK(false); // Should not get here
13378 DALI_TEST_CHECK(true); // We expect an assert
13383 int UtcDaliActorRaiseAboveNegative(void)
13385 TestApplication application;
13386 Dali::Actor instance;
13390 instance.RaiseAbove(arg1);
13391 DALI_TEST_CHECK(false); // Should not get here
13395 DALI_TEST_CHECK(true); // We expect an assert
13400 int UtcDaliActorRaiseToTopNegative(void)
13402 TestApplication application;
13403 Dali::Actor instance;
13406 instance.RaiseToTop();
13407 DALI_TEST_CHECK(false); // Should not get here
13411 DALI_TEST_CHECK(true); // We expect an assert
13416 int UtcDaliActorAddRendererNegative(void)
13418 TestApplication application;
13419 Dali::Actor instance;
13422 Dali::Renderer arg1;
13423 instance.AddRenderer(arg1);
13424 DALI_TEST_CHECK(false); // Should not get here
13428 DALI_TEST_CHECK(true); // We expect an assert
13433 int UtcDaliActorTouchedSignalNegative(void)
13435 TestApplication application;
13436 Dali::Actor instance;
13439 instance.TouchedSignal();
13440 DALI_TEST_CHECK(false); // Should not get here
13444 DALI_TEST_CHECK(true); // We expect an assert
13449 int UtcDaliActorTranslateByNegative(void)
13451 TestApplication application;
13452 Dali::Actor instance;
13455 Dali::Vector3 arg1;
13456 instance.TranslateBy(arg1);
13457 DALI_TEST_CHECK(false); // Should not get here
13461 DALI_TEST_CHECK(true); // We expect an assert
13466 int UtcDaliActorFindChildByIdNegative(void)
13468 TestApplication application;
13469 Dali::Actor instance;
13472 unsigned int arg1 = 0u;
13473 instance.FindChildById(arg1);
13474 DALI_TEST_CHECK(false); // Should not get here
13478 DALI_TEST_CHECK(true); // We expect an assert
13483 int UtcDaliActorGetRendererAtNegative(void)
13485 TestApplication application;
13486 Dali::Actor instance;
13489 unsigned int arg1 = 0u;
13490 instance.GetRendererAt(arg1);
13491 DALI_TEST_CHECK(false); // Should not get here
13495 DALI_TEST_CHECK(true); // We expect an assert
13500 int UtcDaliActorHoveredSignalNegative(void)
13502 TestApplication application;
13503 Dali::Actor instance;
13506 instance.HoveredSignal();
13507 DALI_TEST_CHECK(false); // Should not get here
13511 DALI_TEST_CHECK(true); // We expect an assert
13516 int UtcDaliActorLowerToBottomNegative(void)
13518 TestApplication application;
13519 Dali::Actor instance;
13522 instance.LowerToBottom();
13523 DALI_TEST_CHECK(false); // Should not get here
13527 DALI_TEST_CHECK(true); // We expect an assert
13532 int UtcDaliActorOnSceneSignalNegative(void)
13534 TestApplication application;
13535 Dali::Actor instance;
13538 instance.OnSceneSignal();
13539 DALI_TEST_CHECK(false); // Should not get here
13543 DALI_TEST_CHECK(true); // We expect an assert
13548 int UtcDaliActorOffSceneSignalNegative(void)
13550 TestApplication application;
13551 Dali::Actor instance;
13554 instance.OffSceneSignal();
13555 DALI_TEST_CHECK(false); // Should not get here
13559 DALI_TEST_CHECK(true); // We expect an assert
13564 int UtcDaliActorRemoveRendererNegative01(void)
13566 TestApplication application;
13567 Dali::Actor instance;
13570 unsigned int arg1 = 0u;
13571 instance.RemoveRenderer(arg1);
13572 DALI_TEST_CHECK(false); // Should not get here
13576 DALI_TEST_CHECK(true); // We expect an assert
13581 int UtcDaliActorRemoveRendererNegative02(void)
13583 TestApplication application;
13584 Dali::Actor instance;
13587 Dali::Renderer arg1;
13588 instance.RemoveRenderer(arg1);
13589 DALI_TEST_CHECK(false); // Should not get here
13593 DALI_TEST_CHECK(true); // We expect an assert
13598 int UtcDaliActorFindChildByNameNegative(void)
13600 TestApplication application;
13601 Dali::Actor instance;
13605 instance.FindChildByName(arg1);
13606 DALI_TEST_CHECK(false); // Should not get here
13610 DALI_TEST_CHECK(true); // We expect an assert
13615 int UtcDaliActorSetResizePolicyNegative(void)
13617 TestApplication application;
13618 Dali::Actor instance;
13621 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
13622 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
13623 instance.SetResizePolicy(arg1, arg2);
13624 DALI_TEST_CHECK(false); // Should not get here
13628 DALI_TEST_CHECK(true); // We expect an assert
13633 int UtcDaliActorOnRelayoutSignalNegative(void)
13635 TestApplication application;
13636 Dali::Actor instance;
13639 instance.OnRelayoutSignal();
13640 DALI_TEST_CHECK(false); // Should not get here
13644 DALI_TEST_CHECK(true); // We expect an assert
13649 int UtcDaliActorWheelEventSignalNegative(void)
13651 TestApplication application;
13652 Dali::Actor instance;
13655 instance.WheelEventSignal();
13656 DALI_TEST_CHECK(false); // Should not get here
13660 DALI_TEST_CHECK(true); // We expect an assert
13665 int UtcDaliActorGetHeightForWidthNegative(void)
13667 TestApplication application;
13668 Dali::Actor instance;
13672 instance.GetHeightForWidth(arg1);
13673 DALI_TEST_CHECK(false); // Should not get here
13677 DALI_TEST_CHECK(true); // We expect an assert
13682 int UtcDaliActorGetWidthForHeightNegative(void)
13684 TestApplication application;
13685 Dali::Actor instance;
13689 instance.GetWidthForHeight(arg1);
13690 DALI_TEST_CHECK(false); // Should not get here
13694 DALI_TEST_CHECK(true); // We expect an assert
13699 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
13701 TestApplication application;
13702 Dali::Actor instance;
13705 instance.LayoutDirectionChangedSignal();
13706 DALI_TEST_CHECK(false); // Should not get here
13710 DALI_TEST_CHECK(true); // We expect an assert
13715 int UtcDaliActorAddNegative(void)
13717 TestApplication application;
13718 Dali::Actor instance;
13722 instance.Add(arg1);
13723 DALI_TEST_CHECK(false); // Should not get here
13727 DALI_TEST_CHECK(true); // We expect an assert
13732 int UtcDaliActorLowerNegative(void)
13734 TestApplication application;
13735 Dali::Actor instance;
13739 DALI_TEST_CHECK(false); // Should not get here
13743 DALI_TEST_CHECK(true); // We expect an assert
13748 int UtcDaliActorRaiseNegative(void)
13750 TestApplication application;
13751 Dali::Actor instance;
13755 DALI_TEST_CHECK(false); // Should not get here
13759 DALI_TEST_CHECK(true); // We expect an assert
13764 int UtcDaliActorRemoveNegative(void)
13766 TestApplication application;
13767 Dali::Actor instance;
13771 instance.Remove(arg1);
13772 DALI_TEST_CHECK(false); // Should not get here
13776 DALI_TEST_CHECK(true); // We expect an assert
13781 int UtcDaliActorScaleByNegative(void)
13783 TestApplication application;
13784 Dali::Actor instance;
13787 Dali::Vector3 arg1;
13788 instance.ScaleBy(arg1);
13789 DALI_TEST_CHECK(false); // Should not get here
13793 DALI_TEST_CHECK(true); // We expect an assert
13798 int UtcDaliActorGetLayerNegative(void)
13800 TestApplication application;
13801 Dali::Actor instance;
13804 instance.GetLayer();
13805 DALI_TEST_CHECK(false); // Should not get here
13809 DALI_TEST_CHECK(true); // We expect an assert
13814 int UtcDaliActorRotateByNegative01(void)
13816 TestApplication application;
13817 Dali::Actor instance;
13820 Dali::Quaternion arg1;
13821 instance.RotateBy(arg1);
13822 DALI_TEST_CHECK(false); // Should not get here
13826 DALI_TEST_CHECK(true); // We expect an assert
13831 int UtcDaliActorRotateByNegative02(void)
13833 TestApplication application;
13834 Dali::Actor instance;
13838 Dali::Vector3 arg2;
13839 instance.RotateBy(arg1, arg2);
13840 DALI_TEST_CHECK(false); // Should not get here
13844 DALI_TEST_CHECK(true); // We expect an assert
13849 int UtcDaliActorUnparentNegative(void)
13851 TestApplication application;
13852 Dali::Actor instance;
13855 instance.Unparent();
13856 DALI_TEST_CHECK(false); // Should not get here
13860 DALI_TEST_CHECK(true); // We expect an assert
13865 int UtcDaliActorGetChildAtNegative(void)
13867 TestApplication application;
13868 Dali::Actor instance;
13871 unsigned int arg1 = 0u;
13872 instance.GetChildAt(arg1);
13873 DALI_TEST_CHECK(false); // Should not get here
13877 DALI_TEST_CHECK(true); // We expect an assert
13882 int UtcDaliActorGetChildCountNegative(void)
13884 TestApplication application;
13885 Dali::Actor instance;
13888 instance.GetChildCount();
13889 DALI_TEST_CHECK(false); // Should not get here
13893 DALI_TEST_CHECK(true); // We expect an assert
13898 int UtcDaliActorGetTargetSizeNegative(void)
13900 TestApplication application;
13901 Dali::Actor instance;
13904 instance.GetTargetSize();
13905 DALI_TEST_CHECK(false); // Should not get here
13909 DALI_TEST_CHECK(true); // We expect an assert
13914 int UtcDaliActorScreenToLocalNegative(void)
13916 TestApplication application;
13917 Dali::Actor instance;
13924 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
13925 DALI_TEST_CHECK(false); // Should not get here
13929 DALI_TEST_CHECK(true); // We expect an assert
13934 int UtcDaliActorGetNaturalSizeNegative(void)
13936 TestApplication application;
13937 Dali::Actor instance;
13940 instance.GetNaturalSize();
13941 DALI_TEST_CHECK(false); // Should not get here
13945 DALI_TEST_CHECK(true); // We expect an assert
13950 int UtcDaliActorGetRelayoutSizeNegative(void)
13952 TestApplication application;
13953 Dali::Actor instance;
13956 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
13957 instance.GetRelayoutSize(arg1);
13958 DALI_TEST_CHECK(false); // Should not get here
13962 DALI_TEST_CHECK(true); // We expect an assert
13967 int UtcDaliActorGetResizePolicyNegative(void)
13969 TestApplication application;
13970 Dali::Actor instance;
13973 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
13974 instance.GetResizePolicy(arg1);
13975 DALI_TEST_CHECK(false); // Should not get here
13979 DALI_TEST_CHECK(true); // We expect an assert
13984 int UtcDaliActorGetRendererCountNegative(void)
13986 TestApplication application;
13987 Dali::Actor instance;
13990 instance.GetRendererCount();
13991 DALI_TEST_CHECK(false); // Should not get here
13995 DALI_TEST_CHECK(true); // We expect an assert
14000 int UtcDaliActorGetParentNegative(void)
14002 TestApplication application;
14003 Dali::Actor instance;
14006 instance.GetParent();
14007 DALI_TEST_CHECK(false); // Should not get here
14011 DALI_TEST_CHECK(true); // We expect an assert
14016 int UtcDaliActorPropertyBlendEquation(void)
14018 TestApplication application;
14020 tet_infoline("Test SetProperty AdvancedBlendEquation");
14022 Geometry geometry = CreateQuadGeometry();
14023 Shader shader = CreateShader();
14024 Renderer renderer1 = Renderer::New(geometry, shader);
14026 Actor actor = Actor::New();
14027 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
14029 actor.AddRenderer(renderer1);
14030 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
14031 application.GetScene().Add(actor);
14033 if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
14035 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
14036 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
14037 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
14040 if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
14042 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
14043 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
14044 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
14047 Renderer renderer2 = Renderer::New(geometry, shader);
14048 actor.AddRenderer(renderer2);
14053 int UtcDaliActorRegisterProperty(void)
14055 tet_infoline("Test property registration and uniform map update\n");
14057 TestApplication application;
14059 Geometry geometry = CreateQuadGeometry();
14060 Shader shader = CreateShader();
14061 Renderer renderer1 = Renderer::New(geometry, shader);
14062 Renderer renderer2 = Renderer::New(geometry, shader);
14064 Actor actor1 = Actor::New();
14065 actor1.AddRenderer(renderer1);
14066 actor1.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
14067 actor1.RegisterProperty("uCustom", 1);
14068 application.GetScene().Add(actor1);
14070 Actor actor2 = Actor::New();
14071 actor2.AddRenderer(renderer2);
14072 actor2.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
14073 application.GetScene().Add(actor2);
14075 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
14076 TraceCallStack& callStack = glAbstraction.GetSetUniformTrace();
14077 glAbstraction.EnableSetUniformCallTrace(true);
14079 application.SendNotification();
14080 application.Render();
14082 std::stringstream out;
14084 std::string params;
14086 // Test uniform value of the custom property
14087 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
14088 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
14091 actor1[Actor::Property::VISIBLE] = false;
14093 application.SendNotification();
14094 application.Render();
14096 // Make visible again
14097 actor1[Actor::Property::VISIBLE] = true;
14098 actor1["uCustom"] = 2;
14100 glAbstraction.ResetSetUniformCallStack();
14102 application.SendNotification();
14103 application.Render();
14107 // The uniform value should not be changed
14108 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
14109 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
14114 int UtcDaliActorDoesWantedHitTest(void)
14119 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
14121 mTouchPoint(touchPoint),
14127 Vector2 mTouchPoint;
14131 TestApplication application;
14132 tet_infoline(" UtcDaliActorDoesWantedHitTest");
14134 // Fill a vector with different hit tests.
14135 struct HitTestData* hitTestData[] = {
14136 // scale touch point result
14137 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
14138 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
14139 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.
14140 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
14141 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.
14145 // get the root layer
14146 Actor actor = Actor::New();
14147 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
14148 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
14150 Actor lowerActor = Actor::New();
14151 lowerActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
14152 lowerActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
14154 // actor and lowerActor have no relationship.
14155 application.GetScene().Add(lowerActor);
14156 application.GetScene().Add(actor);
14158 ResetTouchCallbacks();
14159 gHitTestTouchCallBackCalled = false;
14161 unsigned int index = 0;
14162 while(NULL != hitTestData[index])
14164 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
14165 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
14167 lowerActor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
14168 lowerActor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
14170 // flush the queue and render once
14171 application.SendNotification();
14172 application.Render();
14174 DALI_TEST_CHECK(!gTouchCallBackCalled);
14175 DALI_TEST_CHECK(!gTouchCallBackCalled2);
14176 DALI_TEST_CHECK(!gHitTestTouchCallBackCalled);
14178 // connect to its touch signal
14179 actor.TouchedSignal().Connect(TestTouchCallback);
14180 lowerActor.TouchedSignal().Connect(TestTouchCallback2);
14182 // connect to its hit-test signal
14183 Dali::DevelActor::HitTestResultSignal(actor).Connect(TestHitTestTouchCallback);
14185 Dali::Integration::Point point;
14186 point.SetState(PointState::DOWN);
14187 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
14188 Dali::Integration::TouchEvent event;
14189 event.AddPoint(point);
14191 // flush the queue and render once
14192 application.SendNotification();
14193 application.Render();
14194 application.ProcessEvent(event);
14196 // check hit-test events
14197 DALI_TEST_CHECK(gHitTestTouchCallBackCalled == hitTestData[index]->mResult);
14198 // Passed all hit-tests of actor.
14199 DALI_TEST_CHECK(gTouchCallBackCalled == false);
14200 // The lowerActor was hit-tested.
14201 DALI_TEST_CHECK(gTouchCallBackCalled2 == hitTestData[index]->mResult);
14203 if(gTouchCallBackCalled2 != hitTestData[index]->mResult)
14204 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
14205 hitTestData[index]->mScale.x,
14206 hitTestData[index]->mScale.y,
14207 hitTestData[index]->mScale.z,
14208 hitTestData[index]->mTouchPoint.x,
14209 hitTestData[index]->mTouchPoint.y,
14210 hitTestData[index]->mResult);
14212 ResetTouchCallbacks();
14213 gHitTestTouchCallBackCalled = false;
14219 int UtcDaliActorAllowOnlyOwnTouchPropertyP(void)
14221 TestApplication application;
14223 Actor actor = Actor::New();
14224 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), false, TEST_LOCATION);
14225 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, true);
14226 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), true, TEST_LOCATION);
14227 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), Property::BOOLEAN, TEST_LOCATION);
14228 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), true, TEST_LOCATION);
14229 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
14230 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
14231 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), "allowOnlyOwnTouch", TEST_LOCATION);
14235 int UtcDaliActorAllowOnlyOwnTouchPropertyN(void)
14237 TestApplication application;
14239 Actor actor = Actor::New();
14241 // Make sure setting invalid types does not cause a crash
14244 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, 1.0f);
14245 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector2::ONE);
14246 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector3::ONE);
14247 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector4::ONE);
14248 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Map());
14249 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Array());
14250 tet_result(TET_PASS);
14254 tet_result(TET_FAIL);
14259 int UtcDaliActorCalculateWorldTransform01(void)
14261 TestApplication application;
14263 tet_infoline("Test that actor position inheritance produces right transform matrix");
14265 Actor rootActor = Actor::New();
14266 Actor branchActor = Actor::New();
14267 Actor leafActor = Actor::New();
14269 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
14270 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14271 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14273 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14274 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14275 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14277 // Set anchor point to the same value as parent origin
14278 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
14279 branchActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
14280 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
14282 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14283 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14284 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14286 application.GetScene().Add(rootActor);
14287 rootActor.Add(branchActor);
14288 branchActor.Add(leafActor);
14290 application.SendNotification();
14291 application.Render(0);
14292 application.SendNotification();
14293 application.Render(0);
14295 Matrix m = DevelActor::GetWorldTransform(leafActor);
14297 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14298 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14301 Vector3 worldScale;
14302 Quaternion worldRotation;
14303 m.GetTransformComponents(worldPos, worldRotation, worldScale);
14304 DALI_TEST_EQUALS(worldPos, Vector3(200.0f, 150.0f, 30.0f), 0.0001f, TEST_LOCATION);
14309 int UtcDaliActorCalculateWorldTransform02(void)
14311 TestApplication application;
14313 tet_infoline("Test that actor position produces right transform matrix");
14315 Actor rootActor = Actor::New();
14316 Actor branchActor = Actor::New();
14317 Actor leafActor = Actor::New();
14319 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
14320 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14321 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14323 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14324 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14325 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14327 // Set anchor point to the same value as parent origin
14328 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14329 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14330 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14332 application.GetScene().Add(rootActor);
14333 rootActor.Add(branchActor);
14334 branchActor.Add(leafActor);
14336 leafActor[Actor::Property::INHERIT_POSITION] = false;
14337 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
14338 leafActor[Actor::Property::INHERIT_SCALE] = false;
14340 application.SendNotification();
14341 application.Render(0);
14342 application.SendNotification();
14343 application.Render(0);
14345 Matrix m = DevelActor::GetWorldTransform(leafActor);
14347 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14348 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14353 int UtcDaliActorCalculateWorldTransform03(void)
14355 TestApplication application;
14357 tet_infoline("Test that actor position produces right transform matrix");
14359 Actor rootActor = Actor::New();
14360 Actor branchActor = Actor::New();
14361 Actor leafActor = Actor::New();
14363 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
14364 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14365 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14367 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14368 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14369 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14371 // Set anchor point to the same value as parent origin
14372 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14373 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14374 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14376 application.GetScene().Add(rootActor);
14377 rootActor.Add(branchActor);
14378 branchActor.Add(leafActor);
14380 leafActor[Actor::Property::INHERIT_POSITION] = true;
14381 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
14382 leafActor[Actor::Property::INHERIT_SCALE] = false;
14384 application.SendNotification();
14385 application.Render(0);
14386 application.SendNotification();
14387 application.Render(0);
14389 Matrix m = DevelActor::GetWorldTransform(leafActor);
14391 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14392 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14397 int UtcDaliActorCalculateWorldTransform04(void)
14399 TestApplication application;
14401 tet_infoline("Test that actor inheritance scale/orientation produces right transform matrix");
14403 Actor rootActor = Actor::New();
14404 Actor branchActor = Actor::New();
14405 Actor leafActor = Actor::New();
14407 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14408 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14409 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14411 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14412 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14413 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14415 // Set anchor point to the same value as parent origin
14416 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14417 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14418 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14419 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14421 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14422 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14424 application.GetScene().Add(rootActor);
14425 rootActor.Add(branchActor);
14426 branchActor.Add(leafActor);
14428 application.SendNotification();
14429 application.Render(0);
14430 application.SendNotification();
14431 application.Render(0);
14433 Matrix m = DevelActor::GetWorldTransform(leafActor);
14435 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14436 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14441 int UtcDaliActorCalculateWorldTransform05(void)
14443 TestApplication application;
14445 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14447 Actor rootActor = Actor::New();
14448 Actor branchActor = Actor::New();
14449 Actor leafActor = Actor::New();
14451 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14452 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14453 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14455 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14456 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14457 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14459 // Set anchor point to the same value as parent origin
14460 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14461 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14462 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14463 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14465 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14466 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14468 leafActor[Actor::Property::INHERIT_POSITION] = false;
14469 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
14471 application.GetScene().Add(rootActor);
14472 rootActor.Add(branchActor);
14473 branchActor.Add(leafActor);
14475 application.SendNotification();
14476 application.Render(0);
14477 application.SendNotification();
14478 application.Render(0);
14480 Matrix m = DevelActor::GetWorldTransform(leafActor);
14482 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14483 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14488 int UtcDaliActorCalculateWorldTransform06(void)
14490 TestApplication application;
14492 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14494 Actor rootActor = Actor::New();
14495 Actor branchActor = Actor::New();
14496 Actor leafActor = Actor::New();
14498 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14499 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14500 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14502 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14503 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14504 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14506 // Set anchor point to the same value as parent origin
14507 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14508 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14509 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14510 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14512 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
14513 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
14514 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14516 leafActor[Actor::Property::INHERIT_POSITION] = false;
14517 leafActor[Actor::Property::INHERIT_SCALE] = false;
14519 application.GetScene().Add(rootActor);
14520 rootActor.Add(branchActor);
14521 branchActor.Add(leafActor);
14523 application.SendNotification();
14524 application.Render(0);
14525 application.SendNotification();
14526 application.Render(0);
14528 Matrix m = DevelActor::GetWorldTransform(leafActor);
14530 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14531 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14536 int UtcDaliActorCalculateWorldTransform07(void)
14538 TestApplication application;
14540 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14542 Actor rootActor = Actor::New();
14543 Actor branchActor = Actor::New();
14544 Actor leafActor = Actor::New();
14546 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14547 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14548 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14550 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14551 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14552 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14554 // Set anchor point to the same value as parent origin
14555 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14556 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14557 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14559 // This should be ignored.
14560 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14561 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14563 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
14564 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
14565 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14567 leafActor[Actor::Property::INHERIT_POSITION] = false;
14568 leafActor[Actor::Property::INHERIT_SCALE] = false;
14569 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = false;
14571 application.GetScene().Add(rootActor);
14572 rootActor.Add(branchActor);
14573 branchActor.Add(leafActor);
14575 application.SendNotification();
14576 application.Render(0);
14577 application.SendNotification();
14578 application.Render(0);
14580 Matrix m = DevelActor::GetWorldTransform(leafActor);
14582 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14583 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14588 int UtcDaliActorCalculateWorldTransform08(void)
14590 TestApplication application;
14592 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14594 Vector3 solutions[] = {Vector3(250, 0, 0), Vector3(0, 250, 0), Vector3(650, 0, 0), Vector3(0, 250, 0), Vector3(650, 0, 0), Vector3(400, 250, 0), Vector3(200, -50, 0), Vector3(500, 200, 0)};
14602 TestCase testCases[] = {
14603 {false, false, true},
14604 {false, true, false},
14605 {true, false, false},
14606 {false, true, true},
14607 {true, false, true},
14608 {true, true, false},
14609 {false, false, false},
14610 {true, true, true},
14613 Actor rootActor = Actor::New();
14614 Actor leafActor = Actor::New();
14616 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
14617 rootActor[Actor::Property::SCALE] = Vector3(1.0f, 2.0f, 1.0f);
14618 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14619 rootActor[Actor::Property::SIZE] = Vector2(200, 400);
14620 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14621 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14623 leafActor[Actor::Property::POSITION] = Vector3(0.0f, -50.0f, 0.0f);
14624 leafActor[Actor::Property::SCALE] = Vector3(1.0f, 1.0f, 1.0f);
14625 leafActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14626 leafActor[Actor::Property::SIZE] = Vector2(200, 400);
14627 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_CENTER;
14628 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_CENTER;
14629 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
14631 application.GetScene().Add(rootActor);
14632 rootActor.Add(leafActor);
14634 for(uint32_t i = 0; i < 8; ++i)
14636 leafActor[Actor::Property::INHERIT_POSITION] = testCases[i].translation;
14637 leafActor[Actor::Property::INHERIT_ORIENTATION] = testCases[i].rotation;
14638 leafActor[Actor::Property::INHERIT_SCALE] = testCases[i].scaling;
14640 application.SendNotification();
14641 application.Render(0);
14642 application.SendNotification();
14643 application.Render(0);
14645 Matrix m = DevelActor::GetWorldTransform(leafActor);
14646 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14648 Vector3 worldPosition1 = Vector3(m.GetTranslation());
14649 Vector3 worldPosition2 = Vector3(actualMatrix.GetTranslation());
14651 DALI_TEST_EQUALS(solutions[i], worldPosition1, 0.001f, TEST_LOCATION);
14652 DALI_TEST_EQUALS(solutions[i], worldPosition2, 0.001f, TEST_LOCATION);
14658 int UtcDaliActorCalculateWorldColor01(void)
14660 TestApplication application;
14662 tet_infoline("Test that actor inheritance of color produces right final color");
14664 Actor rootActor = Actor::New();
14665 Actor branchActor = Actor::New();
14666 Actor leafActor = Actor::New();
14668 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14669 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14670 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14672 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14673 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14674 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14676 rootActor[Actor::Property::COLOR] = Color::WHITE;
14677 Vector4 testColor1(1.0f, 1.0f, 0.5f, 0.8f);
14678 branchActor[Actor::Property::COLOR] = testColor1;
14679 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14681 // Default is to inherit:
14682 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_ALPHA;
14684 application.GetScene().Add(rootActor);
14685 rootActor.Add(branchActor);
14686 branchActor.Add(leafActor);
14688 application.SendNotification();
14689 application.Render(16);
14690 Vector4 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14691 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14693 application.SendNotification();
14694 application.Render(16);
14695 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14696 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14698 application.SendNotification();
14699 application.Render(16);
14700 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14701 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14703 color = DevelActor::GetWorldColor(leafActor);
14705 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14706 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14711 int UtcDaliActorCalculateWorldColor02(void)
14713 TestApplication application;
14715 tet_infoline("Test that actor uses own color");
14717 Actor rootActor = Actor::New();
14718 Actor branchActor = Actor::New();
14719 Actor leafActor = Actor::New();
14721 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14722 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14723 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14725 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14726 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14727 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14729 rootActor[Actor::Property::COLOR] = Color::WHITE;
14730 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14731 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14733 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_COLOR;
14735 application.GetScene().Add(rootActor);
14736 rootActor.Add(branchActor);
14737 branchActor.Add(leafActor);
14739 application.SendNotification();
14740 application.Render(0);
14742 Vector4 color = DevelActor::GetWorldColor(leafActor);
14744 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14745 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14746 DALI_TEST_EQUALS(color, Vector4(0.1f, 0.5f, 0.5f, 0.8f), 0.001f, TEST_LOCATION);
14750 int UtcDaliActorCalculateWorldColor03(void)
14752 TestApplication application;
14754 tet_infoline("Test that actor uses parent color");
14756 Actor rootActor = Actor::New();
14757 Actor branchActor = Actor::New();
14758 Actor leafActor = Actor::New();
14760 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14761 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14762 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14764 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14765 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14766 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14768 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
14769 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14770 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14772 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_PARENT_COLOR;
14774 application.GetScene().Add(rootActor);
14775 rootActor.Add(branchActor);
14776 branchActor.Add(leafActor);
14778 application.SendNotification();
14779 application.Render(0);
14781 Vector4 color = DevelActor::GetWorldColor(leafActor);
14783 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14784 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14785 DALI_TEST_EQUALS(color, Vector4(1.0f, 1.0f, 0.5f, 0.72f), 0.001f, TEST_LOCATION);
14789 int UtcDaliActorCalculateWorldColor04(void)
14791 TestApplication application;
14793 tet_infoline("Test that actor blends with parent color");
14795 Actor rootActor = Actor::New();
14796 Actor branchActor = Actor::New();
14797 Actor leafActor = Actor::New();
14799 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14800 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14801 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14803 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14804 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14805 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14807 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
14808 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14809 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14811 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR;
14813 application.GetScene().Add(rootActor);
14814 rootActor.Add(branchActor);
14815 branchActor.Add(leafActor);
14817 application.SendNotification();
14818 application.Render(0);
14820 Vector4 color = DevelActor::GetWorldColor(leafActor);
14822 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14823 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14828 int UtcDaliActorCalculateLookAt(void)
14830 TestApplication application;
14832 tet_infoline("Test that actor rotate right value of orientation");
14834 Actor actor = Actor::New();
14836 actor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14837 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14838 actor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14840 application.GetScene().Add(actor);
14842 application.SendNotification();
14843 application.Render(0);
14845 Quaternion actorQuaternion;
14847 tet_printf("Test with target only\n");
14848 Dali::DevelActor::LookAt(actor, Vector3::ZERO);
14849 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14850 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
14852 tet_printf("Test with target + up\n");
14853 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::ZAXIS);
14854 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14855 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::XAXIS) * Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
14857 tet_printf("Test with target + up + localForward\n");
14858 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_XAXIS);
14859 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14860 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(180.0f)), Vector3::XAXIS), TEST_LOCATION);
14862 tet_printf("Test with target + up + localForward + localUp\n");
14863 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_YAXIS, Vector3::XAXIS);
14864 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14865 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_ZAXIS), TEST_LOCATION);
14867 // Reset quaternion
14868 actor[Actor::Property::ORIENTATION] = Quaternion();
14870 Actor actor2 = Actor::New();
14871 actor2[Actor::Property::POSITION] = Vector3(0.0f, 50.0f, -10.0f);
14872 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14873 actor2[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14876 tet_printf("Test whether lookat calculate well by using event side values only\n");
14877 Dali::DevelActor::LookAt(actor2, Vector3(100.0f, 50.0f, 1.0f));
14878 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14879 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
14881 actor[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0f)), Vector3::ZAXIS);
14883 DALI_TEST_EQUALS(Dali::DevelActor::GetWorldTransform(actor2).GetTranslation3(), Vector3(50.0f, 0.0f, -10.0f), TEST_LOCATION);
14885 tet_printf("Test whether lookat calculate well inherit by parent orientation\n");
14886 Dali::DevelActor::LookAt(actor2, Vector3(50.0f, 0.0f, 1.0f), Vector3::NEGATIVE_XAXIS);
14887 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14888 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
14893 int UtcDaliActorIsHittable(void)
14895 TestApplication application;
14897 Actor parent = Actor::New();
14898 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
14899 parent.SetProperty(Actor::Property::COLOR, parentColor);
14900 application.GetScene().Add(parent);
14902 Actor actor = Actor::New();
14903 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
14904 actor.SetProperty(Actor::Property::COLOR, childColor);
14907 actor.SetProperty(Actor::Property::SENSITIVE, true);
14908 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
14909 actor.SetProperty(Actor::Property::VISIBLE, true);
14911 application.SendNotification();
14912 application.Render();
14914 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == true);
14916 actor.SetProperty(Actor::Property::SENSITIVE, false);
14917 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14918 actor.SetProperty(Actor::Property::SENSITIVE, true);
14920 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
14921 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14922 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
14924 actor.SetProperty(Actor::Property::VISIBLE, false);
14925 application.SendNotification();
14926 application.Render();
14927 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14932 int UtcDaliActorGetTouchRequired(void)
14934 TestApplication application;
14936 Actor actor = Actor::New();
14937 DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == false);
14939 actor.TouchedSignal().Connect(TestTouchCallback);
14940 DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == true);
14945 int UtcDaliActorDispatchTouchMotionPropertyP(void)
14947 TestApplication application;
14949 Actor actor = Actor::New();
14950 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION).Get<bool>(), true, TEST_LOCATION);
14951 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, false);
14952 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION).Get<bool>(), false, TEST_LOCATION);
14953 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::DISPATCH_TOUCH_MOTION), Property::BOOLEAN, TEST_LOCATION);
14954 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::DISPATCH_TOUCH_MOTION), true, TEST_LOCATION);
14955 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::DISPATCH_TOUCH_MOTION), false, TEST_LOCATION);
14956 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::DISPATCH_TOUCH_MOTION), false, TEST_LOCATION);
14957 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::DISPATCH_TOUCH_MOTION), "dispatchTouchMotion", TEST_LOCATION);
14961 int UtcDaliActorDispatchTouchMotionPropertyN(void)
14963 TestApplication application;
14965 Actor actor = Actor::New();
14967 // Make sure setting invalid types does not cause a crash
14970 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, 1.0f);
14971 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector2::ONE);
14972 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector3::ONE);
14973 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector4::ONE);
14974 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Property::Map());
14975 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Property::Array());
14976 tet_result(TET_PASS);
14980 tet_result(TET_FAIL);
14985 int UtcDaliActorDispatchHoverMotionPropertyP(void)
14987 TestApplication application;
14989 Actor actor = Actor::New();
14990 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION).Get<bool>(), true, TEST_LOCATION);
14991 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, false);
14992 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION).Get<bool>(), false, TEST_LOCATION);
14993 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::DISPATCH_HOVER_MOTION), Property::BOOLEAN, TEST_LOCATION);
14994 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::DISPATCH_HOVER_MOTION), true, TEST_LOCATION);
14995 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::DISPATCH_HOVER_MOTION), false, TEST_LOCATION);
14996 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::DISPATCH_HOVER_MOTION), false, TEST_LOCATION);
14997 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::DISPATCH_HOVER_MOTION), "dispatchHoverMotion", TEST_LOCATION);
15001 int UtcDaliActorDispatchHoverMotionPropertyN(void)
15003 TestApplication application;
15005 Actor actor = Actor::New();
15007 // Make sure setting invalid types does not cause a crash
15010 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, 1.0f);
15011 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector2::ONE);
15012 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector3::ONE);
15013 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector4::ONE);
15014 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Property::Map());
15015 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Property::Array());
15016 tet_result(TET_PASS);
15020 tet_result(TET_FAIL);