2 * Copyright (c) 2023 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 ChildOrderChangedFunctor
281 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
282 : mSignalCalled(signalCalled),
287 void operator()(Actor actor)
289 mSignalCalled = true;
297 struct CulledPropertyNotificationFunctor
299 CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
300 : mSignalCalled(signalCalled),
301 mPropertyNotification(propertyNotification)
305 void operator()(PropertyNotification& source)
307 mSignalCalled = true;
308 mPropertyNotification = source;
312 PropertyNotification& mPropertyNotification;
315 // Clipping test helper functions:
316 Actor CreateActorWithContent(uint32_t width, uint32_t height)
318 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
319 Actor actor = CreateRenderableActor(image);
321 // Setup dimensions and position so actor is not skipped by culling.
322 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
323 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
324 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
325 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
330 Actor CreateActorWithContent16x16()
332 return CreateActorWithContent(16, 16);
335 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& callTrace)
337 enabledDisableTrace.Reset();
339 enabledDisableTrace.Enable(true);
340 callTrace.Enable(true);
342 application.SendNotification();
343 application.Render();
345 enabledDisableTrace.Enable(false);
346 callTrace.Enable(false);
349 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
351 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
353 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
354 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
355 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
357 // @todo only test alpha if the framebuffer has an alpha channel
358 //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
361 } // anonymous namespace
363 //& purpose: Testing New API
364 int UtcDaliActorNew(void)
366 TestApplication application;
368 Actor actor = Actor::New();
370 DALI_TEST_CHECK(actor);
374 //& purpose: Testing Dali::Actor::DownCast()
375 int UtcDaliActorDownCastP(void)
377 TestApplication application;
378 tet_infoline("Testing Dali::Actor::DownCast()");
380 Actor actor = Actor::New();
381 BaseHandle object(actor);
382 Actor actor2 = Actor::DownCast(object);
383 DALI_TEST_CHECK(actor2);
387 //& purpose: Testing Dali::Actor::DownCast()
388 int UtcDaliActorDownCastN(void)
390 TestApplication application;
391 tet_infoline("Testing Dali::Actor::DownCast()");
393 BaseHandle unInitializedObject;
394 Actor actor = Actor::DownCast(unInitializedObject);
395 DALI_TEST_CHECK(!actor);
399 int UtcDaliActorMoveConstructor(void)
401 TestApplication application;
403 Actor actor = Actor::New();
404 DALI_TEST_CHECK(actor);
406 int id = actor.GetProperty<int>(Actor::Property::ID);
408 Actor moved = std::move(actor);
409 DALI_TEST_CHECK(moved);
410 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
411 DALI_TEST_CHECK(!actor);
416 int UtcDaliActorMoveAssignment(void)
418 TestApplication application;
420 Actor actor = Actor::New();
421 DALI_TEST_CHECK(actor);
423 int id = actor.GetProperty<int>(Actor::Property::ID);
426 moved = std::move(actor);
427 DALI_TEST_CHECK(moved);
428 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
429 DALI_TEST_CHECK(!actor);
434 //& purpose: Testing Dali::Actor::GetName()
435 int UtcDaliActorGetName(void)
437 TestApplication application;
439 Actor actor = Actor::New();
441 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
445 //& purpose: Testing Dali::Actor::SetName()
446 int UtcDaliActorSetName(void)
448 TestApplication application;
450 string str("ActorName");
451 Actor actor = Actor::New();
453 actor.SetProperty(Actor::Property::NAME, str);
454 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
458 int UtcDaliActorGetId(void)
460 tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
461 TestApplication application;
463 Actor first = Actor::New();
464 Actor second = Actor::New();
465 Actor third = Actor::New();
467 DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
468 DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
472 int UtcDaliActorIsRoot(void)
474 TestApplication application;
476 Actor actor = Actor::New();
477 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
479 // get the root layer
480 actor = application.GetScene().GetLayer(0);
481 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
485 int UtcDaliActorOnScene(void)
487 TestApplication application;
489 Actor actor = Actor::New();
490 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
492 // get the root layer
493 actor = application.GetScene().GetLayer(0);
494 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
498 int UtcDaliActorIsLayer(void)
500 TestApplication application;
502 Actor actor = Actor::New();
503 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
505 // get the root layer
506 actor = application.GetScene().GetLayer(0);
507 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
511 int UtcDaliActorGetLayer(void)
513 TestApplication application;
515 Actor actor = Actor::New();
516 application.GetScene().Add(actor);
517 Layer layer = actor.GetLayer();
519 DALI_TEST_CHECK(layer);
521 // get the root layers layer
522 actor = application.GetScene().GetLayer(0);
523 DALI_TEST_CHECK(actor.GetLayer());
527 int UtcDaliActorAddP(void)
529 tet_infoline("Testing Actor::Add");
530 TestApplication application;
532 Actor parent = Actor::New();
533 Actor child = Actor::New();
535 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
539 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
541 Actor parent2 = Actor::New();
544 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
545 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
547 // try Adding to same parent again, works
549 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
551 // try reparenting an orphaned child
553 Actor temporaryParent = Actor::New();
554 temporaryParent.Add(child);
555 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
557 // temporaryParent has now died, reparent the orphaned child
559 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
564 int UtcDaliActorAddN(void)
566 tet_infoline("Testing Actor::Add");
567 TestApplication application;
569 Actor child = Actor::New();
571 Actor parent2 = Actor::New();
577 parent2.Add(parent2);
578 tet_printf("Assertion test failed - no Exception\n");
579 tet_result(TET_FAIL);
581 catch(Dali::DaliException& e)
583 DALI_TEST_PRINT_ASSERT(e);
584 DALI_TEST_ASSERT(e, "&mOwner != &child", TEST_LOCATION);
585 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
589 tet_printf("Assertion test failed - wrong Exception\n");
590 tet_result(TET_FAIL);
593 // try reparenting root
596 parent2.Add(application.GetScene().GetLayer(0));
597 tet_printf("Assertion test failed - no Exception\n");
598 tet_result(TET_FAIL);
600 catch(Dali::DaliException& e)
602 DALI_TEST_PRINT_ASSERT(e);
603 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
604 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
608 tet_printf("Assertion test failed - wrong Exception\n");
609 tet_result(TET_FAIL);
617 tet_printf("Assertion test failed - no Exception\n");
618 tet_result(TET_FAIL);
620 catch(Dali::DaliException& e)
622 DALI_TEST_PRINT_ASSERT(e);
623 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
624 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
628 tet_printf("Assertion test failed - wrong Exception\n");
629 tet_result(TET_FAIL);
635 int UtcDaliActorRemoveN(void)
637 tet_infoline("Testing Actor::Remove");
638 TestApplication application;
640 Actor parent = Actor::New();
641 Actor child = Actor::New();
642 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
645 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
647 parent.Remove(child);
648 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
650 // remove again, no problem
651 parent.Remove(child);
652 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
656 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
657 // try Remove self, its a no-op
658 parent.Remove(parent);
659 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
665 parent.Remove(empty);
666 tet_printf("Assertion test failed - no Exception\n");
667 tet_result(TET_FAIL);
669 catch(Dali::DaliException& e)
671 DALI_TEST_PRINT_ASSERT(e);
672 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
673 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
677 tet_printf("Assertion test failed - wrong Exception\n");
678 tet_result(TET_FAIL);
683 int UtcDaliActorRemoveP(void)
685 TestApplication application;
687 Actor parent = Actor::New();
688 Actor child = Actor::New();
689 Actor random = Actor::New();
691 application.GetScene().Add(parent);
693 DALI_TEST_CHECK(parent.GetChildCount() == 0);
697 DALI_TEST_CHECK(parent.GetChildCount() == 1);
699 parent.Remove(random);
701 DALI_TEST_CHECK(parent.GetChildCount() == 1);
703 application.GetScene().Remove(parent);
705 DALI_TEST_CHECK(parent.GetChildCount() == 1);
709 int UtcDaliActorSwitchParentN(void)
711 tet_infoline("Testing Actor::UtcDaliActorSwitchParentN");
712 TestApplication application;
714 Actor parent1 = Actor::New();
715 Actor child = Actor::New();
717 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
721 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
723 Actor parent2 = Actor::New();
725 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
727 // Try switch parent with that both of parent1 and parent2 are off scene.
728 DevelActor::SwitchParent(child, parent2);
730 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
731 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
735 int UtcDaliActorGetChildCount(void)
737 TestApplication application;
739 Actor parent = Actor::New();
740 Actor child = Actor::New();
742 DALI_TEST_CHECK(parent.GetChildCount() == 0);
746 DALI_TEST_CHECK(parent.GetChildCount() == 1);
750 int UtcDaliActorGetChildren01(void)
752 TestApplication application;
754 Actor parent = Actor::New();
755 Actor first = Actor::New();
756 Actor second = Actor::New();
757 Actor third = Actor::New();
763 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
764 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
765 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
769 int UtcDaliActorGetChildren02(void)
771 TestApplication application;
773 Actor parent = Actor::New();
774 Actor first = Actor::New();
775 Actor second = Actor::New();
776 Actor third = Actor::New();
782 const Actor& constParent = parent;
784 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
785 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
786 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
790 int UtcDaliActorGetParent01(void)
792 TestApplication application;
794 Actor parent = Actor::New();
795 Actor child = Actor::New();
799 DALI_TEST_CHECK(child.GetParent() == parent);
803 int UtcDaliActorGetParent02(void)
805 TestApplication application;
807 Actor actor = Actor::New();
809 DALI_TEST_CHECK(!actor.GetParent());
813 int UtcDaliActorCustomProperty(void)
815 TestApplication application;
817 Actor actor = Actor::New();
818 application.GetScene().Add(actor);
820 float startValue(1.0f);
821 Property::Index index = actor.RegisterProperty("testProperty", startValue);
822 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
824 application.SendNotification();
825 application.Render(0);
826 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
828 actor.SetProperty(index, 5.0f);
830 application.SendNotification();
831 application.Render(0);
832 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
836 int UtcDaliActorCustomPropertyIntToFloat(void)
838 TestApplication application;
840 Actor actor = Actor::New();
841 application.GetScene().Add(actor);
843 float startValue(5.0f);
844 Property::Index index = actor.RegisterProperty("testProperty", startValue);
845 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
847 application.SendNotification();
848 application.Render(0);
849 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
851 actor.SetProperty(index, int(1));
853 application.SendNotification();
854 application.Render(0);
855 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
859 int UtcDaliActorCustomPropertyFloatToInt(void)
861 TestApplication application;
863 Actor actor = Actor::New();
864 application.GetScene().Add(actor);
867 Property::Index index = actor.RegisterProperty("testProperty", startValue);
868 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
870 application.SendNotification();
871 application.Render(0);
872 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
874 actor.SetProperty(index, float(1.5));
876 application.SendNotification();
877 application.Render(0);
878 DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
882 int UtcDaliActorSetParentOrigin(void)
884 TestApplication application;
886 Actor actor = Actor::New();
888 Vector3 vector(0.7f, 0.8f, 0.9f);
889 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
891 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
893 // flush the queue and render once
894 application.SendNotification();
895 application.Render();
897 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
899 application.GetScene().Add(actor);
901 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
903 // flush the queue and render once
904 application.SendNotification();
905 application.Render();
907 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
909 application.GetScene().Remove(actor);
913 int UtcDaliActorSetParentOriginIndividual(void)
915 TestApplication application;
917 Actor actor = Actor::New();
919 Vector3 vector(0.7f, 0.8f, 0.9f);
920 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
922 actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
924 // flush the queue and render once
925 application.SendNotification();
926 application.Render();
928 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
930 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
932 // flush the queue and render once
933 application.SendNotification();
934 application.Render();
936 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
938 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
940 // flush the queue and render once
941 application.SendNotification();
942 application.Render();
944 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
949 int UtcDaliActorGetCurrentParentOrigin(void)
951 TestApplication application;
953 Actor actor = Actor::New();
955 Vector3 vector(0.7f, 0.8f, 0.9f);
956 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
958 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
960 // flush the queue and render once
961 application.SendNotification();
962 application.Render();
964 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
968 int UtcDaliActorSetAnchorPoint(void)
970 TestApplication application;
972 Actor actor = Actor::New();
974 Vector3 vector(0.7f, 0.8f, 0.9f);
975 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
977 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
979 // flush the queue and render once
980 application.SendNotification();
981 application.Render();
983 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
985 application.GetScene().Add(actor);
987 actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
988 // flush the queue and render once
989 application.SendNotification();
990 application.Render();
992 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
994 application.GetScene().Remove(actor);
998 int UtcDaliActorSetAnchorPointIndividual(void)
1000 TestApplication application;
1002 Actor actor = Actor::New();
1004 Vector3 vector(0.7f, 0.8f, 0.9f);
1005 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1007 actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
1009 // flush the queue and render once
1010 application.SendNotification();
1011 application.Render();
1013 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
1015 actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
1017 // flush the queue and render once
1018 application.SendNotification();
1019 application.Render();
1021 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
1023 actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
1025 // flush the queue and render once
1026 application.SendNotification();
1027 application.Render();
1029 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
1034 int UtcDaliActorGetCurrentAnchorPoint(void)
1036 TestApplication application;
1038 Actor actor = Actor::New();
1040 Vector3 vector(0.7f, 0.8f, 0.9f);
1041 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1043 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
1045 // flush the queue and render once
1046 application.SendNotification();
1047 application.Render();
1049 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1053 int UtcDaliActorSetSize01(void)
1055 TestApplication application;
1057 Actor actor = Actor::New();
1058 Vector3 vector(100.0f, 100.0f, 0.0f);
1060 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1062 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1064 // Immediately retrieve the size after setting
1065 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1066 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1067 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1068 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1069 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1071 // Flush the queue and render once
1072 application.SendNotification();
1073 application.Render();
1075 // Check the size in the new frame
1076 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1078 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1079 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1080 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1081 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1082 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1084 // Check async behaviour
1085 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
1086 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1087 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1088 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1089 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1091 // Change the resize policy and check whether the size stays the same
1092 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1094 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1095 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1097 // Set a new size after resize policy is changed and check the new size
1098 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1100 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1101 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1103 // Change the resize policy again and check whether the new size stays the same
1104 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1106 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1107 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1109 // Set another new size after resize policy is changed and check the new size
1110 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1112 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1113 DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1118 int UtcDaliActorSetSize02(void)
1120 TestApplication application;
1122 Actor actor = Actor::New();
1123 Vector3 vector(100.0f, 100.0f, 100.0f);
1125 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1127 actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1129 // Immediately check the size after setting
1130 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1131 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1133 // flush the queue and render once
1134 application.SendNotification();
1135 application.Render();
1137 // Check the size in the new frame
1138 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1140 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1141 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1146 // SetSize(Vector2 size)
1147 int UtcDaliActorSetSize03(void)
1149 TestApplication application;
1151 Actor actor = Actor::New();
1152 Vector3 vector(100.0f, 100.0f, 0.0f);
1154 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1156 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1158 // Immediately check the size after setting
1159 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1160 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1162 // flush the queue and render once
1163 application.SendNotification();
1164 application.Render();
1166 // Check the size in the new frame
1167 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1169 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1170 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1175 // SetSize(Vector3 size)
1176 int UtcDaliActorSetSize04(void)
1178 TestApplication application;
1180 Actor actor = Actor::New();
1181 Vector3 vector(100.0f, 100.0f, 100.0f);
1183 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1185 actor.SetProperty(Actor::Property::SIZE, vector);
1187 // Immediately check the size after setting
1188 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1189 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1191 // flush the queue and render once
1192 application.SendNotification();
1193 application.Render();
1195 // Check the size in the new frame
1196 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1198 application.GetScene().Add(actor);
1199 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1201 // Immediately check the size after setting
1202 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1203 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1205 // flush the queue and render once
1206 application.SendNotification();
1207 application.Render();
1209 // Check the size in the new frame
1210 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1212 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1213 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1215 application.GetScene().Remove(actor);
1219 int UtcDaliActorSetSize05(void)
1221 TestApplication application;
1223 Actor parent = Actor::New();
1224 Vector2 vector(200.0f, 200.0f);
1225 DALI_TEST_CHECK(vector != parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1227 parent.SetProperty(Actor::Property::SIZE, vector);
1228 Vector2 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1229 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1231 Actor child = Actor::New();
1232 DALI_TEST_CHECK(vector != child.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1233 child.SetProperty(Actor::Property::SIZE, vector);
1234 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1235 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1237 // flush the queue and render once
1238 application.SendNotification();
1239 application.Render();
1241 DALI_TEST_CHECK(vector == parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1246 int UtcDaliActorSetSizeIndividual(void)
1248 TestApplication application;
1250 Actor actor = Actor::New();
1252 Vector3 vector(0.7f, 0.8f, 0.9f);
1253 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1255 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1257 // Immediately check the width after setting
1258 float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1259 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1261 // flush the queue and render once
1262 application.SendNotification();
1263 application.Render();
1265 // Check the width in the new frame
1266 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1268 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1269 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1271 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1273 // Immediately check the height after setting
1274 float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1275 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1277 // flush the queue and render once
1278 application.SendNotification();
1279 application.Render();
1281 // Check the height in the new frame
1282 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1284 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1285 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1287 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1289 // Immediately check the depth after setting
1290 float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1291 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1293 // flush the queue and render once
1294 application.SendNotification();
1295 application.Render();
1297 // Check the depth in the new frame
1298 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1300 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1301 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1303 // Change the resize policy and check whether the size stays the same
1304 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1306 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1307 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1309 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1310 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1312 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1313 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1315 // Change the resize policy again and check whether the size stays the same
1316 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1318 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1319 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1321 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1322 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1324 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1325 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1330 int UtcDaliActorSetSizeIndividual02(void)
1332 TestApplication application;
1334 Actor actor = Actor::New();
1335 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1336 application.GetScene().Add(actor);
1338 Vector3 vector(100.0f, 200.0f, 400.0f);
1339 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1341 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1342 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1344 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1345 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1347 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1348 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1350 // flush the queue and render once
1351 application.SendNotification();
1352 application.Render();
1354 // Check the width in the new frame
1355 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1356 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1361 int UtcDaliActorGetCurrentSize(void)
1363 TestApplication application;
1365 Actor actor = Actor::New();
1366 Vector3 vector(100.0f, 100.0f, 20.0f);
1368 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1370 actor.SetProperty(Actor::Property::SIZE, vector);
1372 // flush the queue and render once
1373 application.SendNotification();
1374 application.Render();
1376 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1380 int UtcDaliActorGetNaturalSize(void)
1382 TestApplication application;
1384 Actor actor = Actor::New();
1385 Vector3 vector(0.0f, 0.0f, 0.0f);
1387 DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1392 int UtcDaliActorGetCurrentSizeImmediate(void)
1394 TestApplication application;
1396 Actor actor = Actor::New();
1397 Vector3 vector(100.0f, 100.0f, 20.0f);
1399 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1400 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1402 actor.SetProperty(Actor::Property::SIZE, vector);
1404 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1405 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1407 // flush the queue and render once
1408 application.SendNotification();
1409 application.Render();
1411 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1412 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1415 // Build the animation
1416 const float durationSeconds = 2.0f;
1417 Animation animation = Animation::New(durationSeconds);
1418 const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1419 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1421 DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1423 application.GetScene().Add(actor);
1425 // Start the animation
1428 application.SendNotification();
1429 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1431 DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1436 int UtcDaliActorCalculateScreenExtents(void)
1438 TestApplication application;
1440 Actor actor = Actor::New();
1442 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1443 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1445 application.GetScene().Add(actor);
1447 application.SendNotification();
1448 application.Render();
1450 auto expectedExtent = Rect<>{1.5f, 1.5f, 1.0f, 1.0f};
1451 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1452 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1453 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1454 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1455 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1457 application.GetScene().Remove(actor);
1461 int UtcDaliActorCalculateCurrentScreenExtents(void)
1463 TestApplication application;
1465 Actor actor = Actor::New();
1467 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1468 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1470 application.GetScene().Add(actor);
1472 application.SendNotification();
1473 application.Render();
1475 auto expectedPosition = Vector2(2.0f, 2.0f);
1476 auto actualPosition = DevelActor::CalculateScreenPosition(actor);
1477 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1478 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1480 auto expectedExtent = Rect<>{1.5f, 1.5f, 1.0f, 1.0f};
1481 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1482 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1483 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1484 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1485 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1487 Animation animation = Animation::New(1.0f);
1488 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(6.0f, 4.0f, 0.0f));
1489 animation.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(3.0f, 7.0f, 1.0f));
1492 application.SendNotification();
1493 application.Render(500u);
1496 expectedPosition = Vector2(6.0f, 4.0f);
1497 actualPosition = DevelActor::CalculateScreenPosition(actor);
1498 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1499 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1501 expectedExtent = Rect<>(4.5f, 0.5f, 3.0f, 7.0f);
1502 actualExtent = DevelActor::CalculateScreenExtents(actor);
1503 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1504 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1505 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1506 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1508 expectedPosition = Vector2(4.0f, 3.0f);
1509 actualPosition = actor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1510 DALI_TEST_EQUALS(expectedPosition.x, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1511 DALI_TEST_EQUALS(expectedPosition.y, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1513 expectedExtent = Rect<>(3.0f, 1.0f, 2.0f, 4.0f);
1514 actualExtent = DevelActor::CalculateCurrentScreenExtents(actor);
1515 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1516 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1517 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1518 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1520 application.GetScene().Remove(actor);
1524 int UtcDaliActorCalculateScreenExtentsInCustomCameraAndLayer3D(void)
1526 TestApplication application;
1527 Integration::Scene scene = application.GetScene();
1530 Layer layer = Layer::New();
1531 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1532 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1533 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1537 // Build custom camera with top-view
1538 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
1540 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1541 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1542 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1545 std::ostringstream oss;
1546 oss << cameraPos << "\n";
1547 oss << cameraOrient << "\n";
1548 tet_printf("%s\n", oss.str().c_str());
1551 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1552 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1554 // Now, upside : -Z, leftside : -X, foward : +Y
1556 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1557 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1559 std::ostringstream oss;
1560 oss << cameraPos << "\n";
1561 oss << cameraOrient << "\n";
1562 tet_printf("%s\n", oss.str().c_str());
1566 Actor actor = Actor::New();
1567 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1568 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1569 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 0.0f, 16.0f));
1570 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 0.0f, 3.0f});
1574 application.SendNotification();
1575 application.Render();
1577 Vector2 sceneSize = scene.GetSize();
1579 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + 1.5f, sceneSize.y * 0.5f + 14.5f, 1.0f, 3.0f};
1580 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1581 auto actualPosition = DevelActor::CalculateScreenPosition(actor);
1583 std::ostringstream oss;
1584 oss << expectedExtent << "\n";
1585 oss << actualExtent << "\n";
1586 oss << actualPosition << "\n";
1587 tet_printf("%s\n", oss.str().c_str());
1590 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1591 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1592 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1593 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1595 // Since anchor point is center, screen position is same as center of expect extents
1596 DALI_TEST_EQUALS(expectedExtent.x + expectedExtent.width * 0.5f, actualPosition.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1597 DALI_TEST_EQUALS(expectedExtent.y + expectedExtent.height * 0.5f, actualPosition.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1602 int UtcDaliActorCalculateScreenInCustomCameraAndOffscreenLayer3D(void)
1604 TestApplication application;
1605 Integration::Scene scene = application.GetScene();
1606 Vector2 sceneSize = scene.GetSize();
1609 Layer layer = Layer::New();
1610 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1611 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1612 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1613 layer.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1614 layer.SetProperty(Actor::Property::SIZE, sceneSize);
1618 // Build custom camera with top-view
1619 CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
1621 offscreenCameraActor.SetPerspectiveProjection(sceneSize);
1622 offscreenCameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1623 offscreenCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1625 scene.Add(offscreenCameraActor);
1627 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1628 Vector3 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1629 Quaternion cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1632 std::ostringstream oss;
1633 oss << cameraPos << "\n";
1634 oss << cameraOrient << "\n";
1635 tet_printf("%s\n", oss.str().c_str());
1638 offscreenCameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1639 offscreenCameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1641 // Now, upside : -Z, leftside : -X, foward : +Y
1643 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1644 cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1646 std::ostringstream oss;
1647 oss << cameraPos << "\n";
1648 oss << cameraOrient << "\n";
1649 tet_printf("%s\n", oss.str().c_str());
1652 Vector3 sourcePosition{2.0f, 0.0f, 16.0f};
1653 Vector3 sourceSize{1.0f, 0.0f, 3.0f};
1655 Actor sourceActor = Actor::New();
1656 sourceActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1657 sourceActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1658 sourceActor.SetProperty(Actor::Property::POSITION, sourcePosition);
1659 sourceActor.SetProperty(Actor::Property::SIZE, sourceSize);
1661 layer.Add(sourceActor);
1663 // Create framebuffer
1664 unsigned int width(64);
1665 unsigned int height(64);
1666 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
1667 FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
1668 frameBuffer.AttachColorTexture(texture);
1670 Actor rootActor = Actor::New();
1671 rootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1672 rootActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1673 rootActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1674 rootActor.SetProperty(Actor::Property::SIZE, sceneSize);
1675 scene.Add(rootActor);
1677 RenderTaskList taskList = scene.GetRenderTaskList();
1678 RenderTask newTask = taskList.CreateTask();
1679 newTask.SetCameraActor(offscreenCameraActor);
1680 newTask.SetSourceActor(layer);
1681 newTask.SetInputEnabled(false);
1682 newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
1683 newTask.SetClearEnabled(true);
1684 newTask.SetExclusive(true);
1685 newTask.SetFrameBuffer(frameBuffer);
1686 newTask.SetScreenToFrameBufferMappingActor(rootActor);
1688 application.SendNotification();
1689 application.Render(16u);
1691 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + sourcePosition.x - sourceSize.x * 0.5f,
1692 sceneSize.y * 0.5f + sourcePosition.z - sourceSize.z * 0.5f,
1695 auto actualExtent = DevelActor::CalculateCurrentScreenExtents(sourceActor);
1697 std::ostringstream oss;
1698 oss << expectedExtent << "\n";
1699 oss << actualExtent << "\n";
1700 tet_printf("%s\n", oss.str().c_str());
1703 auto expectedScreen = Vector2{sceneSize.x * 0.5f + sourcePosition.x, sceneSize.y * 0.5f + sourcePosition.z};
1704 auto actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1706 std::ostringstream oss;
1707 oss << expectedScreen << "\n";
1708 oss << actualScreen << "\n";
1709 tet_printf("%s\n", oss.str().c_str());
1712 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1713 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1714 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1715 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1717 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1718 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1720 // Change rootActor's size and position
1722 Vector3 rootPosition{100.0f, 200.0f, 0.0f};
1723 Vector3 rootSize{200.0f, 100.0f, 0.0f};
1725 rootActor.SetProperty(Actor::Property::POSITION, rootPosition);
1726 rootActor.SetProperty(Actor::Property::SIZE, rootSize);
1728 application.SendNotification();
1729 application.Render(16u);
1731 expectedExtent = Rect<>{sceneSize.x * 0.5f + rootPosition.x + (sourcePosition.x - sourceSize.x * 0.5f) * rootSize.x / sceneSize.x,
1732 sceneSize.y * 0.5f + rootPosition.y + (sourcePosition.z - sourceSize.z * 0.5f) * rootSize.y / sceneSize.y,
1733 sourceSize.x * rootSize.x / sceneSize.x,
1734 sourceSize.z * rootSize.y / sceneSize.y};
1735 actualExtent = DevelActor::CalculateCurrentScreenExtents(sourceActor);
1737 std::ostringstream oss;
1738 oss << expectedExtent << "\n";
1739 oss << actualExtent << "\n";
1740 tet_printf("%s\n", oss.str().c_str());
1743 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};
1744 actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1746 std::ostringstream oss;
1747 oss << expectedScreen << "\n";
1748 oss << actualScreen << "\n";
1749 tet_printf("%s\n", oss.str().c_str());
1752 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1753 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1754 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1755 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1757 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1758 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1763 // SetPosition(float x, float y)
1764 int UtcDaliActorSetPosition01(void)
1766 TestApplication application;
1768 Actor actor = Actor::New();
1770 // Set to random to start off with
1771 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1773 Vector3 vector(100.0f, 100.0f, 0.0f);
1775 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1777 actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1778 // flush the queue and render once
1779 application.SendNotification();
1780 application.Render();
1781 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1783 application.GetScene().Add(actor);
1784 actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1785 // flush the queue and render once
1786 application.SendNotification();
1787 application.Render();
1788 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1790 actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1791 actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1792 actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1793 // flush the queue and render once
1794 application.SendNotification();
1795 application.Render();
1796 DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1798 actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1799 // flush the queue and render once
1800 application.SendNotification();
1801 application.Render();
1802 DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1804 application.GetScene().Remove(actor);
1808 // SetPosition(float x, float y, float z)
1809 int UtcDaliActorSetPosition02(void)
1811 TestApplication application;
1813 Actor actor = Actor::New();
1815 // Set to random to start off with
1816 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1818 Vector3 vector(100.0f, 100.0f, 100.0f);
1820 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1822 actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1824 // flush the queue and render once
1825 application.SendNotification();
1826 application.Render();
1828 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1832 // SetPosition(Vector3 position)
1833 int UtcDaliActorSetPosition03(void)
1835 TestApplication application;
1837 Actor actor = Actor::New();
1839 // Set to random to start off with
1840 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1842 Vector3 vector(100.0f, 100.0f, 100.0f);
1844 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1846 actor.SetProperty(Actor::Property::POSITION, vector);
1848 // flush the queue and render once
1849 application.SendNotification();
1850 application.Render();
1852 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1856 int UtcDaliActorSetX(void)
1858 TestApplication application;
1860 Actor actor = Actor::New();
1862 Vector3 vector(100.0f, 0.0f, 0.0f);
1864 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1866 actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1868 // flush the queue and render once
1869 application.SendNotification();
1870 application.Render();
1872 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1876 int UtcDaliActorSetY(void)
1878 TestApplication application;
1880 Actor actor = Actor::New();
1882 Vector3 vector(0.0f, 100.0f, 0.0f);
1884 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1886 actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1888 // flush the queue and render once
1889 application.SendNotification();
1890 application.Render();
1892 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1896 int UtcDaliActorSetZ(void)
1898 TestApplication application;
1900 Actor actor = Actor::New();
1902 Vector3 vector(0.0f, 0.0f, 100.0f);
1904 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1906 actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1908 // flush the queue and render once
1909 application.SendNotification();
1910 application.Render();
1912 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1916 int UtcDaliActorSetPositionProperties(void)
1918 TestApplication application;
1920 Actor actor = Actor::New();
1922 Vector3 vector(0.7f, 0.8f, 0.9f);
1923 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1925 actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1926 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1927 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1929 // flush the queue and render once
1930 application.SendNotification();
1931 application.Render();
1933 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1934 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1935 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1936 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1937 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1939 actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1940 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1941 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1943 // flush the queue and render once
1944 application.SendNotification();
1945 application.Render();
1947 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1948 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1949 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1950 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1951 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1953 actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
1954 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1955 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1957 // flush the queue and render once
1958 application.SendNotification();
1959 application.Render();
1961 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1962 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1963 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1964 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1965 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1970 int UtcDaliActorTranslateBy(void)
1972 TestApplication application;
1974 Actor actor = Actor::New();
1975 Vector3 vector(100.0f, 100.0f, 100.0f);
1977 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1979 actor.SetProperty(Actor::Property::POSITION, vector);
1981 // flush the queue and render once
1982 application.SendNotification();
1983 application.Render();
1985 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1987 actor.TranslateBy(vector);
1989 // flush the queue and render once
1990 application.SendNotification();
1991 application.Render();
1993 DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1997 int UtcDaliActorGetCurrentPosition(void)
1999 TestApplication application;
2001 Actor actor = Actor::New();
2002 Vector3 setVector(100.0f, 100.0f, 0.0f);
2003 actor.SetProperty(Actor::Property::POSITION, setVector);
2005 // flush the queue and render once
2006 application.SendNotification();
2007 application.Render();
2009 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
2013 int UtcDaliActorGetCurrentWorldPosition(void)
2015 TestApplication application;
2017 Actor parent = Actor::New();
2018 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
2019 parent.SetProperty(Actor::Property::POSITION, parentPosition);
2020 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2021 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2022 application.GetScene().Add(parent);
2024 Actor child = Actor::New();
2025 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2026 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2027 Vector3 childPosition(6.0f, 6.0f, 6.0f);
2028 child.SetProperty(Actor::Property::POSITION, childPosition);
2031 // The actors should not have a world position yet
2032 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2033 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2035 application.SendNotification();
2036 application.Render(0);
2038 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2039 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2041 // The actors should have a world position now
2042 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2043 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2047 int UtcDaliActorSetInheritPosition(void)
2049 tet_infoline("Testing Actor::SetInheritPosition");
2050 TestApplication application;
2052 Actor parent = Actor::New();
2053 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
2054 parent.SetProperty(Actor::Property::POSITION, parentPosition);
2055 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2056 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2057 application.GetScene().Add(parent);
2059 Actor child = Actor::New();
2060 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
2061 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
2062 Vector3 childPosition(10.0f, 11.0f, 12.0f);
2063 child.SetProperty(Actor::Property::POSITION, childPosition);
2066 // The actors should not have a world position yet
2067 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2068 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2070 // first test default, which is to inherit position
2071 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2072 application.SendNotification();
2073 application.Render(0); // should only really call Update as Render is not required to update scene
2074 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2075 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2076 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2077 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2079 //Change child position
2080 Vector3 childOffset(-1.0f, 1.0f, 0.0f);
2081 child.SetProperty(Actor::Property::POSITION, childOffset);
2083 // Use local position as world postion
2084 child.SetProperty(Actor::Property::INHERIT_POSITION, false);
2085 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
2086 application.SendNotification();
2087 application.Render(0); // should only really call Update as Render is not required to update scene
2088 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2089 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2090 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2091 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
2093 //Change back to inherit position from parent
2094 child.SetProperty(Actor::Property::INHERIT_POSITION, true);
2095 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2096 application.SendNotification();
2097 application.Render(0); // should only really call Update as Render is not required to update scene
2098 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2099 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2100 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2101 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
2105 int UtcDaliActorInheritOpacity(void)
2107 tet_infoline("Testing Actor::Inherit Opacity");
2108 TestApplication application;
2110 Actor parent = Actor::New();
2111 Actor child = Actor::New();
2113 application.GetScene().Add(parent);
2115 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2116 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2118 // flush the queue and render once
2119 application.SendNotification();
2120 application.Render();
2122 parent.SetProperty(Actor::Property::OPACITY, 0.1f);
2124 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2125 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2127 application.SendNotification();
2128 application.Render();
2130 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2131 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2132 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2133 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2134 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2135 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
2140 // SetOrientation(float angleRadians, Vector3 axis)
2141 int UtcDaliActorSetOrientation01(void)
2143 TestApplication application;
2145 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2146 Actor actor = Actor::New();
2148 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2150 // flush the queue and render once
2151 application.SendNotification();
2152 application.Render();
2154 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2158 int UtcDaliActorSetOrientation02(void)
2160 TestApplication application;
2162 Actor actor = Actor::New();
2164 Radian angle(0.785f);
2165 Vector3 axis(1.0f, 1.0f, 0.0f);
2167 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2168 Quaternion rotation(angle, axis);
2169 // flush the queue and render once
2170 application.SendNotification();
2171 application.Render();
2172 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2174 application.GetScene().Add(actor);
2175 actor.RotateBy(Degree(360), axis);
2176 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2178 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
2179 Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
2180 // flush the queue and render once
2181 application.SendNotification();
2182 application.Render();
2183 DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2185 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2186 // flush the queue and render once
2187 application.SendNotification();
2188 application.Render();
2189 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2191 application.GetScene().Remove(actor);
2195 // SetOrientation(float angleRadians, Vector3 axis)
2196 int UtcDaliActorSetOrientationProperty(void)
2198 TestApplication application;
2200 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2201 Actor actor = Actor::New();
2203 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2204 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2206 // flush the queue and render once
2207 application.SendNotification();
2208 application.Render();
2210 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2211 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2212 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2216 // RotateBy(float angleRadians, Vector3 axis)
2217 int UtcDaliActorRotateBy01(void)
2219 TestApplication application;
2221 Actor actor = Actor::New();
2223 Radian angle(M_PI * 0.25f);
2224 actor.RotateBy((angle), Vector3::ZAXIS);
2225 // flush the queue and render once
2226 application.SendNotification();
2227 application.Render();
2228 DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2230 application.GetScene().Add(actor);
2232 actor.RotateBy(angle, Vector3::ZAXIS);
2233 // flush the queue and render once
2234 application.SendNotification();
2235 application.Render();
2236 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2238 application.GetScene().Remove(actor);
2242 // RotateBy(Quaternion relativeRotation)
2243 int UtcDaliActorRotateBy02(void)
2245 TestApplication application;
2247 Actor actor = Actor::New();
2249 Radian angle(M_PI * 0.25f);
2250 Quaternion rotation(angle, Vector3::ZAXIS);
2251 actor.RotateBy(rotation);
2252 // flush the queue and render once
2253 application.SendNotification();
2254 application.Render();
2255 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2257 actor.RotateBy(rotation);
2258 // flush the queue and render once
2259 application.SendNotification();
2260 application.Render();
2261 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2265 int UtcDaliActorGetCurrentOrientation(void)
2267 TestApplication application;
2268 Actor actor = Actor::New();
2270 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2271 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2272 // flush the queue and render once
2273 application.SendNotification();
2274 application.Render();
2275 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2279 int UtcDaliActorGetCurrentWorldOrientation(void)
2281 tet_infoline("Testing Actor::GetCurrentWorldRotation");
2282 TestApplication application;
2284 Actor parent = Actor::New();
2285 Radian rotationAngle(Degree(90.0f));
2286 Quaternion rotation(rotationAngle, Vector3::YAXIS);
2287 parent.SetProperty(Actor::Property::ORIENTATION, rotation);
2288 application.GetScene().Add(parent);
2290 Actor child = Actor::New();
2291 child.SetProperty(Actor::Property::ORIENTATION, rotation);
2294 // The actors should not have a world rotation yet
2295 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2296 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2298 application.SendNotification();
2299 application.Render(0);
2301 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2302 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2304 // The actors should have a world rotation now
2305 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2306 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
2308 // turn off child rotation inheritance
2309 child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
2310 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
2311 application.SendNotification();
2312 application.Render(0);
2314 // The actors should have a world rotation now
2315 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2316 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
2320 // SetScale(float scale)
2321 int UtcDaliActorSetScale01(void)
2323 TestApplication application;
2325 Actor actor = Actor::New();
2327 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2328 actor.SetProperty(Actor::Property::SCALE, 0.25f);
2330 Vector3 scale(10.0f, 10.0f, 10.0f);
2331 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2333 actor.SetProperty(Actor::Property::SCALE, scale.x);
2335 // flush the queue and render once
2336 application.SendNotification();
2337 application.Render();
2339 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2343 // SetScale(float scaleX, float scaleY, float scaleZ)
2344 int UtcDaliActorSetScale02(void)
2346 TestApplication application;
2347 Vector3 scale(10.0f, 10.0f, 10.0f);
2349 Actor actor = Actor::New();
2351 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2352 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2354 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2356 actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
2357 // flush the queue and render once
2358 application.SendNotification();
2359 application.Render();
2360 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2362 // add to stage and test
2363 application.GetScene().Add(actor);
2364 actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
2365 // flush the queue and render once
2366 application.SendNotification();
2367 application.Render();
2368 DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
2370 application.GetScene().Remove(actor);
2375 // SetScale(Vector3 scale)
2376 int UtcDaliActorSetScale03(void)
2378 TestApplication application;
2379 Vector3 scale(10.0f, 10.0f, 10.0f);
2381 Actor actor = Actor::New();
2383 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2384 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2386 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2388 actor.SetProperty(Actor::Property::SCALE, scale);
2390 // flush the queue and render once
2391 application.SendNotification();
2392 application.Render();
2394 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2398 int UtcDaliActorSetScaleIndividual(void)
2400 TestApplication application;
2402 Actor actor = Actor::New();
2404 Vector3 vector(0.7f, 0.8f, 0.9f);
2405 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2407 actor.SetProperty(Actor::Property::SCALE_X, vector.x);
2408 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2410 // flush the queue and render once
2411 application.SendNotification();
2412 application.Render();
2414 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
2415 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2416 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2418 actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
2419 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2421 // flush the queue and render once
2422 application.SendNotification();
2423 application.Render();
2425 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
2426 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2427 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2429 actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2430 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2432 // flush the queue and render once
2433 application.SendNotification();
2434 application.Render();
2436 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2437 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2438 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2440 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2441 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2446 int UtcDaliActorScaleBy(void)
2448 TestApplication application;
2449 Actor actor = Actor::New();
2450 Vector3 vector(100.0f, 100.0f, 100.0f);
2452 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2454 actor.SetProperty(Actor::Property::SCALE, vector);
2456 // flush the queue and render once
2457 application.SendNotification();
2458 application.Render();
2460 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2462 actor.ScaleBy(vector);
2464 // flush the queue and render once
2465 application.SendNotification();
2466 application.Render();
2468 DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2472 int UtcDaliActorGetCurrentScale(void)
2474 TestApplication application;
2475 Vector3 scale(12.0f, 1.0f, 2.0f);
2477 Actor actor = Actor::New();
2479 actor.SetProperty(Actor::Property::SCALE, scale);
2481 // flush the queue and render once
2482 application.SendNotification();
2483 application.Render();
2485 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2489 int UtcDaliActorGetCurrentWorldScale(void)
2491 TestApplication application;
2493 Actor parent = Actor::New();
2494 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2495 parent.SetProperty(Actor::Property::SCALE, parentScale);
2496 application.GetScene().Add(parent);
2498 Actor child = Actor::New();
2499 Vector3 childScale(2.0f, 2.0f, 2.0f);
2500 child.SetProperty(Actor::Property::SCALE, childScale);
2503 // The actors should not have a scale yet
2504 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2505 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2507 // The actors should not have a world scale yet
2508 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2509 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2511 application.SendNotification();
2512 application.Render(0);
2514 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2515 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2517 // The actors should have a world scale now
2518 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2519 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2523 int UtcDaliActorInheritScale(void)
2525 tet_infoline("Testing Actor::SetInheritScale");
2526 TestApplication application;
2528 Actor parent = Actor::New();
2529 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2530 parent.SetProperty(Actor::Property::SCALE, parentScale);
2531 application.GetScene().Add(parent);
2533 Actor child = Actor::New();
2534 Vector3 childScale(2.0f, 2.0f, 2.0f);
2535 child.SetProperty(Actor::Property::SCALE, childScale);
2538 application.SendNotification();
2539 application.Render(0);
2541 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2542 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2544 child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2545 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2547 application.SendNotification();
2548 application.Render(0);
2550 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2554 int UtcDaliActorSetVisible(void)
2556 TestApplication application;
2558 Actor actor = Actor::New();
2559 actor.SetProperty(Actor::Property::VISIBLE, false);
2560 // flush the queue and render once
2561 application.SendNotification();
2562 application.Render();
2563 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2565 actor.SetProperty(Actor::Property::VISIBLE, true);
2566 // flush the queue and render once
2567 application.SendNotification();
2568 application.Render();
2569 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2571 // put actor on stage
2572 application.GetScene().Add(actor);
2573 actor.SetProperty(Actor::Property::VISIBLE, false);
2574 // flush the queue and render once
2575 application.SendNotification();
2576 application.Render();
2577 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2581 int UtcDaliActorIsVisible(void)
2583 TestApplication application;
2585 Actor actor = Actor::New();
2587 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2591 int UtcDaliActorSetOpacity(void)
2593 TestApplication application;
2595 Actor actor = Actor::New();
2596 // initial opacity is 1
2597 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2599 actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2600 // flush the queue and render once
2601 application.SendNotification();
2602 application.Render();
2603 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2605 // change opacity, actor is on stage to change is not immediate
2606 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2607 // flush the queue and render once
2608 application.SendNotification();
2609 application.Render();
2610 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2612 // put actor on stage
2613 application.GetScene().Add(actor);
2615 // change opacity, actor is on stage to change is not immediate
2616 actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2617 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2618 // flush the queue and render once
2619 application.SendNotification();
2620 application.Render();
2621 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2623 // change opacity, actor is on stage to change is not immediate
2624 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2625 // flush the queue and render once
2626 application.SendNotification();
2627 application.Render();
2628 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2632 int UtcDaliActorGetCurrentOpacity(void)
2634 TestApplication application;
2636 Actor actor = Actor::New();
2637 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2639 actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2640 // flush the queue and render once
2641 application.SendNotification();
2642 application.Render();
2643 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2647 int UtcDaliActorSetSensitive(void)
2649 TestApplication application;
2650 Actor actor = Actor::New();
2652 bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2654 actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2656 DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2660 int UtcDaliActorIsSensitive(void)
2662 TestApplication application;
2663 Actor actor = Actor::New();
2664 actor.SetProperty(Actor::Property::SENSITIVE, false);
2666 DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2670 int UtcDaliActorSetColor(void)
2672 TestApplication application;
2673 Actor actor = Actor::New();
2674 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2676 DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2678 actor.SetProperty(Actor::Property::COLOR, color);
2679 // flush the queue and render once
2680 application.SendNotification();
2681 application.Render();
2682 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2684 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2685 // flush the queue and render once
2686 application.SendNotification();
2687 application.Render();
2688 DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2690 application.GetScene().Add(actor);
2691 actor.SetProperty(Actor::Property::COLOR, color);
2692 // flush the queue and render once
2693 application.SendNotification();
2694 application.Render();
2695 DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2697 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2698 // flush the queue and render once
2699 application.SendNotification();
2700 application.Render();
2701 // Actor color is not clamped
2702 DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2703 // world color is clamped
2704 DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2706 actor.SetProperty(Actor::Property::COLOR, color);
2707 DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2709 Vector3 newColor(1.0f, 0.0f, 0.0f);
2710 actor.SetProperty(Actor::Property::COLOR, newColor);
2711 DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2713 application.GetScene().Remove(actor);
2717 int UtcDaliActorSetColorIndividual(void)
2719 TestApplication application;
2721 Actor actor = Actor::New();
2723 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2724 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2726 actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2727 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2729 // flush the queue and render once
2730 application.SendNotification();
2731 application.Render();
2733 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2734 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2735 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2737 actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2738 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2740 // flush the queue and render once
2741 application.SendNotification();
2742 application.Render();
2744 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2745 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2746 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2748 actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2749 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2751 // flush the queue and render once
2752 application.SendNotification();
2753 application.Render();
2755 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2756 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2757 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2759 actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2760 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2762 // flush the queue and render once
2763 application.SendNotification();
2764 application.Render();
2766 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2767 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2768 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2770 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2771 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2773 actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2775 // flush the queue and render once
2776 application.SendNotification();
2777 application.Render();
2779 DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2784 int UtcDaliActorGetCurrentColor(void)
2786 TestApplication application;
2787 Actor actor = Actor::New();
2788 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2790 actor.SetProperty(Actor::Property::COLOR, color);
2791 // flush the queue and render once
2792 application.SendNotification();
2793 application.Render();
2794 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2798 int UtcDaliActorGetCurrentWorldColor(void)
2800 tet_infoline("Actor::GetCurrentWorldColor");
2801 TestApplication application;
2803 Actor parent = Actor::New();
2804 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2805 parent.SetProperty(Actor::Property::COLOR, parentColor);
2806 application.GetScene().Add(parent);
2808 Actor child = Actor::New();
2809 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2810 child.SetProperty(Actor::Property::COLOR, childColor);
2813 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2814 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2816 // verify the default color mode
2817 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2819 // The actors should not have a world color yet
2820 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2821 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2823 application.SendNotification();
2824 application.Render(0);
2826 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2827 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2829 // The actors should have a world color now
2830 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2831 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2834 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2835 application.SendNotification();
2836 application.Render(0);
2837 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2840 child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2841 application.SendNotification();
2842 application.Render(0);
2843 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2844 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2847 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2848 application.SendNotification();
2849 application.Render(0);
2850 Vector4 expectedColor(childColor);
2851 expectedColor.a *= parentColor.a;
2852 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2853 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2857 int UtcDaliActorSetColorMode(void)
2859 tet_infoline("Actor::SetColorMode");
2860 TestApplication application;
2861 Actor actor = Actor::New();
2862 Actor child = Actor::New();
2865 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2866 DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2868 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2869 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2871 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2872 DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2874 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2875 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2879 int UtcDaliActorScreenToLocal(void)
2881 TestApplication application;
2882 Actor actor = Actor::New();
2883 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2884 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2885 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2886 application.GetScene().Add(actor);
2888 // flush the queue and render once
2889 application.SendNotification();
2890 application.Render();
2895 application.SendNotification();
2896 application.Render();
2898 DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2900 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2901 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2905 int UtcDaliActorSetLeaveRequired(void)
2907 TestApplication application;
2909 Actor actor = Actor::New();
2911 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2912 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2914 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2915 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2919 int UtcDaliActorGetLeaveRequired(void)
2921 TestApplication application;
2923 Actor actor = Actor::New();
2925 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2929 int UtcDaliActorSetKeyboardFocusable(void)
2931 TestApplication application;
2933 Actor actor = Actor::New();
2935 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2936 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2938 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2939 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2943 int UtcDaliActorIsKeyboardFocusable(void)
2945 TestApplication application;
2947 Actor actor = Actor::New();
2949 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2953 int UtcDaliActorSetKeyboardFocusableChildren(void)
2955 TestApplication application;
2957 Actor actor = Actor::New();
2959 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
2960 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2962 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
2963 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
2967 int UtcDaliActorAreChildrenKeyBoardFocusable(void)
2969 TestApplication application;
2971 Actor actor = Actor::New();
2973 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2977 int UtcDaliActorSetTouchFocusable(void)
2979 TestApplication application;
2981 Actor actor = Actor::New();
2983 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
2984 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
2986 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
2987 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2991 int UtcDaliActorIsTouchFocusable(void)
2993 TestApplication application;
2995 Actor actor = Actor::New();
2997 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
3001 int UtcDaliActorSetUserInteractionEnabled(void)
3003 TestApplication application;
3004 Actor actor = Actor::New();
3006 bool enabled = !actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED);
3008 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, enabled);
3010 DALI_TEST_CHECK(enabled == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
3014 int UtcDaliActorIsUserInteractionEnabled(void)
3016 TestApplication application;
3017 Actor actor = Actor::New();
3018 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
3020 DALI_TEST_CHECK(true == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
3024 int UtcDaliActorRemoveConstraints(void)
3026 tet_infoline(" UtcDaliActorRemoveConstraints");
3027 TestApplication application;
3029 gTestConstraintCalled = false;
3031 Actor actor = Actor::New();
3033 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
3035 actor.RemoveConstraints();
3037 DALI_TEST_CHECK(gTestConstraintCalled == false);
3039 application.GetScene().Add(actor);
3042 // flush the queue and render once
3043 application.SendNotification();
3044 application.Render();
3046 actor.RemoveConstraints();
3048 DALI_TEST_CHECK(gTestConstraintCalled == true);
3052 int UtcDaliActorRemoveConstraintTag(void)
3054 tet_infoline(" UtcDaliActorRemoveConstraintTag");
3055 TestApplication application;
3057 Actor actor = Actor::New();
3059 // 1. Apply Constraint1 and Constraint2, and test...
3060 unsigned int result1 = 0u;
3061 unsigned int result2 = 0u;
3063 unsigned constraint1Tag = 1u;
3064 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
3065 constraint1.SetTag(constraint1Tag);
3066 constraint1.Apply();
3068 unsigned constraint2Tag = 2u;
3069 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
3070 constraint2.SetTag(constraint2Tag);
3071 constraint2.Apply();
3073 application.GetScene().Add(actor);
3074 // flush the queue and render once
3075 application.SendNotification();
3076 application.Render();
3078 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3079 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3081 // 2. Remove Constraint1 and test...
3084 actor.RemoveConstraints(constraint1Tag);
3085 // make color property dirty, which will trigger constraints to be reapplied.
3086 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3087 // flush the queue and render once
3088 application.SendNotification();
3089 application.Render();
3091 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3092 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3094 // 3. Re-Apply Constraint1 and test...
3097 constraint1.Apply();
3098 // make color property dirty, which will trigger constraints to be reapplied.
3099 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3100 // flush the queue and render once
3101 application.SendNotification();
3102 application.Render();
3104 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3105 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3107 // 2. Remove Constraint2 and test...
3110 actor.RemoveConstraints(constraint2Tag);
3111 // make color property dirty, which will trigger constraints to be reapplied.
3112 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3113 // flush the queue and render once
3114 application.SendNotification();
3115 application.Render();
3117 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3118 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3120 // 2. Remove Constraint1 as well and test...
3123 actor.RemoveConstraints(constraint1Tag);
3124 // make color property dirty, which will trigger constraints to be reapplied.
3125 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3126 // flush the queue and render once
3127 application.SendNotification();
3128 application.Render();
3130 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3131 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3135 int UtcDaliActorTouchedSignal(void)
3137 TestApplication application;
3139 ResetTouchCallbacks();
3141 // get the root layer
3142 Actor actor = application.GetScene().GetRootLayer();
3143 DALI_TEST_CHECK(gTouchCallBackCalled == false);
3145 application.SendNotification();
3146 application.Render();
3148 // connect to its touch signal
3149 actor.TouchedSignal().Connect(TestTouchCallback);
3151 // simulate a touch event in the middle of the screen
3152 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3153 Dali::Integration::Point point;
3154 point.SetDeviceId(1);
3155 point.SetState(PointState::DOWN);
3156 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3157 Dali::Integration::TouchEvent touchEvent;
3158 touchEvent.AddPoint(point);
3159 application.ProcessEvent(touchEvent);
3161 DALI_TEST_CHECK(gTouchCallBackCalled == true);
3165 int UtcDaliActorGeoTouchedSignal(void)
3167 TestApplication application;
3169 application.GetScene().SetGeometryHittestEnabled(true);
3170 ResetTouchCallbacks(application);
3172 // get the root layer
3173 Actor actor = application.GetScene().GetRootLayer();
3174 DALI_TEST_CHECK(gTouchCallBackCalled == false);
3176 application.SendNotification();
3177 application.Render();
3179 // connect to its touch signal
3180 actor.TouchedSignal().Connect(TestTouchCallback);
3182 // simulate a touch event in the middle of the screen
3183 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3184 Dali::Integration::Point point;
3185 point.SetDeviceId(1);
3186 point.SetState(PointState::DOWN);
3187 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3188 Dali::Integration::TouchEvent touchEvent;
3189 touchEvent.AddPoint(point);
3190 application.ProcessEvent(touchEvent);
3192 DALI_TEST_CHECK(gTouchCallBackCalled == true);
3196 int UtcDaliActorHoveredSignal(void)
3198 TestApplication application;
3200 gHoverCallBackCalled = false;
3202 // get the root layer
3203 Actor actor = application.GetScene().GetRootLayer();
3204 DALI_TEST_CHECK(gHoverCallBackCalled == false);
3206 application.SendNotification();
3207 application.Render();
3209 // connect to its hover signal
3210 actor.HoveredSignal().Connect(TestCallback3);
3212 // simulate a hover event in the middle of the screen
3213 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3214 Dali::Integration::Point point;
3215 point.SetDeviceId(1);
3216 point.SetState(PointState::MOTION);
3217 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3218 Dali::Integration::HoverEvent hoverEvent;
3219 hoverEvent.AddPoint(point);
3220 application.ProcessEvent(hoverEvent);
3222 DALI_TEST_CHECK(gHoverCallBackCalled == true);
3226 int UtcDaliActorOnOffSceneSignal(void)
3228 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
3230 TestApplication application;
3233 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3234 gActorNamesOnOffScene.clear();
3236 Actor parent = Actor::New();
3237 parent.SetProperty(Actor::Property::NAME, "parent");
3238 parent.OnSceneSignal().Connect(OnSceneCallback);
3239 parent.OffSceneSignal().Connect(OffSceneCallback);
3241 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
3242 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
3244 // add parent to the scene
3245 application.GetScene().Add(parent);
3246 // onstage emitted, offstage not
3247 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3248 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3249 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3251 // test adding a child, should get onstage emitted
3253 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3254 gActorNamesOnOffScene.clear();
3256 Actor child = Actor::New();
3257 child.SetProperty(Actor::Property::NAME, "child");
3258 child.OnSceneSignal().Connect(OnSceneCallback);
3259 child.OffSceneSignal().Connect(OffSceneCallback);
3260 parent.Add(child); // add child
3261 // onscene emitted, offscene not
3262 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3263 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3264 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3266 // test removing parent from the scene
3268 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3269 gActorNamesOnOffScene.clear();
3271 application.GetScene().Remove(parent);
3272 // onscene not emitted, offscene is
3273 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3274 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
3275 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3276 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
3278 // test adding parent back to the scene
3280 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3281 gActorNamesOnOffScene.clear();
3283 application.GetScene().Add(parent);
3284 // onscene emitted, offscene not
3285 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
3286 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3287 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3288 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
3290 // test removing child
3292 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3293 gActorNamesOnOffScene.clear();
3295 parent.Remove(child);
3296 // onscene not emitted, offscene is
3297 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3298 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3299 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3301 // test removing parent
3303 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3304 gActorNamesOnOffScene.clear();
3306 application.GetScene().Remove(parent);
3307 // onscene not emitted, offscene is
3308 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3309 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3310 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3314 int UtcDaliActorFindChildByName(void)
3316 tet_infoline("Testing Dali::Actor::FindChildByName()");
3317 TestApplication application;
3319 Actor parent = Actor::New();
3320 parent.SetProperty(Actor::Property::NAME, "parent");
3321 Actor first = Actor::New();
3322 first.SetProperty(Actor::Property::NAME, "first");
3323 Actor second = Actor::New();
3324 second.SetProperty(Actor::Property::NAME, "second");
3329 Actor found = parent.FindChildByName("foo");
3330 DALI_TEST_CHECK(!found);
3332 found = parent.FindChildByName("parent");
3333 DALI_TEST_CHECK(found == parent);
3335 found = parent.FindChildByName("first");
3336 DALI_TEST_CHECK(found == first);
3338 found = parent.FindChildByName("second");
3339 DALI_TEST_CHECK(found == second);
3343 int UtcDaliActorFindChildById(void)
3345 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
3346 TestApplication application;
3348 Actor parent = Actor::New();
3349 Actor first = Actor::New();
3350 Actor second = Actor::New();
3355 Actor found = parent.FindChildById(100000);
3356 DALI_TEST_CHECK(!found);
3358 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
3359 DALI_TEST_CHECK(found == parent);
3361 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
3362 DALI_TEST_CHECK(found == first);
3364 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
3365 DALI_TEST_CHECK(found == second);
3369 int UtcDaliActorHitTest(void)
3374 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
3376 mTouchPoint(touchPoint),
3382 Vector2 mTouchPoint;
3386 TestApplication application;
3387 tet_infoline(" UtcDaliActorHitTest");
3389 // Fill a vector with different hit tests.
3390 struct HitTestData* hitTestData[] = {
3391 // scale touch point result
3392 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
3393 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
3394 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.
3395 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
3396 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.
3400 // get the root layer
3401 Actor actor = Actor::New();
3402 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3403 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3405 application.GetScene().Add(actor);
3407 ResetTouchCallbacks();
3409 unsigned int index = 0;
3410 while(NULL != hitTestData[index])
3412 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
3413 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
3415 // flush the queue and render once
3416 application.SendNotification();
3417 application.Render();
3419 DALI_TEST_CHECK(!gTouchCallBackCalled);
3421 // connect to its touch signal
3422 actor.TouchedSignal().Connect(TestTouchCallback);
3424 Dali::Integration::Point point;
3425 point.SetState(PointState::DOWN);
3426 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
3427 Dali::Integration::TouchEvent event;
3428 event.AddPoint(point);
3430 // flush the queue and render once
3431 application.SendNotification();
3432 application.Render();
3433 application.ProcessEvent(event);
3435 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3437 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3438 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3439 hitTestData[index]->mScale.x,
3440 hitTestData[index]->mScale.y,
3441 hitTestData[index]->mScale.z,
3442 hitTestData[index]->mTouchPoint.x,
3443 hitTestData[index]->mTouchPoint.y,
3444 hitTestData[index]->mResult);
3446 ResetTouchCallbacks();
3452 int UtcDaliActorGeoHitTest(void)
3457 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
3459 mTouchPoint(touchPoint),
3465 Vector2 mTouchPoint;
3469 TestApplication application;
3470 tet_infoline(" UtcDaliActorHitTest");
3472 // Fill a vector with different hit tests.
3473 struct HitTestData* hitTestData[] = {
3474 // scale touch point result
3475 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
3476 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
3477 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.
3478 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
3479 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.
3483 // get the root layer
3484 Actor actor = Actor::New();
3485 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3486 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3488 application.GetScene().Add(actor);
3489 application.GetScene().SetGeometryHittestEnabled(true);
3491 ResetTouchCallbacks(application);
3493 unsigned int index = 0;
3494 while(NULL != hitTestData[index])
3496 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
3497 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
3499 // flush the queue and render once
3500 application.SendNotification();
3501 application.Render();
3503 DALI_TEST_CHECK(!gTouchCallBackCalled);
3505 // connect to its touch signal
3506 actor.TouchedSignal().Connect(TestTouchCallback);
3508 Dali::Integration::Point point;
3509 point.SetState(PointState::DOWN);
3510 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
3511 Dali::Integration::TouchEvent event;
3512 event.AddPoint(point);
3514 // flush the queue and render once
3515 application.SendNotification();
3516 application.Render();
3517 application.ProcessEvent(event);
3519 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3521 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3522 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3523 hitTestData[index]->mScale.x,
3524 hitTestData[index]->mScale.y,
3525 hitTestData[index]->mScale.z,
3526 hitTestData[index]->mTouchPoint.x,
3527 hitTestData[index]->mTouchPoint.y,
3528 hitTestData[index]->mResult);
3530 ResetTouchCallbacks(application);
3536 int UtcDaliActorSetDrawMode(void)
3538 TestApplication application;
3539 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
3541 Actor a = Actor::New();
3543 application.GetScene().Add(a);
3544 application.SendNotification();
3545 application.Render(0);
3546 application.SendNotification();
3547 application.Render(1);
3549 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
3551 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3552 application.SendNotification();
3553 application.Render(1);
3555 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
3557 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3558 application.SendNotification();
3559 application.Render(1);
3561 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
3565 int UtcDaliActorSetDrawModeOverlayRender(void)
3567 TestApplication application;
3568 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
3570 application.SendNotification();
3571 application.Render(1);
3573 std::vector<GLuint> ids;
3574 ids.push_back(8); // first rendered actor
3575 ids.push_back(9); // second rendered actor
3576 ids.push_back(10); // third rendered actor
3577 application.GetGlAbstraction().SetNextTextureIds(ids);
3579 Texture imageA = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3580 Texture imageB = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3581 Texture imageC = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3582 Actor a = CreateRenderableActor(imageA);
3583 Actor b = CreateRenderableActor(imageB);
3584 Actor c = CreateRenderableActor(imageC);
3586 application.SendNotification();
3587 application.Render(1);
3589 //Textures are bound when first created. Clear bound textures vector
3590 application.GetGlAbstraction().ClearBoundTextures();
3592 // Render a,b,c as regular non-overlays. so order will be:
3596 application.GetScene().Add(a);
3597 application.GetScene().Add(b);
3598 application.GetScene().Add(c);
3600 application.SendNotification();
3601 application.Render(1);
3603 // Should be 3 textures changes.
3604 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3605 typedef std::vector<GLuint>::size_type TextureSize;
3606 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3607 if(boundTextures.size() == 3)
3609 DALI_TEST_CHECK(boundTextures[0] == 8u);
3610 DALI_TEST_CHECK(boundTextures[1] == 9u);
3611 DALI_TEST_CHECK(boundTextures[2] == 10u);
3614 // Now texture ids have been set, we can monitor their render order.
3615 // render a as an overlay (last), so order will be:
3619 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3620 application.GetGlAbstraction().ClearBoundTextures();
3622 application.SendNotification();
3623 application.Render(1);
3625 // Should be 3 texture changes.
3626 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3627 if(boundTextures.size() == 3)
3629 DALI_TEST_CHECK(boundTextures[0] == 9u);
3630 DALI_TEST_CHECK(boundTextures[1] == 10u);
3631 DALI_TEST_CHECK(boundTextures[2] == 8u);
3636 int UtcDaliActorSetDrawModeOverlayWithClipping(void)
3638 TestApplication application;
3639 tet_infoline(" UtcDaliActorSetDrawModeOverlayWithClipping");
3641 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3642 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
3643 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3645 const Vector2 surfaceSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
3646 const Vector2 imageSize(16.0f, 16.0f);
3648 std::vector<GLuint> ids;
3649 ids.push_back(8); // first rendered actor
3650 ids.push_back(9); // second rendered actor
3651 ids.push_back(10); // third rendered actor
3652 ids.push_back(11); // forth rendered actor
3653 application.GetGlAbstraction().SetNextTextureIds(ids);
3655 Actor a = CreateActorWithContent16x16();
3656 Actor b = CreateActorWithContent16x16();
3657 Actor c = CreateActorWithContent16x16();
3658 Actor d = CreateActorWithContent16x16();
3660 application.SendNotification();
3661 application.Render();
3663 //Textures are bound when first created. Clear bound textures vector
3664 application.GetGlAbstraction().ClearBoundTextures();
3666 b[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3667 b[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3668 b[Actor::Property::DRAW_MODE] = DrawMode::OVERLAY_2D;
3669 b[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3671 c[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3672 c[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3673 c[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3674 c[Actor::Property::POSITION] = Vector2(100.0f, -100.0f);
3676 application.GetScene().Add(a);
3677 application.GetScene().Add(b);
3678 application.GetScene().Add(c);
3681 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3683 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3684 typedef std::vector<GLuint>::size_type TextureSize;
3685 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(4), TEST_LOCATION);
3686 if(boundTextures.size() == 4)
3688 DALI_TEST_CHECK(boundTextures[0] == 8u);
3689 DALI_TEST_CHECK(boundTextures[1] == 10u);
3690 DALI_TEST_CHECK(boundTextures[2] == 9u);
3691 DALI_TEST_CHECK(boundTextures[3] == 11u);
3694 // Check scissor test was enabled.
3695 std::ostringstream scissor;
3696 scissor << std::hex << GL_SCISSOR_TEST;
3697 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
3699 // Check the scissor was set, and the coordinates are correct.
3700 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3701 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3703 application.GetGlAbstraction().ClearBoundTextures();
3705 // Remove a Renderer of overlay actor
3706 Renderer renderer = b.GetRendererAt(0);
3707 b.RemoveRenderer(renderer);
3709 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3711 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3712 if(boundTextures.size() == 3)
3714 DALI_TEST_CHECK(boundTextures[0] == 8u);
3715 DALI_TEST_CHECK(boundTextures[1] == 10u);
3716 DALI_TEST_CHECK(boundTextures[2] == 11u);
3719 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3720 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3725 int UtcDaliActorGetCurrentWorldMatrix(void)
3727 TestApplication application;
3728 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3730 Actor parent = Actor::New();
3731 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3732 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3733 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3734 Radian rotationAngle(Degree(85.0f));
3735 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3736 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3737 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3738 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3739 parent.SetProperty(Actor::Property::SCALE, parentScale);
3740 application.GetScene().Add(parent);
3742 Actor child = Actor::New();
3743 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3744 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3745 Radian childRotationAngle(Degree(23.0f));
3746 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3747 Vector3 childScale(2.0f, 2.0f, 2.0f);
3748 child.SetProperty(Actor::Property::POSITION, childPosition);
3749 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3750 child.SetProperty(Actor::Property::SCALE, childScale);
3753 application.SendNotification();
3754 application.Render(0);
3755 application.Render();
3756 application.SendNotification();
3758 Matrix parentMatrix(false);
3759 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3761 Matrix childMatrix(false);
3762 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3764 //Child matrix should be the composition of child and parent
3765 Matrix childWorldMatrix(false);
3766 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3768 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3769 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3773 int UtcDaliActorConstrainedToWorldMatrix(void)
3775 TestApplication application;
3776 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3778 Actor parent = Actor::New();
3779 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3780 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3781 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3782 Radian rotationAngle(Degree(85.0f));
3783 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3784 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3785 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3786 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3787 parent.SetProperty(Actor::Property::SCALE, parentScale);
3788 application.GetScene().Add(parent);
3790 Actor child = Actor::New();
3791 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3792 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3793 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3794 posConstraint.Apply();
3796 application.GetScene().Add(child);
3798 application.SendNotification();
3799 application.Render(0);
3800 application.Render();
3801 application.SendNotification();
3803 Matrix parentMatrix(false);
3804 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3806 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3807 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3811 int UtcDaliActorConstrainedToOrientation(void)
3813 TestApplication application;
3814 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3816 Actor parent = Actor::New();
3817 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3818 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3819 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3820 Radian rotationAngle(Degree(85.0f));
3821 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3822 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3823 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3824 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3825 parent.SetProperty(Actor::Property::SCALE, parentScale);
3826 application.GetScene().Add(parent);
3828 Actor child = Actor::New();
3829 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3830 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3831 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3832 posConstraint.Apply();
3834 application.GetScene().Add(child);
3836 application.SendNotification();
3837 application.Render(0);
3838 application.Render();
3839 application.SendNotification();
3841 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3845 int UtcDaliActorConstrainedToOpacity(void)
3847 TestApplication application;
3848 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3850 Actor parent = Actor::New();
3851 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3852 application.GetScene().Add(parent);
3854 Actor child = Actor::New();
3855 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3856 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3857 opacityConstraint.Apply();
3859 application.GetScene().Add(child);
3861 application.SendNotification();
3862 application.Render(0);
3863 application.Render();
3864 application.SendNotification();
3866 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3868 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3870 application.SendNotification();
3871 application.Render(0);
3872 application.Render();
3873 application.SendNotification();
3875 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3880 int UtcDaliActorUnparent(void)
3882 TestApplication application;
3883 tet_infoline(" UtcDaliActorUnparent");
3885 Actor parent = Actor::New();
3886 application.GetScene().Add(parent);
3888 Actor child = Actor::New();
3890 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3891 DALI_TEST_CHECK(!child.GetParent());
3893 // Test that calling Unparent with no parent is a NOOP
3896 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3897 DALI_TEST_CHECK(!child.GetParent());
3899 // Test that Unparent works
3902 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3903 DALI_TEST_CHECK(parent == child.GetParent());
3907 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3908 DALI_TEST_CHECK(!child.GetParent());
3910 // Test that UnparentAndReset works
3913 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3914 DALI_TEST_CHECK(parent == child.GetParent());
3916 UnparentAndReset(child);
3918 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3919 DALI_TEST_CHECK(!child);
3921 // Test that UnparentAndReset is a NOOP with empty handle
3922 UnparentAndReset(child);
3924 DALI_TEST_CHECK(!child);
3928 int UtcDaliActorGetChildAt(void)
3930 TestApplication application;
3931 tet_infoline(" UtcDaliActorGetChildAt");
3933 Actor parent = Actor::New();
3934 application.GetScene().Add(parent);
3936 Actor child0 = Actor::New();
3939 Actor child1 = Actor::New();
3942 Actor child2 = Actor::New();
3945 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3946 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3947 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3951 int UtcDaliActorSetGetOverlay(void)
3953 TestApplication application;
3954 tet_infoline(" UtcDaliActorSetGetOverlay");
3956 Actor parent = Actor::New();
3957 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3958 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3962 int UtcDaliActorCreateDestroy(void)
3964 Actor* actor = new Actor;
3965 DALI_TEST_CHECK(actor);
3972 struct PropertyStringIndex
3974 const char* const name;
3975 const Property::Index index;
3976 const Property::Type type;
3979 const PropertyStringIndex PROPERTY_TABLE[] =
3981 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3982 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3983 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3984 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3985 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3986 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3987 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3988 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3989 {"size", Actor::Property::SIZE, Property::VECTOR3},
3990 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3991 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3992 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3993 {"position", Actor::Property::POSITION, Property::VECTOR3},
3994 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3995 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3996 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3997 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3998 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3999 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
4000 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
4001 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
4002 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
4003 {"scale", Actor::Property::SCALE, Property::VECTOR3},
4004 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
4005 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
4006 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
4007 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
4008 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
4009 {"color", Actor::Property::COLOR, Property::VECTOR4},
4010 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
4011 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
4012 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
4013 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
4014 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
4015 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
4016 {"name", Actor::Property::NAME, Property::STRING},
4017 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
4018 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
4019 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
4020 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
4021 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
4022 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
4023 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
4024 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
4025 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
4026 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
4027 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
4028 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
4029 {"padding", Actor::Property::PADDING, Property::VECTOR4},
4030 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
4031 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
4032 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
4033 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
4034 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
4036 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
4037 } // unnamed namespace
4039 int UtcDaliActorProperties(void)
4041 TestApplication application;
4043 Actor actor = Actor::New();
4045 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
4047 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
4048 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
4049 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
4050 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
4055 int UtcDaliRelayoutProperties_ResizePolicies(void)
4057 TestApplication application;
4059 Actor actor = Actor::New();
4062 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
4063 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
4065 // Set resize policy for all dimensions
4066 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
4067 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
4069 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
4072 // Set individual dimensions
4073 const char* const widthPolicy = "FILL_TO_PARENT";
4074 const char* const heightPolicy = "FIXED";
4076 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
4077 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
4079 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
4080 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
4082 // Set individual dimensions using enums
4083 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
4084 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
4086 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
4087 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
4089 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
4090 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
4095 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
4097 TestApplication application;
4099 Actor actor = Actor::New();
4102 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
4104 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
4105 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
4106 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
4109 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
4110 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
4112 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
4113 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
4115 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
4116 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
4121 int UtcDaliRelayoutProperties_SizeModeFactor(void)
4123 TestApplication application;
4125 Actor actor = Actor::New();
4128 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
4129 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
4131 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
4132 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
4133 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
4136 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
4138 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
4139 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
4144 int UtcDaliRelayoutProperties_DimensionDependency(void)
4146 TestApplication application;
4148 Actor actor = Actor::New();
4151 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4152 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
4155 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
4156 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
4158 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
4159 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
4161 // Test setting another resize policy
4162 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
4163 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4168 int UtcDaliRelayoutProperties_Padding(void)
4170 TestApplication application;
4172 Actor actor = Actor::New();
4175 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
4178 actor.SetProperty(Actor::Property::PADDING, padding);
4179 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
4181 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4186 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
4188 TestApplication application;
4190 Actor actor = Actor::New();
4193 Vector2 minSize(1.0f, 2.0f);
4195 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
4196 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
4198 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4200 Vector2 maxSize(3.0f, 4.0f);
4202 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
4203 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
4205 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4210 int UtcDaliActorGetHeightForWidth(void)
4212 TestApplication application;
4214 Actor actor = Actor::New();
4216 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
4221 int UtcDaliActorGetWidthForHeight(void)
4223 TestApplication application;
4225 Actor actor = Actor::New();
4227 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
4232 int UtcDaliActorGetRelayoutSize(void)
4234 TestApplication application;
4236 Actor actor = Actor::New();
4238 // Add actor to stage
4239 application.GetScene().Add(actor);
4241 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
4243 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
4244 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
4246 // Flush the queue and render once
4247 application.SendNotification();
4248 application.Render();
4250 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
4255 int UtcDaliActorSetPadding(void)
4257 TestApplication application;
4259 Actor actor = Actor::New();
4262 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4264 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
4265 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
4266 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
4267 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
4269 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
4270 actor.SetProperty(Actor::Property::PADDING, padding2);
4272 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4274 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
4275 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
4276 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
4277 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
4282 int UtcDaliActorSetMinimumSize(void)
4284 TestApplication application;
4286 Actor actor = Actor::New();
4288 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4290 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
4291 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
4293 Vector2 size2(1.0f, 2.0f);
4294 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
4296 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4298 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4299 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4304 int UtcDaliActorSetMaximumSize(void)
4306 TestApplication application;
4308 Actor actor = Actor::New();
4310 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4312 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
4313 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
4315 Vector2 size2(1.0f, 2.0f);
4316 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
4318 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4320 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4321 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4326 int UtcDaliActorOnRelayoutSignal(void)
4328 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
4330 TestApplication application;
4333 gOnRelayoutCallBackCalled = false;
4334 gActorNamesRelayout.clear();
4336 Actor actor = Actor::New();
4337 actor.SetProperty(Actor::Property::NAME, "actor");
4338 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
4341 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
4343 // Add actor to stage
4344 application.GetScene().Add(actor);
4346 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4347 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
4349 // Flush the queue and render once
4350 application.SendNotification();
4351 application.Render();
4353 // OnRelayout emitted
4354 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
4355 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
4360 int UtcDaliActorGetHierachyDepth(void)
4362 TestApplication application;
4363 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
4365 /* Build tree of actors:
4375 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
4377 Integration::Scene stage(application.GetScene());
4379 Actor actorA = Actor::New();
4380 Actor actorB = Actor::New();
4381 Actor actorC = Actor::New();
4382 Actor actorD = Actor::New();
4383 Actor actorE = Actor::New();
4384 Actor actorF = Actor::New();
4386 //Test that root actor has depth equal 0
4387 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4389 //Test actors return depth -1 when not connected to the tree
4390 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4391 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4392 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4393 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4394 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4395 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4397 //Create the hierarchy
4405 //Test actors return correct depth
4406 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4407 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4408 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4409 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4410 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4411 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4413 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
4414 actorA.Remove(actorB);
4416 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4417 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4418 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4420 //Removing actorA from the stage. All actors should have depth equal -1
4421 stage.Remove(actorA);
4423 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4424 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4425 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4426 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4427 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4428 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4433 int UtcDaliActorAnchorPointPropertyAsString(void)
4435 TestApplication application;
4437 Actor actor = Actor::New();
4439 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
4440 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4442 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
4443 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4445 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
4446 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4448 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
4449 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4451 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
4452 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
4454 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
4455 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4457 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
4458 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4460 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
4461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4463 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
4464 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4466 // Invalid should not change anything
4467 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
4468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4473 int UtcDaliActorParentOriginPropertyAsString(void)
4475 TestApplication application;
4477 Actor actor = Actor::New();
4479 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
4480 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4482 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
4483 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4485 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
4486 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4488 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
4489 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4491 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
4492 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
4494 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
4495 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4497 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
4498 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4500 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
4501 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4503 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
4504 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4506 // Invalid should not change anything
4507 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
4508 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4513 int UtcDaliActorColorModePropertyAsString(void)
4515 TestApplication application;
4517 Actor actor = Actor::New();
4519 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
4520 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4522 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
4523 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4525 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
4526 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4528 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
4529 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4531 // Invalid should not change anything
4532 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
4533 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4538 int UtcDaliActorDrawModePropertyAsString(void)
4540 TestApplication application;
4542 Actor actor = Actor::New();
4544 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
4545 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4547 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
4548 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4550 // Invalid should not change anything
4551 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
4552 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4557 int UtcDaliActorColorModePropertyAsEnum(void)
4559 TestApplication application;
4561 Actor actor = Actor::New();
4563 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
4564 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4566 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
4567 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4569 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
4570 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4572 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
4573 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4578 int UtcDaliActorDrawModePropertyAsEnum(void)
4580 TestApplication application;
4582 Actor actor = Actor::New();
4584 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
4585 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4587 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
4588 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4593 int UtcDaliActorAddRendererP(void)
4595 tet_infoline("Testing Actor::AddRenderer");
4596 TestApplication application;
4598 Actor actor = Actor::New();
4600 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4602 Geometry geometry = CreateQuadGeometry();
4603 Shader shader = CreateShader();
4604 Renderer renderer = Renderer::New(geometry, shader);
4606 actor.AddRenderer(renderer);
4607 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4608 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4613 int UtcDaliActorAddRendererN01(void)
4615 tet_infoline("Testing Actor::AddRenderer");
4616 TestApplication application;
4618 Actor actor = Actor::New();
4624 actor.AddRenderer(renderer);
4625 tet_printf("Assertion test failed - no Exception\n");
4626 tet_result(TET_FAIL);
4628 catch(Dali::DaliException& e)
4630 DALI_TEST_PRINT_ASSERT(e);
4631 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
4632 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4636 tet_printf("Assertion test failed - wrong Exception\n");
4637 tet_result(TET_FAIL);
4643 int UtcDaliActorAddRendererN02(void)
4645 tet_infoline("UtcDaliActorAddRendererN02");
4651 TestApplication application;
4653 Geometry geometry = CreateQuadGeometry();
4654 Shader shader = CreateShader();
4655 renderer = Renderer::New(geometry, shader);
4657 actor = Actor::New();
4660 // try illegal AddRenderer
4663 actor.AddRenderer(renderer);
4664 tet_printf("Assertion test failed - no Exception\n");
4665 tet_result(TET_FAIL);
4667 catch(Dali::DaliException& e)
4669 DALI_TEST_PRINT_ASSERT(e);
4670 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
4674 tet_printf("Assertion test failed - wrong Exception\n");
4675 tet_result(TET_FAIL);
4681 int UtcDaliActorAddRendererOnScene(void)
4683 tet_infoline("Testing Actor::AddRenderer");
4684 TestApplication application;
4686 Actor actor = Actor::New();
4687 application.GetScene().Add(actor);
4689 application.SendNotification();
4690 application.Render(0);
4692 Geometry geometry = CreateQuadGeometry();
4693 Shader shader = CreateShader();
4694 Renderer renderer = Renderer::New(geometry, shader);
4696 application.SendNotification();
4697 application.Render(0);
4701 actor.AddRenderer(renderer);
4702 tet_result(TET_PASS);
4706 tet_result(TET_FAIL);
4712 int UtcDaliActorRemoveRendererP1(void)
4714 tet_infoline("Testing Actor::RemoveRenderer");
4715 TestApplication application;
4717 Actor actor = Actor::New();
4719 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4722 Geometry geometry = CreateQuadGeometry();
4723 Shader shader = CreateShader();
4724 Renderer renderer = Renderer::New(geometry, shader);
4726 actor.AddRenderer(renderer);
4727 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4728 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4730 application.SendNotification();
4731 application.Render();
4735 Renderer renderer = actor.GetRendererAt(0);
4736 actor.RemoveRenderer(renderer);
4737 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4739 application.SendNotification();
4740 application.Render();
4743 // Call one final time to ensure that the renderer is actually removed after
4744 // the handle goes out of scope, and excercises the deletion code path in
4745 // scene graph and render.
4746 application.SendNotification();
4747 application.Render();
4752 int UtcDaliActorRemoveRendererP2(void)
4754 tet_infoline("Testing Actor::RemoveRenderer");
4755 TestApplication application;
4757 Actor actor = Actor::New();
4759 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4761 Geometry geometry = CreateQuadGeometry();
4762 Shader shader = CreateShader();
4763 Renderer renderer = Renderer::New(geometry, shader);
4765 actor.AddRenderer(renderer);
4766 application.SendNotification();
4767 application.Render();
4769 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4770 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4772 actor.RemoveRenderer(0);
4773 application.SendNotification();
4774 application.Render();
4776 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4778 // Shut down whilst holding onto the renderer handle.
4782 int UtcDaliActorRemoveRendererP3(void)
4784 tet_infoline("Testing Actor::RemoveRenderer");
4785 TestApplication application;
4787 Actor actor1 = Actor::New();
4788 Actor actor2 = Actor::New();
4789 Actor actor3 = Actor::New();
4791 application.GetScene().Add(actor1);
4792 application.GetScene().Add(actor2);
4793 application.GetScene().Add(actor3);
4795 // Make each actors size bigger than zero, so we can assuem that actor is rendered
4796 actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4797 actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4798 actor3.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4800 // Register some dummy property to seperate actor1 and actor2 in Render::Renderer
4801 actor1.RegisterProperty("dummy1", 1);
4802 actor2.RegisterProperty("dummy2", 2.0f);
4803 actor3.RegisterProperty("dummy3", Vector2(3.0f, 4.0f));
4805 DALI_TEST_EQUALS(actor1.GetRendererCount(), 0u, TEST_LOCATION);
4806 DALI_TEST_EQUALS(actor2.GetRendererCount(), 0u, TEST_LOCATION);
4807 DALI_TEST_EQUALS(actor3.GetRendererCount(), 0u, TEST_LOCATION);
4809 Geometry geometry = CreateQuadGeometry();
4810 Shader shader = CreateShader();
4811 Renderer renderer1 = Renderer::New(geometry, shader);
4812 Renderer renderer2 = Renderer::New(geometry, shader);
4814 actor1.AddRenderer(renderer1);
4815 actor1.AddRenderer(renderer2);
4816 actor2.AddRenderer(renderer1);
4817 actor2.AddRenderer(renderer2);
4818 actor3.AddRenderer(renderer1);
4819 actor3.AddRenderer(renderer2);
4820 application.SendNotification();
4821 application.Render();
4823 DALI_TEST_EQUALS(actor1.GetRendererCount(), 2u, TEST_LOCATION);
4824 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer1, TEST_LOCATION);
4825 DALI_TEST_EQUALS(actor1.GetRendererAt(1), renderer2, TEST_LOCATION);
4827 DALI_TEST_EQUALS(actor2.GetRendererCount(), 2u, TEST_LOCATION);
4828 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4829 DALI_TEST_EQUALS(actor2.GetRendererAt(1), renderer2, TEST_LOCATION);
4831 DALI_TEST_EQUALS(actor3.GetRendererCount(), 2u, TEST_LOCATION);
4832 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer1, TEST_LOCATION);
4833 DALI_TEST_EQUALS(actor3.GetRendererAt(1), renderer2, TEST_LOCATION);
4835 actor1.RemoveRenderer(0);
4836 actor2.RemoveRenderer(1);
4837 actor3.RemoveRenderer(0);
4838 application.SendNotification();
4839 application.Render();
4841 DALI_TEST_EQUALS(actor1.GetRendererCount(), 1u, TEST_LOCATION);
4842 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer2, TEST_LOCATION);
4843 DALI_TEST_EQUALS(actor2.GetRendererCount(), 1u, TEST_LOCATION);
4844 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4845 DALI_TEST_EQUALS(actor3.GetRendererCount(), 1u, TEST_LOCATION);
4846 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer2, TEST_LOCATION);
4848 // Shut down whilst holding onto the renderer handle.
4852 int UtcDaliActorRemoveRendererN(void)
4854 tet_infoline("Testing Actor::RemoveRenderer");
4855 TestApplication application;
4857 Actor actor = Actor::New();
4859 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4861 Geometry geometry = CreateQuadGeometry();
4862 Shader shader = CreateShader();
4863 Renderer renderer = Renderer::New(geometry, shader);
4865 actor.AddRenderer(renderer);
4866 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4867 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4869 actor.RemoveRenderer(10);
4870 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4871 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4876 int UtcDaliActorPropertyClippingP(void)
4878 // This test checks the clippingMode property.
4879 tet_infoline("Testing Actor::Property::ClippingMode: P");
4880 TestApplication application;
4882 Actor actor = Actor::New();
4884 // Check default clippingEnabled value.
4885 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4888 bool getValueResult = getValue.Get(value);
4889 DALI_TEST_CHECK(getValueResult);
4893 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4896 // Check setting the property to the stencil mode.
4897 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4899 // Check the new value was set.
4900 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4901 getValueResult = getValue.Get(value);
4902 DALI_TEST_CHECK(getValueResult);
4906 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4909 // Check setting the property to the scissor mode.
4910 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4912 // Check the new value was set.
4913 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4914 getValueResult = getValue.Get(value);
4915 DALI_TEST_CHECK(getValueResult);
4919 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4924 int UtcDaliActorPropertyClippingN(void)
4926 // Negative test case for Clipping.
4927 tet_infoline("Testing Actor::Property::ClippingMode: N");
4928 TestApplication application;
4930 Actor actor = Actor::New();
4932 // Check default clippingEnabled value.
4933 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4936 bool getValueResult = getValue.Get(value);
4937 DALI_TEST_CHECK(getValueResult);
4941 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4944 // Check setting an invalid property value won't change the current property value.
4945 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4947 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4948 getValueResult = getValue.Get(value);
4949 DALI_TEST_CHECK(getValueResult);
4953 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4959 int UtcDaliActorPropertyClippingActor(void)
4961 // This test checks that an actor is correctly setup for clipping.
4962 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4963 TestApplication application;
4965 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4966 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4967 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4968 size_t startIndex = 0u;
4970 // Create a clipping actor.
4971 Actor actorDepth1Clip = CreateActorWithContent16x16();
4972 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4973 application.GetScene().Add(actorDepth1Clip);
4975 // Gather the call trace.
4976 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4978 // Check we are writing to the color buffer.
4979 CheckColorMask(glAbstraction, true);
4981 // Check the stencil buffer was enabled.
4982 std::ostringstream oss;
4983 oss << std::hex << GL_STENCIL_TEST;
4984 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4986 // Check the stencil buffer was cleared.
4987 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4989 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4990 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4991 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4992 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4997 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4999 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
5000 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
5001 TestApplication application;
5003 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5004 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5005 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5006 size_t startIndex = 0u;
5008 // Create a clipping actor.
5009 Actor actorDepth1Clip = CreateActorWithContent16x16();
5010 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5011 application.GetScene().Add(actorDepth1Clip);
5013 // Gather the call trace.
5014 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5016 // Check we are writing to the color buffer.
5017 CheckColorMask(glAbstraction, true);
5019 // Check the stencil buffer was enabled.
5020 std::ostringstream oss;
5021 oss << std::hex << GL_STENCIL_TEST;
5022 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
5024 // Check the stencil buffer was cleared.
5025 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
5027 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
5028 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
5029 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
5030 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5032 // Now disable the clipping
5033 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
5035 // Gather the call trace.
5036 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5038 // Check the stencil buffer was disabled.
5039 std::ostringstream stencil;
5040 stencil << std::hex << GL_STENCIL_TEST;
5041 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", stencil.str()));
5043 // Ensure all values in stencil-mask are set to 1.
5045 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
5050 int UtcDaliActorPropertyClippingNestedChildren(void)
5052 // This test checks that a hierarchy of actors are clipped correctly by
5053 // writing to and reading from the correct bit-planes of the stencil buffer.
5054 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
5055 TestApplication application;
5056 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5057 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5058 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5060 // Create a clipping actor.
5061 Actor actorDepth1Clip = CreateActorWithContent16x16();
5062 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5063 application.GetScene().Add(actorDepth1Clip);
5065 // Create a child actor.
5066 Actor childDepth2 = CreateActorWithContent16x16();
5067 actorDepth1Clip.Add(childDepth2);
5069 // Create another clipping actor.
5070 Actor childDepth2Clip = CreateActorWithContent16x16();
5071 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5072 childDepth2.Add(childDepth2Clip);
5074 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
5075 // This tests the sort algorithm.
5076 Actor childDepth3 = CreateActorWithContent16x16();
5077 childDepth2Clip.Add(childDepth3);
5078 Actor childDepth4 = CreateActorWithContent16x16();
5079 childDepth3.Add(childDepth4);
5081 // Gather the call trace.
5082 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5084 // Check we are writing to the color buffer.
5085 CheckColorMask(glAbstraction, true);
5087 // Check the stencil buffer was enabled.
5088 std::ostringstream oss;
5089 oss << std::hex << GL_STENCIL_TEST;
5090 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
5092 // Perform the test twice, once for 2D layer, and once for 3D.
5093 for(unsigned int i = 0u; i < 2u; ++i)
5095 size_t startIndex = 0u;
5097 // Check the stencil buffer was cleared.
5098 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
5100 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
5101 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
5102 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
5103 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5105 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
5106 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 1", startIndex)); // 514 is GL_EQUAL
5107 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
5109 // Check we are set up to write to the second bitplane of the stencil buffer (only).
5110 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
5111 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
5112 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
5114 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
5115 // (Both must be set to pass the check).
5116 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 3", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
5117 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
5119 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
5122 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
5123 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5130 int UtcDaliActorPropertyClippingActorDrawOrder(void)
5132 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
5133 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
5134 TestApplication application;
5135 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5136 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5138 /* We create a small tree of actors as follows:
5142 Clipping enabled -> B D
5146 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
5149 for(int i = 0; i < 5; ++i)
5151 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
5152 Actor actor = CreateRenderableActor(image);
5154 // Setup dimensions and position so actor is not skipped by culling.
5155 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
5156 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
5160 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5164 float b = i > 2 ? 1.0f : -1.0f;
5165 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
5171 // Enable clipping on the actor at the top of the left branch.
5172 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5174 // Build the scene graph.
5175 application.GetScene().Add(actors[0]);
5178 actors[0].Add(actors[1]);
5179 actors[1].Add(actors[2]);
5182 actors[0].Add(actors[3]);
5183 actors[3].Add(actors[4]);
5185 // Gather the call trace.
5186 enabledDisableTrace.Reset();
5187 enabledDisableTrace.Enable(true);
5188 application.SendNotification();
5189 application.Render();
5190 enabledDisableTrace.Enable(false);
5192 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
5194 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
5195 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
5197 size_t startIndex = 0u;
5198 std::ostringstream blend;
5199 blend << std::hex << GL_BLEND;
5200 std::ostringstream stencil;
5201 stencil << std::hex << GL_STENCIL_TEST;
5203 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", blend.str(), startIndex));
5204 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5205 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5207 // Swap the clipping actor from top of left branch to top of right branch.
5208 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
5209 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5211 // Gather the call trace.
5212 enabledDisableTrace.Reset();
5213 enabledDisableTrace.Enable(true);
5214 application.SendNotification();
5215 application.Render();
5216 enabledDisableTrace.Enable(false);
5218 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
5219 // This proves the draw order has remained the same.
5221 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5222 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5227 int UtcDaliActorPropertyScissorClippingActor01(void)
5229 // This test checks that an actor is correctly setup for clipping.
5230 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
5231 TestApplication application;
5233 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5234 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5235 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5237 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5238 const Vector2 imageSize(16.0f, 16.0f);
5240 // Create a clipping actor.
5241 Actor clippingActorA = CreateActorWithContent16x16();
5242 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5243 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5244 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5245 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5246 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5247 application.GetScene().Add(clippingActorA);
5249 // Gather the call trace.
5250 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5252 // Check we are writing to the color buffer.
5253 CheckColorMask(glAbstraction, true);
5255 // Check scissor test was enabled.
5257 std::ostringstream scissor;
5258 scissor << std::hex << GL_SCISSOR_TEST;
5259 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5261 // Check the scissor was set, and the coordinates are correct.
5262 std::stringstream compareParametersString;
5263 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
5264 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5266 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5267 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5269 // Gather the call trace.
5270 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5272 // Check the scissor was set, and the coordinates are correct.
5273 compareParametersString.str(std::string());
5274 compareParametersString.clear();
5275 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
5276 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5281 int UtcDaliActorPropertyScissorClippingActor02(void)
5283 // This test checks that an actor is correctly setup for clipping.
5284 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
5285 TestApplication application;
5287 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5288 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5289 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5291 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5292 const Vector2 actorSize(16.0f, 16.0f);
5294 // Create a clipping actor.
5295 Actor clippingActorA = CreateRenderableActor();
5296 clippingActorA[Actor::Property::SIZE] = actorSize;
5298 Renderer renderer = clippingActorA.GetRendererAt(0);
5299 DALI_TEST_CHECK(renderer);
5301 // Make Renderer opacity 0.
5302 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
5304 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5305 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5306 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5307 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5308 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5309 application.GetScene().Add(clippingActorA);
5311 // Gather the call trace.
5312 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5314 // Check we are writing to the color buffer.
5315 CheckColorMask(glAbstraction, true);
5317 // Check scissor test was enabled.
5319 std::ostringstream scissor;
5320 scissor << std::hex << GL_SCISSOR_TEST;
5321 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5323 // Check the scissor was set, and the coordinates are correct.
5324 std::stringstream compareParametersString;
5325 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5326 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5328 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5329 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5331 // Gather the call trace.
5332 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5334 // Check the scissor was set, and the coordinates are correct.
5335 compareParametersString.str(std::string());
5336 compareParametersString.clear();
5337 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5338 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5342 int UtcDaliActorPropertyScissorClippingActorWihtoutRenderer(void)
5344 // This test checks that an actor is correctly setup for clipping.
5345 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor without renderer");
5346 TestApplication application;
5348 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5349 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5350 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5352 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5353 const Vector2 actorSize(16.0f, 16.0f);
5355 // Create a clipping actor without renderer
5356 Actor clippingActorA = Actor::New();
5357 clippingActorA[Actor::Property::SIZE] = actorSize;
5359 // Add dummy actor, to make application would be rendering.
5360 Actor dummyActor = CreateRenderableActor();
5361 dummyActor[Actor::Property::SIZE] = actorSize;
5362 clippingActorA.Add(dummyActor);
5364 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5365 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5366 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5367 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5368 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5369 application.GetScene().Add(clippingActorA);
5371 // Gather the call trace.
5372 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5374 // Check we are writing to the color buffer.
5375 CheckColorMask(glAbstraction, true);
5377 // Check scissor test was enabled.
5379 std::ostringstream scissor;
5380 scissor << std::hex << GL_SCISSOR_TEST;
5381 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5383 // Check the scissor was set, and the coordinates are correct.
5384 std::stringstream compareParametersString;
5385 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5386 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5388 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5389 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5391 // Gather the call trace.
5392 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5394 // Check the scissor was set, and the coordinates are correct.
5395 compareParametersString.str(std::string());
5396 compareParametersString.clear();
5397 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5398 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5403 int UtcDaliActorPropertyScissorClippingActorWihtoutRendererUnderLayer3D(void)
5405 // This test checks that an actor is correctly setup for clipping.
5406 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor without renderer under layer 3d");
5407 TestApplication application;
5409 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5410 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5411 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5413 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5414 const Vector2 actorSize(16.0f, 16.0f);
5416 // Make root layer as LAYER_3D, to make we follow 3d flow.
5417 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
5419 // Create a clipping actor without renderer
5420 Actor clippingActorA = Actor::New();
5421 clippingActorA[Actor::Property::SIZE] = actorSize;
5423 // Add dummy actor, to make application would be rendering.
5424 Actor dummyActor = CreateRenderableActor();
5425 dummyActor[Actor::Property::SIZE] = actorSize;
5426 clippingActorA.Add(dummyActor);
5428 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5429 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5430 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5431 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5432 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5433 application.GetScene().Add(clippingActorA);
5435 // Gather the call trace.
5436 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5438 // Check we are writing to the color buffer.
5439 CheckColorMask(glAbstraction, true);
5441 // Check scissor test was enabled.
5443 std::ostringstream scissor;
5444 scissor << std::hex << GL_SCISSOR_TEST;
5445 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5447 // Check the scissor was set, and the coordinates are correct.
5448 std::stringstream compareParametersString;
5449 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5450 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5452 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5453 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5455 // Gather the call trace.
5456 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5458 // Check the scissor was set, and the coordinates are correct.
5459 compareParametersString.str(std::string());
5460 compareParametersString.clear();
5461 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5462 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5467 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
5469 // This test checks that an actor is correctly setup for clipping.
5470 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
5471 TestApplication application;
5473 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5474 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5475 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5477 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5478 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5479 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5481 // Create a clipping actors.
5482 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5483 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5485 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5486 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5487 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5489 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5490 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5491 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5493 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5494 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5496 application.GetScene().Add(clippingActorA);
5497 application.GetScene().Add(clippingActorB);
5499 // Gather the call trace.
5500 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5502 // Check we are writing to the color buffer.
5503 CheckColorMask(glAbstraction, true);
5505 // Check scissor test was enabled.
5506 std::ostringstream scissor;
5507 scissor << std::hex << GL_SCISSOR_TEST;
5508 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5510 // Check the scissor was set, and the coordinates are correct.
5511 std::stringstream compareParametersString;
5513 std::string clipA("0, 500, 480, 200");
5514 std::string clipB("0, 380, 480, 40");
5516 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5517 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5522 int UtcDaliActorPropertyScissorClippingActorNested01(void)
5524 // This test checks that an actor is correctly setup for clipping.
5525 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5526 TestApplication application;
5528 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5529 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5530 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5532 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5533 const Vector2 imageSize(16.0f, 16.0f);
5535 /* Create a nest of 2 scissors to test nesting (intersecting clips).
5537 A is drawn first - with scissor clipping on
5538 B is drawn second - also with scissor clipping on
5539 C is the generated clipping region, the intersection ( A ∩ B )
5543 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
5544 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
5545 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
5549 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
5552 // Create a clipping actor.
5553 Actor clippingActorA = CreateActorWithContent16x16();
5554 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5555 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5556 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5557 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5558 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5559 application.GetScene().Add(clippingActorA);
5561 // Create a child clipping actor.
5562 Actor clippingActorB = CreateActorWithContent16x16();
5563 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5564 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5565 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5566 clippingActorA.Add(clippingActorB);
5568 // positionModifiers is an array of positions to position B around.
5569 // expect is an array of expected scissor clip coordinate results.
5570 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
5571 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
5573 // Loop through each overlap combination.
5574 for(unsigned int test = 0u; test < 4u; ++test)
5576 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
5577 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
5578 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
5580 // Gather the call trace.
5581 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5583 // Check we are writing to the color buffer.
5584 CheckColorMask(glAbstraction, true);
5586 // Check scissor test was enabled.
5587 std::ostringstream scissor;
5588 scissor << std::hex << GL_SCISSOR_TEST;
5589 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5591 // Check the scissor was set, and the coordinates are correct.
5592 const Vector4& expectResults(expect[test]);
5593 std::stringstream compareParametersString;
5594 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
5595 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
5601 int UtcDaliActorPropertyScissorClippingActorNested02(void)
5603 // This test checks that an actor is correctly setup for clipping.
5604 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5605 TestApplication application;
5607 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5608 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5609 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5611 /* Create a nest of 2 scissors and siblings of the parent.
5621 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5622 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5623 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5624 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
5625 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
5626 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
5628 // Create a clipping actors.
5629 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5630 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5631 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
5632 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
5633 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
5635 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5636 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5637 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5639 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5640 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5641 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5643 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5644 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5645 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5647 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5648 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5649 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5651 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5652 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5654 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5655 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5656 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
5657 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5658 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5660 application.GetScene().Add(clippingActorA);
5661 clippingActorA.Add(clippingActorB);
5662 application.GetScene().Add(clippingActorC);
5663 application.GetScene().Add(clippingActorD);
5664 clippingActorD.Add(clippingActorE);
5666 // Gather the call trace.
5667 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5669 // Check we are writing to the color buffer.
5670 CheckColorMask(glAbstraction, true);
5672 // Check scissor test was enabled.
5673 std::ostringstream scissor;
5674 scissor << std::hex << GL_SCISSOR_TEST;
5675 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5677 // Check the scissor was set, and the coordinates are correct.
5678 std::string clipA("0, 500, 480, 200");
5679 std::string clipB("0, 580, 480, 40");
5680 std::string clipC("0, 200, 480, 200");
5681 std::string clipD("0, 300, 480, 200");
5683 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5684 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5685 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
5686 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
5687 DALI_TEST_EQUALS(scissorTrace.CountMethod("Scissor"), 4, TEST_LOCATION); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
5692 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
5694 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
5695 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
5696 TestApplication application;
5698 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5699 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5700 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5702 // Create a clipping actor.
5703 Actor actorDepth1Clip = CreateActorWithContent16x16();
5704 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5705 application.GetScene().Add(actorDepth1Clip);
5707 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
5708 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
5710 // Gather the call trace.
5711 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5713 // Check we are writing to the color buffer.
5714 CheckColorMask(glAbstraction, true);
5716 // Check the stencil buffer was not enabled.
5717 std::ostringstream stencil;
5718 stencil << std::hex << GL_STENCIL_TEST;
5719 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", stencil.str()));
5721 // Check stencil functions are not called.
5722 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
5723 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
5725 // Check that scissor clipping is overriden by the renderer properties.
5726 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5728 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5730 // Gather the call trace.
5731 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5733 // Check the stencil buffer was not enabled.
5734 std::ostringstream scissor;
5735 scissor << std::hex << GL_SCISSOR_TEST;
5736 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5738 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
5743 int UtcDaliActorPropertyClippingActorCulled(void)
5745 // This test checks that child actors are clipped by an culled parent actor.
5746 tet_infoline("Testing child actors are clipped by an culled parent actor");
5747 TestApplication application;
5749 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5750 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5751 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5753 const Vector2 actorSize(160.0f, 160.0f);
5755 // Create a clipping actor.
5756 Actor clippingActorA = CreateRenderableActor();
5757 clippingActorA[Actor::Property::SIZE] = actorSize;
5759 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5760 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5761 clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5762 clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5763 clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
5764 application.GetScene().Add(clippingActorA);
5766 // Create a child actor
5767 Actor childActor = CreateRenderableActor();
5768 childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5769 childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5770 childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
5771 childActor[Actor::Property::INHERIT_POSITION] = false;
5773 // Gather the call trace.
5774 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5776 // Check scissor test was enabled.
5777 std::ostringstream scissor;
5778 scissor << std::hex << GL_SCISSOR_TEST;
5779 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5781 // Check the scissor was set, and the coordinates are correct.
5782 std::stringstream compareParametersString;
5783 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5784 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5786 // Move the clipping actor out of screen
5787 clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
5789 // Gather the call trace.
5790 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5792 // Check the scissor was set, and the coordinates are correct.
5793 compareParametersString.str(std::string());
5794 compareParametersString.clear();
5795 compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
5796 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
5801 int UtcDaliGetPropertyN(void)
5803 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
5804 TestApplication application;
5806 Actor actor = Actor::New();
5808 unsigned int propertyCount = actor.GetPropertyCount();
5809 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
5813 int UtcDaliActorRaiseLower(void)
5815 tet_infoline("UtcDaliActor Raise and Lower test\n");
5817 TestApplication application;
5819 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5820 Debug::Filter::EnableGlobalTrace();
5822 Integration::Scene stage(application.GetScene());
5824 Actor actorA = Actor::New();
5825 Actor actorB = Actor::New();
5826 Actor actorC = Actor::New();
5828 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5829 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5831 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5832 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5834 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5835 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5837 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5838 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5840 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5841 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5843 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5844 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5850 ResetTouchCallbacks();
5852 application.SendNotification();
5853 application.Render();
5855 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5856 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5857 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5859 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5860 // Only top actor will get touched.
5861 actorA.TouchedSignal().Connect(TestTouchCallback);
5862 actorB.TouchedSignal().Connect(TestTouchCallback2);
5863 actorC.TouchedSignal().Connect(TestTouchCallback3);
5865 // Connect ChildOrderChangedSignal
5866 bool orderChangedSignal(false);
5867 Actor orderChangedActor;
5868 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5869 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5871 Dali::Integration::Point point;
5872 point.SetDeviceId(1);
5873 point.SetState(PointState::DOWN);
5874 point.SetScreenPosition(Vector2(10.f, 10.f));
5875 Dali::Integration::TouchEvent touchEvent;
5876 touchEvent.AddPoint(point);
5878 application.ProcessEvent(touchEvent);
5880 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5881 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5882 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5884 ResetTouchCallbacks();
5886 tet_printf("Testing Raising of Actor\n");
5888 int preActorOrder(0);
5889 int postActorOrder(0);
5891 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5892 value.Get(preActorOrder);
5894 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5896 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5897 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5899 // Ensure sort order is calculated before next touch event
5900 application.SendNotification();
5902 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5903 value.Get(postActorOrder);
5905 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5907 application.ProcessEvent(touchEvent);
5909 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5910 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5911 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5913 ResetTouchCallbacks();
5915 tet_printf("Testing Lowering of Actor\n");
5917 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5918 value.Get(preActorOrder);
5920 orderChangedSignal = false;
5922 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5924 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5925 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5927 application.SendNotification(); // ensure sort order calculated before next touch event
5929 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5930 value.Get(postActorOrder);
5932 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5934 application.ProcessEvent(touchEvent);
5936 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5937 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5938 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5940 ResetTouchCallbacks();
5942 Debug::Filter::DisableGlobalTrace();
5943 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
5948 int UtcDaliActorGeoTouchRaiseLower(void)
5950 tet_infoline("UtcDaliActor Raise and Lower test\n");
5952 TestApplication application;
5954 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5955 Debug::Filter::EnableGlobalTrace();
5957 Integration::Scene stage(application.GetScene());
5959 Actor actorA = Actor::New();
5960 Actor actorB = Actor::New();
5961 Actor actorC = Actor::New();
5963 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5964 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5966 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5967 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5969 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5970 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5972 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5973 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5975 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5976 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5978 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5979 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5985 application.GetScene().SetGeometryHittestEnabled(true);
5986 ResetTouchCallbacks(application);
5988 application.SendNotification();
5989 application.Render();
5991 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5992 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5993 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5995 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5996 // Only top actor will get touched.
5997 actorA.TouchedSignal().Connect(TestTouchCallback);
5998 actorB.TouchedSignal().Connect(TestTouchCallback2);
5999 actorC.TouchedSignal().Connect(TestTouchCallback3);
6001 // Connect ChildOrderChangedSignal
6002 bool orderChangedSignal(false);
6003 Actor orderChangedActor;
6004 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6005 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6007 Dali::Integration::Point point;
6008 point.SetDeviceId(1);
6009 point.SetState(PointState::DOWN);
6010 point.SetScreenPosition(Vector2(10.f, 10.f));
6011 Dali::Integration::TouchEvent touchEvent;
6012 touchEvent.AddPoint(point);
6014 application.ProcessEvent(touchEvent);
6016 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6017 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6018 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6020 ResetTouchCallbacks(application);
6022 tet_printf("Testing Raising of Actor\n");
6024 int preActorOrder(0);
6025 int postActorOrder(0);
6027 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6028 value.Get(preActorOrder);
6030 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6032 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6033 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6035 // Ensure sort order is calculated before next touch event
6036 application.SendNotification();
6038 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6039 value.Get(postActorOrder);
6041 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6043 application.ProcessEvent(touchEvent);
6045 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6046 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6047 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6049 ResetTouchCallbacks(application);
6051 tet_printf("Testing Lowering of Actor\n");
6053 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6054 value.Get(preActorOrder);
6056 orderChangedSignal = false;
6058 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6060 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6061 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6063 application.SendNotification(); // ensure sort order calculated before next touch event
6065 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
6066 value.Get(postActorOrder);
6068 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
6070 application.ProcessEvent(touchEvent);
6072 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6073 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6074 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6076 ResetTouchCallbacks(application);
6078 Debug::Filter::DisableGlobalTrace();
6079 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
6084 int UtcDaliActorRaiseToTopLowerToBottom(void)
6086 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
6088 TestApplication application;
6090 Integration::Scene stage(application.GetScene());
6092 Actor actorA = Actor::New();
6093 Actor actorB = Actor::New();
6094 Actor actorC = Actor::New();
6096 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6097 // enables checking of which actor the uniform is assigned too
6098 Shader shaderA = CreateShader();
6099 shaderA.RegisterProperty("uRendererColor", 1.f);
6101 Shader shaderB = CreateShader();
6102 shaderB.RegisterProperty("uRendererColor", 2.f);
6104 Shader shaderC = CreateShader();
6105 shaderC.RegisterProperty("uRendererColor", 3.f);
6107 Geometry geometry = CreateQuadGeometry();
6109 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6110 Renderer rendererA = Renderer::New(geometry, shaderA);
6111 actorA.AddRenderer(rendererA);
6113 Renderer rendererB = Renderer::New(geometry, shaderB);
6114 actorB.AddRenderer(rendererB);
6116 Renderer rendererC = Renderer::New(geometry, shaderC);
6117 actorC.AddRenderer(rendererC);
6119 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6120 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6122 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6123 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6125 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6126 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6128 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6129 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6131 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6132 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6134 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6135 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6141 ResetTouchCallbacks();
6143 // Connect ChildOrderChangedSignal
6144 bool orderChangedSignal(false);
6145 Actor orderChangedActor;
6146 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6147 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6149 // Set up gl abstraction trace so can query the set uniform order
6150 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6151 glAbstraction.EnableSetUniformCallTrace(true);
6152 glAbstraction.ResetSetUniformCallStack();
6154 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6156 application.SendNotification();
6157 application.Render();
6159 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
6161 // Test order of uniforms in stack
6162 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6163 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6164 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6166 bool CBA = (indexC > indexB) && (indexB > indexA);
6168 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6170 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6171 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6172 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6174 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6175 // Only top actor will get touched.
6176 actorA.TouchedSignal().Connect(TestTouchCallback);
6177 actorB.TouchedSignal().Connect(TestTouchCallback2);
6178 actorC.TouchedSignal().Connect(TestTouchCallback3);
6180 Dali::Integration::Point point;
6181 point.SetDeviceId(1);
6182 point.SetState(PointState::DOWN);
6183 point.SetScreenPosition(Vector2(10.f, 10.f));
6184 Dali::Integration::TouchEvent touchEvent;
6185 touchEvent.AddPoint(point);
6187 application.ProcessEvent(touchEvent);
6189 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6190 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6191 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6193 ResetTouchCallbacks();
6195 tet_printf("RaiseToTop ActorA\n");
6197 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6198 actorA.RaiseToTop();
6199 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6200 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6202 application.SendNotification(); // ensure sorting order is calculated before next touch event
6204 application.ProcessEvent(touchEvent);
6206 glSetUniformStack.Reset();
6208 application.SendNotification();
6209 application.Render();
6211 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6213 // Test order of uniforms in stack
6214 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6215 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6216 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6218 tet_infoline("Testing A above C and B at bottom\n");
6219 bool ACB = (indexA > indexC) && (indexC > indexB);
6221 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
6223 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6224 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6225 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6227 ResetTouchCallbacks();
6229 tet_printf("RaiseToTop ActorB\n");
6231 orderChangedSignal = false;
6233 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6234 actorB.RaiseToTop();
6235 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6236 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6238 application.SendNotification(); // Ensure sort order is calculated before next touch event
6240 application.ProcessEvent(touchEvent);
6242 glSetUniformStack.Reset();
6244 application.SendNotification();
6245 application.Render();
6247 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6249 // Test order of uniforms in stack
6250 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6251 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6252 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6254 tet_infoline("Testing B above A and C at bottom\n");
6255 bool BAC = (indexB > indexA) && (indexA > indexC);
6257 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
6259 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6260 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6261 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6263 ResetTouchCallbacks();
6265 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
6267 orderChangedSignal = false;
6269 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6270 actorA.LowerToBottom();
6271 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6272 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6274 application.SendNotification();
6275 application.Render();
6277 orderChangedSignal = false;
6279 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6280 actorB.LowerToBottom();
6281 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6282 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6284 application.SendNotification();
6285 application.Render();
6287 application.ProcessEvent(touchEvent);
6289 glSetUniformStack.Reset();
6291 application.SendNotification();
6292 application.Render();
6294 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6296 // Test order of uniforms in stack
6297 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6298 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6299 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6301 tet_infoline("Testing C above A and B at bottom\n");
6302 bool CAB = (indexC > indexA) && (indexA > indexB);
6304 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
6306 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6307 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6308 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6310 ResetTouchCallbacks();
6315 int UtcDaliActorGeoTouchRaiseToTopLowerToBottom(void)
6317 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
6319 TestApplication application;
6321 Integration::Scene stage(application.GetScene());
6323 Actor actorA = Actor::New();
6324 Actor actorB = Actor::New();
6325 Actor actorC = Actor::New();
6327 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6328 // enables checking of which actor the uniform is assigned too
6329 Shader shaderA = CreateShader();
6330 shaderA.RegisterProperty("uRendererColor", 1.f);
6332 Shader shaderB = CreateShader();
6333 shaderB.RegisterProperty("uRendererColor", 2.f);
6335 Shader shaderC = CreateShader();
6336 shaderC.RegisterProperty("uRendererColor", 3.f);
6338 Geometry geometry = CreateQuadGeometry();
6340 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6341 Renderer rendererA = Renderer::New(geometry, shaderA);
6342 actorA.AddRenderer(rendererA);
6344 Renderer rendererB = Renderer::New(geometry, shaderB);
6345 actorB.AddRenderer(rendererB);
6347 Renderer rendererC = Renderer::New(geometry, shaderC);
6348 actorC.AddRenderer(rendererC);
6350 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6351 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6353 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6354 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6356 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6357 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6359 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6360 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6362 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6363 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6365 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6366 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6372 application.GetScene().SetGeometryHittestEnabled(true);
6373 ResetTouchCallbacks(application);
6375 // Connect ChildOrderChangedSignal
6376 bool orderChangedSignal(false);
6377 Actor orderChangedActor;
6378 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6379 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6381 // Set up gl abstraction trace so can query the set uniform order
6382 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6383 glAbstraction.EnableSetUniformCallTrace(true);
6384 glAbstraction.ResetSetUniformCallStack();
6386 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6388 application.SendNotification();
6389 application.Render();
6391 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
6393 // Test order of uniforms in stack
6394 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6395 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6396 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6398 bool CBA = (indexC > indexB) && (indexB > indexA);
6400 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6402 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6403 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6404 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6406 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6407 // Only top actor will get touched.
6408 actorA.TouchedSignal().Connect(TestTouchCallback);
6409 actorB.TouchedSignal().Connect(TestTouchCallback2);
6410 actorC.TouchedSignal().Connect(TestTouchCallback3);
6412 Dali::Integration::Point point;
6413 point.SetDeviceId(1);
6414 point.SetState(PointState::DOWN);
6415 point.SetScreenPosition(Vector2(10.f, 10.f));
6416 Dali::Integration::TouchEvent touchEvent;
6417 touchEvent.AddPoint(point);
6419 application.ProcessEvent(touchEvent);
6421 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6422 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6423 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6425 ResetTouchCallbacks(application);
6427 tet_printf("RaiseToTop ActorA\n");
6429 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6430 actorA.RaiseToTop();
6431 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6432 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6434 application.SendNotification(); // ensure sorting order is calculated before next touch event
6436 application.ProcessEvent(touchEvent);
6438 glSetUniformStack.Reset();
6440 application.SendNotification();
6441 application.Render();
6443 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6445 // Test order of uniforms in stack
6446 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6447 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6448 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6450 tet_infoline("Testing A above C and B at bottom\n");
6451 bool ACB = (indexA > indexC) && (indexC > indexB);
6453 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
6455 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6456 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6457 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6459 ResetTouchCallbacks(application);
6461 tet_printf("RaiseToTop ActorB\n");
6463 orderChangedSignal = false;
6465 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6466 actorB.RaiseToTop();
6467 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6468 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6470 application.SendNotification(); // Ensure sort order is calculated before next touch event
6472 application.ProcessEvent(touchEvent);
6474 glSetUniformStack.Reset();
6476 application.SendNotification();
6477 application.Render();
6479 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6481 // Test order of uniforms in stack
6482 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6483 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6484 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6486 tet_infoline("Testing B above A and C at bottom\n");
6487 bool BAC = (indexB > indexA) && (indexA > indexC);
6489 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
6491 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6492 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6493 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6495 ResetTouchCallbacks(application);
6497 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
6499 orderChangedSignal = false;
6501 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6502 actorA.LowerToBottom();
6503 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6504 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6506 application.SendNotification();
6507 application.Render();
6509 orderChangedSignal = false;
6511 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6512 actorB.LowerToBottom();
6513 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6514 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6516 application.SendNotification();
6517 application.Render();
6519 application.ProcessEvent(touchEvent);
6521 glSetUniformStack.Reset();
6523 application.SendNotification();
6524 application.Render();
6526 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6528 // Test order of uniforms in stack
6529 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6530 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6531 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6533 tet_infoline("Testing C above A and B at bottom\n");
6534 bool CAB = (indexC > indexA) && (indexA > indexB);
6536 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
6538 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6539 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6540 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6542 ResetTouchCallbacks(application);
6547 int UtcDaliActorRaiseAbove(void)
6549 tet_infoline("UtcDaliActor RaiseToAbove test \n");
6551 TestApplication application;
6553 Integration::Scene stage(application.GetScene());
6555 Actor actorA = Actor::New();
6556 Actor actorB = Actor::New();
6557 Actor actorC = Actor::New();
6559 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6560 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6562 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6563 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6565 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6566 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6568 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6569 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6571 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6572 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6574 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6575 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6581 ResetTouchCallbacks();
6583 application.SendNotification();
6584 application.Render();
6586 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6587 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6588 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6590 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6591 // Only top actor will get touched.
6592 actorA.TouchedSignal().Connect(TestTouchCallback);
6593 actorB.TouchedSignal().Connect(TestTouchCallback2);
6594 actorC.TouchedSignal().Connect(TestTouchCallback3);
6596 bool orderChangedSignal(false);
6597 Actor orderChangedActor;
6598 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6599 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6601 Dali::Integration::Point point;
6602 point.SetDeviceId(1);
6603 point.SetState(PointState::DOWN);
6604 point.SetScreenPosition(Vector2(10.f, 10.f));
6605 Dali::Integration::TouchEvent touchEvent;
6606 touchEvent.AddPoint(point);
6608 application.ProcessEvent(touchEvent);
6610 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6611 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6612 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6614 ResetTouchCallbacks();
6616 tet_printf("Raise actor B Above Actor C\n");
6618 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6619 actorB.RaiseAbove(actorC);
6620 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6621 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6623 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6624 application.SendNotification();
6625 application.ProcessEvent(touchEvent);
6627 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6628 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6629 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6631 ResetTouchCallbacks();
6633 tet_printf("Raise actor A Above Actor B\n");
6635 orderChangedSignal = false;
6637 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6638 actorA.RaiseAbove(actorB);
6639 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6640 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6642 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6643 application.SendNotification();
6645 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6647 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6648 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6649 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6651 ResetTouchCallbacks();
6656 int UtcDaliActorGeoTouchRaiseAbove(void)
6658 tet_infoline("UtcDaliActor RaiseToAbove test \n");
6660 TestApplication application;
6662 Integration::Scene stage(application.GetScene());
6664 Actor actorA = Actor::New();
6665 Actor actorB = Actor::New();
6666 Actor actorC = Actor::New();
6668 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6669 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6671 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6672 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6674 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6675 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6677 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6678 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6680 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6681 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6683 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6684 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6690 application.GetScene().SetGeometryHittestEnabled(true);
6691 ResetTouchCallbacks(application);
6693 application.SendNotification();
6694 application.Render();
6696 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6697 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6698 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6700 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6701 // Only top actor will get touched.
6702 actorA.TouchedSignal().Connect(TestTouchCallback);
6703 actorB.TouchedSignal().Connect(TestTouchCallback2);
6704 actorC.TouchedSignal().Connect(TestTouchCallback3);
6706 bool orderChangedSignal(false);
6707 Actor orderChangedActor;
6708 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6709 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6711 Dali::Integration::Point point;
6712 point.SetDeviceId(1);
6713 point.SetState(PointState::DOWN);
6714 point.SetScreenPosition(Vector2(10.f, 10.f));
6715 Dali::Integration::TouchEvent touchEvent;
6716 touchEvent.AddPoint(point);
6718 application.ProcessEvent(touchEvent);
6720 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6721 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6722 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6724 ResetTouchCallbacks(application);
6726 tet_printf("Raise actor B Above Actor C\n");
6728 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6729 actorB.RaiseAbove(actorC);
6730 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6731 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6733 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6734 application.SendNotification();
6735 application.ProcessEvent(touchEvent);
6737 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6738 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6739 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6741 ResetTouchCallbacks(application);
6743 tet_printf("Raise actor A Above Actor B\n");
6745 orderChangedSignal = false;
6747 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6748 actorA.RaiseAbove(actorB);
6749 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6750 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6752 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6753 application.SendNotification();
6755 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6757 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6758 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6759 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6761 ResetTouchCallbacks(application);
6767 int UtcDaliActorRaiseAbove2(void)
6769 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
6771 TestApplication application;
6773 Integration::Scene stage(application.GetScene());
6775 Actor actorA = Actor::New();
6776 Actor actorB = Actor::New();
6777 Actor actorC = Actor::New();
6779 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6780 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6782 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6783 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6785 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6786 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6788 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6789 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6791 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6792 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6794 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6795 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6801 ResetTouchCallbacks();
6803 application.SendNotification();
6804 application.Render();
6806 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6807 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6808 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6810 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6811 // Only top actor will get touched.
6812 actorA.TouchedSignal().Connect(TestTouchCallback);
6813 actorB.TouchedSignal().Connect(TestTouchCallback2);
6814 actorC.TouchedSignal().Connect(TestTouchCallback3);
6816 bool orderChangedSignal(false);
6817 Actor orderChangedActor;
6818 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6819 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6821 Dali::Integration::Point point;
6822 point.SetDeviceId(1);
6823 point.SetState(PointState::DOWN);
6824 point.SetScreenPosition(Vector2(10.f, 10.f));
6825 Dali::Integration::TouchEvent touchEvent;
6826 touchEvent.AddPoint(point);
6828 application.ProcessEvent(touchEvent);
6830 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6831 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6832 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6834 ResetTouchCallbacks();
6836 tet_printf("Raise actor B Above Actor C\n");
6838 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6839 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
6840 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
6841 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6842 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6844 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6845 application.SendNotification();
6846 application.ProcessEvent(touchEvent);
6848 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6849 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6850 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6852 ResetTouchCallbacks();
6854 tet_printf("Raise actor A Above Actor B\n");
6856 orderChangedSignal = false;
6858 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6859 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
6860 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
6861 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6862 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6864 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6865 application.SendNotification();
6867 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6869 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6870 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6871 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6873 ResetTouchCallbacks();
6878 int UtcDaliActorGeoTouchRaiseAbove2(void)
6880 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
6882 TestApplication application;
6884 Integration::Scene stage(application.GetScene());
6886 Actor actorA = Actor::New();
6887 Actor actorB = Actor::New();
6888 Actor actorC = Actor::New();
6890 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6891 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6893 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6894 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6896 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6897 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6899 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6900 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6902 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6903 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6905 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6906 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6912 application.GetScene().SetGeometryHittestEnabled(true);
6913 ResetTouchCallbacks(application);
6915 application.SendNotification();
6916 application.Render();
6918 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6919 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6920 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6922 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6923 // Only top actor will get touched.
6924 actorA.TouchedSignal().Connect(TestTouchCallback);
6925 actorB.TouchedSignal().Connect(TestTouchCallback2);
6926 actorC.TouchedSignal().Connect(TestTouchCallback3);
6928 bool orderChangedSignal(false);
6929 Actor orderChangedActor;
6930 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6931 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6933 Dali::Integration::Point point;
6934 point.SetDeviceId(1);
6935 point.SetState(PointState::DOWN);
6936 point.SetScreenPosition(Vector2(10.f, 10.f));
6937 Dali::Integration::TouchEvent touchEvent;
6938 touchEvent.AddPoint(point);
6940 application.ProcessEvent(touchEvent);
6942 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6943 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6944 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6946 ResetTouchCallbacks(application);
6948 tet_printf("Raise actor B Above Actor C\n");
6950 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6951 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
6952 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
6953 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6954 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6956 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6957 application.SendNotification();
6958 application.ProcessEvent(touchEvent);
6960 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6961 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6962 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6964 ResetTouchCallbacks(application);
6966 tet_printf("Raise actor A Above Actor B\n");
6968 orderChangedSignal = false;
6970 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6971 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
6972 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
6973 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6974 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6976 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6977 application.SendNotification();
6979 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6981 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6982 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6983 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6985 ResetTouchCallbacks(application);
6990 int UtcDaliActorLowerBelow(void)
6992 tet_infoline("UtcDaliActor LowerBelow test \n");
6994 TestApplication application;
6996 Integration::Scene stage(application.GetScene());
6998 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6999 // enables checking of which actor the uniform is assigned too
7000 Shader shaderA = CreateShader();
7001 shaderA.RegisterProperty("uRendererColor", 1.f);
7003 Shader shaderB = CreateShader();
7004 shaderB.RegisterProperty("uRendererColor", 2.f);
7006 Shader shaderC = CreateShader();
7007 shaderC.RegisterProperty("uRendererColor", 3.f);
7009 Actor actorA = Actor::New();
7010 Actor actorB = Actor::New();
7011 Actor actorC = Actor::New();
7013 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7014 Geometry geometry = CreateQuadGeometry();
7016 Renderer rendererA = Renderer::New(geometry, shaderA);
7017 actorA.AddRenderer(rendererA);
7019 Renderer rendererB = Renderer::New(geometry, shaderB);
7020 actorB.AddRenderer(rendererB);
7022 Renderer rendererC = Renderer::New(geometry, shaderC);
7023 actorC.AddRenderer(rendererC);
7025 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7026 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7028 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7029 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7031 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7032 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7034 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7035 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7037 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7038 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7040 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7041 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7043 Actor container = Actor::New();
7044 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7045 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7046 stage.Add(container);
7048 container.Add(actorA);
7049 container.Add(actorB);
7050 container.Add(actorC);
7052 ResetTouchCallbacks();
7054 // Connect ChildOrderChangedSignal
7055 bool orderChangedSignal(false);
7056 Actor orderChangedActor;
7057 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7058 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7060 // Set up gl abstraction trace so can query the set uniform order
7061 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7062 glAbstraction.EnableSetUniformCallTrace(true);
7063 glAbstraction.ResetSetUniformCallStack();
7064 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7066 glAbstraction.ResetSetUniformCallStack();
7068 application.SendNotification();
7069 application.Render();
7071 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7073 // Test order of uniforms in stack
7074 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7075 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7076 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7078 tet_infoline("Testing C above B and A at bottom\n");
7079 bool CBA = (indexC > indexB) && (indexB > indexA);
7081 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7083 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7084 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7085 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7087 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7088 // Only top actor will get touched.
7089 actorA.TouchedSignal().Connect(TestTouchCallback);
7090 actorB.TouchedSignal().Connect(TestTouchCallback2);
7091 actorC.TouchedSignal().Connect(TestTouchCallback3);
7093 Dali::Integration::Point point;
7094 point.SetDeviceId(1);
7095 point.SetState(PointState::DOWN);
7096 point.SetScreenPosition(Vector2(10.f, 10.f));
7097 Dali::Integration::TouchEvent touchEvent;
7098 touchEvent.AddPoint(point);
7100 tet_infoline("UtcDaliActor Test Set up completed \n");
7102 application.ProcessEvent(touchEvent);
7104 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7105 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7106 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7108 ResetTouchCallbacks();
7110 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");
7112 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7113 actorC.LowerBelow(actorB);
7114 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7115 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7117 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7118 application.SendNotification();
7119 application.Render();
7121 application.ProcessEvent(touchEvent); // touch event
7123 glSetUniformStack.Reset();
7125 application.SendNotification();
7126 application.Render();
7128 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7130 // Test order of uniforms in stack
7131 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7132 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7133 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7135 tet_infoline("Testing render order is A, C, B");
7136 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7137 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7139 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7140 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7141 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7143 ResetTouchCallbacks();
7145 tet_printf("Lower actor C below Actor A leaving B on top\n");
7147 orderChangedSignal = false;
7149 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7150 actorC.LowerBelow(actorA);
7151 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7152 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7154 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7155 application.SendNotification();
7156 application.Render();
7158 application.ProcessEvent(touchEvent);
7160 glSetUniformStack.Reset();
7162 application.Render();
7163 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7165 // Test order of uniforms in stack
7166 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7167 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7168 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7170 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7171 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7173 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7174 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7175 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7177 ResetTouchCallbacks();
7179 tet_printf("Lower actor B below Actor C leaving A on top\n");
7181 orderChangedSignal = false;
7183 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7184 actorB.LowerBelow(actorC);
7185 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7186 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7188 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7189 application.SendNotification();
7190 application.Render();
7192 application.ProcessEvent(touchEvent);
7194 glSetUniformStack.Reset();
7196 application.Render();
7197 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7199 // Test order of uniforms in stack
7200 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7201 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7202 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7204 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7205 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7210 int UtcDaliActorGeoTouchLowerBelow(void)
7212 tet_infoline("UtcDaliActor LowerBelow test \n");
7214 TestApplication application;
7216 Integration::Scene stage(application.GetScene());
7218 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7219 // enables checking of which actor the uniform is assigned too
7220 Shader shaderA = CreateShader();
7221 shaderA.RegisterProperty("uRendererColor", 1.f);
7223 Shader shaderB = CreateShader();
7224 shaderB.RegisterProperty("uRendererColor", 2.f);
7226 Shader shaderC = CreateShader();
7227 shaderC.RegisterProperty("uRendererColor", 3.f);
7229 Actor actorA = Actor::New();
7230 Actor actorB = Actor::New();
7231 Actor actorC = Actor::New();
7233 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7234 Geometry geometry = CreateQuadGeometry();
7236 Renderer rendererA = Renderer::New(geometry, shaderA);
7237 actorA.AddRenderer(rendererA);
7239 Renderer rendererB = Renderer::New(geometry, shaderB);
7240 actorB.AddRenderer(rendererB);
7242 Renderer rendererC = Renderer::New(geometry, shaderC);
7243 actorC.AddRenderer(rendererC);
7245 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7246 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7248 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7249 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7251 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7252 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7254 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7255 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7257 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7258 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7260 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7261 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7263 Actor container = Actor::New();
7264 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7265 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7266 stage.Add(container);
7268 container.Add(actorA);
7269 container.Add(actorB);
7270 container.Add(actorC);
7272 application.GetScene().SetGeometryHittestEnabled(true);
7273 ResetTouchCallbacks(application);
7275 // Connect ChildOrderChangedSignal
7276 bool orderChangedSignal(false);
7277 Actor orderChangedActor;
7278 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7279 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7281 // Set up gl abstraction trace so can query the set uniform order
7282 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7283 glAbstraction.EnableSetUniformCallTrace(true);
7284 glAbstraction.ResetSetUniformCallStack();
7285 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7287 glAbstraction.ResetSetUniformCallStack();
7289 application.SendNotification();
7290 application.Render();
7292 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7294 // Test order of uniforms in stack
7295 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7296 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7297 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7299 tet_infoline("Testing C above B and A at bottom\n");
7300 bool CBA = (indexC > indexB) && (indexB > indexA);
7302 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7304 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7305 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7306 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7308 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7309 // Only top actor will get touched.
7310 actorA.TouchedSignal().Connect(TestTouchCallback);
7311 actorB.TouchedSignal().Connect(TestTouchCallback2);
7312 actorC.TouchedSignal().Connect(TestTouchCallback3);
7314 Dali::Integration::Point point;
7315 point.SetDeviceId(1);
7316 point.SetState(PointState::DOWN);
7317 point.SetScreenPosition(Vector2(10.f, 10.f));
7318 Dali::Integration::TouchEvent touchEvent;
7319 touchEvent.AddPoint(point);
7321 tet_infoline("UtcDaliActor Test Set up completed \n");
7323 application.ProcessEvent(touchEvent);
7325 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7326 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7327 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7329 ResetTouchCallbacks(application);
7331 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");
7333 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7334 actorC.LowerBelow(actorB);
7335 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7336 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7338 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7339 application.SendNotification();
7340 application.Render();
7342 application.ProcessEvent(touchEvent); // touch event
7344 glSetUniformStack.Reset();
7346 application.SendNotification();
7347 application.Render();
7349 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7351 // Test order of uniforms in stack
7352 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7353 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7354 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7356 tet_infoline("Testing render order is A, C, B");
7357 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7358 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7360 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7361 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7362 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7364 ResetTouchCallbacks(application);
7366 tet_printf("Lower actor C below Actor A leaving B on top\n");
7368 orderChangedSignal = false;
7370 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7371 actorC.LowerBelow(actorA);
7372 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7373 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7375 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7376 application.SendNotification();
7377 application.Render();
7379 application.ProcessEvent(touchEvent);
7381 glSetUniformStack.Reset();
7383 application.Render();
7384 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7386 // Test order of uniforms in stack
7387 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7388 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7389 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7391 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7392 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7394 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7395 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7396 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7398 ResetTouchCallbacks(application);
7400 tet_printf("Lower actor B below Actor C leaving A on top\n");
7402 orderChangedSignal = false;
7404 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7405 actorB.LowerBelow(actorC);
7406 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7407 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7409 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7410 application.SendNotification();
7411 application.Render();
7413 application.ProcessEvent(touchEvent);
7415 glSetUniformStack.Reset();
7417 application.Render();
7418 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7420 // Test order of uniforms in stack
7421 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7422 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7423 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7425 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7426 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7431 int UtcDaliActorLowerBelow2(void)
7433 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
7435 TestApplication application;
7437 Integration::Scene stage(application.GetScene());
7439 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7440 // enables checking of which actor the uniform is assigned too
7441 Shader shaderA = CreateShader();
7442 shaderA.RegisterProperty("uRendererColor", 1.f);
7444 Shader shaderB = CreateShader();
7445 shaderB.RegisterProperty("uRendererColor", 2.f);
7447 Shader shaderC = CreateShader();
7448 shaderC.RegisterProperty("uRendererColor", 3.f);
7450 Actor actorA = Actor::New();
7451 Actor actorB = Actor::New();
7452 Actor actorC = Actor::New();
7454 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7455 Geometry geometry = CreateQuadGeometry();
7457 Renderer rendererA = Renderer::New(geometry, shaderA);
7458 actorA.AddRenderer(rendererA);
7460 Renderer rendererB = Renderer::New(geometry, shaderB);
7461 actorB.AddRenderer(rendererB);
7463 Renderer rendererC = Renderer::New(geometry, shaderC);
7464 actorC.AddRenderer(rendererC);
7466 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7467 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7469 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7470 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7472 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7473 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7475 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7476 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7478 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7479 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7481 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7482 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7484 Actor container = Actor::New();
7485 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7486 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7487 stage.Add(container);
7489 container.Add(actorA);
7490 container.Add(actorB);
7491 container.Add(actorC);
7493 ResetTouchCallbacks();
7495 // Connect ChildOrderChangedSignal
7496 bool orderChangedSignal(false);
7497 Actor orderChangedActor;
7498 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7499 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7501 // Set up gl abstraction trace so can query the set uniform order
7502 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7503 glAbstraction.EnableSetUniformCallTrace(true);
7504 glAbstraction.ResetSetUniformCallStack();
7505 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7507 glAbstraction.ResetSetUniformCallStack();
7509 application.SendNotification();
7510 application.Render();
7512 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7514 // Test order of uniforms in stack
7515 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7516 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7517 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7519 tet_infoline("Testing C above B and A at bottom\n");
7520 bool CBA = (indexC > indexB) && (indexB > indexA);
7522 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7524 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7525 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7526 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7528 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7529 // Only top actor will get touched.
7530 actorA.TouchedSignal().Connect(TestTouchCallback);
7531 actorB.TouchedSignal().Connect(TestTouchCallback2);
7532 actorC.TouchedSignal().Connect(TestTouchCallback3);
7534 Dali::Integration::Point point;
7535 point.SetDeviceId(1);
7536 point.SetState(PointState::DOWN);
7537 point.SetScreenPosition(Vector2(10.f, 10.f));
7538 Dali::Integration::TouchEvent touchEvent;
7539 touchEvent.AddPoint(point);
7541 tet_infoline("UtcDaliActor Test Set up completed \n");
7543 application.ProcessEvent(touchEvent);
7545 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7546 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7547 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7549 ResetTouchCallbacks();
7551 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");
7553 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7554 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
7555 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7556 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7558 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7559 application.SendNotification();
7560 application.Render();
7562 application.ProcessEvent(touchEvent); // touch event
7564 glSetUniformStack.Reset();
7566 application.SendNotification();
7567 application.Render();
7569 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7571 // Test order of uniforms in stack
7572 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7573 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7574 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7576 tet_infoline("Testing render order is A, C, B");
7577 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7578 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7580 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7581 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7582 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7584 ResetTouchCallbacks();
7586 tet_printf("Lower actor C below Actor A leaving B on top\n");
7588 orderChangedSignal = false;
7590 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7591 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
7592 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7593 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7595 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7596 application.SendNotification();
7597 application.Render();
7599 application.ProcessEvent(touchEvent);
7601 glSetUniformStack.Reset();
7603 application.Render();
7604 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7606 // Test order of uniforms in stack
7607 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7608 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7609 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7611 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7612 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7614 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7615 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7616 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7618 ResetTouchCallbacks();
7620 tet_printf("Lower actor B below Actor C leaving A on top\n");
7622 orderChangedSignal = false;
7624 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7625 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
7626 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7627 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7629 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7630 application.SendNotification();
7631 application.Render();
7633 application.ProcessEvent(touchEvent);
7635 glSetUniformStack.Reset();
7637 application.Render();
7638 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7640 // Test order of uniforms in stack
7641 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7642 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7643 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7645 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7646 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7651 int UtcDaliActorGeoTouchLowerBelow2(void)
7653 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
7655 TestApplication application;
7657 Integration::Scene stage(application.GetScene());
7659 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
7660 // enables checking of which actor the uniform is assigned too
7661 Shader shaderA = CreateShader();
7662 shaderA.RegisterProperty("uRendererColor", 1.f);
7664 Shader shaderB = CreateShader();
7665 shaderB.RegisterProperty("uRendererColor", 2.f);
7667 Shader shaderC = CreateShader();
7668 shaderC.RegisterProperty("uRendererColor", 3.f);
7670 Actor actorA = Actor::New();
7671 Actor actorB = Actor::New();
7672 Actor actorC = Actor::New();
7674 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
7675 Geometry geometry = CreateQuadGeometry();
7677 Renderer rendererA = Renderer::New(geometry, shaderA);
7678 actorA.AddRenderer(rendererA);
7680 Renderer rendererB = Renderer::New(geometry, shaderB);
7681 actorB.AddRenderer(rendererB);
7683 Renderer rendererC = Renderer::New(geometry, shaderC);
7684 actorC.AddRenderer(rendererC);
7686 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7687 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7689 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7690 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7692 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7693 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7695 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7696 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7698 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7699 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7701 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7702 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7704 Actor container = Actor::New();
7705 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7706 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
7707 stage.Add(container);
7709 container.Add(actorA);
7710 container.Add(actorB);
7711 container.Add(actorC);
7713 application.GetScene().SetGeometryHittestEnabled(true);
7714 ResetTouchCallbacks(application);
7716 // Connect ChildOrderChangedSignal
7717 bool orderChangedSignal(false);
7718 Actor orderChangedActor;
7719 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7720 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
7722 // Set up gl abstraction trace so can query the set uniform order
7723 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
7724 glAbstraction.EnableSetUniformCallTrace(true);
7725 glAbstraction.ResetSetUniformCallStack();
7726 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
7728 glAbstraction.ResetSetUniformCallStack();
7730 application.SendNotification();
7731 application.Render();
7733 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7735 // Test order of uniforms in stack
7736 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7737 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7738 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7740 tet_infoline("Testing C above B and A at bottom\n");
7741 bool CBA = (indexC > indexB) && (indexB > indexA);
7743 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
7745 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7746 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7747 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7749 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7750 // Only top actor will get touched.
7751 actorA.TouchedSignal().Connect(TestTouchCallback);
7752 actorB.TouchedSignal().Connect(TestTouchCallback2);
7753 actorC.TouchedSignal().Connect(TestTouchCallback3);
7755 Dali::Integration::Point point;
7756 point.SetDeviceId(1);
7757 point.SetState(PointState::DOWN);
7758 point.SetScreenPosition(Vector2(10.f, 10.f));
7759 Dali::Integration::TouchEvent touchEvent;
7760 touchEvent.AddPoint(point);
7762 tet_infoline("UtcDaliActor Test Set up completed \n");
7764 application.ProcessEvent(touchEvent);
7766 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7767 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7768 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7770 ResetTouchCallbacks(application);
7772 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");
7774 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7775 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
7776 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7777 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7779 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7780 application.SendNotification();
7781 application.Render();
7783 application.ProcessEvent(touchEvent); // touch event
7785 glSetUniformStack.Reset();
7787 application.SendNotification();
7788 application.Render();
7790 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7792 // Test order of uniforms in stack
7793 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7794 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7795 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7797 tet_infoline("Testing render order is A, C, B");
7798 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
7799 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
7801 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7802 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7803 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7805 ResetTouchCallbacks(application);
7807 tet_printf("Lower actor C below Actor A leaving B on top\n");
7809 orderChangedSignal = false;
7811 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7812 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
7813 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7814 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
7816 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7817 application.SendNotification();
7818 application.Render();
7820 application.ProcessEvent(touchEvent);
7822 glSetUniformStack.Reset();
7824 application.Render();
7825 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7827 // Test order of uniforms in stack
7828 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7829 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7830 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7832 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7833 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
7835 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7836 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
7837 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7839 ResetTouchCallbacks(application);
7841 tet_printf("Lower actor B below Actor C leaving A on top\n");
7843 orderChangedSignal = false;
7845 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7846 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
7847 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7848 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
7850 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7851 application.SendNotification();
7852 application.Render();
7854 application.ProcessEvent(touchEvent);
7856 glSetUniformStack.Reset();
7858 application.Render();
7859 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
7861 // Test order of uniforms in stack
7862 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
7863 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
7864 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
7866 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
7867 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
7872 int UtcDaliActorRaiseAboveDifferentParentsN(void)
7874 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
7876 TestApplication application;
7878 Integration::Scene stage(application.GetScene());
7880 Actor parentA = Actor::New();
7881 Actor parentB = Actor::New();
7882 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7883 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7884 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7885 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7887 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7888 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7890 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7891 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7896 Actor actorA = Actor::New();
7897 Actor actorB = Actor::New();
7898 Actor actorC = Actor::New();
7900 parentA.Add(actorA);
7901 parentA.Add(actorB);
7903 tet_printf("Actor C added to different parent from A and B \n");
7904 parentB.Add(actorC);
7906 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7907 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7909 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7910 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7912 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7913 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7915 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7916 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7918 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7919 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7921 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7922 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7924 ResetTouchCallbacks();
7926 // Connect ChildOrderChangedSignal
7927 bool orderChangedSignal(false);
7928 Actor orderChangedActor;
7929 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7930 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
7932 application.SendNotification();
7933 application.Render();
7935 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7936 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7937 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7939 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7940 // Only top actor will get touched.
7941 actorA.TouchedSignal().Connect(TestTouchCallback);
7942 actorB.TouchedSignal().Connect(TestTouchCallback2);
7943 actorC.TouchedSignal().Connect(TestTouchCallback3);
7945 Dali::Integration::Point point;
7946 point.SetDeviceId(1);
7947 point.SetState(PointState::DOWN);
7948 point.SetScreenPosition(Vector2(10.f, 10.f));
7949 Dali::Integration::TouchEvent touchEvent;
7950 touchEvent.AddPoint(point);
7952 application.ProcessEvent(touchEvent);
7954 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7955 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7956 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7958 ResetTouchCallbacks();
7960 tet_printf("Raise actor A Above Actor C which have different parents\n");
7962 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7963 actorA.RaiseAbove(actorC);
7964 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7966 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
7967 application.SendNotification();
7969 application.ProcessEvent(touchEvent); // touch event
7971 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7972 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7973 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7975 ResetTouchCallbacks();
7980 int UtcDaliActorGeoTouchRaiseAboveDifferentParentsN(void)
7982 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
7984 TestApplication application;
7986 Integration::Scene stage(application.GetScene());
7988 Actor parentA = Actor::New();
7989 Actor parentB = Actor::New();
7990 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7991 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7992 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7993 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7995 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7996 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7998 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7999 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8004 Actor actorA = Actor::New();
8005 Actor actorB = Actor::New();
8006 Actor actorC = Actor::New();
8008 parentA.Add(actorA);
8009 parentA.Add(actorB);
8011 tet_printf("Actor C added to different parent from A and B \n");
8012 parentB.Add(actorC);
8014 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8015 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8017 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8018 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8020 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8021 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8023 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8024 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8026 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8027 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8029 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8030 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8032 application.GetScene().SetGeometryHittestEnabled(true);
8033 ResetTouchCallbacks(application);
8035 // Connect ChildOrderChangedSignal
8036 bool orderChangedSignal(false);
8037 Actor orderChangedActor;
8038 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8039 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8041 application.SendNotification();
8042 application.Render();
8044 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8045 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8046 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8048 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8049 // Only top actor will get touched.
8050 actorA.TouchedSignal().Connect(TestTouchCallback);
8051 actorB.TouchedSignal().Connect(TestTouchCallback2);
8052 actorC.TouchedSignal().Connect(TestTouchCallback3);
8054 Dali::Integration::Point point;
8055 point.SetDeviceId(1);
8056 point.SetState(PointState::DOWN);
8057 point.SetScreenPosition(Vector2(10.f, 10.f));
8058 Dali::Integration::TouchEvent touchEvent;
8059 touchEvent.AddPoint(point);
8061 application.ProcessEvent(touchEvent);
8063 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8064 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8065 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8067 ResetTouchCallbacks(application);
8069 tet_printf("Raise actor A Above Actor C which have different parents\n");
8071 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8072 actorA.RaiseAbove(actorC);
8073 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8075 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8076 application.SendNotification();
8078 application.ProcessEvent(touchEvent); // touch event
8080 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8081 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8082 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8084 ResetTouchCallbacks(application);
8089 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
8091 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
8093 TestApplication application;
8095 Integration::Scene stage(application.GetScene());
8097 Actor actorA = Actor::New();
8098 Actor actorB = Actor::New();
8099 Actor actorC = Actor::New();
8101 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8102 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8104 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8105 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8107 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8108 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8110 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8111 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8113 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8114 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8116 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8117 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8119 ResetTouchCallbacks();
8121 // Connect ChildOrderChangedSignal
8122 bool orderChangedSignal(false);
8123 Actor orderChangedActor;
8124 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8125 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8127 application.SendNotification();
8128 application.Render();
8130 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8131 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8132 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8134 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8135 // Only top actor will get touched.
8136 actorA.TouchedSignal().Connect(TestTouchCallback);
8137 actorB.TouchedSignal().Connect(TestTouchCallback2);
8138 actorC.TouchedSignal().Connect(TestTouchCallback3);
8140 Dali::Integration::Point point;
8141 point.SetDeviceId(1);
8142 point.SetState(PointState::DOWN);
8143 point.SetScreenPosition(Vector2(10.f, 10.f));
8144 Dali::Integration::TouchEvent touchEvent;
8145 touchEvent.AddPoint(point);
8147 tet_printf("Raise actor A Above Actor C which have no parents\n");
8149 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8150 actorA.RaiseAbove(actorC);
8151 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8153 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8154 application.SendNotification();
8156 application.ProcessEvent(touchEvent);
8158 tet_printf("Not parented so RaiseAbove should show no effect\n");
8160 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8161 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8162 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8164 ResetTouchCallbacks();
8166 orderChangedSignal = false;
8169 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
8171 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8172 actorA.LowerBelow(actorC);
8173 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8175 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8176 application.SendNotification();
8177 application.Render();
8179 application.ProcessEvent(touchEvent);
8181 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
8182 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8183 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8184 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8186 ResetTouchCallbacks();
8188 orderChangedSignal = false;
8190 tet_printf("Adding Actor A to stage, will be on top\n");
8193 application.SendNotification();
8194 application.Render();
8196 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
8198 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8199 actorB.RaiseAbove(actorC);
8200 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8202 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8203 application.SendNotification();
8205 application.ProcessEvent(touchEvent);
8207 tet_printf("C not parented so RaiseAbove should show no effect\n");
8208 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8209 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8210 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8212 ResetTouchCallbacks();
8214 orderChangedSignal = false;
8216 tet_printf("Lower actor A below Actor C when only A has a parent\n");
8218 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8219 actorA.LowerBelow(actorC);
8220 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8222 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8223 application.SendNotification();
8225 application.ProcessEvent(touchEvent);
8227 tet_printf("C not parented so LowerBelow should show no effect\n");
8228 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8229 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8230 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8232 ResetTouchCallbacks();
8234 orderChangedSignal = false;
8238 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8239 actorA.RaiseAbove(actorC);
8240 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8241 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8243 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8244 application.SendNotification();
8245 application.Render();
8247 application.ProcessEvent(touchEvent);
8249 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
8250 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8251 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8252 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8257 int UtcDaliActorGeoTouchRaiseLowerWhenUnparentedTargetN(void)
8259 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
8261 TestApplication application;
8263 Integration::Scene stage(application.GetScene());
8265 Actor actorA = Actor::New();
8266 Actor actorB = Actor::New();
8267 Actor actorC = Actor::New();
8269 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8270 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8272 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8273 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8275 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8276 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8278 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8279 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8281 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8282 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8284 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8285 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8287 application.GetScene().SetGeometryHittestEnabled(true);
8288 ResetTouchCallbacks(application);
8290 // Connect ChildOrderChangedSignal
8291 bool orderChangedSignal(false);
8292 Actor orderChangedActor;
8293 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8294 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8296 application.SendNotification();
8297 application.Render();
8299 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8300 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8301 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8303 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8304 // Only top actor will get touched.
8305 actorA.TouchedSignal().Connect(TestTouchCallback);
8306 actorB.TouchedSignal().Connect(TestTouchCallback2);
8307 actorC.TouchedSignal().Connect(TestTouchCallback3);
8309 Dali::Integration::Point point;
8310 point.SetDeviceId(1);
8311 point.SetState(PointState::DOWN);
8312 point.SetScreenPosition(Vector2(10.f, 10.f));
8313 Dali::Integration::TouchEvent touchEvent;
8314 touchEvent.AddPoint(point);
8316 tet_printf("Raise actor A Above Actor C which have no parents\n");
8318 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8319 actorA.RaiseAbove(actorC);
8320 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8322 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8323 application.SendNotification();
8325 application.ProcessEvent(touchEvent);
8327 tet_printf("Not parented so RaiseAbove should show no effect\n");
8329 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8330 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8331 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8333 ResetTouchCallbacks(application);
8335 orderChangedSignal = false;
8338 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
8340 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8341 actorA.LowerBelow(actorC);
8342 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8344 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8345 application.SendNotification();
8346 application.Render();
8348 application.ProcessEvent(touchEvent);
8350 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
8351 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8352 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8353 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8355 ResetTouchCallbacks(application);
8357 orderChangedSignal = false;
8359 tet_printf("Adding Actor A to stage, will be on top\n");
8362 application.SendNotification();
8363 application.Render();
8365 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
8367 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8368 actorB.RaiseAbove(actorC);
8369 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8371 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8372 application.SendNotification();
8374 application.ProcessEvent(touchEvent);
8376 tet_printf("C not parented so RaiseAbove should show no effect\n");
8377 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8378 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8379 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8381 ResetTouchCallbacks(application);
8383 orderChangedSignal = false;
8385 tet_printf("Lower actor A below Actor C when only A has a parent\n");
8387 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8388 actorA.LowerBelow(actorC);
8389 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8391 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8392 application.SendNotification();
8394 application.ProcessEvent(touchEvent);
8396 tet_printf("C not parented so LowerBelow should show no effect\n");
8397 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8398 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8399 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8401 ResetTouchCallbacks(application);
8403 orderChangedSignal = false;
8407 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8408 actorA.RaiseAbove(actorC);
8409 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8410 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8412 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
8413 application.SendNotification();
8414 application.Render();
8416 application.ProcessEvent(touchEvent);
8418 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
8419 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8420 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8421 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8426 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
8428 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
8430 TestApplication application;
8432 Integration::Scene stage(application.GetScene());
8434 Actor actorA = Actor::New();
8435 Actor actorB = Actor::New();
8436 Actor actorC = Actor::New();
8438 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8439 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8441 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8442 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8444 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8445 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8447 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8448 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8450 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8451 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8453 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8454 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8456 ResetTouchCallbacks();
8458 // Connect ChildOrderChangedSignal
8459 bool orderChangedSignal(false);
8460 Actor orderChangedActor;
8461 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8462 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8464 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8465 // Only top actor will get touched.
8466 actorA.TouchedSignal().Connect(TestTouchCallback);
8467 actorB.TouchedSignal().Connect(TestTouchCallback2);
8468 actorC.TouchedSignal().Connect(TestTouchCallback3);
8470 Dali::Integration::Point point;
8471 point.SetDeviceId(1);
8472 point.SetState(PointState::DOWN);
8473 point.SetScreenPosition(Vector2(10.f, 10.f));
8474 Dali::Integration::TouchEvent touchEvent;
8475 touchEvent.AddPoint(point);
8478 tet_printf("Raise actor B Above Actor C but B not parented\n");
8480 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8482 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8484 application.SendNotification();
8485 application.Render();
8487 application.ProcessEvent(touchEvent);
8489 tet_printf("Not parented so RaiseAbove should show no effect\n");
8491 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8492 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8493 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8495 tet_printf("Raise actor B Above Actor C but B not parented\n");
8496 ResetTouchCallbacks();
8498 orderChangedSignal = false;
8500 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8502 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8504 // Sort actor tree before next touch event
8505 application.SendNotification();
8506 application.Render();
8508 application.ProcessEvent(touchEvent);
8510 tet_printf("Not parented so RaiseAbove should show no effect\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);
8515 ResetTouchCallbacks();
8517 orderChangedSignal = false;
8519 tet_printf("Lower actor C below B but C not parented\n");
8521 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8523 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8525 // Sort actor tree before next touch event
8526 application.SendNotification();
8527 application.Render();
8529 application.ProcessEvent(touchEvent);
8531 tet_printf("Not parented so Lower should show no effect\n");
8533 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8534 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8535 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8536 ResetTouchCallbacks();
8538 orderChangedSignal = false;
8540 tet_printf("Raise actor B to top\n");
8542 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8543 actorB.RaiseToTop();
8544 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8546 // Sort actor tree before next touch event
8547 application.SendNotification();
8548 application.Render();
8550 application.ProcessEvent(touchEvent);
8552 tet_printf("Not parented so RaiseToTop should show no effect\n");
8554 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8555 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8556 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8557 ResetTouchCallbacks();
8559 orderChangedSignal = false;
8561 tet_printf("Add ActorB to stage so only Actor C not parented\n");
8565 tet_printf("Lower actor C to Bottom, B stays at top\n");
8567 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8568 actorC.LowerToBottom();
8569 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8571 application.SendNotification();
8572 application.Render();
8574 application.ProcessEvent(touchEvent);
8576 tet_printf("Not parented so LowerToBottom should show no effect\n");
8578 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8579 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8580 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8581 ResetTouchCallbacks();
8586 int UtcDaliActorGeoTouchTestAllAPIwhenActorNotParented(void)
8588 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
8590 TestApplication application;
8592 Integration::Scene stage(application.GetScene());
8594 Actor actorA = Actor::New();
8595 Actor actorB = Actor::New();
8596 Actor actorC = Actor::New();
8598 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8599 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8601 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8602 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8604 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8605 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8607 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8608 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8610 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8611 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8613 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8614 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8616 application.GetScene().SetGeometryHittestEnabled(true);
8617 ResetTouchCallbacks(application);
8619 // Connect ChildOrderChangedSignal
8620 bool orderChangedSignal(false);
8621 Actor orderChangedActor;
8622 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8623 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8625 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8626 // Only top actor will get touched.
8627 actorA.TouchedSignal().Connect(TestTouchCallback);
8628 actorB.TouchedSignal().Connect(TestTouchCallback2);
8629 actorC.TouchedSignal().Connect(TestTouchCallback3);
8631 Dali::Integration::Point point;
8632 point.SetDeviceId(1);
8633 point.SetState(PointState::DOWN);
8634 point.SetScreenPosition(Vector2(10.f, 10.f));
8635 Dali::Integration::TouchEvent touchEvent;
8636 touchEvent.AddPoint(point);
8639 tet_printf("Raise actor B Above Actor C but B not parented\n");
8641 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8643 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8645 application.SendNotification();
8646 application.Render();
8648 application.ProcessEvent(touchEvent);
8650 tet_printf("Not parented so RaiseAbove should show no effect\n");
8652 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8653 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8654 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8656 tet_printf("Raise actor B Above Actor C but B not parented\n");
8657 ResetTouchCallbacks(application);
8659 orderChangedSignal = false;
8661 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8663 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8665 // Sort actor tree before next touch event
8666 application.SendNotification();
8667 application.Render();
8669 application.ProcessEvent(touchEvent);
8671 tet_printf("Not parented so RaiseAbove should show no effect\n");
8673 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8674 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8675 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8676 ResetTouchCallbacks(application);
8678 orderChangedSignal = false;
8680 tet_printf("Lower actor C below B but C not parented\n");
8682 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8684 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8686 // Sort actor tree before next touch event
8687 application.SendNotification();
8688 application.Render();
8690 application.ProcessEvent(touchEvent);
8692 tet_printf("Not parented so Lower should show no effect\n");
8694 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8695 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8696 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8697 ResetTouchCallbacks(application);
8699 orderChangedSignal = false;
8701 tet_printf("Raise actor B to top\n");
8703 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8704 actorB.RaiseToTop();
8705 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8707 // Sort actor tree before next touch event
8708 application.SendNotification();
8709 application.Render();
8711 application.ProcessEvent(touchEvent);
8713 tet_printf("Not parented so RaiseToTop should show no effect\n");
8715 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8716 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8717 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8718 ResetTouchCallbacks(application);
8720 orderChangedSignal = false;
8722 tet_printf("Add ActorB to stage so only Actor C not parented\n");
8726 tet_printf("Lower actor C to Bottom, B stays at top\n");
8728 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8729 actorC.LowerToBottom();
8730 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8732 application.SendNotification();
8733 application.Render();
8735 application.ProcessEvent(touchEvent);
8737 tet_printf("Not parented so LowerToBottom should show no effect\n");
8739 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8740 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
8741 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8742 ResetTouchCallbacks(application);
8747 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
8749 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
8751 TestApplication application;
8753 Integration::Scene stage(application.GetScene());
8755 Actor actorA = Actor::New();
8756 Actor actorB = Actor::New();
8757 Actor actorC = Actor::New();
8759 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8760 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8762 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8763 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8765 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8766 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8768 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8769 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8771 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8772 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8774 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8775 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8781 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8782 // Only top actor will get touched.
8783 actorA.TouchedSignal().Connect(TestTouchCallback);
8784 actorB.TouchedSignal().Connect(TestTouchCallback2);
8785 actorC.TouchedSignal().Connect(TestTouchCallback3);
8787 ResetTouchCallbacks();
8789 // Connect ChildOrderChangedSignal
8790 bool orderChangedSignal(false);
8791 Actor orderChangedActor;
8792 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8793 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8795 application.SendNotification();
8796 application.Render();
8798 Dali::Integration::Point point;
8799 point.SetDeviceId(1);
8800 point.SetState(PointState::DOWN);
8801 point.SetScreenPosition(Vector2(10.f, 10.f));
8802 Dali::Integration::TouchEvent touchEvent;
8803 touchEvent.AddPoint(point);
8805 application.ProcessEvent(touchEvent);
8807 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8808 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8809 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8811 ResetTouchCallbacks();
8813 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
8815 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8816 actorA.RaiseAbove(actorA);
8817 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8818 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8820 application.SendNotification();
8821 application.Render();
8823 application.ProcessEvent(touchEvent);
8825 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
8827 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8828 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8829 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8831 ResetTouchCallbacks();
8833 orderChangedSignal = false;
8835 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8836 actorA.RaiseAbove(actorC);
8837 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8838 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8840 application.SendNotification();
8841 application.Render();
8843 application.ProcessEvent(touchEvent);
8845 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
8846 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8847 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8848 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8853 int UtcDaliActorGeoTouchRaiseAboveActorAndTargetTheSameN(void)
8855 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
8857 TestApplication application;
8859 Integration::Scene stage(application.GetScene());
8861 Actor actorA = Actor::New();
8862 Actor actorB = Actor::New();
8863 Actor actorC = Actor::New();
8865 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8866 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8868 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8869 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8871 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8872 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
8874 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8875 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8877 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8878 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8880 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
8881 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
8887 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
8888 // Only top actor will get touched.
8889 actorA.TouchedSignal().Connect(TestTouchCallback);
8890 actorB.TouchedSignal().Connect(TestTouchCallback2);
8891 actorC.TouchedSignal().Connect(TestTouchCallback3);
8893 application.GetScene().SetGeometryHittestEnabled(true);
8894 ResetTouchCallbacks(application);
8896 // Connect ChildOrderChangedSignal
8897 bool orderChangedSignal(false);
8898 Actor orderChangedActor;
8899 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
8900 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
8902 application.SendNotification();
8903 application.Render();
8905 Dali::Integration::Point point;
8906 point.SetDeviceId(1);
8907 point.SetState(PointState::DOWN);
8908 point.SetScreenPosition(Vector2(10.f, 10.f));
8909 Dali::Integration::TouchEvent touchEvent;
8910 touchEvent.AddPoint(point);
8912 application.ProcessEvent(touchEvent);
8914 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8915 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8916 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8918 ResetTouchCallbacks(application);
8920 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
8922 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8923 actorA.RaiseAbove(actorA);
8924 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8925 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8927 application.SendNotification();
8928 application.Render();
8930 application.ProcessEvent(touchEvent);
8932 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
8934 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
8935 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8936 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
8938 ResetTouchCallbacks(application);
8940 orderChangedSignal = false;
8942 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
8943 actorA.RaiseAbove(actorC);
8944 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
8945 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
8947 application.SendNotification();
8948 application.Render();
8950 application.ProcessEvent(touchEvent);
8952 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
8953 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
8954 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
8955 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
8960 int UtcDaliActorGetScreenPosition(void)
8962 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
8964 TestApplication application;
8966 Integration::Scene stage(application.GetScene());
8968 Actor actorA = Actor::New();
8969 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
8971 Vector2 size2(10.0f, 20.0f);
8972 actorA.SetProperty(Actor::Property::SIZE, size2);
8974 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
8976 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
8980 application.SendNotification();
8981 application.Render();
8983 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
8984 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
8986 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
8987 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
8989 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
8990 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
8992 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
8994 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8996 application.SendNotification();
8997 application.Render();
8999 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9000 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9002 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9003 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
9005 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9006 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9008 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
9010 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9012 application.SendNotification();
9013 application.Render();
9015 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9016 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9018 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9019 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
9021 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9022 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9024 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
9026 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
9028 application.SendNotification();
9029 application.Render();
9031 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9032 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9034 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
9035 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
9037 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
9038 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9040 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
9042 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
9044 application.SendNotification();
9045 application.Render();
9047 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9048 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9050 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
9051 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
9053 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
9054 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
9056 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
9058 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9059 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
9061 Actor actorB = Actor::New();
9062 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9063 actorB.SetProperty(Actor::Property::SIZE, size2);
9064 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
9067 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
9069 application.SendNotification();
9070 application.Render();
9072 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9074 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
9075 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
9080 int UtcDaliActorGetScreenPositionAfterScaling(void)
9082 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
9084 TestApplication application;
9086 Integration::Scene stage(application.GetScene());
9088 Actor actorA = Actor::New();
9089 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9091 Vector2 size2(10.0f, 20.0f);
9092 actorA.SetProperty(Actor::Property::SIZE, size2);
9093 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
9094 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9096 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
9100 application.SendNotification();
9101 application.Render();
9103 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9104 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9106 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9107 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9109 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
9110 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
9112 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
9114 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9116 application.SendNotification();
9117 application.Render();
9119 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9120 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9122 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9123 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9125 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
9126 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
9131 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
9133 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
9135 TestApplication application;
9137 Integration::Scene stage(application.GetScene());
9139 Actor actorA = Actor::New();
9140 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9141 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9142 Vector2 size2(10.0f, 20.0f);
9143 actorA.SetProperty(Actor::Property::SIZE, size2);
9144 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9146 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9150 application.SendNotification();
9151 application.Render();
9153 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9154 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9156 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9157 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9159 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
9160 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
9162 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
9164 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
9165 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9167 application.SendNotification();
9168 application.Render();
9170 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9171 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9173 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
9174 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9176 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
9177 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
9183 int UtcDaliActorGetScreenPositionWithChildActors(void)
9185 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
9187 TestApplication application;
9189 Integration::Scene stage(application.GetScene());
9191 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9193 Actor actorA = Actor::New();
9194 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9195 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9196 Vector2 size1(10.0f, 20.0f);
9197 actorA.SetProperty(Actor::Property::SIZE, size1);
9198 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9200 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9202 Actor parentActorA = Actor::New();
9203 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9204 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9205 Vector2 size2(30.0f, 60.0f);
9206 parentActorA.SetProperty(Actor::Property::SIZE, size2);
9207 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9209 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
9211 stage.Add(parentActorA);
9212 parentActorA.Add(actorA);
9214 application.SendNotification();
9215 application.Render();
9217 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9218 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9220 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9221 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9223 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
9224 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
9226 tet_infoline("Test 2\n");
9228 tet_infoline("change parent anchor point and parent origin then check screen position \n");
9230 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
9231 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
9233 application.SendNotification();
9234 application.Render();
9236 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9237 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9239 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
9240 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9242 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
9243 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
9248 int UtcDaliActorGetScreenPositionWithChildActors02(void)
9250 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
9252 TestApplication application;
9254 Integration::Scene stage(application.GetScene());
9256 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9258 Actor actorA = Actor::New();
9259 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9260 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9261 Vector2 size1(10.0f, 20.0f);
9262 actorA.SetProperty(Actor::Property::SIZE, size1);
9263 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9265 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
9267 Actor parentActorA = Actor::New();
9268 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9269 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9270 Vector2 size2(30.0f, 60.0f);
9271 parentActorA.SetProperty(Actor::Property::SIZE, size2);
9272 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9274 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
9276 Actor grandParentActorA = Actor::New();
9277 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
9278 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
9279 Vector2 size3(60.0f, 120.0f);
9280 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
9281 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
9283 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
9285 stage.Add(grandParentActorA);
9286 grandParentActorA.Add(parentActorA);
9288 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
9290 parentActorA.Add(actorA);
9292 application.SendNotification();
9293 application.Render();
9295 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
9296 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9298 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
9299 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
9301 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
9302 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
9307 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
9309 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
9311 TestApplication application;
9313 Integration::Scene stage(application.GetScene());
9315 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9317 Actor actorA = Actor::New();
9318 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9319 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9320 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9321 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
9324 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9326 Actor actorB = Actor::New();
9327 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9328 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9329 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9330 Vector2 actorBSize(30.0f, 60.0f);
9331 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
9334 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
9336 Actor actorC = Actor::New();
9337 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9338 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9339 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9340 Vector2 actorCSize(60.0f, 120.0f);
9341 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
9344 application.SendNotification();
9345 application.Render();
9347 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
9349 Vector2 center(stage.GetSize() * 0.5f);
9351 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9352 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9353 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
9355 tet_infoline("Add scale to all actors");
9357 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
9358 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
9359 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
9361 application.SendNotification();
9362 application.Render();
9364 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
9365 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
9366 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
9371 int UtcDaliActorGetScreenPositionResizeScene(void)
9373 tet_infoline("UtcDaliActorGetScreenPositionResizeScene Check screen position after resizing the scene size");
9375 TestApplication application;
9376 Integration::Scene scene = application.GetScene();
9378 Actor actorA = Actor::New();
9379 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9380 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9381 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
9385 application.SendNotification();
9386 application.Render();
9388 Vector2 sceneSize = scene.GetSize();
9389 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9391 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9394 Vector2 newSize(1000.0f, 2000.0f);
9395 DALI_TEST_CHECK(scene.GetSize() != newSize);
9397 scene.SurfaceResized(newSize.width, newSize.height);
9399 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9401 // The screen position should not be updated yet
9402 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9404 application.SendNotification();
9405 application.Render();
9407 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9409 // The screen position should be updated
9410 sceneSize = scene.GetSize();
9411 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
9416 int UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D(void)
9418 tet_infoline("UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D Check screen position under LAYER_3D and custom camera");
9420 TestApplication application;
9421 Integration::Scene scene = application.GetScene();
9424 Layer layer = scene.GetRootLayer();
9425 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
9427 // Build custom camera with top-view
9428 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
9430 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
9431 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
9432 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
9435 std::ostringstream oss;
9436 oss << cameraPos << "\n";
9437 oss << cameraOrient << "\n";
9438 tet_printf("%s\n", oss.str().c_str());
9441 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
9442 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
9444 // Now, upside : -Z, leftside : -X, foward : +Y
9446 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
9447 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
9449 std::ostringstream oss;
9450 oss << cameraPos << "\n";
9451 oss << cameraOrient << "\n";
9452 tet_printf("%s\n", oss.str().c_str());
9456 Actor actorA = Actor::New();
9457 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9458 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9459 actorA.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
9460 actorA.SetProperty(Actor::Property::POSITION, Vector3(20.0f, 0.0f, 10.0f));
9462 Actor actorB = Actor::New();
9463 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9464 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9465 actorB.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
9466 actorB.SetProperty(Actor::Property::POSITION, Vector3(-20.0f, 0.0f, -10.0f));
9471 application.SendNotification();
9472 application.Render();
9474 Vector2 sceneSize = scene.GetSize();
9475 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9477 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 + Vector2(20.0f, 10.0f), TEST_LOCATION);
9479 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
9481 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 - Vector2(20.0f, 10.0f), TEST_LOCATION);
9486 int utcDaliActorPositionUsesAnchorPoint(void)
9488 TestApplication application;
9489 tet_infoline("Check default behaviour\n");
9491 Actor actor = Actor::New();
9492 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9493 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9494 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9495 application.GetScene().Add(actor);
9497 application.SendNotification();
9498 application.Render();
9500 tet_infoline("Check that the world position is in the center\n");
9501 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
9503 tet_infoline("Set the position uses anchor point property to false\n");
9504 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9506 application.SendNotification();
9507 application.Render();
9509 tet_infoline("Check that the world position has changed appropriately\n");
9510 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9515 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
9517 TestApplication application;
9518 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9520 Actor actor = Actor::New();
9521 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9522 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9523 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9524 actor.SetProperty(Actor::Property::SCALE, 2.0f);
9525 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9526 application.GetScene().Add(actor);
9528 application.SendNotification();
9529 application.Render();
9531 tet_infoline("Check the world position is the same as it would be without a scale\n");
9532 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9534 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9535 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9536 application.SendNotification();
9537 application.Render();
9538 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
9540 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9541 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9542 application.SendNotification();
9543 application.Render();
9544 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
9549 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
9551 TestApplication application;
9552 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9554 Actor actor = Actor::New();
9555 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9556 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9557 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9558 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
9559 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9560 application.GetScene().Add(actor);
9562 application.SendNotification();
9563 application.Render();
9565 tet_infoline("Check the world position is the same as it would be without a rotation\n");
9566 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9568 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9569 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9570 application.SendNotification();
9571 application.Render();
9572 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
9574 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9575 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9576 application.SendNotification();
9577 application.Render();
9578 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
9583 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
9585 TestApplication application;
9586 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9588 Actor actor = Actor::New();
9589 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9590 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9591 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9592 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
9593 actor.SetProperty(Actor::Property::SCALE, 2.0f);
9594 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9595 application.GetScene().Add(actor);
9597 application.SendNotification();
9598 application.Render();
9600 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
9601 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
9603 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
9604 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9605 application.SendNotification();
9606 application.Render();
9607 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
9609 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
9610 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9611 application.SendNotification();
9612 application.Render();
9613 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
9618 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
9620 TestApplication application;
9621 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
9623 Actor parent = Actor::New();
9625 application.GetScene().Add(parent);
9626 Vector2 stageSize(application.GetScene().GetSize());
9628 Actor actor = Actor::New();
9629 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
9630 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
9631 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
9632 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
9633 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
9634 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
9637 application.SendNotification();
9638 application.Render();
9640 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
9642 tet_infoline("Check the world position is in the right place\n");
9643 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9645 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
9646 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9647 application.SendNotification();
9648 application.Render();
9649 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9651 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
9652 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
9653 application.SendNotification();
9654 application.Render();
9655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
9660 int utcDaliActorVisibilityChangeSignalSelf(void)
9662 TestApplication application;
9663 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
9665 Actor actor = Actor::New();
9667 VisibilityChangedFunctorData data;
9668 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
9670 actor.SetProperty(Actor::Property::VISIBLE, false);
9672 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9674 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
9677 actor.SetProperty(Actor::Property::VISIBLE, false);
9678 data.Check(false /* not called */, TEST_LOCATION);
9680 tet_infoline("Change the visibility using properties, ensure called");
9683 actor.SetProperty(Actor::Property::VISIBLE, true);
9684 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9686 tet_infoline("Set the visibility to current using properties, ensure not called");
9689 actor.SetProperty(Actor::Property::VISIBLE, true);
9690 data.Check(false /* not called */, TEST_LOCATION);
9695 int utcDaliActorVisibilityChangeSignalChildren(void)
9697 TestApplication application;
9698 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
9700 Actor parent = Actor::New();
9701 Actor child = Actor::New();
9704 Actor grandChild = Actor::New();
9705 child.Add(grandChild);
9707 VisibilityChangedFunctorData parentData;
9708 VisibilityChangedFunctorData childData;
9709 VisibilityChangedFunctorData grandChildData;
9711 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
9712 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
9713 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
9715 parent.SetProperty(Actor::Property::VISIBLE, false);
9716 parentData.Check(false /* not called */, TEST_LOCATION);
9717 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9718 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9720 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
9723 grandChildData.Reset();
9725 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
9727 parent.SetProperty(Actor::Property::VISIBLE, true);
9728 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9729 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9730 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
9732 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
9735 grandChildData.Reset();
9737 parent.SetProperty(Actor::Property::VISIBLE, true);
9738 parentData.Check(false /* not called */, TEST_LOCATION);
9739 childData.Check(false /* not called */, TEST_LOCATION);
9740 grandChildData.Check(false /* not called */, TEST_LOCATION);
9745 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
9747 TestApplication application;
9748 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
9750 Actor actor = Actor::New();
9751 application.GetScene().Add(actor);
9753 application.SendNotification();
9754 application.Render();
9756 VisibilityChangedFunctorData data;
9757 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
9759 Animation animation = Animation::New(1.0f);
9760 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
9762 data.Check(false, TEST_LOCATION);
9763 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9764 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9766 tet_infoline("Play the animation and check the property value");
9769 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
9770 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
9772 tet_infoline("Animation not currently finished, so the current visibility should still be true");
9773 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9775 application.SendNotification();
9776 application.Render(1100); // After the animation
9778 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
9783 int utcDaliActorVisibilityChangeSignalByName(void)
9785 TestApplication application;
9786 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
9788 Actor actor = Actor::New();
9790 bool signalCalled = false;
9791 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
9792 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9793 actor.SetProperty(Actor::Property::VISIBLE, false);
9794 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
9796 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
9797 signalCalled = false;
9798 actor.SetProperty(Actor::Property::VISIBLE, false);
9799 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9801 tet_infoline("Change the visibility using properties, ensure called");
9802 actor.SetProperty(Actor::Property::VISIBLE, true);
9803 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
9805 tet_infoline("Set the visibility to current using properties, ensure not called");
9806 signalCalled = false;
9808 actor.SetProperty(Actor::Property::VISIBLE, true);
9809 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9814 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
9816 gLayoutDirectionType = type;
9819 int UtcDaliActorLayoutDirectionProperty(void)
9821 TestApplication application;
9822 tet_infoline("Check layout direction property");
9824 Actor actor0 = Actor::New();
9825 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9826 application.GetScene().Add(actor0);
9828 application.SendNotification();
9829 application.Render();
9831 Actor actor1 = Actor::New();
9832 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9833 Actor actor2 = Actor::New();
9834 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9835 Actor actor3 = Actor::New();
9836 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9837 Actor actor4 = Actor::New();
9838 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9839 Actor actor5 = Actor::New();
9840 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9841 Actor actor6 = Actor::New();
9842 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9843 Actor actor7 = Actor::New();
9844 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9845 Actor actor8 = Actor::New();
9846 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9847 Actor actor9 = Actor::New();
9848 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9851 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
9852 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
9854 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
9855 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
9856 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
9858 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9859 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9860 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
9862 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
9864 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9865 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9867 application.GetScene().Add(actor3);
9874 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
9875 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
9877 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
9878 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
9879 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
9881 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
9883 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9884 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9885 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9886 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9887 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9888 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9889 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9891 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
9892 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9893 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9895 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
9896 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9897 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9898 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
9900 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
9901 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9902 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9907 struct LayoutDirectionFunctor
9909 LayoutDirectionFunctor(bool& signalCalled)
9910 : mSignalCalled(signalCalled)
9914 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
9915 : mSignalCalled(rhs.mSignalCalled)
9921 mSignalCalled = true;
9924 bool& mSignalCalled;
9927 int UtcDaliActorLayoutDirectionSignal(void)
9929 TestApplication application;
9930 tet_infoline("Check changing layout direction property sends a signal");
9932 Actor actor = Actor::New();
9933 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
9934 application.GetScene().Add(actor);
9935 bool signalCalled = false;
9936 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
9938 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
9939 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9941 // Test that writing the same value doesn't send a signal
9942 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
9943 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9945 // Test that writing a different value sends the signal
9946 signalCalled = false;
9947 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
9948 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
9950 signalCalled = false;
9951 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
9952 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
9957 struct ChildAddedSignalCheck
9959 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
9960 : mSignalReceived(signalReceived),
9961 mChildHandle(childHandle)
9965 void operator()(Actor childHandle)
9967 mSignalReceived = true;
9968 mChildHandle = childHandle;
9972 mSignalReceived = true;
9973 mChildHandle = Actor();
9976 bool& mSignalReceived;
9977 Actor& mChildHandle;
9980 int UtcDaliChildAddedSignalP1(void)
9982 TestApplication application;
9983 auto stage = application.GetScene();
9985 bool signalReceived = false;
9988 ChildAddedSignalCheck signal(signalReceived, childActor);
9989 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
9990 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
9992 auto actorA = Actor::New();
9994 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
9995 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
9996 signalReceived = false;
9998 auto actorB = Actor::New();
10000 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10001 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
10006 int UtcDaliChildAddedSignalP2(void)
10008 TestApplication application;
10009 auto stage = application.GetScene();
10011 bool signalReceived = false;
10014 ChildAddedSignalCheck signal(signalReceived, childActor);
10015 tet_infoline("Connect to childAdded signal by name");
10017 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
10018 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10020 auto actorA = Actor::New();
10022 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10024 // Can't test which actor was added; signal signature is void() when connecting via name.
10025 signalReceived = false;
10027 auto actorB = Actor::New();
10029 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10034 int UtcDaliChildAddedSignalN(void)
10036 TestApplication application;
10037 auto stage = application.GetScene();
10039 bool signalReceived = false;
10042 ChildAddedSignalCheck signal(signalReceived, childActor);
10043 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
10044 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10046 auto actorA = Actor::New();
10048 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10049 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
10050 signalReceived = false;
10052 auto actorB = Actor::New();
10053 actorA.Add(actorB);
10054 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10058 struct ChildRemovedSignalCheck
10060 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
10061 : mSignalReceived(signalReceived),
10062 mChildHandle(childHandle)
10066 void operator()(Actor childHandle)
10068 mSignalReceived = true;
10069 mChildHandle = childHandle;
10074 mSignalReceived = true;
10077 bool& mSignalReceived;
10078 Actor& mChildHandle;
10081 int UtcDaliChildRemovedSignalP1(void)
10083 TestApplication application;
10084 auto stage = application.GetScene();
10086 bool signalReceived = false;
10089 ChildRemovedSignalCheck signal(signalReceived, childActor);
10090 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
10091 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10093 auto actorA = Actor::New();
10095 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10096 DALI_TEST_CHECK(!childActor);
10098 stage.Remove(actorA);
10099 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
10100 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10102 signalReceived = false;
10103 auto actorB = Actor::New();
10105 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10107 stage.Remove(actorB);
10108 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10109 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
10114 int UtcDaliChildRemovedSignalP2(void)
10116 TestApplication application;
10117 auto stage = application.GetScene();
10119 bool signalReceived = false;
10122 ChildAddedSignalCheck signal(signalReceived, childActor);
10123 tet_infoline("Connect to childRemoved signal by name");
10125 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
10126 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10128 auto actorA = Actor::New();
10130 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10132 stage.Remove(actorA);
10133 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10135 signalReceived = false;
10136 auto actorB = Actor::New();
10138 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10140 stage.Remove(actorB);
10141 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
10146 int UtcDaliChildRemovedSignalN(void)
10148 TestApplication application;
10149 auto stage = application.GetScene();
10151 bool signalReceived = false;
10154 ChildRemovedSignalCheck signal(signalReceived, childActor);
10155 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
10156 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10158 auto actorA = Actor::New();
10161 auto actorB = Actor::New();
10162 actorA.Add(actorB);
10164 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10165 DALI_TEST_CHECK(!childActor);
10167 actorA.Remove(actorB);
10168 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
10172 int UtcDaliChildMovedSignalP(void)
10174 TestApplication application;
10175 auto stage = application.GetScene();
10177 bool addedASignalReceived = false;
10178 bool removedASignalReceived = false;
10179 bool addedBSignalReceived = false;
10180 bool removedBSignalReceived = false;
10183 auto actorA = Actor::New();
10184 auto actorB = Actor::New();
10188 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
10189 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
10190 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
10191 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
10193 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
10194 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
10195 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
10196 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
10198 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
10199 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10200 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10201 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10203 // Create a child of A
10205 auto child = Actor::New();
10208 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
10209 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10210 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10211 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10212 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
10214 // Move child to B:
10215 addedASignalReceived = false;
10216 addedBSignalReceived = false;
10217 removedASignalReceived = false;
10218 removedBSignalReceived = false;
10220 actorB.Add(child); // Expect this child to be re-parented
10221 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
10222 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
10223 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
10224 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
10226 // Move child back to A:
10227 addedASignalReceived = false;
10228 addedBSignalReceived = false;
10229 removedASignalReceived = false;
10230 removedBSignalReceived = false;
10232 actorA.Add(child); // Expect this child to be re-parented
10233 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
10234 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
10235 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
10236 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
10241 int UtcDaliActorSwitchParentP(void)
10243 tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
10244 TestApplication application;
10246 Actor parent1 = Actor::New();
10247 Actor child = Actor::New();
10249 application.GetScene().Add(parent1);
10251 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
10253 child.OnSceneSignal().Connect(OnSceneCallback);
10254 child.OffSceneSignal().Connect(OffSceneCallback);
10257 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
10258 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10260 parent1.Add(child);
10262 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
10264 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
10265 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10267 Actor parent2 = Actor::New();
10268 application.GetScene().Add(parent2);
10270 bool addSignalReceived = false;
10271 ChildAddedSignalCheck addedSignal(addSignalReceived, child);
10272 DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
10273 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
10275 bool removedSignalReceived = false;
10276 ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
10277 DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
10278 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
10280 DevelActor::SwitchParent(child, parent2);
10282 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
10283 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
10285 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
10286 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
10288 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
10289 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
10290 DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
10291 DALI_TEST_CHECK(child.GetParent() == parent2);
10296 int utcDaliActorCulled(void)
10298 TestApplication application;
10299 auto stage = application.GetScene();
10301 tet_infoline("Check that the actor is culled if the actor is out of the screen");
10303 Actor actor = Actor::New();
10304 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
10306 Geometry geometry = CreateQuadGeometry();
10307 Shader shader = CreateShader();
10308 Renderer renderer = Renderer::New(geometry, shader);
10309 actor.AddRenderer(renderer);
10313 application.SendNotification();
10314 application.Render(0);
10316 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
10318 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
10319 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
10321 // Connect NotifySignal
10322 bool propertyNotificationSignal(false);
10323 PropertyNotification source;
10324 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
10325 notification.NotifySignal().Connect(&application, f);
10327 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
10329 application.SendNotification();
10330 application.Render();
10332 application.SendNotification();
10334 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
10336 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
10337 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
10338 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
10343 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
10345 TestApplication application;
10346 auto stage = application.GetScene();
10348 tet_infoline("Ensure we clear the screen when the last actor is removed");
10350 Actor actor = CreateRenderableActor();
10351 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
10354 application.SendNotification();
10355 application.Render();
10357 auto& glAbstraction = application.GetGlAbstraction();
10358 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
10362 application.SendNotification();
10363 application.Render();
10365 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
10370 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
10372 TestApplication application;
10373 auto stage = application.GetScene();
10375 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
10377 Actor actor = CreateRenderableActor();
10378 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
10381 application.SendNotification();
10382 application.Render();
10384 auto& glAbstraction = application.GetGlAbstraction();
10385 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
10387 actor.SetProperty(Actor::Property::VISIBLE, false);
10389 application.SendNotification();
10390 application.Render();
10392 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
10397 int utcDaliActorGetSizeAfterAnimation(void)
10399 TestApplication application;
10400 tet_infoline("Check the actor size before / after an animation is finished");
10402 Vector3 actorSize(100.0f, 100.0f, 0.0f);
10404 Actor actor = Actor::New();
10405 actor.SetProperty(Actor::Property::SIZE, actorSize);
10406 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10407 application.GetScene().Add(actor);
10409 // Size should be updated without rendering.
10410 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10411 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10413 application.SendNotification();
10414 application.Render();
10416 // Size and current size should be updated.
10417 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10418 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10419 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10420 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10421 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10423 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10424 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10425 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10426 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10427 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10430 actorSize = Vector3(200.0f, 200.0f, 0.0f);
10431 actor.SetProperty(Actor::Property::SIZE, actorSize);
10433 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10434 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10436 Vector3 targetValue(10.0f, 20.0f, 0.0f);
10438 Animation animation = Animation::New(1.0f);
10439 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
10442 // Size should be updated without rendering.
10443 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10444 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10446 application.SendNotification();
10447 application.Render(1100); // After the animation
10449 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10450 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10451 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10452 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10453 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10455 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10456 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10457 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10458 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10459 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10461 targetValue.width = 50.0f;
10464 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
10467 application.SendNotification();
10468 application.Render(1100); // After the animation
10470 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10471 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10472 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10473 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10474 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10476 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10477 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10478 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10479 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10480 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10482 targetValue.height = 70.0f;
10485 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
10488 application.SendNotification();
10489 application.Render(1100); // After the animation
10491 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10492 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10493 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10494 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10495 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10497 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10498 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10499 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10500 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10501 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10503 Vector3 offset(10.0f, 20.0f, 0.0f);
10506 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
10509 application.SendNotification();
10510 application.Render(1100); // After the animation
10512 targetValue += offset;
10514 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10515 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10516 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10517 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10518 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10520 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10521 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10522 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10523 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10524 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10526 offset.width = 20.0f;
10529 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
10532 application.SendNotification();
10533 application.Render(1100); // After the animation
10535 targetValue.width += offset.width;
10537 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10538 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10539 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10540 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10541 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10543 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10544 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10545 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10546 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10547 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10549 offset.height = 10.0f;
10552 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
10555 application.SendNotification();
10556 application.Render(1100); // After the animation
10558 targetValue.height += offset.height;
10560 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10561 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10562 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10563 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10564 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10566 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10567 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10568 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10569 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10570 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10573 actorSize = Vector3(300.0f, 300.0f, 0.0f);
10575 actor.SetProperty(Actor::Property::SIZE, actorSize);
10577 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10578 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10580 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10581 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10583 application.SendNotification();
10584 application.Render();
10586 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10587 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10589 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10590 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10595 int utcDaliActorGetSizeAfterAnimation2(void)
10597 TestApplication application;
10598 tet_infoline("Check the actor size before / after an animation is finished if before size is equal to animation target size");
10600 Vector3 actorSize(100.0f, 100.0f, 0.0f);
10602 Actor actor = Actor::New();
10603 actor.SetProperty(Actor::Property::SIZE, actorSize);
10604 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10605 application.GetScene().Add(actor);
10607 // Size should be updated without rendering.
10608 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10609 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10611 application.SendNotification();
10612 application.Render();
10614 // Size and current size should be updated.
10615 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10616 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10617 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10618 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10619 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10621 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10622 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10623 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10624 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10625 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10628 actorSize = Vector3(200.0f, 200.0f, 0.0f);
10629 actor.SetProperty(Actor::Property::SIZE, actorSize);
10631 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10632 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10634 Vector3 targetValue(actorSize);
10636 Animation animation = Animation::New(1.0f);
10637 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
10640 // Size should be updated without rendering.
10641 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10642 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10644 application.SendNotification();
10645 application.Render(100); // During the animation
10647 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10648 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10649 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10650 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10651 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10653 // We should get target value because targetValue is equal to current actor size.
10654 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10655 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10656 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
10657 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
10658 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
10660 application.SendNotification();
10661 application.Render(1000); // After animation finished
10663 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10664 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10666 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10667 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10672 int utcDaliActorRelayoutAndAnimation(void)
10674 TestApplication application;
10675 tet_infoline("Check the actor size when relayoutting and playing animation");
10677 Vector3 parentSize(300.0f, 300.0f, 0.0f);
10678 Vector3 actorSize(100.0f, 100.0f, 0.0f);
10681 Actor parentA = Actor::New();
10682 parentA.SetProperty(Actor::Property::SIZE, parentSize);
10683 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10684 application.GetScene().Add(parentA);
10686 Actor parentB = Actor::New();
10687 parentB.SetProperty(Actor::Property::SIZE, parentSize);
10688 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10689 application.GetScene().Add(parentB);
10691 Actor actor = Actor::New();
10692 actor.SetProperty(Actor::Property::SIZE, actorSize);
10693 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10694 parentA.Add(actor);
10696 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10697 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10699 Vector3 targetValue(200.0f, 200.0f, 0.0f);
10701 Animation animation = Animation::New(1.0f);
10702 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
10705 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10706 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10708 application.SendNotification();
10709 application.Render(1100); // After the animation
10711 // Size and current size should be updated.
10712 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10713 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10715 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10716 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10718 // Trigger relayout
10719 parentB.Add(actor);
10721 application.SendNotification();
10722 application.Render();
10724 // Size and current size should be same.
10725 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10726 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10728 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10729 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10732 parentA.Unparent();
10733 parentB.Unparent();
10737 Actor parentA = Actor::New();
10738 parentA.SetProperty(Actor::Property::SIZE, parentSize);
10739 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10740 application.GetScene().Add(parentA);
10742 Actor parentB = Actor::New();
10743 parentB.SetProperty(Actor::Property::SIZE, parentSize);
10744 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10745 application.GetScene().Add(parentB);
10747 Actor actor = Actor::New();
10748 actor.SetProperty(Actor::Property::SIZE, actorSize);
10749 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10750 parentA.Add(actor);
10752 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10753 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10755 application.SendNotification();
10756 application.Render();
10758 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10759 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10761 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10762 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10764 Vector3 targetValue(200.0f, 200.0f, 0.0f);
10766 // Make an animation
10767 Animation animation = Animation::New(1.0f);
10768 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
10771 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10772 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10774 application.SendNotification();
10775 application.Render(1100); // After the animation
10777 // Size and current size should be updated.
10778 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10779 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10781 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10782 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10784 // Trigger relayout
10785 parentB.Add(actor);
10787 application.SendNotification();
10788 application.Render();
10790 // Size and current size should be same.
10791 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
10792 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10794 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
10795 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
10798 parentA.Unparent();
10799 parentB.Unparent();
10805 int utcDaliActorPartialUpdate(void)
10807 TestApplication application(
10808 TestApplication::DEFAULT_SURFACE_WIDTH,
10809 TestApplication::DEFAULT_SURFACE_HEIGHT,
10810 TestApplication::DEFAULT_HORIZONTAL_DPI,
10811 TestApplication::DEFAULT_VERTICAL_DPI,
10815 tet_infoline("Check the damaged area");
10817 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10819 std::vector<Rect<int>> damagedRects;
10820 Rect<int> clippingRect;
10821 application.SendNotification();
10822 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10824 // First render pass, nothing to render, adaptor would just do swap buffer.
10825 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10827 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
10828 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10830 Actor actor = CreateRenderableActor();
10831 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
10832 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
10833 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
10834 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10835 application.GetScene().Add(actor);
10837 application.SendNotification();
10839 // 1. Actor added, damaged rect is added size of actor
10840 damagedRects.clear();
10841 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10842 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10845 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10846 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10847 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10848 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10849 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10850 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10851 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10854 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
10855 application.SendNotification();
10857 damagedRects.clear();
10858 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10859 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10862 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
10863 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10864 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10865 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10866 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10867 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10868 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10870 // 3. Set new position
10871 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
10872 application.SendNotification();
10874 damagedRects.clear();
10875 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10876 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10879 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
10880 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10881 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10882 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10883 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10884 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10885 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10887 application.GetScene().Remove(actor);
10888 application.SendNotification();
10890 // Actor removed, last a dirty rect is reported.
10891 damagedRects.clear();
10892 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10893 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10895 clippingRect = damagedRects[0];
10897 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
10898 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(32, 736, 48, 48), TEST_LOCATION);
10900 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10901 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10902 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10903 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10904 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10909 int utcDaliActorPartialUpdateSetColor(void)
10911 TestApplication application(
10912 TestApplication::DEFAULT_SURFACE_WIDTH,
10913 TestApplication::DEFAULT_SURFACE_HEIGHT,
10914 TestApplication::DEFAULT_HORIZONTAL_DPI,
10915 TestApplication::DEFAULT_VERTICAL_DPI,
10919 tet_infoline("Check uniform update");
10921 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10923 std::vector<Rect<int>> damagedRects;
10924 Rect<int> clippingRect;
10925 application.SendNotification();
10926 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10928 // First render pass, nothing to render, adaptor would just do swap buffer.
10929 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10931 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
10932 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10934 Actor actor = CreateRenderableActor();
10935 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
10936 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
10937 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
10938 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10939 application.GetScene().Add(actor);
10941 application.SendNotification();
10943 // 1. Actor added, damaged rect is added size of actor
10944 damagedRects.clear();
10945 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10946 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10949 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10950 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10951 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10952 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10953 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10954 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10955 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10957 damagedRects.clear();
10958 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10959 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10961 damagedRects.clear();
10962 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10963 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10965 // 2. Set new color
10966 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
10967 application.SendNotification();
10969 damagedRects.clear();
10970 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10971 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10974 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10975 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10976 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10977 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10978 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10979 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10980 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10985 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
10986 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
10987 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
10988 const char* const RENDER_SHADOW_VERTEX_SOURCE =
10989 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
10990 " uniform mediump mat4 uLightCameraViewMatrix;\n"
10994 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
10995 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
10996 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
10999 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
11000 "uniform lowp vec4 uShadowColor;\n"
11003 " lowp float alpha;\n"
11004 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
11005 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
11008 int utcDaliActorPartialUpdateSetProperty(void)
11010 TestApplication application(
11011 TestApplication::DEFAULT_SURFACE_WIDTH,
11012 TestApplication::DEFAULT_SURFACE_HEIGHT,
11013 TestApplication::DEFAULT_HORIZONTAL_DPI,
11014 TestApplication::DEFAULT_VERTICAL_DPI,
11018 tet_infoline("Set/Update property with partial update");
11020 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11022 std::vector<Rect<int>> damagedRects;
11023 Rect<int> clippingRect;
11024 application.SendNotification();
11025 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11027 // First render pass, nothing to render, adaptor would just do swap buffer.
11028 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11030 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11031 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11033 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
11034 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
11035 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11036 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11037 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11038 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11039 application.GetScene().Add(actor);
11041 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
11043 damagedRects.clear();
11044 application.SendNotification();
11045 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11046 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11049 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11050 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11051 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11052 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11053 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11054 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11055 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11057 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
11058 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
11060 damagedRects.clear();
11061 application.SendNotification();
11062 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11063 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11065 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11066 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11067 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11068 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11069 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11070 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11072 // Should be no damage rects, nothing changed
11073 damagedRects.clear();
11074 application.SendNotification();
11075 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11076 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11078 // Should be 1 damage rect due to change in size
11079 damagedRects.clear();
11080 actor.SetProperty(Actor::Property::SIZE, Vector3(26.0f, 26.0f, 0.0f));
11081 application.SendNotification();
11082 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11083 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11085 clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
11086 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11087 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11088 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11089 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11090 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11091 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11093 damagedRects.clear();
11094 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11095 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11100 int utcDaliActorPartialUpdateTwoActors(void)
11102 TestApplication application(
11103 TestApplication::DEFAULT_SURFACE_WIDTH,
11104 TestApplication::DEFAULT_SURFACE_HEIGHT,
11105 TestApplication::DEFAULT_HORIZONTAL_DPI,
11106 TestApplication::DEFAULT_VERTICAL_DPI,
11110 tet_infoline("Check the damaged rects with partial update and two actors");
11112 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11114 Actor actor = CreateRenderableActor();
11115 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
11116 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
11117 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11118 application.GetScene().Add(actor);
11120 Actor actor2 = CreateRenderableActor();
11121 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
11122 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
11123 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11124 application.GetScene().Add(actor2);
11126 application.SendNotification();
11127 std::vector<Rect<int>> damagedRects;
11128 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11130 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
11131 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64), Rect<int>(96, 592, 112, 112)}, true, TEST_LOCATION);
11133 // in screen coordinates, adaptor would calculate it using previous frames information
11134 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
11135 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11137 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11138 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11139 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11140 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11142 // Change a Renderer of actor1
11143 Geometry geometry = CreateQuadGeometry();
11144 Shader shader = CreateShader();
11145 Renderer newRenderer = Renderer::New(geometry, shader);
11146 Renderer renderer = actor.GetRendererAt(0);
11148 actor.RemoveRenderer(renderer);
11149 actor.AddRenderer(newRenderer);
11151 damagedRects.clear();
11153 application.SendNotification();
11154 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11156 DALI_TEST_CHECK(damagedRects.size() > 0);
11157 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64)}, false, TEST_LOCATION);
11159 // in screen coordinates, adaptor would calculate it using previous frames information
11160 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11162 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11163 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11164 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11165 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11170 int utcDaliActorPartialUpdateActorsWithSizeHint01(void)
11172 TestApplication application(
11173 TestApplication::DEFAULT_SURFACE_WIDTH,
11174 TestApplication::DEFAULT_SURFACE_HEIGHT,
11175 TestApplication::DEFAULT_HORIZONTAL_DPI,
11176 TestApplication::DEFAULT_VERTICAL_DPI,
11180 tet_infoline("Check the damaged rect with partial update and update area hint");
11182 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11184 Actor actor = CreateRenderableActor();
11185 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11186 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11187 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11188 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11189 application.GetScene().Add(actor);
11191 application.SendNotification();
11192 std::vector<Rect<int>> damagedRects;
11193 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11195 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11197 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
11198 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11200 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11202 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11203 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11204 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11205 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11210 damagedRects.clear();
11211 application.SendNotification();
11212 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11214 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11215 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11217 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11219 damagedRects.clear();
11220 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11221 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11223 // Ensure the damaged rect is empty
11224 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11226 // Change UPDATE_AREA_HINT
11227 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 32.0f, 32.0f));
11228 application.GetScene().Add(actor);
11230 application.SendNotification();
11231 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11233 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11235 clippingRect = Rect<int>(64, 704, 48, 48);
11236 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11238 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11240 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11241 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11242 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11243 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11248 damagedRects.clear();
11249 application.SendNotification();
11250 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11252 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11253 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11255 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11257 damagedRects.clear();
11258 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11259 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11261 // Ensure the damaged rect is empty
11262 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11264 // Change UPDATE_AREA_HINT
11265 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(-32.0f, -16.0f, 64.0f, 64.0f));
11266 application.GetScene().Add(actor);
11268 application.SendNotification();
11269 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11271 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11273 clippingRect = Rect<int>(0, 720, 80, 80);
11274 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11276 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11278 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11279 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11280 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11281 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11286 int utcDaliActorPartialUpdateActorsWithSizeHint02(void)
11288 TestApplication application(
11289 TestApplication::DEFAULT_SURFACE_WIDTH,
11290 TestApplication::DEFAULT_SURFACE_HEIGHT,
11291 TestApplication::DEFAULT_HORIZONTAL_DPI,
11292 TestApplication::DEFAULT_VERTICAL_DPI,
11296 tet_infoline("Check the damaged rect with partial update and update area hint");
11298 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11300 Actor actor = CreateRenderableActor();
11301 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11302 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11303 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11304 application.GetScene().Add(actor);
11306 application.SendNotification();
11307 std::vector<Rect<int>> damagedRects;
11308 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11310 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11312 Rect<int> clippingRect = Rect<int>(48, 720, 48, 48);
11313 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11315 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11317 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11318 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11319 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11320 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11322 damagedRects.clear();
11323 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11324 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11326 // Ensure the damaged rect is empty
11327 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11329 // Change UPDATE_AREA_HINT
11330 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11332 application.SendNotification();
11333 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11335 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11337 clippingRect = Rect<int>(32, 704, 80, 80);
11338 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11340 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11342 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11343 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11344 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11345 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11347 damagedRects.clear();
11348 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11349 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11351 // Ensure the damaged rect is empty
11352 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11354 // Change UPDATE_AREA_HINT
11355 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 64.0f, 64.0f));
11356 application.GetScene().Add(actor);
11358 application.SendNotification();
11359 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11361 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11363 clippingRect = Rect<int>(32, 688, 96, 96);
11364 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11366 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11368 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11369 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11370 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11371 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11376 int utcDaliActorPartialUpdateActorsWithSizeHint03(void)
11378 TestApplication application(
11379 TestApplication::DEFAULT_SURFACE_WIDTH,
11380 TestApplication::DEFAULT_SURFACE_HEIGHT,
11381 TestApplication::DEFAULT_HORIZONTAL_DPI,
11382 TestApplication::DEFAULT_VERTICAL_DPI,
11386 tet_infoline("Check the damaged rect with partial update and update area hint");
11388 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11390 Actor actor = CreateRenderableActor();
11391 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
11392 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
11393 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
11394 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11395 application.GetScene().Add(actor);
11397 application.SendNotification();
11398 std::vector<Rect<int>> damagedRects;
11399 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11401 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11403 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
11404 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11406 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11408 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11409 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11410 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11411 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11413 damagedRects.clear();
11414 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11415 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11417 // Ensure the damaged rect is empty
11418 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11420 // Set UPDATE_AREA_HINT twice before rendering
11421 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 32.0f, 32.0f));
11422 application.SendNotification();
11424 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(32.0f, -32.0f, 32.0f, 32.0f));
11425 application.SendNotification();
11427 damagedRects.clear();
11428 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
11430 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11432 clippingRect = Rect<int>(32, 704, 96, 96);
11433 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11435 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11437 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11438 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11439 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11440 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11445 int utcDaliActorPartialUpdateAnimation01(void)
11447 TestApplication application(
11448 TestApplication::DEFAULT_SURFACE_WIDTH,
11449 TestApplication::DEFAULT_SURFACE_HEIGHT,
11450 TestApplication::DEFAULT_HORIZONTAL_DPI,
11451 TestApplication::DEFAULT_VERTICAL_DPI,
11455 tet_infoline("Check the damaged area with partial update and animation");
11457 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11458 drawTrace.Enable(true);
11461 Actor actor1 = CreateRenderableActor();
11462 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11463 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
11464 application.GetScene().Add(actor1);
11466 Actor actor2 = CreateRenderableActor();
11467 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11468 actor2.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11469 application.GetScene().Add(actor2);
11471 std::vector<Rect<int>> damagedRects;
11472 Rect<int> clippingRect;
11473 Rect<int> expectedRect1, expectedRect2;
11475 application.SendNotification();
11476 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11478 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
11481 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 1 last frames updates
11482 expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
11483 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2}, true, TEST_LOCATION);
11485 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11486 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11488 // Make an animation
11489 Animation animation = Animation::New(1.0f);
11490 animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
11493 application.SendNotification();
11495 damagedRects.clear();
11496 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11497 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11498 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11501 damagedRects.clear();
11503 // In animation deley time
11504 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11505 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11506 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11509 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
11512 damagedRects.clear();
11514 // Also in animation deley time
11515 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11516 application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
11517 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11520 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
11522 // Unparent 2 actors and make a new actor
11526 Actor actor3 = CreateRenderableActor();
11527 actor3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11528 actor3.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11529 application.GetScene().Add(actor3);
11531 application.SendNotification();
11533 // Started animation
11534 damagedRects.clear();
11535 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11536 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
11538 // One of dirty rect is actor3's.
11539 // We don't know the exact dirty rect of actor1 and actor2.
11540 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2, expectedRect2}, true, TEST_LOCATION);
11542 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11543 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11545 // Finished animation, but the actor was already unparented
11546 damagedRects.clear();
11547 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11549 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11551 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11552 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11557 int utcDaliActorPartialUpdateAnimation02(void)
11559 TestApplication application(
11560 TestApplication::DEFAULT_SURFACE_WIDTH,
11561 TestApplication::DEFAULT_SURFACE_HEIGHT,
11562 TestApplication::DEFAULT_HORIZONTAL_DPI,
11563 TestApplication::DEFAULT_VERTICAL_DPI,
11567 tet_infoline("Check the damaged area with partial update and animation delay");
11569 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11570 drawTrace.Enable(true);
11573 Actor actor = CreateRenderableActor();
11574 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11575 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11576 application.GetScene().Add(actor);
11578 std::vector<Rect<int>> damagedRects;
11579 Rect<int> clippingRect;
11581 application.SendNotification();
11582 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11584 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11587 clippingRect = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
11588 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11590 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11592 // Make an animation
11593 Renderer renderer = actor.GetRendererAt(0);
11594 Animation animation = Animation::New(1.0f);
11595 animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f, TimePeriod(0.5f, 0.5f));
11596 animation.SetLoopCount(3);
11599 application.SendNotification();
11601 damagedRects.clear();
11602 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11603 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11606 damagedRects.clear();
11607 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11608 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11610 clippingRect = Rect<int>(0, 784, 32, 32);
11611 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11613 // Started animation
11614 damagedRects.clear();
11615 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11616 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11618 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11621 damagedRects.clear();
11622 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
11624 // The property is reset to base value. Should be updated
11625 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11627 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11629 // Next render during delay time
11630 damagedRects.clear();
11631 application.PreRenderWithPartialUpdate(50, nullptr, damagedRects);
11633 // Should not be updated
11634 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11636 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11641 int utcDaliActorPartialUpdateChangeVisibility(void)
11643 TestApplication application(
11644 TestApplication::DEFAULT_SURFACE_WIDTH,
11645 TestApplication::DEFAULT_SURFACE_HEIGHT,
11646 TestApplication::DEFAULT_HORIZONTAL_DPI,
11647 TestApplication::DEFAULT_VERTICAL_DPI,
11651 tet_infoline("Check the damaged rect with partial update and visibility change");
11653 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11655 Actor actor = CreateRenderableActor();
11656 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11657 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11658 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11659 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11660 application.GetScene().Add(actor);
11662 application.SendNotification();
11664 std::vector<Rect<int>> damagedRects;
11665 Rect<int> clippingRect;
11667 // 1. Actor added, damaged rect is added size of actor
11668 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11669 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11672 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11673 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11674 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11675 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11676 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11677 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11678 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11680 damagedRects.clear();
11681 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11682 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11684 // Ensure the damaged rect is empty
11685 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11687 // 2. Make the Actor invisible
11688 actor.SetProperty(Actor::Property::VISIBLE, false);
11689 application.SendNotification();
11691 damagedRects.clear();
11692 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11693 DALI_TEST_CHECK(damagedRects.size() > 0);
11694 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
11696 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11697 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11698 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11699 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11700 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11702 // 3. Make the Actor visible again
11703 actor.SetProperty(Actor::Property::VISIBLE, true);
11704 application.SendNotification();
11706 damagedRects.clear();
11707 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11708 DALI_TEST_CHECK(damagedRects.size() > 0);
11709 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
11711 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11712 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11713 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11714 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11715 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11720 int utcDaliActorPartialUpdateOnOffScene(void)
11722 TestApplication application(
11723 TestApplication::DEFAULT_SURFACE_WIDTH,
11724 TestApplication::DEFAULT_SURFACE_HEIGHT,
11725 TestApplication::DEFAULT_HORIZONTAL_DPI,
11726 TestApplication::DEFAULT_VERTICAL_DPI,
11730 tet_infoline("Check the damaged rect with partial update and on/off scene");
11732 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11734 Actor actor = CreateRenderableActor();
11735 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11736 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
11737 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
11738 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11739 application.GetScene().Add(actor);
11741 application.SendNotification();
11743 std::vector<Rect<int>> damagedRects;
11744 Rect<int> clippingRect;
11746 // 1. Actor added, damaged rect is added size of actor
11747 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11748 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11751 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
11752 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
11753 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11754 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11755 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11756 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11757 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11759 damagedRects.clear();
11760 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11761 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11763 damagedRects.clear();
11764 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11765 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11767 // Ensure the damaged rect is empty
11768 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11770 // 2. Remove the Actor from the Scene
11772 application.SendNotification();
11774 damagedRects.clear();
11775 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11776 DALI_TEST_CHECK(damagedRects.size() > 0);
11777 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
11779 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11780 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11781 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11782 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11783 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11785 // 3. Add the Actor to the Scene again
11786 application.GetScene().Add(actor);
11787 application.SendNotification();
11789 damagedRects.clear();
11790 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11791 DALI_TEST_CHECK(damagedRects.size() > 0);
11792 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
11794 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11795 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
11796 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
11797 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
11798 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
11803 int utcDaliActorPartialUpdateSkipRendering(void)
11805 TestApplication application(
11806 TestApplication::DEFAULT_SURFACE_WIDTH,
11807 TestApplication::DEFAULT_SURFACE_HEIGHT,
11808 TestApplication::DEFAULT_HORIZONTAL_DPI,
11809 TestApplication::DEFAULT_VERTICAL_DPI,
11813 tet_infoline("Check to skip rendering in case of the empty damaged rect");
11815 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11816 drawTrace.Enable(true);
11819 Actor actor1 = CreateRenderableActor();
11820 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11821 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
11822 application.GetScene().Add(actor1);
11824 std::vector<Rect<int>> damagedRects;
11825 Rect<int> clippingRect;
11826 Rect<int> expectedRect1;
11828 application.SendNotification();
11829 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11831 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11834 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates
11835 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
11837 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11838 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11840 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
11842 damagedRects.clear();
11843 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11844 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11845 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11847 // Remove the actor
11850 application.SendNotification();
11852 damagedRects.clear();
11853 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11855 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
11857 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11858 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11860 // Render again without any change
11861 damagedRects.clear();
11863 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11865 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
11867 clippingRect = Rect<int>();
11868 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11871 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
11873 // Add the actor again
11874 application.GetScene().Add(actor1);
11876 application.SendNotification();
11878 damagedRects.clear();
11880 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11882 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
11884 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11885 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11887 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
11892 int utcDaliActorPartialUpdate3DNode(void)
11894 TestApplication application(
11895 TestApplication::DEFAULT_SURFACE_WIDTH,
11896 TestApplication::DEFAULT_SURFACE_HEIGHT,
11897 TestApplication::DEFAULT_HORIZONTAL_DPI,
11898 TestApplication::DEFAULT_VERTICAL_DPI,
11902 tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
11904 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
11905 drawTrace.Enable(true);
11908 Actor actor1 = CreateRenderableActor();
11909 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
11910 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
11911 application.GetScene().Add(actor1);
11913 std::vector<Rect<int>> damagedRects;
11914 Rect<int> clippingRect;
11916 application.SendNotification();
11917 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11919 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11921 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11922 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11924 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
11926 // Change the layer to 3D
11927 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
11929 application.SendNotification();
11931 damagedRects.clear();
11932 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11934 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11935 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
11937 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11939 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11941 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
11943 // Change the layer to 2D
11944 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
11946 application.SendNotification();
11948 damagedRects.clear();
11949 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11951 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11953 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11954 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11956 // Make 3D transform
11957 actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
11959 application.SendNotification();
11961 damagedRects.clear();
11962 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
11964 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
11965 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
11967 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
11969 application.RenderWithPartialUpdate(damagedRects, clippingRect);
11971 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
11976 int utcDaliActorPartialUpdateNotRenderableActor(void)
11978 TestApplication application(
11979 TestApplication::DEFAULT_SURFACE_WIDTH,
11980 TestApplication::DEFAULT_SURFACE_HEIGHT,
11981 TestApplication::DEFAULT_HORIZONTAL_DPI,
11982 TestApplication::DEFAULT_VERTICAL_DPI,
11986 tet_infoline("Check the damaged rect with not renderable parent actor");
11988 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
11990 Actor parent = Actor::New();
11991 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11992 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
11993 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
11994 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
11995 application.GetScene().Add(parent);
11997 Actor child = CreateRenderableActor();
11998 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11999 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12000 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12003 application.SendNotification();
12005 std::vector<Rect<int>> damagedRects;
12007 // 1. Actor added, damaged rect is added size of actor
12008 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12009 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12012 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12013 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12015 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12016 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12017 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12018 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12019 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12021 damagedRects.clear();
12022 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12023 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12025 damagedRects.clear();
12026 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12027 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12029 // Ensure the damaged rect is empty
12030 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12035 int utcDaliActorPartialUpdateChangeTransparency(void)
12037 TestApplication application(
12038 TestApplication::DEFAULT_SURFACE_WIDTH,
12039 TestApplication::DEFAULT_SURFACE_HEIGHT,
12040 TestApplication::DEFAULT_HORIZONTAL_DPI,
12041 TestApplication::DEFAULT_VERTICAL_DPI,
12045 tet_infoline("Check the damaged rect with changing transparency");
12047 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12049 Actor actor = CreateRenderableActor();
12050 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12051 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12052 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12053 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12054 application.GetScene().Add(actor);
12056 application.SendNotification();
12058 std::vector<Rect<int>> damagedRects;
12060 // Actor added, damaged rect is added size of actor
12061 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12062 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12065 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12066 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12068 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12069 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12070 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12071 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12072 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12074 damagedRects.clear();
12075 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12076 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12078 // Ensure the damaged rect is empty
12079 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12081 // Make the actor transparent by changing opacity of the Renderer
12082 // It changes a uniform value
12083 Renderer renderer = actor.GetRendererAt(0);
12084 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
12086 application.SendNotification();
12088 // The damaged rect should be same
12089 damagedRects.clear();
12090 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12091 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12092 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12093 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12095 damagedRects.clear();
12096 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12097 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12099 // Ensure the damaged rect is empty
12100 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12102 // Make the actor opaque again
12103 renderer[DevelRenderer::Property::OPACITY] = 1.0f;
12105 application.SendNotification();
12107 // The damaged rect should not be empty
12108 damagedRects.clear();
12109 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12110 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12111 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12112 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12114 damagedRects.clear();
12115 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12116 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12118 // Ensure the damaged rect is empty
12119 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12121 // Make the actor translucent
12122 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
12124 application.SendNotification();
12126 // The damaged rect should not be empty
12127 damagedRects.clear();
12128 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12129 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12130 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12131 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12133 damagedRects.clear();
12134 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12135 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12137 // Ensure the damaged rect is empty
12138 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12140 // Change Renderer opacity - also translucent
12141 renderer[DevelRenderer::Property::OPACITY] = 0.2f;
12143 application.SendNotification();
12145 // The damaged rect should not be empty
12146 damagedRects.clear();
12147 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12148 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12149 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12150 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12152 damagedRects.clear();
12153 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12154 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12156 // Ensure the damaged rect is empty
12157 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12159 // Make the actor culled
12160 actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
12162 application.SendNotification();
12164 // The damaged rect should be same
12165 damagedRects.clear();
12166 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12167 DALI_TEST_CHECK(damagedRects.size() > 0);
12168 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12169 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12171 damagedRects.clear();
12172 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12173 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12175 // Ensure the damaged rect is empty
12176 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12178 // Make the actor not culled again
12179 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 16.0f);
12181 application.SendNotification();
12183 // The damaged rect should not be empty
12184 damagedRects.clear();
12185 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12186 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12187 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12188 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12193 int utcDaliActorPartialUpdateChangeParentOpacity(void)
12195 TestApplication application(
12196 TestApplication::DEFAULT_SURFACE_WIDTH,
12197 TestApplication::DEFAULT_SURFACE_HEIGHT,
12198 TestApplication::DEFAULT_HORIZONTAL_DPI,
12199 TestApplication::DEFAULT_VERTICAL_DPI,
12203 tet_infoline("Check the damaged rect with changing parent's opacity");
12205 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12207 Actor parent = Actor::New();
12208 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12209 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12210 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12211 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12212 application.GetScene().Add(parent);
12214 Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
12215 Actor child = CreateRenderableActor(texture);
12216 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12217 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12218 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12221 application.SendNotification();
12223 std::vector<Rect<int>> damagedRects;
12225 // Actor added, damaged rect is added size of actor
12226 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12227 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12230 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12231 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12233 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12234 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12235 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12236 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12237 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12239 damagedRects.clear();
12240 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12241 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12243 damagedRects.clear();
12244 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12245 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12247 // Ensure the damaged rect is empty
12248 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12250 // Change the parent's opacity
12251 parent[Actor::Property::OPACITY] = 0.5f;
12253 application.SendNotification();
12255 // The damaged rect should be same
12256 damagedRects.clear();
12257 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12258 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12259 DALI_TEST_CHECK(damagedRects.size() > 0);
12260 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12265 int utcDaliActorPartialUpdateAddRemoveRenderer(void)
12267 TestApplication application(
12268 TestApplication::DEFAULT_SURFACE_WIDTH,
12269 TestApplication::DEFAULT_SURFACE_HEIGHT,
12270 TestApplication::DEFAULT_HORIZONTAL_DPI,
12271 TestApplication::DEFAULT_VERTICAL_DPI,
12275 tet_infoline("Check the damaged rect with adding / removing renderer");
12277 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12279 Actor actor = CreateRenderableActor();
12280 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12281 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12282 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12283 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12284 application.GetScene().Add(actor);
12286 application.SendNotification();
12288 std::vector<Rect<int>> damagedRects;
12290 // Actor added, damaged rect is added size of actor
12291 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12292 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12295 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12296 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12298 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12299 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12300 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12301 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12302 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12304 damagedRects.clear();
12305 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12306 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12308 damagedRects.clear();
12309 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12310 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12312 // Remove the Renderer
12313 Renderer renderer = actor.GetRendererAt(0);
12314 actor.RemoveRenderer(renderer);
12316 application.SendNotification();
12318 // The damaged rect should be the actor area
12319 damagedRects.clear();
12320 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12321 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12322 DALI_TEST_CHECK(damagedRects.size() > 0);
12323 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
12325 damagedRects.clear();
12326 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12327 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12329 // Ensure the damaged rect is empty
12330 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12332 // Add the Renderer again
12333 actor.AddRenderer(renderer);
12335 application.SendNotification();
12337 // The damaged rect should be the actor area
12338 damagedRects.clear();
12339 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12340 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12341 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12342 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12347 int utcDaliActorPartialUpdate3DTransform(void)
12349 TestApplication application(
12350 TestApplication::DEFAULT_SURFACE_WIDTH,
12351 TestApplication::DEFAULT_SURFACE_HEIGHT,
12352 TestApplication::DEFAULT_HORIZONTAL_DPI,
12353 TestApplication::DEFAULT_VERTICAL_DPI,
12357 tet_infoline("Check the damaged rect with 3D transformed actors");
12359 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12361 Actor actor1 = CreateRenderableActor();
12362 actor1[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12363 actor1[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12364 actor1[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12365 actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12366 application.GetScene().Add(actor1);
12369 Actor actor2 = CreateRenderableActor();
12370 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12371 actor2[Actor::Property::POSITION] = Vector3(160.0f, 160.0f, 0.0f);
12372 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12373 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12374 application.GetScene().Add(actor2);
12376 application.SendNotification();
12378 std::vector<Rect<int>> damagedRects;
12380 // Actor added, damaged rect is added size of actor
12381 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12382 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12385 Rect<int> clippingRect1 = Rect<int>(16, 768, 32, 32); // in screen coordinates
12386 Rect<int> clippingRect2 = Rect<int>(160, 624, 32, 32);
12387 DirtyRectChecker(damagedRects, {clippingRect1, clippingRect2}, true, TEST_LOCATION);
12389 Rect<int> surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12390 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12392 damagedRects.clear();
12393 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12394 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12395 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12397 damagedRects.clear();
12398 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12399 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12400 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12402 // Rotate actor1 on y axis
12403 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
12408 application.SendNotification();
12410 damagedRects.clear();
12411 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12413 // Should update full area
12414 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12415 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12416 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12417 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12419 // Add actor2 again
12420 application.GetScene().Add(actor2);
12422 application.SendNotification();
12424 damagedRects.clear();
12425 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12427 // Should update full area
12428 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12429 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12430 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12431 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12433 // Reset the orientation of actor1
12434 actor1[Actor::Property::ORIENTATION] = Quaternion::IDENTITY;
12436 application.SendNotification();
12438 damagedRects.clear();
12439 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12441 // Should update full area
12442 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12443 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12444 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12445 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12447 // Make actor2 dirty
12448 actor2[Actor::Property::SIZE] = Vector3(32.0f, 32.0f, 0.0f);
12450 application.SendNotification();
12452 damagedRects.clear();
12453 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12455 clippingRect2 = Rect<int>(160, 608, 48, 48);
12456 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12457 DirtyRectChecker(damagedRects, {clippingRect2}, true, TEST_LOCATION);
12459 application.RenderWithPartialUpdate(damagedRects, clippingRect2);
12460 DALI_TEST_EQUALS(clippingRect2.x, glScissorParams.x, TEST_LOCATION);
12461 DALI_TEST_EQUALS(clippingRect2.y, glScissorParams.y, TEST_LOCATION);
12462 DALI_TEST_EQUALS(clippingRect2.width, glScissorParams.width, TEST_LOCATION);
12463 DALI_TEST_EQUALS(clippingRect2.height, glScissorParams.height, TEST_LOCATION);
12468 application.SendNotification();
12470 damagedRects.clear();
12471 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12472 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12473 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12475 // Rotate actor1 on y axis
12476 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
12478 // Add actor1 again
12479 application.GetScene().Add(actor1);
12481 application.SendNotification();
12483 damagedRects.clear();
12484 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12486 // Should update full area
12487 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
12488 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12489 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
12490 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
12495 int utcDaliActorPartialUpdateOneActorMultipleRenderers(void)
12497 TestApplication application(
12498 TestApplication::DEFAULT_SURFACE_WIDTH,
12499 TestApplication::DEFAULT_SURFACE_HEIGHT,
12500 TestApplication::DEFAULT_HORIZONTAL_DPI,
12501 TestApplication::DEFAULT_VERTICAL_DPI,
12505 tet_infoline("Check the damaged rect with one actor which has multiple renderers");
12507 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12509 Actor actor = CreateRenderableActor();
12511 // Create another renderer
12512 Geometry geometry = CreateQuadGeometry();
12513 Shader shader = CreateShader();
12514 Renderer renderer2 = Renderer::New(geometry, shader);
12515 actor.AddRenderer(renderer2);
12517 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12518 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12519 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12520 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12521 application.GetScene().Add(actor);
12523 application.SendNotification();
12525 DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
12527 std::vector<Rect<int>> damagedRects;
12529 // Actor added, damaged rect is added size of actor
12530 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12531 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12534 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12535 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
12537 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12538 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12539 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12540 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12541 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12543 damagedRects.clear();
12544 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12545 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12547 // Ensure the damaged rect is empty
12548 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12550 // Make renderer2 dirty
12551 renderer2[DevelRenderer::Property::OPACITY] = 0.5f;
12553 application.SendNotification();
12555 // The damaged rect should be the actor area
12556 damagedRects.clear();
12557 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12559 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12560 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12561 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12563 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12565 damagedRects.clear();
12566 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12567 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12569 // Ensure the damaged rect is empty
12570 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12572 // Make renderer2 dirty
12573 renderer2[Renderer::Property::FACE_CULLING_MODE] = FaceCullingMode::BACK;
12575 application.SendNotification();
12577 // The damaged rect should be the actor area
12578 damagedRects.clear();
12579 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12581 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12582 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12583 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12585 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12587 damagedRects.clear();
12588 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12589 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12591 // Ensure the damaged rect is empty
12592 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12597 int utcDaliActorPartialUpdateMultipleActorsOneRenderer(void)
12599 TestApplication application(
12600 TestApplication::DEFAULT_SURFACE_WIDTH,
12601 TestApplication::DEFAULT_SURFACE_HEIGHT,
12602 TestApplication::DEFAULT_HORIZONTAL_DPI,
12603 TestApplication::DEFAULT_VERTICAL_DPI,
12607 tet_infoline("Check the damaged rect with multiple actors which share a same renderer");
12609 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12611 Actor actor = CreateRenderableActor();
12612 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12613 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12614 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12615 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12616 application.GetScene().Add(actor);
12618 // Create another actor which has the same renderer with actor1
12619 Actor actor2 = Actor::New();
12620 Renderer renderer = actor.GetRendererAt(0);
12621 actor2.AddRenderer(renderer);
12622 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12623 actor2[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
12624 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
12625 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12626 application.GetScene().Add(actor2);
12628 application.SendNotification();
12630 std::vector<Rect<int>> damagedRects;
12632 // Actor added, damaged rect is added size of actor
12633 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12634 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12637 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12638 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
12640 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12641 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12642 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12643 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12644 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12646 damagedRects.clear();
12647 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12648 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12650 // Ensure the damaged rect is empty
12651 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12653 // Make renderer dirty
12654 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
12656 application.SendNotification();
12658 // The damaged rect should be the actor area
12659 damagedRects.clear();
12660 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12662 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
12663 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
12664 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
12666 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12668 damagedRects.clear();
12669 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12670 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12672 // Ensure the damaged rect is empty
12673 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
12678 int utcDaliActorPartialUpdateUseTextureUpdateArea01(void)
12680 TestApplication application(
12681 TestApplication::DEFAULT_SURFACE_WIDTH,
12682 TestApplication::DEFAULT_SURFACE_HEIGHT,
12683 TestApplication::DEFAULT_HORIZONTAL_DPI,
12684 TestApplication::DEFAULT_VERTICAL_DPI,
12688 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property");
12690 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12692 Actor actor = CreateRenderableActor();
12693 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12694 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
12695 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
12696 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
12697 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12699 // Create a native image source.
12700 TestNativeImagePointer testNativeImage = TestNativeImage::New(64u, 64u);
12701 Texture texture = Texture::New(*testNativeImage);
12702 TextureSet textureSet = TextureSet::New();
12703 textureSet.SetTexture(0u, texture);
12704 actor.GetRendererAt(0).SetTextures(textureSet);
12706 application.GetScene().Add(actor);
12708 application.SendNotification();
12710 std::vector<Rect<int>> damagedRects;
12712 // Actor added, damaged rect is added size of actor
12713 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12714 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12717 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
12718 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12720 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12721 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12722 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12723 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12724 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12726 // Set USE_TEXTURE_UPDATE_AREA
12727 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
12729 // Set updated area of native image
12730 testNativeImage->SetUpdatedArea(Rect<uint32_t>(16, 16, 48, 48));
12732 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12733 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
12735 application.SendNotification();
12737 damagedRects.clear();
12738 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12739 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12740 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12743 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
12744 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12746 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12751 int utcDaliActorPartialUpdateUseTextureUpdateArea02(void)
12753 TestApplication application(
12754 TestApplication::DEFAULT_SURFACE_WIDTH,
12755 TestApplication::DEFAULT_SURFACE_HEIGHT,
12756 TestApplication::DEFAULT_HORIZONTAL_DPI,
12757 TestApplication::DEFAULT_VERTICAL_DPI,
12761 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property and multiple native textures");
12763 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12765 Actor actor = CreateRenderableActor();
12766 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12767 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
12768 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
12769 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
12770 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12772 // Create a native image source.
12773 TestNativeImagePointer testNativeImage1 = TestNativeImage::New(64u, 64u);
12774 Texture texture1 = Texture::New(*testNativeImage1);
12775 TestNativeImagePointer testNativeImage2 = TestNativeImage::New(64u, 64u);
12776 Texture texture2 = Texture::New(*testNativeImage2);
12778 TextureSet textureSet = TextureSet::New();
12779 textureSet.SetTexture(0u, texture1);
12780 textureSet.SetTexture(1u, texture2);
12781 actor.GetRendererAt(0).SetTextures(textureSet);
12783 application.GetScene().Add(actor);
12785 application.SendNotification();
12787 std::vector<Rect<int>> damagedRects;
12789 // Actor added, damaged rect is added size of actor
12790 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12791 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12794 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
12795 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12797 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12798 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12799 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12800 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12801 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12803 // Set USE_TEXTURE_UPDATE_AREA
12804 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
12806 // Set updated area of native image
12807 testNativeImage1->SetUpdatedArea(Rect<uint32_t>(0, 0, 32, 32));
12808 testNativeImage2->SetUpdatedArea(Rect<uint32_t>(32, 0, 32, 32));
12810 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12811 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
12813 application.SendNotification();
12815 damagedRects.clear();
12816 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12817 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12818 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12821 clippingRect = Rect<int>(0, 752, 80, 64); // in screen coordinates
12822 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12824 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12829 int utcDaliActorPartialUpdateUseTextureUpdateArea03(void)
12831 TestApplication application(
12832 TestApplication::DEFAULT_SURFACE_WIDTH,
12833 TestApplication::DEFAULT_SURFACE_HEIGHT,
12834 TestApplication::DEFAULT_HORIZONTAL_DPI,
12835 TestApplication::DEFAULT_VERTICAL_DPI,
12839 tet_infoline("Check the damaged rect with USE_TEXTURE_UPDATE_AREA property and multiple normal textures");
12841 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
12843 uint32_t width = 64, height = 64;
12845 Texture texture1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, width, height);
12846 Texture texture2 = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, width, height);
12847 Actor actor = CreateRenderableActor(texture1);
12848 actor.GetRendererAt(0).GetTextures().SetTexture(1u, texture2);
12850 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12851 actor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
12852 actor[Actor::Property::SIZE] = Vector3(64.0f, 64.0f, 0.0f);
12853 actor[Actor::Property::UPDATE_AREA_HINT] = Vector4(0.0f, 0.0f, 32.0f, 32.0f);
12854 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
12856 application.GetScene().Add(actor);
12858 application.SendNotification();
12860 std::vector<Rect<int>> damagedRects;
12862 // Actor added, damaged rect is added size of actor
12863 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12864 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12867 Rect<int> clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
12868 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12870 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12871 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
12872 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
12873 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
12874 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
12876 // Set USE_TEXTURE_UPDATE_AREA
12877 actor[DevelActor::Property::USE_TEXTURE_UPDATE_AREA] = true;
12879 int bufferSize = width * height * 4;
12880 uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(bufferSize));
12881 PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::Format::RGBA8888, PixelData::FREE);
12884 texture1.Upload(pixelData, 0u, 0u, 0u, 0u, 32u, 32u);
12885 texture2.Upload(pixelData, 0u, 0u, 32u, 0u, 32u, 32u);
12887 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12888 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), false, TEST_LOCATION);
12890 application.SendNotification();
12892 damagedRects.clear();
12893 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12894 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12895 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12898 clippingRect = Rect<int>(0, 752, 80, 64); // in screen coordinates
12899 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12901 DALI_TEST_EQUALS(actor.GetCurrentProperty(DevelActor::Property::USE_TEXTURE_UPDATE_AREA).Get<bool>(), true, TEST_LOCATION);
12903 // Update full area of the texture
12904 texture1.Upload(pixelData);
12906 application.SendNotification();
12908 damagedRects.clear();
12909 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
12910 application.RenderWithPartialUpdate(damagedRects, clippingRect);
12911 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
12914 clippingRect = Rect<int>(0, 736, 80, 80); // in screen coordinates
12915 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
12920 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
12922 TestApplication application;
12924 Actor actor = Actor::New();
12925 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
12926 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
12927 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
12928 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
12929 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
12930 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
12931 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
12932 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
12936 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
12938 TestApplication application;
12940 Actor actor = Actor::New();
12942 // Make sure setting invalid types does not cause a crash
12945 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
12946 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
12947 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
12948 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
12949 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
12950 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
12951 tet_result(TET_PASS);
12955 tet_result(TET_FAIL);
12960 int UtcDaliActorTouchAreaOffsetPropertyP(void)
12962 TestApplication application;
12964 Actor actor = Actor::New();
12965 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
12966 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
12967 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
12968 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
12969 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
12973 int UtcDaliActorTouchAreaOffsetPropertyN(void)
12975 TestApplication application;
12977 Actor actor = Actor::New();
12979 // Make sure setting invalid types does not cause a crash
12982 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
12983 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
12984 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
12985 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
12986 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
12987 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
12988 tet_result(TET_PASS);
12992 tet_result(TET_FAIL);
12997 int UtcDaliActorLowerBelowNegative(void)
12999 TestApplication application;
13000 Dali::Actor instance;
13004 instance.LowerBelow(arg1);
13005 DALI_TEST_CHECK(false); // Should not get here
13009 DALI_TEST_CHECK(true); // We expect an assert
13014 int UtcDaliActorRaiseAboveNegative(void)
13016 TestApplication application;
13017 Dali::Actor instance;
13021 instance.RaiseAbove(arg1);
13022 DALI_TEST_CHECK(false); // Should not get here
13026 DALI_TEST_CHECK(true); // We expect an assert
13031 int UtcDaliActorRaiseToTopNegative(void)
13033 TestApplication application;
13034 Dali::Actor instance;
13037 instance.RaiseToTop();
13038 DALI_TEST_CHECK(false); // Should not get here
13042 DALI_TEST_CHECK(true); // We expect an assert
13047 int UtcDaliActorAddRendererNegative(void)
13049 TestApplication application;
13050 Dali::Actor instance;
13053 Dali::Renderer arg1;
13054 instance.AddRenderer(arg1);
13055 DALI_TEST_CHECK(false); // Should not get here
13059 DALI_TEST_CHECK(true); // We expect an assert
13064 int UtcDaliActorTouchedSignalNegative(void)
13066 TestApplication application;
13067 Dali::Actor instance;
13070 instance.TouchedSignal();
13071 DALI_TEST_CHECK(false); // Should not get here
13075 DALI_TEST_CHECK(true); // We expect an assert
13080 int UtcDaliActorTranslateByNegative(void)
13082 TestApplication application;
13083 Dali::Actor instance;
13086 Dali::Vector3 arg1;
13087 instance.TranslateBy(arg1);
13088 DALI_TEST_CHECK(false); // Should not get here
13092 DALI_TEST_CHECK(true); // We expect an assert
13097 int UtcDaliActorFindChildByIdNegative(void)
13099 TestApplication application;
13100 Dali::Actor instance;
13103 unsigned int arg1 = 0u;
13104 instance.FindChildById(arg1);
13105 DALI_TEST_CHECK(false); // Should not get here
13109 DALI_TEST_CHECK(true); // We expect an assert
13114 int UtcDaliActorGetRendererAtNegative(void)
13116 TestApplication application;
13117 Dali::Actor instance;
13120 unsigned int arg1 = 0u;
13121 instance.GetRendererAt(arg1);
13122 DALI_TEST_CHECK(false); // Should not get here
13126 DALI_TEST_CHECK(true); // We expect an assert
13131 int UtcDaliActorHoveredSignalNegative(void)
13133 TestApplication application;
13134 Dali::Actor instance;
13137 instance.HoveredSignal();
13138 DALI_TEST_CHECK(false); // Should not get here
13142 DALI_TEST_CHECK(true); // We expect an assert
13147 int UtcDaliActorLowerToBottomNegative(void)
13149 TestApplication application;
13150 Dali::Actor instance;
13153 instance.LowerToBottom();
13154 DALI_TEST_CHECK(false); // Should not get here
13158 DALI_TEST_CHECK(true); // We expect an assert
13163 int UtcDaliActorOnSceneSignalNegative(void)
13165 TestApplication application;
13166 Dali::Actor instance;
13169 instance.OnSceneSignal();
13170 DALI_TEST_CHECK(false); // Should not get here
13174 DALI_TEST_CHECK(true); // We expect an assert
13179 int UtcDaliActorOffSceneSignalNegative(void)
13181 TestApplication application;
13182 Dali::Actor instance;
13185 instance.OffSceneSignal();
13186 DALI_TEST_CHECK(false); // Should not get here
13190 DALI_TEST_CHECK(true); // We expect an assert
13195 int UtcDaliActorRemoveRendererNegative01(void)
13197 TestApplication application;
13198 Dali::Actor instance;
13201 unsigned int arg1 = 0u;
13202 instance.RemoveRenderer(arg1);
13203 DALI_TEST_CHECK(false); // Should not get here
13207 DALI_TEST_CHECK(true); // We expect an assert
13212 int UtcDaliActorRemoveRendererNegative02(void)
13214 TestApplication application;
13215 Dali::Actor instance;
13218 Dali::Renderer arg1;
13219 instance.RemoveRenderer(arg1);
13220 DALI_TEST_CHECK(false); // Should not get here
13224 DALI_TEST_CHECK(true); // We expect an assert
13229 int UtcDaliActorFindChildByNameNegative(void)
13231 TestApplication application;
13232 Dali::Actor instance;
13236 instance.FindChildByName(arg1);
13237 DALI_TEST_CHECK(false); // Should not get here
13241 DALI_TEST_CHECK(true); // We expect an assert
13246 int UtcDaliActorSetResizePolicyNegative(void)
13248 TestApplication application;
13249 Dali::Actor instance;
13252 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
13253 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
13254 instance.SetResizePolicy(arg1, arg2);
13255 DALI_TEST_CHECK(false); // Should not get here
13259 DALI_TEST_CHECK(true); // We expect an assert
13264 int UtcDaliActorOnRelayoutSignalNegative(void)
13266 TestApplication application;
13267 Dali::Actor instance;
13270 instance.OnRelayoutSignal();
13271 DALI_TEST_CHECK(false); // Should not get here
13275 DALI_TEST_CHECK(true); // We expect an assert
13280 int UtcDaliActorWheelEventSignalNegative(void)
13282 TestApplication application;
13283 Dali::Actor instance;
13286 instance.WheelEventSignal();
13287 DALI_TEST_CHECK(false); // Should not get here
13291 DALI_TEST_CHECK(true); // We expect an assert
13296 int UtcDaliActorGetHeightForWidthNegative(void)
13298 TestApplication application;
13299 Dali::Actor instance;
13303 instance.GetHeightForWidth(arg1);
13304 DALI_TEST_CHECK(false); // Should not get here
13308 DALI_TEST_CHECK(true); // We expect an assert
13313 int UtcDaliActorGetWidthForHeightNegative(void)
13315 TestApplication application;
13316 Dali::Actor instance;
13320 instance.GetWidthForHeight(arg1);
13321 DALI_TEST_CHECK(false); // Should not get here
13325 DALI_TEST_CHECK(true); // We expect an assert
13330 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
13332 TestApplication application;
13333 Dali::Actor instance;
13336 instance.LayoutDirectionChangedSignal();
13337 DALI_TEST_CHECK(false); // Should not get here
13341 DALI_TEST_CHECK(true); // We expect an assert
13346 int UtcDaliActorAddNegative(void)
13348 TestApplication application;
13349 Dali::Actor instance;
13353 instance.Add(arg1);
13354 DALI_TEST_CHECK(false); // Should not get here
13358 DALI_TEST_CHECK(true); // We expect an assert
13363 int UtcDaliActorLowerNegative(void)
13365 TestApplication application;
13366 Dali::Actor instance;
13370 DALI_TEST_CHECK(false); // Should not get here
13374 DALI_TEST_CHECK(true); // We expect an assert
13379 int UtcDaliActorRaiseNegative(void)
13381 TestApplication application;
13382 Dali::Actor instance;
13386 DALI_TEST_CHECK(false); // Should not get here
13390 DALI_TEST_CHECK(true); // We expect an assert
13395 int UtcDaliActorRemoveNegative(void)
13397 TestApplication application;
13398 Dali::Actor instance;
13402 instance.Remove(arg1);
13403 DALI_TEST_CHECK(false); // Should not get here
13407 DALI_TEST_CHECK(true); // We expect an assert
13412 int UtcDaliActorScaleByNegative(void)
13414 TestApplication application;
13415 Dali::Actor instance;
13418 Dali::Vector3 arg1;
13419 instance.ScaleBy(arg1);
13420 DALI_TEST_CHECK(false); // Should not get here
13424 DALI_TEST_CHECK(true); // We expect an assert
13429 int UtcDaliActorGetLayerNegative(void)
13431 TestApplication application;
13432 Dali::Actor instance;
13435 instance.GetLayer();
13436 DALI_TEST_CHECK(false); // Should not get here
13440 DALI_TEST_CHECK(true); // We expect an assert
13445 int UtcDaliActorRotateByNegative01(void)
13447 TestApplication application;
13448 Dali::Actor instance;
13451 Dali::Quaternion arg1;
13452 instance.RotateBy(arg1);
13453 DALI_TEST_CHECK(false); // Should not get here
13457 DALI_TEST_CHECK(true); // We expect an assert
13462 int UtcDaliActorRotateByNegative02(void)
13464 TestApplication application;
13465 Dali::Actor instance;
13469 Dali::Vector3 arg2;
13470 instance.RotateBy(arg1, arg2);
13471 DALI_TEST_CHECK(false); // Should not get here
13475 DALI_TEST_CHECK(true); // We expect an assert
13480 int UtcDaliActorUnparentNegative(void)
13482 TestApplication application;
13483 Dali::Actor instance;
13486 instance.Unparent();
13487 DALI_TEST_CHECK(false); // Should not get here
13491 DALI_TEST_CHECK(true); // We expect an assert
13496 int UtcDaliActorGetChildAtNegative(void)
13498 TestApplication application;
13499 Dali::Actor instance;
13502 unsigned int arg1 = 0u;
13503 instance.GetChildAt(arg1);
13504 DALI_TEST_CHECK(false); // Should not get here
13508 DALI_TEST_CHECK(true); // We expect an assert
13513 int UtcDaliActorGetChildCountNegative(void)
13515 TestApplication application;
13516 Dali::Actor instance;
13519 instance.GetChildCount();
13520 DALI_TEST_CHECK(false); // Should not get here
13524 DALI_TEST_CHECK(true); // We expect an assert
13529 int UtcDaliActorGetTargetSizeNegative(void)
13531 TestApplication application;
13532 Dali::Actor instance;
13535 instance.GetTargetSize();
13536 DALI_TEST_CHECK(false); // Should not get here
13540 DALI_TEST_CHECK(true); // We expect an assert
13545 int UtcDaliActorScreenToLocalNegative(void)
13547 TestApplication application;
13548 Dali::Actor instance;
13555 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
13556 DALI_TEST_CHECK(false); // Should not get here
13560 DALI_TEST_CHECK(true); // We expect an assert
13565 int UtcDaliActorGetNaturalSizeNegative(void)
13567 TestApplication application;
13568 Dali::Actor instance;
13571 instance.GetNaturalSize();
13572 DALI_TEST_CHECK(false); // Should not get here
13576 DALI_TEST_CHECK(true); // We expect an assert
13581 int UtcDaliActorGetRelayoutSizeNegative(void)
13583 TestApplication application;
13584 Dali::Actor instance;
13587 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
13588 instance.GetRelayoutSize(arg1);
13589 DALI_TEST_CHECK(false); // Should not get here
13593 DALI_TEST_CHECK(true); // We expect an assert
13598 int UtcDaliActorGetResizePolicyNegative(void)
13600 TestApplication application;
13601 Dali::Actor instance;
13604 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
13605 instance.GetResizePolicy(arg1);
13606 DALI_TEST_CHECK(false); // Should not get here
13610 DALI_TEST_CHECK(true); // We expect an assert
13615 int UtcDaliActorGetRendererCountNegative(void)
13617 TestApplication application;
13618 Dali::Actor instance;
13621 instance.GetRendererCount();
13622 DALI_TEST_CHECK(false); // Should not get here
13626 DALI_TEST_CHECK(true); // We expect an assert
13631 int UtcDaliActorGetParentNegative(void)
13633 TestApplication application;
13634 Dali::Actor instance;
13637 instance.GetParent();
13638 DALI_TEST_CHECK(false); // Should not get here
13642 DALI_TEST_CHECK(true); // We expect an assert
13647 int UtcDaliActorPropertyBlendEquation(void)
13649 TestApplication application;
13651 tet_infoline("Test SetProperty AdvancedBlendEquation");
13653 Geometry geometry = CreateQuadGeometry();
13654 Shader shader = CreateShader();
13655 Renderer renderer1 = Renderer::New(geometry, shader);
13657 Actor actor = Actor::New();
13658 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
13660 actor.AddRenderer(renderer1);
13661 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
13662 application.GetScene().Add(actor);
13664 if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
13666 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
13667 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
13668 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
13671 if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
13673 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
13674 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
13675 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
13678 Renderer renderer2 = Renderer::New(geometry, shader);
13679 actor.AddRenderer(renderer2);
13684 int UtcDaliActorRegisterProperty(void)
13686 tet_infoline("Test property registration and uniform map update\n");
13688 TestApplication application;
13690 Geometry geometry = CreateQuadGeometry();
13691 Shader shader = CreateShader();
13692 Renderer renderer1 = Renderer::New(geometry, shader);
13693 Renderer renderer2 = Renderer::New(geometry, shader);
13695 Actor actor1 = Actor::New();
13696 actor1.AddRenderer(renderer1);
13697 actor1.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
13698 actor1.RegisterProperty("uCustom", 1);
13699 application.GetScene().Add(actor1);
13701 Actor actor2 = Actor::New();
13702 actor2.AddRenderer(renderer2);
13703 actor2.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
13704 application.GetScene().Add(actor2);
13706 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
13707 TraceCallStack& callStack = glAbstraction.GetSetUniformTrace();
13708 glAbstraction.EnableSetUniformCallTrace(true);
13710 application.SendNotification();
13711 application.Render();
13713 std::stringstream out;
13715 std::string params;
13717 // Test uniform value of the custom property
13718 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
13719 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
13722 actor1[Actor::Property::VISIBLE] = false;
13724 application.SendNotification();
13725 application.Render();
13727 // Make visible again
13728 actor1[Actor::Property::VISIBLE] = true;
13729 actor1["uCustom"] = 2;
13731 glAbstraction.ResetSetUniformCallStack();
13733 application.SendNotification();
13734 application.Render();
13738 // The uniform value should not be changed
13739 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
13740 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
13745 int UtcDaliActorDoesWantedHitTest(void)
13750 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
13752 mTouchPoint(touchPoint),
13758 Vector2 mTouchPoint;
13762 TestApplication application;
13763 tet_infoline(" UtcDaliActorDoesWantedHitTest");
13765 // Fill a vector with different hit tests.
13766 struct HitTestData* hitTestData[] = {
13767 // scale touch point result
13768 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
13769 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
13770 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.
13771 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
13772 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.
13776 // get the root layer
13777 Actor actor = Actor::New();
13778 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
13779 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
13781 Actor lowerActor = Actor::New();
13782 lowerActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
13783 lowerActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
13785 // actor and lowerActor have no relationship.
13786 application.GetScene().Add(lowerActor);
13787 application.GetScene().Add(actor);
13789 ResetTouchCallbacks();
13790 gHitTestTouchCallBackCalled = false;
13792 unsigned int index = 0;
13793 while(NULL != hitTestData[index])
13795 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
13796 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
13798 lowerActor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
13799 lowerActor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
13801 // flush the queue and render once
13802 application.SendNotification();
13803 application.Render();
13805 DALI_TEST_CHECK(!gTouchCallBackCalled);
13806 DALI_TEST_CHECK(!gTouchCallBackCalled2);
13807 DALI_TEST_CHECK(!gHitTestTouchCallBackCalled);
13809 // connect to its touch signal
13810 actor.TouchedSignal().Connect(TestTouchCallback);
13811 lowerActor.TouchedSignal().Connect(TestTouchCallback2);
13813 // connect to its hit-test signal
13814 Dali::DevelActor::HitTestResultSignal(actor).Connect(TestHitTestTouchCallback);
13816 Dali::Integration::Point point;
13817 point.SetState(PointState::DOWN);
13818 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
13819 Dali::Integration::TouchEvent event;
13820 event.AddPoint(point);
13822 // flush the queue and render once
13823 application.SendNotification();
13824 application.Render();
13825 application.ProcessEvent(event);
13827 // check hit-test events
13828 DALI_TEST_CHECK(gHitTestTouchCallBackCalled == hitTestData[index]->mResult);
13829 // Passed all hit-tests of actor.
13830 DALI_TEST_CHECK(gTouchCallBackCalled == false);
13831 // The lowerActor was hit-tested.
13832 DALI_TEST_CHECK(gTouchCallBackCalled2 == hitTestData[index]->mResult);
13834 if(gTouchCallBackCalled2 != hitTestData[index]->mResult)
13835 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
13836 hitTestData[index]->mScale.x,
13837 hitTestData[index]->mScale.y,
13838 hitTestData[index]->mScale.z,
13839 hitTestData[index]->mTouchPoint.x,
13840 hitTestData[index]->mTouchPoint.y,
13841 hitTestData[index]->mResult);
13843 ResetTouchCallbacks();
13844 gHitTestTouchCallBackCalled = false;
13850 int UtcDaliActorAllowOnlyOwnTouchPropertyP(void)
13852 TestApplication application;
13854 Actor actor = Actor::New();
13855 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), false, TEST_LOCATION);
13856 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, true);
13857 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), true, TEST_LOCATION);
13858 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), Property::BOOLEAN, TEST_LOCATION);
13859 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), true, TEST_LOCATION);
13860 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
13861 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
13862 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), "allowOnlyOwnTouch", TEST_LOCATION);
13866 int UtcDaliActorAllowOnlyOwnTouchPropertyN(void)
13868 TestApplication application;
13870 Actor actor = Actor::New();
13872 // Make sure setting invalid types does not cause a crash
13875 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, 1.0f);
13876 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector2::ONE);
13877 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector3::ONE);
13878 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector4::ONE);
13879 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Map());
13880 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Array());
13881 tet_result(TET_PASS);
13885 tet_result(TET_FAIL);
13890 int UtcDaliActorCalculateWorldTransform01(void)
13892 TestApplication application;
13894 tet_infoline("Test that actor position inheritance produces right transform matrix");
13896 Actor rootActor = Actor::New();
13897 Actor branchActor = Actor::New();
13898 Actor leafActor = Actor::New();
13900 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13901 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
13902 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
13904 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13905 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13906 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13908 // Set anchor point to the same value as parent origin
13909 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
13910 branchActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
13911 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
13913 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13914 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13915 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13917 application.GetScene().Add(rootActor);
13918 rootActor.Add(branchActor);
13919 branchActor.Add(leafActor);
13921 application.SendNotification();
13922 application.Render(0);
13923 application.SendNotification();
13924 application.Render(0);
13926 Matrix m = DevelActor::GetWorldTransform(leafActor);
13928 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
13929 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
13932 Vector3 worldScale;
13933 Quaternion worldRotation;
13934 m.GetTransformComponents(worldPos, worldRotation, worldScale);
13935 DALI_TEST_EQUALS(worldPos, Vector3(200.0f, 150.0f, 30.0f), 0.0001f, TEST_LOCATION);
13940 int UtcDaliActorCalculateWorldTransform02(void)
13942 TestApplication application;
13944 tet_infoline("Test that actor position produces right transform matrix");
13946 Actor rootActor = Actor::New();
13947 Actor branchActor = Actor::New();
13948 Actor leafActor = Actor::New();
13950 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13951 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
13952 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
13954 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13955 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13956 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13958 // Set anchor point to the same value as parent origin
13959 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13960 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13961 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
13963 application.GetScene().Add(rootActor);
13964 rootActor.Add(branchActor);
13965 branchActor.Add(leafActor);
13967 leafActor[Actor::Property::INHERIT_POSITION] = false;
13968 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
13969 leafActor[Actor::Property::INHERIT_SCALE] = false;
13971 application.SendNotification();
13972 application.Render(0);
13973 application.SendNotification();
13974 application.Render(0);
13976 Matrix m = DevelActor::GetWorldTransform(leafActor);
13978 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
13979 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
13984 int UtcDaliActorCalculateWorldTransform03(void)
13986 TestApplication application;
13988 tet_infoline("Test that actor position produces right transform matrix");
13990 Actor rootActor = Actor::New();
13991 Actor branchActor = Actor::New();
13992 Actor leafActor = Actor::New();
13994 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
13995 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
13996 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
13998 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
13999 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14000 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14002 // Set anchor point to the same value as parent origin
14003 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14004 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14005 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14007 application.GetScene().Add(rootActor);
14008 rootActor.Add(branchActor);
14009 branchActor.Add(leafActor);
14011 leafActor[Actor::Property::INHERIT_POSITION] = true;
14012 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
14013 leafActor[Actor::Property::INHERIT_SCALE] = false;
14015 application.SendNotification();
14016 application.Render(0);
14017 application.SendNotification();
14018 application.Render(0);
14020 Matrix m = DevelActor::GetWorldTransform(leafActor);
14022 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14023 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14028 int UtcDaliActorCalculateWorldTransform04(void)
14030 TestApplication application;
14032 tet_infoline("Test that actor inheritance scale/orientation produces right transform matrix");
14034 Actor rootActor = Actor::New();
14035 Actor branchActor = Actor::New();
14036 Actor leafActor = Actor::New();
14038 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14039 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14040 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14042 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14043 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14044 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14046 // Set anchor point to the same value as parent origin
14047 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14048 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14049 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14050 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14052 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14053 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14055 application.GetScene().Add(rootActor);
14056 rootActor.Add(branchActor);
14057 branchActor.Add(leafActor);
14059 application.SendNotification();
14060 application.Render(0);
14061 application.SendNotification();
14062 application.Render(0);
14064 Matrix m = DevelActor::GetWorldTransform(leafActor);
14066 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14067 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14072 int UtcDaliActorCalculateWorldTransform05(void)
14074 TestApplication application;
14076 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14078 Actor rootActor = Actor::New();
14079 Actor branchActor = Actor::New();
14080 Actor leafActor = Actor::New();
14082 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14083 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14084 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14086 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14087 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14088 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14090 // Set anchor point to the same value as parent origin
14091 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14092 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14093 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14094 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14096 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
14097 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14099 leafActor[Actor::Property::INHERIT_POSITION] = false;
14100 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
14102 application.GetScene().Add(rootActor);
14103 rootActor.Add(branchActor);
14104 branchActor.Add(leafActor);
14106 application.SendNotification();
14107 application.Render(0);
14108 application.SendNotification();
14109 application.Render(0);
14111 Matrix m = DevelActor::GetWorldTransform(leafActor);
14113 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14114 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14119 int UtcDaliActorCalculateWorldTransform06(void)
14121 TestApplication application;
14123 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14125 Actor rootActor = Actor::New();
14126 Actor branchActor = Actor::New();
14127 Actor leafActor = Actor::New();
14129 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14130 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14131 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14133 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14134 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14135 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14137 // Set anchor point to the same value as parent origin
14138 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14139 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14140 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14141 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14143 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
14144 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
14145 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14147 leafActor[Actor::Property::INHERIT_POSITION] = false;
14148 leafActor[Actor::Property::INHERIT_SCALE] = false;
14150 application.GetScene().Add(rootActor);
14151 rootActor.Add(branchActor);
14152 branchActor.Add(leafActor);
14154 application.SendNotification();
14155 application.Render(0);
14156 application.SendNotification();
14157 application.Render(0);
14159 Matrix m = DevelActor::GetWorldTransform(leafActor);
14161 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14162 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14167 int UtcDaliActorCalculateWorldTransform07(void)
14169 TestApplication application;
14171 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14173 Actor rootActor = Actor::New();
14174 Actor branchActor = Actor::New();
14175 Actor leafActor = Actor::New();
14177 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14178 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14179 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14181 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14182 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14183 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14185 // Set anchor point to the same value as parent origin
14186 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14187 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14188 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
14190 // This should be ignored.
14191 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14192 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14194 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
14195 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
14196 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
14198 leafActor[Actor::Property::INHERIT_POSITION] = false;
14199 leafActor[Actor::Property::INHERIT_SCALE] = false;
14200 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = false;
14202 application.GetScene().Add(rootActor);
14203 rootActor.Add(branchActor);
14204 branchActor.Add(leafActor);
14206 application.SendNotification();
14207 application.Render(0);
14208 application.SendNotification();
14209 application.Render(0);
14211 Matrix m = DevelActor::GetWorldTransform(leafActor);
14213 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14214 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
14219 int UtcDaliActorCalculateWorldTransform08(void)
14221 TestApplication application;
14223 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
14225 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)};
14233 TestCase testCases[] = {
14234 {false, false, true},
14235 {false, true, false},
14236 {true, false, false},
14237 {false, true, true},
14238 {true, false, true},
14239 {true, true, false},
14240 {false, false, false},
14241 {true, true, true},
14244 Actor rootActor = Actor::New();
14245 Actor leafActor = Actor::New();
14247 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
14248 rootActor[Actor::Property::SCALE] = Vector3(1.0f, 2.0f, 1.0f);
14249 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14250 rootActor[Actor::Property::SIZE] = Vector2(200, 400);
14251 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14252 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14254 leafActor[Actor::Property::POSITION] = Vector3(0.0f, -50.0f, 0.0f);
14255 leafActor[Actor::Property::SCALE] = Vector3(1.0f, 1.0f, 1.0f);
14256 leafActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14257 leafActor[Actor::Property::SIZE] = Vector2(200, 400);
14258 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_CENTER;
14259 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_CENTER;
14260 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
14262 application.GetScene().Add(rootActor);
14263 rootActor.Add(leafActor);
14265 for(uint32_t i = 0; i < 8; ++i)
14267 leafActor[Actor::Property::INHERIT_POSITION] = testCases[i].translation;
14268 leafActor[Actor::Property::INHERIT_ORIENTATION] = testCases[i].rotation;
14269 leafActor[Actor::Property::INHERIT_SCALE] = testCases[i].scaling;
14271 application.SendNotification();
14272 application.Render(0);
14273 application.SendNotification();
14274 application.Render(0);
14276 Matrix m = DevelActor::GetWorldTransform(leafActor);
14277 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
14279 Vector3 worldPosition1 = Vector3(m.GetTranslation());
14280 Vector3 worldPosition2 = Vector3(actualMatrix.GetTranslation());
14282 DALI_TEST_EQUALS(solutions[i], worldPosition1, 0.001f, TEST_LOCATION);
14283 DALI_TEST_EQUALS(solutions[i], worldPosition2, 0.001f, TEST_LOCATION);
14289 int UtcDaliActorCalculateWorldColor01(void)
14291 TestApplication application;
14293 tet_infoline("Test that actor inheritance of color produces right final color");
14295 Actor rootActor = Actor::New();
14296 Actor branchActor = Actor::New();
14297 Actor leafActor = Actor::New();
14299 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14300 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14301 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14303 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14304 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14305 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14307 rootActor[Actor::Property::COLOR] = Color::WHITE;
14308 Vector4 testColor1(1.0f, 1.0f, 0.5f, 0.8f);
14309 branchActor[Actor::Property::COLOR] = testColor1;
14310 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14312 // Default is to inherit:
14313 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_ALPHA;
14315 application.GetScene().Add(rootActor);
14316 rootActor.Add(branchActor);
14317 branchActor.Add(leafActor);
14319 application.SendNotification();
14320 application.Render(16);
14321 Vector4 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14322 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14324 application.SendNotification();
14325 application.Render(16);
14326 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14327 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14329 application.SendNotification();
14330 application.Render(16);
14331 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
14332 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
14334 color = DevelActor::GetWorldColor(leafActor);
14336 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14337 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14342 int UtcDaliActorCalculateWorldColor02(void)
14344 TestApplication application;
14346 tet_infoline("Test that actor uses own color");
14348 Actor rootActor = Actor::New();
14349 Actor branchActor = Actor::New();
14350 Actor leafActor = Actor::New();
14352 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14353 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14354 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14356 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14357 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14358 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14360 rootActor[Actor::Property::COLOR] = Color::WHITE;
14361 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14362 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14364 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_COLOR;
14366 application.GetScene().Add(rootActor);
14367 rootActor.Add(branchActor);
14368 branchActor.Add(leafActor);
14370 application.SendNotification();
14371 application.Render(0);
14373 Vector4 color = DevelActor::GetWorldColor(leafActor);
14375 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14376 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14377 DALI_TEST_EQUALS(color, Vector4(0.1f, 0.5f, 0.5f, 0.8f), 0.001f, TEST_LOCATION);
14381 int UtcDaliActorCalculateWorldColor03(void)
14383 TestApplication application;
14385 tet_infoline("Test that actor uses parent color");
14387 Actor rootActor = Actor::New();
14388 Actor branchActor = Actor::New();
14389 Actor leafActor = Actor::New();
14391 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14392 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14393 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14395 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14396 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14397 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14399 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
14400 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14401 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14403 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_PARENT_COLOR;
14405 application.GetScene().Add(rootActor);
14406 rootActor.Add(branchActor);
14407 branchActor.Add(leafActor);
14409 application.SendNotification();
14410 application.Render(0);
14412 Vector4 color = DevelActor::GetWorldColor(leafActor);
14414 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14415 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14416 DALI_TEST_EQUALS(color, Vector4(1.0f, 1.0f, 0.5f, 0.72f), 0.001f, TEST_LOCATION);
14420 int UtcDaliActorCalculateWorldColor04(void)
14422 TestApplication application;
14424 tet_infoline("Test that actor blends with parent color");
14426 Actor rootActor = Actor::New();
14427 Actor branchActor = Actor::New();
14428 Actor leafActor = Actor::New();
14430 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14431 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
14432 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
14434 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14435 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14436 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
14438 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
14439 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
14440 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
14442 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR;
14444 application.GetScene().Add(rootActor);
14445 rootActor.Add(branchActor);
14446 branchActor.Add(leafActor);
14448 application.SendNotification();
14449 application.Render(0);
14451 Vector4 color = DevelActor::GetWorldColor(leafActor);
14453 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
14454 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
14459 int UtcDaliActorCalculateLookAt(void)
14461 TestApplication application;
14463 tet_infoline("Test that actor rotate right value of orientation");
14465 Actor actor = Actor::New();
14467 actor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
14468 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14469 actor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14471 application.GetScene().Add(actor);
14473 application.SendNotification();
14474 application.Render(0);
14476 Quaternion actorQuaternion;
14478 tet_printf("Test with target only\n");
14479 Dali::DevelActor::LookAt(actor, Vector3::ZERO);
14480 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14481 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
14483 tet_printf("Test with target + up\n");
14484 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::ZAXIS);
14485 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14486 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::XAXIS) * Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
14488 tet_printf("Test with target + up + localForward\n");
14489 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_XAXIS);
14490 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14491 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(180.0f)), Vector3::XAXIS), TEST_LOCATION);
14493 tet_printf("Test with target + up + localForward + localUp\n");
14494 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_YAXIS, Vector3::XAXIS);
14495 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14496 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_ZAXIS), TEST_LOCATION);
14498 // Reset quaternion
14499 actor[Actor::Property::ORIENTATION] = Quaternion();
14501 Actor actor2 = Actor::New();
14502 actor2[Actor::Property::POSITION] = Vector3(0.0f, 50.0f, -10.0f);
14503 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
14504 actor2[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
14507 tet_printf("Test whether lookat calculate well by using event side values only\n");
14508 Dali::DevelActor::LookAt(actor2, Vector3(100.0f, 50.0f, 1.0f));
14509 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14510 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
14512 actor[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0f)), Vector3::ZAXIS);
14514 DALI_TEST_EQUALS(Dali::DevelActor::GetWorldTransform(actor2).GetTranslation3(), Vector3(50.0f, 0.0f, -10.0f), TEST_LOCATION);
14516 tet_printf("Test whether lookat calculate well inherit by parent orientation\n");
14517 Dali::DevelActor::LookAt(actor2, Vector3(50.0f, 0.0f, 1.0f), Vector3::NEGATIVE_XAXIS);
14518 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
14519 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
14524 int UtcDaliActorIsHittable(void)
14526 TestApplication application;
14528 Actor parent = Actor::New();
14529 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
14530 parent.SetProperty(Actor::Property::COLOR, parentColor);
14531 application.GetScene().Add(parent);
14533 Actor actor = Actor::New();
14534 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
14535 actor.SetProperty(Actor::Property::COLOR, childColor);
14538 actor.SetProperty(Actor::Property::SENSITIVE, true);
14539 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
14540 actor.SetProperty(Actor::Property::VISIBLE, true);
14542 application.SendNotification();
14543 application.Render();
14545 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == true);
14547 actor.SetProperty(Actor::Property::SENSITIVE, false);
14548 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14549 actor.SetProperty(Actor::Property::SENSITIVE, true);
14551 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
14552 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14553 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
14555 actor.SetProperty(Actor::Property::VISIBLE, false);
14556 application.SendNotification();
14557 application.Render();
14558 DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
14563 int UtcDaliActorGetTouchRequired(void)
14565 TestApplication application;
14567 Actor actor = Actor::New();
14568 DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == false);
14570 actor.TouchedSignal().Connect(TestTouchCallback);
14571 DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == true);
14576 int UtcDaliActorDispatchTouchMotionPropertyP(void)
14578 TestApplication application;
14580 Actor actor = Actor::New();
14581 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION).Get<bool>(), true, TEST_LOCATION);
14582 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, false);
14583 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION).Get<bool>(), false, TEST_LOCATION);
14584 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::DISPATCH_TOUCH_MOTION), Property::BOOLEAN, TEST_LOCATION);
14585 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::DISPATCH_TOUCH_MOTION), true, TEST_LOCATION);
14586 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::DISPATCH_TOUCH_MOTION), false, TEST_LOCATION);
14587 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::DISPATCH_TOUCH_MOTION), false, TEST_LOCATION);
14588 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::DISPATCH_TOUCH_MOTION), "dispatchTouchMotion", TEST_LOCATION);
14592 int UtcDaliActorDispatchTouchMotionPropertyN(void)
14594 TestApplication application;
14596 Actor actor = Actor::New();
14598 // Make sure setting invalid types does not cause a crash
14601 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, 1.0f);
14602 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector2::ONE);
14603 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector3::ONE);
14604 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Vector4::ONE);
14605 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Property::Map());
14606 actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, Property::Array());
14607 tet_result(TET_PASS);
14611 tet_result(TET_FAIL);
14616 int UtcDaliActorDispatchHoverMotionPropertyP(void)
14618 TestApplication application;
14620 Actor actor = Actor::New();
14621 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION).Get<bool>(), true, TEST_LOCATION);
14622 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, false);
14623 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION).Get<bool>(), false, TEST_LOCATION);
14624 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::DISPATCH_HOVER_MOTION), Property::BOOLEAN, TEST_LOCATION);
14625 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::DISPATCH_HOVER_MOTION), true, TEST_LOCATION);
14626 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::DISPATCH_HOVER_MOTION), false, TEST_LOCATION);
14627 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::DISPATCH_HOVER_MOTION), false, TEST_LOCATION);
14628 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::DISPATCH_HOVER_MOTION), "dispatchHoverMotion", TEST_LOCATION);
14632 int UtcDaliActorDispatchHoverMotionPropertyN(void)
14634 TestApplication application;
14636 Actor actor = Actor::New();
14638 // Make sure setting invalid types does not cause a crash
14641 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, 1.0f);
14642 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector2::ONE);
14643 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector3::ONE);
14644 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Vector4::ONE);
14645 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Property::Map());
14646 actor.SetProperty(DevelActor::Property::DISPATCH_HOVER_MOTION, Property::Array());
14647 tet_result(TET_PASS);
14651 tet_result(TET_FAIL);