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>
31 #include <cfloat> // For FLT_MAX
32 #include <set> // For std::multiset
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 bool TestCallback3(Actor actor, const HoverEvent& event)
133 gHoverCallBackCalled = true;
138 // validation stuff for onstage & offstage signals
139 static std::vector<std::string> gActorNamesOnOffScene;
140 static int gOnSceneCallBackCalled;
141 void OnSceneCallback(Actor actor)
143 ++gOnSceneCallBackCalled;
144 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
145 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
147 static int gOffSceneCallBackCalled;
148 void OffSceneCallback(Actor actor)
150 ++gOffSceneCallBackCalled;
151 gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
152 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
155 struct PositionComponentConstraint
157 PositionComponentConstraint()
161 void operator()(Vector3& pos, const PropertyInputContainer& inputs)
163 const Matrix& m = inputs[0]->GetMatrix();
166 m.GetTransformComponents(pos, rot, scale);
170 struct OrientationComponentConstraint
172 OrientationComponentConstraint()
176 void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
178 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
181 orientation = parentOrientation;
186 static bool gOnRelayoutCallBackCalled = false;
187 static std::vector<std::string> gActorNamesRelayout;
189 void OnRelayoutCallback(Actor actor)
191 gOnRelayoutCallBackCalled = true;
192 gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
195 struct VisibilityChangedFunctorData
197 VisibilityChangedFunctorData()
200 type(DevelActor::VisibilityChange::SELF),
209 type = DevelActor::VisibilityChange::SELF;
213 void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
215 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
216 DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
217 DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
218 DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
221 void Check(bool compareCalled, const std::string& location)
223 DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
228 DevelActor::VisibilityChange::Type type;
232 struct VisibilityChangedFunctor
234 VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
239 void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
242 data.visible = visible;
247 VisibilityChangedFunctorData& data;
250 struct VisibilityChangedVoidFunctor
252 VisibilityChangedVoidFunctor(bool& signalCalled)
253 : mSignalCalled(signalCalled)
259 mSignalCalled = true;
265 struct ChildOrderChangedFunctor
267 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
268 : mSignalCalled(signalCalled),
273 void operator()(Actor actor)
275 mSignalCalled = true;
283 struct CulledPropertyNotificationFunctor
285 CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
286 : mSignalCalled(signalCalled),
287 mPropertyNotification(propertyNotification)
291 void operator()(PropertyNotification& source)
293 mSignalCalled = true;
294 mPropertyNotification = source;
298 PropertyNotification& mPropertyNotification;
301 // Check dirtyRect is equal with expected multiset.
302 // Note that the order of damagedRect is not important
305 bool operator()(const Rect<int>& lhs, const Rect<int>& rhs) const
309 return lhs.x < rhs.x;
313 return lhs.y < rhs.y;
315 if(lhs.width != rhs.width)
317 return lhs.width < rhs.width;
319 return lhs.height < rhs.height;
323 void DirtyRectChecker(const std::vector<Rect<int>>& damagedRects, std::multiset<Rect<int>, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation)
325 // Just check damagedRect contain all expectRectList.
326 DALI_TEST_GREATER(damagedRects.size() + 1u, expectedRectList.size(), testLocation);
328 for(auto& rect : damagedRects)
330 auto iter = expectedRectList.find(rect);
331 if(iter != expectedRectList.end())
333 expectedRectList.erase(iter);
335 else if(checkRectsExact)
337 std::ostringstream o;
338 o << rect << " exist in expectRectList" << std::endl;
339 fprintf(stderr, "Test failed in %s, checking %s", testLocation, o.str().c_str());
340 tet_result(TET_FAIL);
344 // Check all rects are matched
345 DALI_TEST_EQUALS(expectedRectList.empty(), true, testLocation);
348 // Clipping test helper functions:
349 Actor CreateActorWithContent(uint32_t width, uint32_t height)
351 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
352 Actor actor = CreateRenderableActor(image);
354 // Setup dimensions and position so actor is not skipped by culling.
355 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
356 actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
357 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
358 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
363 Actor CreateActorWithContent16x16()
365 return CreateActorWithContent(16, 16);
368 void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& callTrace)
370 enabledDisableTrace.Reset();
372 enabledDisableTrace.Enable(true);
373 callTrace.Enable(true);
375 application.SendNotification();
376 application.Render();
378 enabledDisableTrace.Enable(false);
379 callTrace.Enable(false);
382 void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
384 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
386 DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
387 DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
388 DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
390 // @todo only test alpha if the framebuffer has an alpha channel
391 //DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
394 } // anonymous namespace
396 //& purpose: Testing New API
397 int UtcDaliActorNew(void)
399 TestApplication application;
401 Actor actor = Actor::New();
403 DALI_TEST_CHECK(actor);
407 //& purpose: Testing Dali::Actor::DownCast()
408 int UtcDaliActorDownCastP(void)
410 TestApplication application;
411 tet_infoline("Testing Dali::Actor::DownCast()");
413 Actor actor = Actor::New();
414 BaseHandle object(actor);
415 Actor actor2 = Actor::DownCast(object);
416 DALI_TEST_CHECK(actor2);
420 //& purpose: Testing Dali::Actor::DownCast()
421 int UtcDaliActorDownCastN(void)
423 TestApplication application;
424 tet_infoline("Testing Dali::Actor::DownCast()");
426 BaseHandle unInitializedObject;
427 Actor actor = Actor::DownCast(unInitializedObject);
428 DALI_TEST_CHECK(!actor);
432 int UtcDaliActorMoveConstructor(void)
434 TestApplication application;
436 Actor actor = Actor::New();
437 DALI_TEST_CHECK(actor);
439 int id = actor.GetProperty<int>(Actor::Property::ID);
441 Actor moved = std::move(actor);
442 DALI_TEST_CHECK(moved);
443 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
444 DALI_TEST_CHECK(!actor);
449 int UtcDaliActorMoveAssignment(void)
451 TestApplication application;
453 Actor actor = Actor::New();
454 DALI_TEST_CHECK(actor);
456 int id = actor.GetProperty<int>(Actor::Property::ID);
459 moved = std::move(actor);
460 DALI_TEST_CHECK(moved);
461 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
462 DALI_TEST_CHECK(!actor);
467 //& purpose: Testing Dali::Actor::GetName()
468 int UtcDaliActorGetName(void)
470 TestApplication application;
472 Actor actor = Actor::New();
474 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
478 //& purpose: Testing Dali::Actor::SetName()
479 int UtcDaliActorSetName(void)
481 TestApplication application;
483 string str("ActorName");
484 Actor actor = Actor::New();
486 actor.SetProperty(Actor::Property::NAME, str);
487 DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
491 int UtcDaliActorGetId(void)
493 tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
494 TestApplication application;
496 Actor first = Actor::New();
497 Actor second = Actor::New();
498 Actor third = Actor::New();
500 DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
501 DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
505 int UtcDaliActorIsRoot(void)
507 TestApplication application;
509 Actor actor = Actor::New();
510 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
512 // get the root layer
513 actor = application.GetScene().GetLayer(0);
514 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
518 int UtcDaliActorOnScene(void)
520 TestApplication application;
522 Actor actor = Actor::New();
523 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
525 // get the root layer
526 actor = application.GetScene().GetLayer(0);
527 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
531 int UtcDaliActorIsLayer(void)
533 TestApplication application;
535 Actor actor = Actor::New();
536 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
538 // get the root layer
539 actor = application.GetScene().GetLayer(0);
540 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
544 int UtcDaliActorGetLayer(void)
546 TestApplication application;
548 Actor actor = Actor::New();
549 application.GetScene().Add(actor);
550 Layer layer = actor.GetLayer();
552 DALI_TEST_CHECK(layer);
554 // get the root layers layer
555 actor = application.GetScene().GetLayer(0);
556 DALI_TEST_CHECK(actor.GetLayer());
560 int UtcDaliActorAddP(void)
562 tet_infoline("Testing Actor::Add");
563 TestApplication application;
565 Actor parent = Actor::New();
566 Actor child = Actor::New();
568 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
572 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
574 Actor parent2 = Actor::New();
577 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
578 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
580 // try Adding to same parent again, works
582 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
584 // try reparenting an orphaned child
586 Actor temporaryParent = Actor::New();
587 temporaryParent.Add(child);
588 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
590 // temporaryParent has now died, reparent the orphaned child
592 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
597 int UtcDaliActorAddN(void)
599 tet_infoline("Testing Actor::Add");
600 TestApplication application;
602 Actor child = Actor::New();
604 Actor parent2 = Actor::New();
610 parent2.Add(parent2);
611 tet_printf("Assertion test failed - no Exception\n");
612 tet_result(TET_FAIL);
614 catch(Dali::DaliException& e)
616 DALI_TEST_PRINT_ASSERT(e);
617 DALI_TEST_ASSERT(e, "&mOwner != &child", TEST_LOCATION);
618 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
622 tet_printf("Assertion test failed - wrong Exception\n");
623 tet_result(TET_FAIL);
626 // try reparenting root
629 parent2.Add(application.GetScene().GetLayer(0));
630 tet_printf("Assertion test failed - no Exception\n");
631 tet_result(TET_FAIL);
633 catch(Dali::DaliException& e)
635 DALI_TEST_PRINT_ASSERT(e);
636 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
637 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
641 tet_printf("Assertion test failed - wrong Exception\n");
642 tet_result(TET_FAIL);
650 tet_printf("Assertion test failed - no Exception\n");
651 tet_result(TET_FAIL);
653 catch(Dali::DaliException& e)
655 DALI_TEST_PRINT_ASSERT(e);
656 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
657 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
661 tet_printf("Assertion test failed - wrong Exception\n");
662 tet_result(TET_FAIL);
668 int UtcDaliActorRemoveN(void)
670 tet_infoline("Testing Actor::Remove");
671 TestApplication application;
673 Actor parent = Actor::New();
674 Actor child = Actor::New();
675 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
678 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
680 parent.Remove(child);
681 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
683 // remove again, no problem
684 parent.Remove(child);
685 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
689 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
690 // try Remove self, its a no-op
691 parent.Remove(parent);
692 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
698 parent.Remove(empty);
699 tet_printf("Assertion test failed - no Exception\n");
700 tet_result(TET_FAIL);
702 catch(Dali::DaliException& e)
704 DALI_TEST_PRINT_ASSERT(e);
705 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
706 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
710 tet_printf("Assertion test failed - wrong Exception\n");
711 tet_result(TET_FAIL);
716 int UtcDaliActorRemoveP(void)
718 TestApplication application;
720 Actor parent = Actor::New();
721 Actor child = Actor::New();
722 Actor random = Actor::New();
724 application.GetScene().Add(parent);
726 DALI_TEST_CHECK(parent.GetChildCount() == 0);
730 DALI_TEST_CHECK(parent.GetChildCount() == 1);
732 parent.Remove(random);
734 DALI_TEST_CHECK(parent.GetChildCount() == 1);
736 application.GetScene().Remove(parent);
738 DALI_TEST_CHECK(parent.GetChildCount() == 1);
742 int UtcDaliActorSwitchParentN(void)
744 tet_infoline("Testing Actor::UtcDaliActorSwitchParentN");
745 TestApplication application;
747 Actor parent1 = Actor::New();
748 Actor child = Actor::New();
750 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
754 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
756 Actor parent2 = Actor::New();
758 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
760 // Try switch parent with that both of parent1 and parent2 are off scene.
761 DevelActor::SwitchParent(child, parent2);
763 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
764 DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
768 int UtcDaliActorGetChildCount(void)
770 TestApplication application;
772 Actor parent = Actor::New();
773 Actor child = Actor::New();
775 DALI_TEST_CHECK(parent.GetChildCount() == 0);
779 DALI_TEST_CHECK(parent.GetChildCount() == 1);
783 int UtcDaliActorGetChildren01(void)
785 TestApplication application;
787 Actor parent = Actor::New();
788 Actor first = Actor::New();
789 Actor second = Actor::New();
790 Actor third = Actor::New();
796 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
797 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
798 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
802 int UtcDaliActorGetChildren02(void)
804 TestApplication application;
806 Actor parent = Actor::New();
807 Actor first = Actor::New();
808 Actor second = Actor::New();
809 Actor third = Actor::New();
815 const Actor& constParent = parent;
817 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
818 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
819 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
823 int UtcDaliActorGetParent01(void)
825 TestApplication application;
827 Actor parent = Actor::New();
828 Actor child = Actor::New();
832 DALI_TEST_CHECK(child.GetParent() == parent);
836 int UtcDaliActorGetParent02(void)
838 TestApplication application;
840 Actor actor = Actor::New();
842 DALI_TEST_CHECK(!actor.GetParent());
846 int UtcDaliActorCustomProperty(void)
848 TestApplication application;
850 Actor actor = Actor::New();
851 application.GetScene().Add(actor);
853 float startValue(1.0f);
854 Property::Index index = actor.RegisterProperty("testProperty", startValue);
855 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
857 application.SendNotification();
858 application.Render(0);
859 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
861 actor.SetProperty(index, 5.0f);
863 application.SendNotification();
864 application.Render(0);
865 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
869 int UtcDaliActorCustomPropertyIntToFloat(void)
871 TestApplication application;
873 Actor actor = Actor::New();
874 application.GetScene().Add(actor);
876 float startValue(5.0f);
877 Property::Index index = actor.RegisterProperty("testProperty", startValue);
878 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
880 application.SendNotification();
881 application.Render(0);
882 DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
884 actor.SetProperty(index, int(1));
886 application.SendNotification();
887 application.Render(0);
888 DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
892 int UtcDaliActorCustomPropertyFloatToInt(void)
894 TestApplication application;
896 Actor actor = Actor::New();
897 application.GetScene().Add(actor);
900 Property::Index index = actor.RegisterProperty("testProperty", startValue);
901 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
903 application.SendNotification();
904 application.Render(0);
905 DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
907 actor.SetProperty(index, float(1.5));
909 application.SendNotification();
910 application.Render(0);
911 DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
915 int UtcDaliActorSetParentOrigin(void)
917 TestApplication application;
919 Actor actor = Actor::New();
921 Vector3 vector(0.7f, 0.8f, 0.9f);
922 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
924 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
926 // flush the queue and render once
927 application.SendNotification();
928 application.Render();
930 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
932 application.GetScene().Add(actor);
934 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
936 // flush the queue and render once
937 application.SendNotification();
938 application.Render();
940 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
942 application.GetScene().Remove(actor);
946 int UtcDaliActorSetParentOriginIndividual(void)
948 TestApplication application;
950 Actor actor = Actor::New();
952 Vector3 vector(0.7f, 0.8f, 0.9f);
953 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
955 actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
957 // flush the queue and render once
958 application.SendNotification();
959 application.Render();
961 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
963 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
965 // flush the queue and render once
966 application.SendNotification();
967 application.Render();
969 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
971 actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
973 // flush the queue and render once
974 application.SendNotification();
975 application.Render();
977 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
982 int UtcDaliActorGetCurrentParentOrigin(void)
984 TestApplication application;
986 Actor actor = Actor::New();
988 Vector3 vector(0.7f, 0.8f, 0.9f);
989 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
991 actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
993 // flush the queue and render once
994 application.SendNotification();
995 application.Render();
997 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
1001 int UtcDaliActorSetAnchorPoint(void)
1003 TestApplication application;
1005 Actor actor = Actor::New();
1007 Vector3 vector(0.7f, 0.8f, 0.9f);
1008 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1010 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
1012 // flush the queue and render once
1013 application.SendNotification();
1014 application.Render();
1016 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1018 application.GetScene().Add(actor);
1020 actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
1021 // flush the queue and render once
1022 application.SendNotification();
1023 application.Render();
1025 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
1027 application.GetScene().Remove(actor);
1031 int UtcDaliActorSetAnchorPointIndividual(void)
1033 TestApplication application;
1035 Actor actor = Actor::New();
1037 Vector3 vector(0.7f, 0.8f, 0.9f);
1038 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1040 actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
1042 // flush the queue and render once
1043 application.SendNotification();
1044 application.Render();
1046 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
1048 actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
1050 // flush the queue and render once
1051 application.SendNotification();
1052 application.Render();
1054 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
1056 actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
1058 // flush the queue and render once
1059 application.SendNotification();
1060 application.Render();
1062 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
1067 int UtcDaliActorGetCurrentAnchorPoint(void)
1069 TestApplication application;
1071 Actor actor = Actor::New();
1073 Vector3 vector(0.7f, 0.8f, 0.9f);
1074 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1076 actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
1078 // flush the queue and render once
1079 application.SendNotification();
1080 application.Render();
1082 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
1086 int UtcDaliActorSetSize01(void)
1088 TestApplication application;
1090 Actor actor = Actor::New();
1091 Vector3 vector(100.0f, 100.0f, 0.0f);
1093 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1095 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1097 // Immediately retrieve the size after setting
1098 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1099 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1100 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1101 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1102 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1104 // Flush the queue and render once
1105 application.SendNotification();
1106 application.Render();
1108 // Check the size in the new frame
1109 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1111 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1112 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1113 DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1114 DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1115 DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1117 // Check async behaviour
1118 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
1119 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1120 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
1121 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
1122 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
1124 // Change the resize policy and check whether the size stays the same
1125 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1127 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1128 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1130 // Set a new size after resize policy is changed and check the new size
1131 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
1133 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1134 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1136 // Change the resize policy again and check whether the new size stays the same
1137 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1139 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1140 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1142 // Set another new size after resize policy is changed and check the new size
1143 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
1145 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1146 DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1151 int UtcDaliActorSetSize02(void)
1153 TestApplication application;
1155 Actor actor = Actor::New();
1156 Vector3 vector(100.0f, 100.0f, 100.0f);
1158 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1160 actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
1162 // Immediately check the size after setting
1163 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1164 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1166 // flush the queue and render once
1167 application.SendNotification();
1168 application.Render();
1170 // Check the size in the new frame
1171 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1173 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1174 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1179 // SetSize(Vector2 size)
1180 int UtcDaliActorSetSize03(void)
1182 TestApplication application;
1184 Actor actor = Actor::New();
1185 Vector3 vector(100.0f, 100.0f, 0.0f);
1187 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1189 actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
1191 // Immediately check the size after setting
1192 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1193 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1195 // flush the queue and render once
1196 application.SendNotification();
1197 application.Render();
1199 // Check the size in the new frame
1200 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1202 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1203 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1208 // SetSize(Vector3 size)
1209 int UtcDaliActorSetSize04(void)
1211 TestApplication application;
1213 Actor actor = Actor::New();
1214 Vector3 vector(100.0f, 100.0f, 100.0f);
1216 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1218 actor.SetProperty(Actor::Property::SIZE, vector);
1220 // Immediately check the size after setting
1221 Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1222 DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1224 // flush the queue and render once
1225 application.SendNotification();
1226 application.Render();
1228 // Check the size in the new frame
1229 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1231 application.GetScene().Add(actor);
1232 actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
1234 // Immediately check the size after setting
1235 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1236 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1238 // flush the queue and render once
1239 application.SendNotification();
1240 application.Render();
1242 // Check the size in the new frame
1243 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
1245 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
1246 DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
1248 application.GetScene().Remove(actor);
1252 int UtcDaliActorSetSize05(void)
1254 TestApplication application;
1256 Actor parent = Actor::New();
1257 Vector2 vector(200.0f, 200.0f);
1258 DALI_TEST_CHECK(vector != parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1260 parent.SetProperty(Actor::Property::SIZE, vector);
1261 Vector2 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1262 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1264 Actor child = Actor::New();
1265 DALI_TEST_CHECK(vector != child.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1266 child.SetProperty(Actor::Property::SIZE, vector);
1267 size = parent.GetProperty(Actor::Property::SIZE).Get<Vector2>();
1268 DALI_TEST_EQUALS(size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1270 // flush the queue and render once
1271 application.SendNotification();
1272 application.Render();
1274 DALI_TEST_CHECK(vector == parent.GetCurrentProperty<Vector2>(Actor::Property::SIZE));
1279 int UtcDaliActorSetSizeIndividual(void)
1281 TestApplication application;
1283 Actor actor = Actor::New();
1285 Vector3 vector(0.7f, 0.8f, 0.9f);
1286 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1288 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1290 // Immediately check the width after setting
1291 float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1292 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1294 // flush the queue and render once
1295 application.SendNotification();
1296 application.Render();
1298 // Check the width in the new frame
1299 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1301 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1302 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1304 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1306 // Immediately check the height after setting
1307 float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1308 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1310 // flush the queue and render once
1311 application.SendNotification();
1312 application.Render();
1314 // Check the height in the new frame
1315 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1317 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1318 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1320 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1322 // Immediately check the depth after setting
1323 float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1324 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1326 // flush the queue and render once
1327 application.SendNotification();
1328 application.Render();
1330 // Check the depth in the new frame
1331 DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
1333 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1334 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1336 // Change the resize policy and check whether the size stays the same
1337 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1339 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1340 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1342 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1343 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1345 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1346 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1348 // Change the resize policy again and check whether the size stays the same
1349 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
1351 sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
1352 DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1354 sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
1355 DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1357 sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
1358 DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1363 int UtcDaliActorSetSizeIndividual02(void)
1365 TestApplication application;
1367 Actor actor = Actor::New();
1368 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
1369 application.GetScene().Add(actor);
1371 Vector3 vector(100.0f, 200.0f, 400.0f);
1372 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1374 actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
1375 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1377 actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
1378 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1380 actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
1381 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
1383 // flush the queue and render once
1384 application.SendNotification();
1385 application.Render();
1387 // Check the width in the new frame
1388 DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
1389 DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
1394 int UtcDaliActorGetCurrentSize(void)
1396 TestApplication application;
1398 Actor actor = Actor::New();
1399 Vector3 vector(100.0f, 100.0f, 20.0f);
1401 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1403 actor.SetProperty(Actor::Property::SIZE, vector);
1405 // flush the queue and render once
1406 application.SendNotification();
1407 application.Render();
1409 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1413 int UtcDaliActorGetNaturalSize(void)
1415 TestApplication application;
1417 Actor actor = Actor::New();
1418 Vector3 vector(0.0f, 0.0f, 0.0f);
1420 DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
1425 int UtcDaliActorGetCurrentSizeImmediate(void)
1427 TestApplication application;
1429 Actor actor = Actor::New();
1430 Vector3 vector(100.0f, 100.0f, 20.0f);
1432 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1433 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1435 actor.SetProperty(Actor::Property::SIZE, vector);
1437 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1438 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1440 // flush the queue and render once
1441 application.SendNotification();
1442 application.Render();
1444 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1445 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
1448 // Build the animation
1449 const float durationSeconds = 2.0f;
1450 Animation animation = Animation::New(durationSeconds);
1451 const Vector3 targetValue(10.0f, 20.0f, 30.0f);
1452 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
1454 DALI_TEST_CHECK(actor.GetTargetSize() == vector);
1456 application.GetScene().Add(actor);
1458 // Start the animation
1461 application.SendNotification();
1462 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
1464 DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
1469 int UtcDaliActorCalculateScreenExtents(void)
1471 TestApplication application;
1473 Actor actor = Actor::New();
1475 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
1476 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
1478 application.GetScene().Add(actor);
1480 application.SendNotification();
1481 application.Render();
1483 auto expectedExtent = Rect<>{1.5f, 1.5f, 1.0f, 1.0f};
1484 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1485 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1486 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1487 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1488 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1490 application.GetScene().Remove(actor);
1494 int UtcDaliActorCalculateScreenExtentsInCustomCameraAndLayer3D(void)
1496 TestApplication application;
1497 Integration::Scene scene = application.GetScene();
1500 Layer layer = Layer::New();
1501 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1502 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1503 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1507 // Build custom camera with top-view
1508 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
1510 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1511 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1512 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1515 std::ostringstream oss;
1516 oss << cameraPos << "\n";
1517 oss << cameraOrient << "\n";
1518 tet_printf("%s\n", oss.str().c_str());
1521 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1522 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1524 // Now, upside : -Z, leftside : -X, foward : +Y
1526 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1527 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1529 std::ostringstream oss;
1530 oss << cameraPos << "\n";
1531 oss << cameraOrient << "\n";
1532 tet_printf("%s\n", oss.str().c_str());
1536 Actor actor = Actor::New();
1537 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1538 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1539 actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 0.0f, 16.0f));
1540 actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 0.0f, 3.0f});
1544 application.SendNotification();
1545 application.Render();
1547 Vector2 sceneSize = scene.GetSize();
1549 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + 1.5f, sceneSize.y * 0.5f + 14.5f, 1.0f, 3.0f};
1550 auto actualExtent = DevelActor::CalculateScreenExtents(actor);
1552 std::ostringstream oss;
1553 oss << expectedExtent << "\n";
1554 oss << actualExtent << "\n";
1555 tet_printf("%s\n", oss.str().c_str());
1558 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1559 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1560 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1561 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1566 int UtcDaliActorCalculateScreenInCustomCameraAndOffscreenLayer3D(void)
1568 // TODO : Need to make it works well
1569 TestApplication application;
1570 Integration::Scene scene = application.GetScene();
1571 Vector2 sceneSize = scene.GetSize();
1574 Layer layer = Layer::New();
1575 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
1576 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1577 layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1578 layer.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1579 layer.SetProperty(Actor::Property::SIZE, sceneSize);
1583 // Build custom camera with top-view
1584 CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
1586 offscreenCameraActor.SetPerspectiveProjection(sceneSize);
1587 offscreenCameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1588 offscreenCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1590 scene.Add(offscreenCameraActor);
1592 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
1593 Vector3 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1594 Quaternion cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1597 std::ostringstream oss;
1598 oss << cameraPos << "\n";
1599 oss << cameraOrient << "\n";
1600 tet_printf("%s\n", oss.str().c_str());
1603 offscreenCameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
1604 offscreenCameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
1606 // Now, upside : -Z, leftside : -X, foward : +Y
1608 cameraPos = offscreenCameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
1609 cameraOrient = offscreenCameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
1611 std::ostringstream oss;
1612 oss << cameraPos << "\n";
1613 oss << cameraOrient << "\n";
1614 tet_printf("%s\n", oss.str().c_str());
1617 Vector3 sourcePosition{2.0f, 0.0f, 16.0f};
1618 Vector3 sourceSize{1.0f, 0.0f, 3.0f};
1620 Actor sourceActor = Actor::New();
1621 sourceActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1622 sourceActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1623 sourceActor.SetProperty(Actor::Property::POSITION, sourcePosition);
1624 sourceActor.SetProperty(Actor::Property::SIZE, sourceSize);
1626 layer.Add(sourceActor);
1628 // Create framebuffer
1629 unsigned int width(64);
1630 unsigned int height(64);
1631 Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
1632 FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
1633 frameBuffer.AttachColorTexture(texture);
1635 Actor rootActor = Actor::New();
1636 rootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1637 rootActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1638 rootActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
1639 rootActor.SetProperty(Actor::Property::SIZE, sceneSize);
1640 scene.Add(rootActor);
1642 RenderTaskList taskList = scene.GetRenderTaskList();
1643 RenderTask newTask = taskList.CreateTask();
1644 newTask.SetCameraActor(offscreenCameraActor);
1645 newTask.SetSourceActor(layer);
1646 newTask.SetInputEnabled(false);
1647 newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
1648 newTask.SetClearEnabled(true);
1649 newTask.SetExclusive(true);
1650 newTask.SetFrameBuffer(frameBuffer);
1651 newTask.SetScreenToFrameBufferMappingActor(rootActor);
1653 application.SendNotification();
1654 application.Render(16u);
1656 auto expectedExtent = Rect<>{sceneSize.x * 0.5f + sourcePosition.x - sourceSize.x * 0.5f,
1657 sceneSize.y * 0.5f + sourcePosition.z - sourceSize.z * 0.5f,
1660 auto actualExtent = DevelActor::CalculateScreenExtents(sourceActor);
1662 std::ostringstream oss;
1663 oss << expectedExtent << "\n";
1664 oss << actualExtent << "\n";
1665 tet_printf("%s\n", oss.str().c_str());
1668 auto expectedScreen = Vector2{sceneSize.x * 0.5f + sourcePosition.x, sceneSize.y * 0.5f + sourcePosition.z};
1669 auto actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1671 std::ostringstream oss;
1672 oss << expectedScreen << "\n";
1673 oss << actualScreen << "\n";
1674 tet_printf("%s\n", oss.str().c_str());
1677 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1678 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1679 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1680 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1682 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1683 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1685 // Change rootActor's size and position
1687 Vector3 rootPosition{100.0f, 200.0f, 0.0f};
1688 Vector3 rootSize{200.0f, 100.0f, 0.0f};
1690 rootActor.SetProperty(Actor::Property::POSITION, rootPosition);
1691 rootActor.SetProperty(Actor::Property::SIZE, rootSize);
1693 application.SendNotification();
1694 application.Render(16u);
1696 expectedExtent = Rect<>{sceneSize.x * 0.5f + rootPosition.x + (sourcePosition.x - sourceSize.x * 0.5f) * rootSize.x / sceneSize.x,
1697 sceneSize.y * 0.5f + rootPosition.y + (sourcePosition.z - sourceSize.z * 0.5f) * rootSize.y / sceneSize.y,
1698 sourceSize.x * rootSize.x / sceneSize.x,
1699 sourceSize.z * rootSize.y / sceneSize.y};
1700 actualExtent = DevelActor::CalculateScreenExtents(sourceActor);
1702 std::ostringstream oss;
1703 oss << expectedExtent << "\n";
1704 oss << actualExtent << "\n";
1705 tet_printf("%s\n", oss.str().c_str());
1708 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};
1709 actualScreen = sourceActor.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
1711 std::ostringstream oss;
1712 oss << expectedScreen << "\n";
1713 oss << actualScreen << "\n";
1714 tet_printf("%s\n", oss.str().c_str());
1717 DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1718 DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1719 DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1720 DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1722 DALI_TEST_EQUALS(expectedScreen.x, actualScreen.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1723 DALI_TEST_EQUALS(expectedScreen.y, actualScreen.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1728 // SetPosition(float x, float y)
1729 int UtcDaliActorSetPosition01(void)
1731 TestApplication application;
1733 Actor actor = Actor::New();
1735 // Set to random to start off with
1736 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
1738 Vector3 vector(100.0f, 100.0f, 0.0f);
1740 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1742 actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
1743 // flush the queue and render once
1744 application.SendNotification();
1745 application.Render();
1746 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1748 application.GetScene().Add(actor);
1749 actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
1750 // flush the queue and render once
1751 application.SendNotification();
1752 application.Render();
1753 DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1755 actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
1756 actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
1757 actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
1758 // flush the queue and render once
1759 application.SendNotification();
1760 application.Render();
1761 DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1763 actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
1764 // flush the queue and render once
1765 application.SendNotification();
1766 application.Render();
1767 DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
1769 application.GetScene().Remove(actor);
1773 // SetPosition(float x, float y, float z)
1774 int UtcDaliActorSetPosition02(void)
1776 TestApplication application;
1778 Actor actor = Actor::New();
1780 // Set to random to start off with
1781 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1783 Vector3 vector(100.0f, 100.0f, 100.0f);
1785 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1787 actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
1789 // flush the queue and render once
1790 application.SendNotification();
1791 application.Render();
1793 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1797 // SetPosition(Vector3 position)
1798 int UtcDaliActorSetPosition03(void)
1800 TestApplication application;
1802 Actor actor = Actor::New();
1804 // Set to random to start off with
1805 actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
1807 Vector3 vector(100.0f, 100.0f, 100.0f);
1809 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1811 actor.SetProperty(Actor::Property::POSITION, vector);
1813 // flush the queue and render once
1814 application.SendNotification();
1815 application.Render();
1817 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1821 int UtcDaliActorSetX(void)
1823 TestApplication application;
1825 Actor actor = Actor::New();
1827 Vector3 vector(100.0f, 0.0f, 0.0f);
1829 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1831 actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
1833 // flush the queue and render once
1834 application.SendNotification();
1835 application.Render();
1837 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1841 int UtcDaliActorSetY(void)
1843 TestApplication application;
1845 Actor actor = Actor::New();
1847 Vector3 vector(0.0f, 100.0f, 0.0f);
1849 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1851 actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
1853 // flush the queue and render once
1854 application.SendNotification();
1855 application.Render();
1857 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1861 int UtcDaliActorSetZ(void)
1863 TestApplication application;
1865 Actor actor = Actor::New();
1867 Vector3 vector(0.0f, 0.0f, 100.0f);
1869 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1871 actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
1873 // flush the queue and render once
1874 application.SendNotification();
1875 application.Render();
1877 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1881 int UtcDaliActorSetPositionProperties(void)
1883 TestApplication application;
1885 Actor actor = Actor::New();
1887 Vector3 vector(0.7f, 0.8f, 0.9f);
1888 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1890 actor.SetProperty(Actor::Property::POSITION_X, vector.x);
1891 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1892 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1894 // flush the queue and render once
1895 application.SendNotification();
1896 application.Render();
1898 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1899 DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1900 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1901 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
1902 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
1904 actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
1905 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1906 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1908 // flush the queue and render once
1909 application.SendNotification();
1910 application.Render();
1912 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1913 DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1914 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1915 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
1916 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
1918 actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
1919 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1920 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1922 // flush the queue and render once
1923 application.SendNotification();
1924 application.Render();
1926 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1927 DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1928 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1929 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
1930 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
1935 int UtcDaliActorTranslateBy(void)
1937 TestApplication application;
1939 Actor actor = Actor::New();
1940 Vector3 vector(100.0f, 100.0f, 100.0f);
1942 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1944 actor.SetProperty(Actor::Property::POSITION, vector);
1946 // flush the queue and render once
1947 application.SendNotification();
1948 application.Render();
1950 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1952 actor.TranslateBy(vector);
1954 // flush the queue and render once
1955 application.SendNotification();
1956 application.Render();
1958 DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
1962 int UtcDaliActorGetCurrentPosition(void)
1964 TestApplication application;
1966 Actor actor = Actor::New();
1967 Vector3 setVector(100.0f, 100.0f, 0.0f);
1968 actor.SetProperty(Actor::Property::POSITION, setVector);
1970 // flush the queue and render once
1971 application.SendNotification();
1972 application.Render();
1974 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
1978 int UtcDaliActorGetCurrentWorldPosition(void)
1980 TestApplication application;
1982 Actor parent = Actor::New();
1983 Vector3 parentPosition(1.0f, 2.0f, 3.0f);
1984 parent.SetProperty(Actor::Property::POSITION, parentPosition);
1985 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1986 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1987 application.GetScene().Add(parent);
1989 Actor child = Actor::New();
1990 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1991 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
1992 Vector3 childPosition(6.0f, 6.0f, 6.0f);
1993 child.SetProperty(Actor::Property::POSITION, childPosition);
1996 // The actors should not have a world position yet
1997 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
1998 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
2000 application.SendNotification();
2001 application.Render(0);
2003 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2004 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2006 // The actors should have a world position now
2007 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2008 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2012 int UtcDaliActorSetInheritPosition(void)
2014 tet_infoline("Testing Actor::SetInheritPosition");
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(10.0f, 11.0f, 12.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 // first test default, which is to inherit position
2036 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2037 application.SendNotification();
2038 application.Render(0); // should only really call Update as Render is not required to update scene
2039 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2040 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
2041 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2042 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
2044 //Change child position
2045 Vector3 childOffset(-1.0f, 1.0f, 0.0f);
2046 child.SetProperty(Actor::Property::POSITION, childOffset);
2048 // Use local position as world postion
2049 child.SetProperty(Actor::Property::INHERIT_POSITION, false);
2050 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
2051 application.SendNotification();
2052 application.Render(0); // should only really call Update as Render is not required to update scene
2053 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2054 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2055 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2056 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
2058 //Change back to inherit position from parent
2059 child.SetProperty(Actor::Property::INHERIT_POSITION, true);
2060 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
2061 application.SendNotification();
2062 application.Render(0); // should only really call Update as Render is not required to update scene
2063 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
2064 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
2065 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
2066 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
2070 int UtcDaliActorInheritOpacity(void)
2072 tet_infoline("Testing Actor::Inherit Opacity");
2073 TestApplication application;
2075 Actor parent = Actor::New();
2076 Actor child = Actor::New();
2078 application.GetScene().Add(parent);
2080 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2081 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2083 // flush the queue and render once
2084 application.SendNotification();
2085 application.Render();
2087 parent.SetProperty(Actor::Property::OPACITY, 0.1f);
2089 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2090 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
2092 application.SendNotification();
2093 application.Render();
2095 DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2096 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
2097 DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2098 DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2099 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
2100 DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
2105 // SetOrientation(float angleRadians, Vector3 axis)
2106 int UtcDaliActorSetOrientation01(void)
2108 TestApplication application;
2110 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2111 Actor actor = Actor::New();
2113 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2115 // flush the queue and render once
2116 application.SendNotification();
2117 application.Render();
2119 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2123 int UtcDaliActorSetOrientation02(void)
2125 TestApplication application;
2127 Actor actor = Actor::New();
2129 Radian angle(0.785f);
2130 Vector3 axis(1.0f, 1.0f, 0.0f);
2132 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2133 Quaternion rotation(angle, axis);
2134 // flush the queue and render once
2135 application.SendNotification();
2136 application.Render();
2137 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2139 application.GetScene().Add(actor);
2140 actor.RotateBy(Degree(360), axis);
2141 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2143 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
2144 Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
2145 // flush the queue and render once
2146 application.SendNotification();
2147 application.Render();
2148 DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2150 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
2151 // flush the queue and render once
2152 application.SendNotification();
2153 application.Render();
2154 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2156 application.GetScene().Remove(actor);
2160 // SetOrientation(float angleRadians, Vector3 axis)
2161 int UtcDaliActorSetOrientationProperty(void)
2163 TestApplication application;
2165 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2166 Actor actor = Actor::New();
2168 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2169 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2171 // flush the queue and render once
2172 application.SendNotification();
2173 application.Render();
2175 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2176 DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2177 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2181 // RotateBy(float angleRadians, Vector3 axis)
2182 int UtcDaliActorRotateBy01(void)
2184 TestApplication application;
2186 Actor actor = Actor::New();
2188 Radian angle(M_PI * 0.25f);
2189 actor.RotateBy((angle), Vector3::ZAXIS);
2190 // flush the queue and render once
2191 application.SendNotification();
2192 application.Render();
2193 DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2195 application.GetScene().Add(actor);
2197 actor.RotateBy(angle, Vector3::ZAXIS);
2198 // flush the queue and render once
2199 application.SendNotification();
2200 application.Render();
2201 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2203 application.GetScene().Remove(actor);
2207 // RotateBy(Quaternion relativeRotation)
2208 int UtcDaliActorRotateBy02(void)
2210 TestApplication application;
2212 Actor actor = Actor::New();
2214 Radian angle(M_PI * 0.25f);
2215 Quaternion rotation(angle, Vector3::ZAXIS);
2216 actor.RotateBy(rotation);
2217 // flush the queue and render once
2218 application.SendNotification();
2219 application.Render();
2220 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2222 actor.RotateBy(rotation);
2223 // flush the queue and render once
2224 application.SendNotification();
2225 application.Render();
2226 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2230 int UtcDaliActorGetCurrentOrientation(void)
2232 TestApplication application;
2233 Actor actor = Actor::New();
2235 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
2236 actor.SetProperty(Actor::Property::ORIENTATION, rotation);
2237 // flush the queue and render once
2238 application.SendNotification();
2239 application.Render();
2240 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
2244 int UtcDaliActorGetCurrentWorldOrientation(void)
2246 tet_infoline("Testing Actor::GetCurrentWorldRotation");
2247 TestApplication application;
2249 Actor parent = Actor::New();
2250 Radian rotationAngle(Degree(90.0f));
2251 Quaternion rotation(rotationAngle, Vector3::YAXIS);
2252 parent.SetProperty(Actor::Property::ORIENTATION, rotation);
2253 application.GetScene().Add(parent);
2255 Actor child = Actor::New();
2256 child.SetProperty(Actor::Property::ORIENTATION, rotation);
2259 // The actors should not have a world rotation yet
2260 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2261 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
2263 application.SendNotification();
2264 application.Render(0);
2266 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2267 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
2269 // The actors should have a world rotation now
2270 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2271 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
2273 // turn off child rotation inheritance
2274 child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
2275 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
2276 application.SendNotification();
2277 application.Render(0);
2279 // The actors should have a world rotation now
2280 DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
2281 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
2285 // SetScale(float scale)
2286 int UtcDaliActorSetScale01(void)
2288 TestApplication application;
2290 Actor actor = Actor::New();
2292 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2293 actor.SetProperty(Actor::Property::SCALE, 0.25f);
2295 Vector3 scale(10.0f, 10.0f, 10.0f);
2296 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2298 actor.SetProperty(Actor::Property::SCALE, scale.x);
2300 // flush the queue and render once
2301 application.SendNotification();
2302 application.Render();
2304 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2308 // SetScale(float scaleX, float scaleY, float scaleZ)
2309 int UtcDaliActorSetScale02(void)
2311 TestApplication application;
2312 Vector3 scale(10.0f, 10.0f, 10.0f);
2314 Actor actor = Actor::New();
2316 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2317 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2319 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2321 actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
2322 // flush the queue and render once
2323 application.SendNotification();
2324 application.Render();
2325 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2327 // add to stage and test
2328 application.GetScene().Add(actor);
2329 actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
2330 // flush the queue and render once
2331 application.SendNotification();
2332 application.Render();
2333 DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
2335 application.GetScene().Remove(actor);
2340 // SetScale(Vector3 scale)
2341 int UtcDaliActorSetScale03(void)
2343 TestApplication application;
2344 Vector3 scale(10.0f, 10.0f, 10.0f);
2346 Actor actor = Actor::New();
2348 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
2349 actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
2351 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
2353 actor.SetProperty(Actor::Property::SCALE, scale);
2355 // flush the queue and render once
2356 application.SendNotification();
2357 application.Render();
2359 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2363 int UtcDaliActorSetScaleIndividual(void)
2365 TestApplication application;
2367 Actor actor = Actor::New();
2369 Vector3 vector(0.7f, 0.8f, 0.9f);
2370 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2372 actor.SetProperty(Actor::Property::SCALE_X, vector.x);
2373 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2375 // flush the queue and render once
2376 application.SendNotification();
2377 application.Render();
2379 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
2380 DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2381 DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
2383 actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
2384 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2386 // flush the queue and render once
2387 application.SendNotification();
2388 application.Render();
2390 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
2391 DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2392 DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
2394 actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
2395 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2397 // flush the queue and render once
2398 application.SendNotification();
2399 application.Render();
2401 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
2402 DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2403 DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
2405 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2406 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
2411 int UtcDaliActorScaleBy(void)
2413 TestApplication application;
2414 Actor actor = Actor::New();
2415 Vector3 vector(100.0f, 100.0f, 100.0f);
2417 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2419 actor.SetProperty(Actor::Property::SCALE, vector);
2421 // flush the queue and render once
2422 application.SendNotification();
2423 application.Render();
2425 DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2427 actor.ScaleBy(vector);
2429 // flush the queue and render once
2430 application.SendNotification();
2431 application.Render();
2433 DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
2437 int UtcDaliActorGetCurrentScale(void)
2439 TestApplication application;
2440 Vector3 scale(12.0f, 1.0f, 2.0f);
2442 Actor actor = Actor::New();
2444 actor.SetProperty(Actor::Property::SCALE, scale);
2446 // flush the queue and render once
2447 application.SendNotification();
2448 application.Render();
2450 DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
2454 int UtcDaliActorGetCurrentWorldScale(void)
2456 TestApplication application;
2458 Actor parent = Actor::New();
2459 Vector3 parentScale(1.0f, 2.0f, 3.0f);
2460 parent.SetProperty(Actor::Property::SCALE, parentScale);
2461 application.GetScene().Add(parent);
2463 Actor child = Actor::New();
2464 Vector3 childScale(2.0f, 2.0f, 2.0f);
2465 child.SetProperty(Actor::Property::SCALE, childScale);
2468 // The actors should not have a scale yet
2469 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2470 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
2472 // The actors should not have a world scale yet
2473 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2474 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
2476 application.SendNotification();
2477 application.Render(0);
2479 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
2480 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
2482 // The actors should have a world scale now
2483 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
2484 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2488 int UtcDaliActorInheritScale(void)
2490 tet_infoline("Testing Actor::SetInheritScale");
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 application.SendNotification();
2504 application.Render(0);
2506 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
2507 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
2509 child.SetProperty(Actor::Property::INHERIT_SCALE, false);
2510 DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
2512 application.SendNotification();
2513 application.Render(0);
2515 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
2519 int UtcDaliActorSetVisible(void)
2521 TestApplication application;
2523 Actor actor = Actor::New();
2524 actor.SetProperty(Actor::Property::VISIBLE, false);
2525 // flush the queue and render once
2526 application.SendNotification();
2527 application.Render();
2528 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2530 actor.SetProperty(Actor::Property::VISIBLE, true);
2531 // flush the queue and render once
2532 application.SendNotification();
2533 application.Render();
2534 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2536 // put actor on stage
2537 application.GetScene().Add(actor);
2538 actor.SetProperty(Actor::Property::VISIBLE, false);
2539 // flush the queue and render once
2540 application.SendNotification();
2541 application.Render();
2542 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
2546 int UtcDaliActorIsVisible(void)
2548 TestApplication application;
2550 Actor actor = Actor::New();
2552 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
2556 int UtcDaliActorSetOpacity(void)
2558 TestApplication application;
2560 Actor actor = Actor::New();
2561 // initial opacity is 1
2562 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
2564 actor.SetProperty(Actor::Property::OPACITY, 0.4f);
2565 // flush the queue and render once
2566 application.SendNotification();
2567 application.Render();
2568 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
2570 // change opacity, actor is on stage to change is not immediate
2571 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
2572 // flush the queue and render once
2573 application.SendNotification();
2574 application.Render();
2575 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2577 // put actor on stage
2578 application.GetScene().Add(actor);
2580 // change opacity, actor is on stage to change is not immediate
2581 actor.SetProperty(Actor::Property::OPACITY, 0.9f);
2582 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
2583 // flush the queue and render once
2584 application.SendNotification();
2585 application.Render();
2586 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
2588 // change opacity, actor is on stage to change is not immediate
2589 actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
2590 // flush the queue and render once
2591 application.SendNotification();
2592 application.Render();
2593 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
2597 int UtcDaliActorGetCurrentOpacity(void)
2599 TestApplication application;
2601 Actor actor = Actor::New();
2602 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
2604 actor.SetProperty(Actor::Property::OPACITY, 0.5f);
2605 // flush the queue and render once
2606 application.SendNotification();
2607 application.Render();
2608 DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
2612 int UtcDaliActorSetSensitive(void)
2614 TestApplication application;
2615 Actor actor = Actor::New();
2617 bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
2619 actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
2621 DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2625 int UtcDaliActorIsSensitive(void)
2627 TestApplication application;
2628 Actor actor = Actor::New();
2629 actor.SetProperty(Actor::Property::SENSITIVE, false);
2631 DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
2635 int UtcDaliActorSetColor(void)
2637 TestApplication application;
2638 Actor actor = Actor::New();
2639 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2641 DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2643 actor.SetProperty(Actor::Property::COLOR, color);
2644 // flush the queue and render once
2645 application.SendNotification();
2646 application.Render();
2647 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2649 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
2650 // flush the queue and render once
2651 application.SendNotification();
2652 application.Render();
2653 DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2655 application.GetScene().Add(actor);
2656 actor.SetProperty(Actor::Property::COLOR, color);
2657 // flush the queue and render once
2658 application.SendNotification();
2659 application.Render();
2660 DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2662 actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
2663 // flush the queue and render once
2664 application.SendNotification();
2665 application.Render();
2666 // Actor color is not clamped
2667 DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2668 // world color is clamped
2669 DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
2671 actor.SetProperty(Actor::Property::COLOR, color);
2672 DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2674 Vector3 newColor(1.0f, 0.0f, 0.0f);
2675 actor.SetProperty(Actor::Property::COLOR, newColor);
2676 DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2678 application.GetScene().Remove(actor);
2682 int UtcDaliActorSetColorIndividual(void)
2684 TestApplication application;
2686 Actor actor = Actor::New();
2688 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2689 DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2691 actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
2692 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2694 // flush the queue and render once
2695 application.SendNotification();
2696 application.Render();
2698 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
2699 DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2700 DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
2702 actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
2703 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2705 // flush the queue and render once
2706 application.SendNotification();
2707 application.Render();
2709 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
2710 DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2711 DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
2713 actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
2714 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2716 // flush the queue and render once
2717 application.SendNotification();
2718 application.Render();
2720 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
2721 DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2722 DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
2724 actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
2725 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2727 // flush the queue and render once
2728 application.SendNotification();
2729 application.Render();
2731 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2732 DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2733 DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
2735 DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2736 DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
2738 actor.SetProperty(Actor::Property::OPACITY, 0.2f);
2740 // flush the queue and render once
2741 application.SendNotification();
2742 application.Render();
2744 DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
2749 int UtcDaliActorGetCurrentColor(void)
2751 TestApplication application;
2752 Actor actor = Actor::New();
2753 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2755 actor.SetProperty(Actor::Property::COLOR, color);
2756 // flush the queue and render once
2757 application.SendNotification();
2758 application.Render();
2759 DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
2763 int UtcDaliActorGetCurrentWorldColor(void)
2765 tet_infoline("Actor::GetCurrentWorldColor");
2766 TestApplication application;
2768 Actor parent = Actor::New();
2769 Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
2770 parent.SetProperty(Actor::Property::COLOR, parentColor);
2771 application.GetScene().Add(parent);
2773 Actor child = Actor::New();
2774 Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
2775 child.SetProperty(Actor::Property::COLOR, childColor);
2778 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2779 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
2781 // verify the default color mode
2782 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2784 // The actors should not have a world color yet
2785 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2786 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
2788 application.SendNotification();
2789 application.Render(0);
2791 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
2792 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2794 // The actors should have a world color now
2795 DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2796 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
2799 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2800 application.SendNotification();
2801 application.Render(0);
2802 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
2805 child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2806 application.SendNotification();
2807 application.Render(0);
2808 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2809 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
2812 child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2813 application.SendNotification();
2814 application.Render(0);
2815 Vector4 expectedColor(childColor);
2816 expectedColor.a *= parentColor.a;
2817 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
2818 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
2822 int UtcDaliActorSetColorMode(void)
2824 tet_infoline("Actor::SetColorMode");
2825 TestApplication application;
2826 Actor actor = Actor::New();
2827 Actor child = Actor::New();
2830 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
2831 DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2833 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
2834 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2836 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
2837 DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2839 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
2840 DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
2844 int UtcDaliActorScreenToLocal(void)
2846 TestApplication application;
2847 Actor actor = Actor::New();
2848 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2849 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2850 actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
2851 application.GetScene().Add(actor);
2853 // flush the queue and render once
2854 application.SendNotification();
2855 application.Render();
2860 application.SendNotification();
2861 application.Render();
2863 DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
2865 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2866 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2870 int UtcDaliActorSetLeaveRequired(void)
2872 TestApplication application;
2874 Actor actor = Actor::New();
2876 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
2877 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2879 actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
2880 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
2884 int UtcDaliActorGetLeaveRequired(void)
2886 TestApplication application;
2888 Actor actor = Actor::New();
2890 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
2894 int UtcDaliActorSetKeyboardFocusable(void)
2896 TestApplication application;
2898 Actor actor = Actor::New();
2900 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
2901 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
2903 actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
2904 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2908 int UtcDaliActorIsKeyboardFocusable(void)
2910 TestApplication application;
2912 Actor actor = Actor::New();
2914 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
2918 int UtcDaliActorSetKeyboardFocusableChildren(void)
2920 TestApplication application;
2922 Actor actor = Actor::New();
2924 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
2925 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2927 actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
2928 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
2932 int UtcDaliActorAreChildrenKeyBoardFocusable(void)
2934 TestApplication application;
2936 Actor actor = Actor::New();
2938 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
2942 int UtcDaliActorSetTouchFocusable(void)
2944 TestApplication application;
2946 Actor actor = Actor::New();
2948 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
2949 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
2951 actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
2952 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2956 int UtcDaliActorIsTouchFocusable(void)
2958 TestApplication application;
2960 Actor actor = Actor::New();
2962 DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
2966 int UtcDaliActorSetUserInteractionEnabled(void)
2968 TestApplication application;
2969 Actor actor = Actor::New();
2971 bool enabled = !actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED);
2973 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, enabled);
2975 DALI_TEST_CHECK(enabled == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
2979 int UtcDaliActorIsUserInteractionEnabled(void)
2981 TestApplication application;
2982 Actor actor = Actor::New();
2983 actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
2985 DALI_TEST_CHECK(true == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
2989 int UtcDaliActorRemoveConstraints(void)
2991 tet_infoline(" UtcDaliActorRemoveConstraints");
2992 TestApplication application;
2994 gTestConstraintCalled = false;
2996 Actor actor = Actor::New();
2998 Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
3000 actor.RemoveConstraints();
3002 DALI_TEST_CHECK(gTestConstraintCalled == false);
3004 application.GetScene().Add(actor);
3007 // flush the queue and render once
3008 application.SendNotification();
3009 application.Render();
3011 actor.RemoveConstraints();
3013 DALI_TEST_CHECK(gTestConstraintCalled == true);
3017 int UtcDaliActorRemoveConstraintTag(void)
3019 tet_infoline(" UtcDaliActorRemoveConstraintTag");
3020 TestApplication application;
3022 Actor actor = Actor::New();
3024 // 1. Apply Constraint1 and Constraint2, and test...
3025 unsigned int result1 = 0u;
3026 unsigned int result2 = 0u;
3028 unsigned constraint1Tag = 1u;
3029 Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
3030 constraint1.SetTag(constraint1Tag);
3031 constraint1.Apply();
3033 unsigned constraint2Tag = 2u;
3034 Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
3035 constraint2.SetTag(constraint2Tag);
3036 constraint2.Apply();
3038 application.GetScene().Add(actor);
3039 // flush the queue and render once
3040 application.SendNotification();
3041 application.Render();
3043 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3044 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3046 // 2. Remove Constraint1 and test...
3049 actor.RemoveConstraints(constraint1Tag);
3050 // make color property dirty, which will trigger constraints to be reapplied.
3051 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3052 // flush the queue and render once
3053 application.SendNotification();
3054 application.Render();
3056 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3057 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3059 // 3. Re-Apply Constraint1 and test...
3062 constraint1.Apply();
3063 // make color property dirty, which will trigger constraints to be reapplied.
3064 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3065 // flush the queue and render once
3066 application.SendNotification();
3067 application.Render();
3069 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3070 DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
3072 // 2. Remove Constraint2 and test...
3075 actor.RemoveConstraints(constraint2Tag);
3076 // make color property dirty, which will trigger constraints to be reapplied.
3077 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3078 // flush the queue and render once
3079 application.SendNotification();
3080 application.Render();
3082 DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
3083 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3085 // 2. Remove Constraint1 as well and test...
3088 actor.RemoveConstraints(constraint1Tag);
3089 // make color property dirty, which will trigger constraints to be reapplied.
3090 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
3091 // flush the queue and render once
3092 application.SendNotification();
3093 application.Render();
3095 DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
3096 DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
3100 int UtcDaliActorTouchedSignal(void)
3102 TestApplication application;
3104 ResetTouchCallbacks();
3106 // get the root layer
3107 Actor actor = application.GetScene().GetRootLayer();
3108 DALI_TEST_CHECK(gTouchCallBackCalled == false);
3110 application.SendNotification();
3111 application.Render();
3113 // connect to its touch signal
3114 actor.TouchedSignal().Connect(TestTouchCallback);
3116 // simulate a touch event in the middle of the screen
3117 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3118 Dali::Integration::Point point;
3119 point.SetDeviceId(1);
3120 point.SetState(PointState::DOWN);
3121 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3122 Dali::Integration::TouchEvent touchEvent;
3123 touchEvent.AddPoint(point);
3124 application.ProcessEvent(touchEvent);
3126 DALI_TEST_CHECK(gTouchCallBackCalled == true);
3130 int UtcDaliActorHoveredSignal(void)
3132 TestApplication application;
3134 gHoverCallBackCalled = false;
3136 // get the root layer
3137 Actor actor = application.GetScene().GetRootLayer();
3138 DALI_TEST_CHECK(gHoverCallBackCalled == false);
3140 application.SendNotification();
3141 application.Render();
3143 // connect to its hover signal
3144 actor.HoveredSignal().Connect(TestCallback3);
3146 // simulate a hover event in the middle of the screen
3147 Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
3148 Dali::Integration::Point point;
3149 point.SetDeviceId(1);
3150 point.SetState(PointState::MOTION);
3151 point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
3152 Dali::Integration::HoverEvent hoverEvent;
3153 hoverEvent.AddPoint(point);
3154 application.ProcessEvent(hoverEvent);
3156 DALI_TEST_CHECK(gHoverCallBackCalled == true);
3160 int UtcDaliActorOnOffSceneSignal(void)
3162 tet_infoline("Testing Dali::Actor::OnSceneSignal() and OffSceneSignal()");
3164 TestApplication application;
3167 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3168 gActorNamesOnOffScene.clear();
3170 Actor parent = Actor::New();
3171 parent.SetProperty(Actor::Property::NAME, "parent");
3172 parent.OnSceneSignal().Connect(OnSceneCallback);
3173 parent.OffSceneSignal().Connect(OffSceneCallback);
3175 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
3176 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
3178 // add parent to the scene
3179 application.GetScene().Add(parent);
3180 // onstage emitted, offstage not
3181 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3182 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3183 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3185 // test adding a child, should get onstage emitted
3187 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3188 gActorNamesOnOffScene.clear();
3190 Actor child = Actor::New();
3191 child.SetProperty(Actor::Property::NAME, "child");
3192 child.OnSceneSignal().Connect(OnSceneCallback);
3193 child.OffSceneSignal().Connect(OffSceneCallback);
3194 parent.Add(child); // add child
3195 // onscene emitted, offscene not
3196 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
3197 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3198 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3200 // test removing parent from the scene
3202 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3203 gActorNamesOnOffScene.clear();
3205 application.GetScene().Remove(parent);
3206 // onscene not emitted, offscene is
3207 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3208 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
3209 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3210 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
3212 // test adding parent back to the scene
3214 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3215 gActorNamesOnOffScene.clear();
3217 application.GetScene().Add(parent);
3218 // onscene emitted, offscene not
3219 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
3220 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
3221 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3222 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
3224 // test removing child
3226 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3227 gActorNamesOnOffScene.clear();
3229 parent.Remove(child);
3230 // onscene not emitted, offscene is
3231 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3232 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3233 DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
3235 // test removing parent
3237 gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
3238 gActorNamesOnOffScene.clear();
3240 application.GetScene().Remove(parent);
3241 // onscene not emitted, offscene is
3242 DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
3243 DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
3244 DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
3248 int UtcDaliActorFindChildByName(void)
3250 tet_infoline("Testing Dali::Actor::FindChildByName()");
3251 TestApplication application;
3253 Actor parent = Actor::New();
3254 parent.SetProperty(Actor::Property::NAME, "parent");
3255 Actor first = Actor::New();
3256 first.SetProperty(Actor::Property::NAME, "first");
3257 Actor second = Actor::New();
3258 second.SetProperty(Actor::Property::NAME, "second");
3263 Actor found = parent.FindChildByName("foo");
3264 DALI_TEST_CHECK(!found);
3266 found = parent.FindChildByName("parent");
3267 DALI_TEST_CHECK(found == parent);
3269 found = parent.FindChildByName("first");
3270 DALI_TEST_CHECK(found == first);
3272 found = parent.FindChildByName("second");
3273 DALI_TEST_CHECK(found == second);
3277 int UtcDaliActorFindChildById(void)
3279 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
3280 TestApplication application;
3282 Actor parent = Actor::New();
3283 Actor first = Actor::New();
3284 Actor second = Actor::New();
3289 Actor found = parent.FindChildById(100000);
3290 DALI_TEST_CHECK(!found);
3292 found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
3293 DALI_TEST_CHECK(found == parent);
3295 found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
3296 DALI_TEST_CHECK(found == first);
3298 found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
3299 DALI_TEST_CHECK(found == second);
3303 int UtcDaliActorHitTest(void)
3308 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
3310 mTouchPoint(touchPoint),
3316 Vector2 mTouchPoint;
3320 TestApplication application;
3321 tet_infoline(" UtcDaliActorHitTest");
3323 // Fill a vector with different hit tests.
3324 struct HitTestData* hitTestData[] = {
3325 // scale touch point result
3326 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
3327 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
3328 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.
3329 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
3330 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.
3334 // get the root layer
3335 Actor actor = Actor::New();
3336 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3337 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3339 application.GetScene().Add(actor);
3341 ResetTouchCallbacks();
3343 unsigned int index = 0;
3344 while(NULL != hitTestData[index])
3346 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
3347 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
3349 // flush the queue and render once
3350 application.SendNotification();
3351 application.Render();
3353 DALI_TEST_CHECK(!gTouchCallBackCalled);
3355 // connect to its touch signal
3356 actor.TouchedSignal().Connect(TestTouchCallback);
3358 Dali::Integration::Point point;
3359 point.SetState(PointState::DOWN);
3360 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
3361 Dali::Integration::TouchEvent event;
3362 event.AddPoint(point);
3364 // flush the queue and render once
3365 application.SendNotification();
3366 application.Render();
3367 application.ProcessEvent(event);
3369 DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
3371 if(gTouchCallBackCalled != hitTestData[index]->mResult)
3372 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
3373 hitTestData[index]->mScale.x,
3374 hitTestData[index]->mScale.y,
3375 hitTestData[index]->mScale.z,
3376 hitTestData[index]->mTouchPoint.x,
3377 hitTestData[index]->mTouchPoint.y,
3378 hitTestData[index]->mResult);
3380 ResetTouchCallbacks();
3386 int UtcDaliActorSetDrawMode(void)
3388 TestApplication application;
3389 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
3391 Actor a = Actor::New();
3393 application.GetScene().Add(a);
3394 application.SendNotification();
3395 application.Render(0);
3396 application.SendNotification();
3397 application.Render(1);
3399 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
3401 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3402 application.SendNotification();
3403 application.Render(1);
3405 DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
3407 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
3408 application.SendNotification();
3409 application.Render(1);
3411 DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
3415 int UtcDaliActorSetDrawModeOverlayRender(void)
3417 TestApplication application;
3418 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
3420 application.SendNotification();
3421 application.Render(1);
3423 std::vector<GLuint> ids;
3424 ids.push_back(8); // first rendered actor
3425 ids.push_back(9); // second rendered actor
3426 ids.push_back(10); // third rendered actor
3427 application.GetGlAbstraction().SetNextTextureIds(ids);
3429 Texture imageA = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3430 Texture imageB = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3431 Texture imageC = CreateTexture(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
3432 Actor a = CreateRenderableActor(imageA);
3433 Actor b = CreateRenderableActor(imageB);
3434 Actor c = CreateRenderableActor(imageC);
3436 application.SendNotification();
3437 application.Render(1);
3439 //Textures are bound when first created. Clear bound textures vector
3440 application.GetGlAbstraction().ClearBoundTextures();
3442 // Render a,b,c as regular non-overlays. so order will be:
3446 application.GetScene().Add(a);
3447 application.GetScene().Add(b);
3448 application.GetScene().Add(c);
3450 application.SendNotification();
3451 application.Render(1);
3453 // Should be 3 textures changes.
3454 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3455 typedef std::vector<GLuint>::size_type TextureSize;
3456 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3457 if(boundTextures.size() == 3)
3459 DALI_TEST_CHECK(boundTextures[0] == 8u);
3460 DALI_TEST_CHECK(boundTextures[1] == 9u);
3461 DALI_TEST_CHECK(boundTextures[2] == 10u);
3464 // Now texture ids have been set, we can monitor their render order.
3465 // render a as an overlay (last), so order will be:
3469 a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3470 application.GetGlAbstraction().ClearBoundTextures();
3472 application.SendNotification();
3473 application.Render(1);
3475 // Should be 3 texture changes.
3476 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3477 if(boundTextures.size() == 3)
3479 DALI_TEST_CHECK(boundTextures[0] == 9u);
3480 DALI_TEST_CHECK(boundTextures[1] == 10u);
3481 DALI_TEST_CHECK(boundTextures[2] == 8u);
3486 int UtcDaliActorSetDrawModeOverlayWithClipping(void)
3488 TestApplication application;
3489 tet_infoline(" UtcDaliActorSetDrawModeOverlayWithClipping");
3491 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3492 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
3493 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3495 const Vector2 surfaceSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
3496 const Vector2 imageSize(16.0f, 16.0f);
3498 std::vector<GLuint> ids;
3499 ids.push_back(8); // first rendered actor
3500 ids.push_back(9); // second rendered actor
3501 ids.push_back(10); // third rendered actor
3502 ids.push_back(11); // forth rendered actor
3503 application.GetGlAbstraction().SetNextTextureIds(ids);
3505 Actor a = CreateActorWithContent16x16();
3506 Actor b = CreateActorWithContent16x16();
3507 Actor c = CreateActorWithContent16x16();
3508 Actor d = CreateActorWithContent16x16();
3510 application.SendNotification();
3511 application.Render();
3513 //Textures are bound when first created. Clear bound textures vector
3514 application.GetGlAbstraction().ClearBoundTextures();
3516 b[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3517 b[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3518 b[Actor::Property::DRAW_MODE] = DrawMode::OVERLAY_2D;
3519 b[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3521 c[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
3522 c[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
3523 c[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
3524 c[Actor::Property::POSITION] = Vector2(100.0f, -100.0f);
3526 application.GetScene().Add(a);
3527 application.GetScene().Add(b);
3528 application.GetScene().Add(c);
3531 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3533 const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
3534 typedef std::vector<GLuint>::size_type TextureSize;
3535 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(4), TEST_LOCATION);
3536 if(boundTextures.size() == 4)
3538 DALI_TEST_CHECK(boundTextures[0] == 8u);
3539 DALI_TEST_CHECK(boundTextures[1] == 10u);
3540 DALI_TEST_CHECK(boundTextures[2] == 9u);
3541 DALI_TEST_CHECK(boundTextures[3] == 11u);
3544 // Check scissor test was enabled.
3545 std::ostringstream scissor;
3546 scissor << std::hex << GL_SCISSOR_TEST;
3547 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
3549 // Check the scissor was set, and the coordinates are correct.
3550 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3551 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3553 application.GetGlAbstraction().ClearBoundTextures();
3555 // Remove a Renderer of overlay actor
3556 Renderer renderer = b.GetRendererAt(0);
3557 b.RemoveRenderer(renderer);
3559 GenerateTrace(application, enabledDisableTrace, scissorTrace);
3561 DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
3562 if(boundTextures.size() == 3)
3564 DALI_TEST_CHECK(boundTextures[0] == 8u);
3565 DALI_TEST_CHECK(boundTextures[1] == 10u);
3566 DALI_TEST_CHECK(boundTextures[2] == 11u);
3569 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(0, "Scissor", "100, 100, 16, 16")); // First compare with c area
3570 DALI_TEST_CHECK(scissorTrace.TestMethodAndParams(1, "Scissor", "0, 0, 16, 16")); // Second compare with b area
3575 int UtcDaliActorGetCurrentWorldMatrix(void)
3577 TestApplication application;
3578 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
3580 Actor parent = Actor::New();
3581 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3582 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3583 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3584 Radian rotationAngle(Degree(85.0f));
3585 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3586 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3587 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3588 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3589 parent.SetProperty(Actor::Property::SCALE, parentScale);
3590 application.GetScene().Add(parent);
3592 Actor child = Actor::New();
3593 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3594 Vector3 childPosition(0.0f, 0.0f, 100.0f);
3595 Radian childRotationAngle(Degree(23.0f));
3596 Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
3597 Vector3 childScale(2.0f, 2.0f, 2.0f);
3598 child.SetProperty(Actor::Property::POSITION, childPosition);
3599 child.SetProperty(Actor::Property::ORIENTATION, childRotation);
3600 child.SetProperty(Actor::Property::SCALE, childScale);
3603 application.SendNotification();
3604 application.Render(0);
3605 application.Render();
3606 application.SendNotification();
3608 Matrix parentMatrix(false);
3609 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3611 Matrix childMatrix(false);
3612 childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
3614 //Child matrix should be the composition of child and parent
3615 Matrix childWorldMatrix(false);
3616 Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
3618 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3619 DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
3623 int UtcDaliActorConstrainedToWorldMatrix(void)
3625 TestApplication application;
3626 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3628 Actor parent = Actor::New();
3629 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3630 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3631 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3632 Radian rotationAngle(Degree(85.0f));
3633 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3634 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3635 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3636 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3637 parent.SetProperty(Actor::Property::SCALE, parentScale);
3638 application.GetScene().Add(parent);
3640 Actor child = Actor::New();
3641 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3642 Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
3643 posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
3644 posConstraint.Apply();
3646 application.GetScene().Add(child);
3648 application.SendNotification();
3649 application.Render(0);
3650 application.Render();
3651 application.SendNotification();
3653 Matrix parentMatrix(false);
3654 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3656 DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
3657 DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
3661 int UtcDaliActorConstrainedToOrientation(void)
3663 TestApplication application;
3664 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3666 Actor parent = Actor::New();
3667 parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3668 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
3669 Vector3 parentPosition(10.0f, 20.0f, 30.0f);
3670 Radian rotationAngle(Degree(85.0f));
3671 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3672 Vector3 parentScale(1.0f, 2.0f, 3.0f);
3673 parent.SetProperty(Actor::Property::POSITION, parentPosition);
3674 parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
3675 parent.SetProperty(Actor::Property::SCALE, parentScale);
3676 application.GetScene().Add(parent);
3678 Actor child = Actor::New();
3679 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
3680 Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
3681 posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
3682 posConstraint.Apply();
3684 application.GetScene().Add(child);
3686 application.SendNotification();
3687 application.Render(0);
3688 application.Render();
3689 application.SendNotification();
3691 DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
3695 int UtcDaliActorConstrainedToOpacity(void)
3697 TestApplication application;
3698 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3700 Actor parent = Actor::New();
3701 parent.SetProperty(Actor::Property::OPACITY, 0.7f);
3702 application.GetScene().Add(parent);
3704 Actor child = Actor::New();
3705 Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
3706 opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
3707 opacityConstraint.Apply();
3709 application.GetScene().Add(child);
3711 application.SendNotification();
3712 application.Render(0);
3713 application.Render();
3714 application.SendNotification();
3716 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3718 parent.SetProperty(Actor::Property::OPACITY, 0.3f);
3720 application.SendNotification();
3721 application.Render(0);
3722 application.Render();
3723 application.SendNotification();
3725 DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
3730 int UtcDaliActorUnparent(void)
3732 TestApplication application;
3733 tet_infoline(" UtcDaliActorUnparent");
3735 Actor parent = Actor::New();
3736 application.GetScene().Add(parent);
3738 Actor child = Actor::New();
3740 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3741 DALI_TEST_CHECK(!child.GetParent());
3743 // Test that calling Unparent with no parent is a NOOP
3746 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3747 DALI_TEST_CHECK(!child.GetParent());
3749 // Test that Unparent works
3752 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3753 DALI_TEST_CHECK(parent == child.GetParent());
3757 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3758 DALI_TEST_CHECK(!child.GetParent());
3760 // Test that UnparentAndReset works
3763 DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
3764 DALI_TEST_CHECK(parent == child.GetParent());
3766 UnparentAndReset(child);
3768 DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
3769 DALI_TEST_CHECK(!child);
3771 // Test that UnparentAndReset is a NOOP with empty handle
3772 UnparentAndReset(child);
3774 DALI_TEST_CHECK(!child);
3778 int UtcDaliActorGetChildAt(void)
3780 TestApplication application;
3781 tet_infoline(" UtcDaliActorGetChildAt");
3783 Actor parent = Actor::New();
3784 application.GetScene().Add(parent);
3786 Actor child0 = Actor::New();
3789 Actor child1 = Actor::New();
3792 Actor child2 = Actor::New();
3795 DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
3796 DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
3797 DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
3801 int UtcDaliActorSetGetOverlay(void)
3803 TestApplication application;
3804 tet_infoline(" UtcDaliActorSetGetOverlay");
3806 Actor parent = Actor::New();
3807 parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
3808 DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
3812 int UtcDaliActorCreateDestroy(void)
3814 Actor* actor = new Actor;
3815 DALI_TEST_CHECK(actor);
3822 struct PropertyStringIndex
3824 const char* const name;
3825 const Property::Index index;
3826 const Property::Type type;
3829 const PropertyStringIndex PROPERTY_TABLE[] =
3831 {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
3832 {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
3833 {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
3834 {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
3835 {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
3836 {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
3837 {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
3838 {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
3839 {"size", Actor::Property::SIZE, Property::VECTOR3},
3840 {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
3841 {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
3842 {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
3843 {"position", Actor::Property::POSITION, Property::VECTOR3},
3844 {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
3845 {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
3846 {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
3847 {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
3848 {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
3849 {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
3850 {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
3851 {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
3852 {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
3853 {"scale", Actor::Property::SCALE, Property::VECTOR3},
3854 {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
3855 {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
3856 {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
3857 {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
3858 {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
3859 {"color", Actor::Property::COLOR, Property::VECTOR4},
3860 {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
3861 {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
3862 {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
3863 {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
3864 {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
3865 {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
3866 {"name", Actor::Property::NAME, Property::STRING},
3867 {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
3868 {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
3869 {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
3870 {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
3871 {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
3872 {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
3873 {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
3874 {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
3875 {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
3876 {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
3877 {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
3878 {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
3879 {"padding", Actor::Property::PADDING, Property::VECTOR4},
3880 {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
3881 {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
3882 {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
3883 {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
3884 {"opacity", Actor::Property::OPACITY, Property::FLOAT},
3886 const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
3887 } // unnamed namespace
3889 int UtcDaliActorProperties(void)
3891 TestApplication application;
3893 Actor actor = Actor::New();
3895 for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
3897 tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
3898 DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
3899 DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
3900 DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
3905 int UtcDaliRelayoutProperties_ResizePolicies(void)
3907 TestApplication application;
3909 Actor actor = Actor::New();
3912 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3913 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
3915 // Set resize policy for all dimensions
3916 actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
3917 for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3919 DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
3922 // Set individual dimensions
3923 const char* const widthPolicy = "FILL_TO_PARENT";
3924 const char* const heightPolicy = "FIXED";
3926 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
3927 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
3929 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
3930 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
3932 // Set individual dimensions using enums
3933 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
3934 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3936 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
3937 actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
3939 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
3940 DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
3945 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3947 TestApplication application;
3949 Actor actor = Actor::New();
3952 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
3954 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3955 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
3956 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
3959 const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
3960 const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3962 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
3963 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
3965 actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
3966 DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
3971 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3973 TestApplication application;
3975 Actor actor = Actor::New();
3978 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3979 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
3981 Vector3 sizeMode(1.0f, 2.0f, 3.0f);
3982 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
3983 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
3986 Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
3988 actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
3989 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
3994 int UtcDaliRelayoutProperties_DimensionDependency(void)
3996 TestApplication application;
3998 Actor actor = Actor::New();
4001 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4002 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
4005 actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
4006 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
4008 actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
4009 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
4011 // Test setting another resize policy
4012 actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
4013 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
4018 int UtcDaliRelayoutProperties_Padding(void)
4020 TestApplication application;
4022 Actor actor = Actor::New();
4025 Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
4028 actor.SetProperty(Actor::Property::PADDING, padding);
4029 Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
4031 DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4036 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
4038 TestApplication application;
4040 Actor actor = Actor::New();
4043 Vector2 minSize(1.0f, 2.0f);
4045 actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
4046 Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
4048 DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4050 Vector2 maxSize(3.0f, 4.0f);
4052 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
4053 Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
4055 DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
4060 int UtcDaliActorGetHeightForWidth(void)
4062 TestApplication application;
4064 Actor actor = Actor::New();
4066 DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
4071 int UtcDaliActorGetWidthForHeight(void)
4073 TestApplication application;
4075 Actor actor = Actor::New();
4077 DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
4082 int UtcDaliActorGetRelayoutSize(void)
4084 TestApplication application;
4086 Actor actor = Actor::New();
4088 // Add actor to stage
4089 application.GetScene().Add(actor);
4091 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
4093 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
4094 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
4096 // Flush the queue and render once
4097 application.SendNotification();
4098 application.Render();
4100 DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
4105 int UtcDaliActorSetPadding(void)
4107 TestApplication application;
4109 Actor actor = Actor::New();
4112 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4114 DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
4115 DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
4116 DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
4117 DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
4119 Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
4120 actor.SetProperty(Actor::Property::PADDING, padding2);
4122 padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
4124 DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
4125 DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
4126 DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
4127 DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
4132 int UtcDaliActorSetMinimumSize(void)
4134 TestApplication application;
4136 Actor actor = Actor::New();
4138 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4140 DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
4141 DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
4143 Vector2 size2(1.0f, 2.0f);
4144 actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
4146 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
4148 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4149 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4154 int UtcDaliActorSetMaximumSize(void)
4156 TestApplication application;
4158 Actor actor = Actor::New();
4160 Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4162 DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
4163 DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
4165 Vector2 size2(1.0f, 2.0f);
4166 actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
4168 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
4170 DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
4171 DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
4176 int UtcDaliActorOnRelayoutSignal(void)
4178 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
4180 TestApplication application;
4183 gOnRelayoutCallBackCalled = false;
4184 gActorNamesRelayout.clear();
4186 Actor actor = Actor::New();
4187 actor.SetProperty(Actor::Property::NAME, "actor");
4188 actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
4191 DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
4193 // Add actor to stage
4194 application.GetScene().Add(actor);
4196 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
4197 actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
4199 // Flush the queue and render once
4200 application.SendNotification();
4201 application.Render();
4203 // OnRelayout emitted
4204 DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
4205 DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
4210 int UtcDaliActorGetHierachyDepth(void)
4212 TestApplication application;
4213 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
4215 /* Build tree of actors:
4225 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
4227 Integration::Scene stage(application.GetScene());
4229 Actor actorA = Actor::New();
4230 Actor actorB = Actor::New();
4231 Actor actorC = Actor::New();
4232 Actor actorD = Actor::New();
4233 Actor actorE = Actor::New();
4234 Actor actorF = Actor::New();
4236 //Test that root actor has depth equal 0
4237 DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4239 //Test actors return depth -1 when not connected to the tree
4240 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4241 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4242 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4243 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4244 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4245 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4247 //Create the hierarchy
4255 //Test actors return correct depth
4256 DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4257 DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4258 DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4259 DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4260 DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4261 DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4263 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
4264 actorA.Remove(actorB);
4266 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4267 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4268 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4270 //Removing actorA from the stage. All actors should have depth equal -1
4271 stage.Remove(actorA);
4273 DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4274 DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4275 DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4276 DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4277 DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4278 DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
4283 int UtcDaliActorAnchorPointPropertyAsString(void)
4285 TestApplication application;
4287 Actor actor = Actor::New();
4289 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
4290 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4292 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
4293 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4295 actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
4296 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4298 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
4299 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4301 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
4302 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
4304 actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
4305 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4307 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
4308 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4310 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
4311 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4313 actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
4314 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4316 // Invalid should not change anything
4317 actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
4318 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4323 int UtcDaliActorParentOriginPropertyAsString(void)
4325 TestApplication application;
4327 Actor actor = Actor::New();
4329 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
4330 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
4332 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
4333 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
4335 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
4336 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
4338 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
4339 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
4341 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
4342 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
4344 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
4345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
4347 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
4348 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
4350 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
4351 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
4353 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
4354 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4356 // Invalid should not change anything
4357 actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
4358 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
4363 int UtcDaliActorColorModePropertyAsString(void)
4365 TestApplication application;
4367 Actor actor = Actor::New();
4369 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
4370 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4372 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
4373 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4375 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
4376 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4378 actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
4379 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4381 // Invalid should not change anything
4382 actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
4383 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4388 int UtcDaliActorDrawModePropertyAsString(void)
4390 TestApplication application;
4392 Actor actor = Actor::New();
4394 actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
4395 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4397 actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
4398 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4400 // Invalid should not change anything
4401 actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
4402 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4407 int UtcDaliActorColorModePropertyAsEnum(void)
4409 TestApplication application;
4411 Actor actor = Actor::New();
4413 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
4414 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
4416 actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
4417 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
4419 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
4420 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
4422 actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
4423 DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
4428 int UtcDaliActorDrawModePropertyAsEnum(void)
4430 TestApplication application;
4432 Actor actor = Actor::New();
4434 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
4435 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
4437 actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
4438 DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
4443 int UtcDaliActorAddRendererP(void)
4445 tet_infoline("Testing Actor::AddRenderer");
4446 TestApplication application;
4448 Actor actor = Actor::New();
4450 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4452 Geometry geometry = CreateQuadGeometry();
4453 Shader shader = CreateShader();
4454 Renderer renderer = Renderer::New(geometry, shader);
4456 actor.AddRenderer(renderer);
4457 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4458 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4463 int UtcDaliActorAddRendererN01(void)
4465 tet_infoline("Testing Actor::AddRenderer");
4466 TestApplication application;
4468 Actor actor = Actor::New();
4474 actor.AddRenderer(renderer);
4475 tet_printf("Assertion test failed - no Exception\n");
4476 tet_result(TET_FAIL);
4478 catch(Dali::DaliException& e)
4480 DALI_TEST_PRINT_ASSERT(e);
4481 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
4482 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4486 tet_printf("Assertion test failed - wrong Exception\n");
4487 tet_result(TET_FAIL);
4493 int UtcDaliActorAddRendererN02(void)
4495 tet_infoline("UtcDaliActorAddRendererN02");
4501 TestApplication application;
4503 Geometry geometry = CreateQuadGeometry();
4504 Shader shader = CreateShader();
4505 renderer = Renderer::New(geometry, shader);
4507 actor = Actor::New();
4510 // try illegal AddRenderer
4513 actor.AddRenderer(renderer);
4514 tet_printf("Assertion test failed - no Exception\n");
4515 tet_result(TET_FAIL);
4517 catch(Dali::DaliException& e)
4519 DALI_TEST_PRINT_ASSERT(e);
4520 DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
4524 tet_printf("Assertion test failed - wrong Exception\n");
4525 tet_result(TET_FAIL);
4531 int UtcDaliActorAddRendererOnScene(void)
4533 tet_infoline("Testing Actor::AddRenderer");
4534 TestApplication application;
4536 Actor actor = Actor::New();
4537 application.GetScene().Add(actor);
4539 application.SendNotification();
4540 application.Render(0);
4542 Geometry geometry = CreateQuadGeometry();
4543 Shader shader = CreateShader();
4544 Renderer renderer = Renderer::New(geometry, shader);
4546 application.SendNotification();
4547 application.Render(0);
4551 actor.AddRenderer(renderer);
4552 tet_result(TET_PASS);
4556 tet_result(TET_FAIL);
4562 int UtcDaliActorRemoveRendererP1(void)
4564 tet_infoline("Testing Actor::RemoveRenderer");
4565 TestApplication application;
4567 Actor actor = Actor::New();
4569 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4572 Geometry geometry = CreateQuadGeometry();
4573 Shader shader = CreateShader();
4574 Renderer renderer = Renderer::New(geometry, shader);
4576 actor.AddRenderer(renderer);
4577 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4578 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4580 application.SendNotification();
4581 application.Render();
4585 Renderer renderer = actor.GetRendererAt(0);
4586 actor.RemoveRenderer(renderer);
4587 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4589 application.SendNotification();
4590 application.Render();
4593 // Call one final time to ensure that the renderer is actually removed after
4594 // the handle goes out of scope, and excercises the deletion code path in
4595 // scene graph and render.
4596 application.SendNotification();
4597 application.Render();
4602 int UtcDaliActorRemoveRendererP2(void)
4604 tet_infoline("Testing Actor::RemoveRenderer");
4605 TestApplication application;
4607 Actor actor = Actor::New();
4609 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4611 Geometry geometry = CreateQuadGeometry();
4612 Shader shader = CreateShader();
4613 Renderer renderer = Renderer::New(geometry, shader);
4615 actor.AddRenderer(renderer);
4616 application.SendNotification();
4617 application.Render();
4619 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4620 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4622 actor.RemoveRenderer(0);
4623 application.SendNotification();
4624 application.Render();
4626 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4628 // Shut down whilst holding onto the renderer handle.
4632 int UtcDaliActorRemoveRendererP3(void)
4634 tet_infoline("Testing Actor::RemoveRenderer");
4635 TestApplication application;
4637 Actor actor1 = Actor::New();
4638 Actor actor2 = Actor::New();
4639 Actor actor3 = Actor::New();
4641 application.GetScene().Add(actor1);
4642 application.GetScene().Add(actor2);
4643 application.GetScene().Add(actor3);
4645 // Make each actors size bigger than zero, so we can assuem that actor is rendered
4646 actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4647 actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4648 actor3.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
4650 // Register some dummy property to seperate actor1 and actor2 in Render::Renderer
4651 actor1.RegisterProperty("dummy1", 1);
4652 actor2.RegisterProperty("dummy2", 2.0f);
4653 actor3.RegisterProperty("dummy3", Vector2(3.0f, 4.0f));
4655 DALI_TEST_EQUALS(actor1.GetRendererCount(), 0u, TEST_LOCATION);
4656 DALI_TEST_EQUALS(actor2.GetRendererCount(), 0u, TEST_LOCATION);
4657 DALI_TEST_EQUALS(actor3.GetRendererCount(), 0u, TEST_LOCATION);
4659 Geometry geometry = CreateQuadGeometry();
4660 Shader shader = CreateShader();
4661 Renderer renderer1 = Renderer::New(geometry, shader);
4662 Renderer renderer2 = Renderer::New(geometry, shader);
4664 actor1.AddRenderer(renderer1);
4665 actor1.AddRenderer(renderer2);
4666 actor2.AddRenderer(renderer1);
4667 actor2.AddRenderer(renderer2);
4668 actor3.AddRenderer(renderer1);
4669 actor3.AddRenderer(renderer2);
4670 application.SendNotification();
4671 application.Render();
4673 DALI_TEST_EQUALS(actor1.GetRendererCount(), 2u, TEST_LOCATION);
4674 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer1, TEST_LOCATION);
4675 DALI_TEST_EQUALS(actor1.GetRendererAt(1), renderer2, TEST_LOCATION);
4677 DALI_TEST_EQUALS(actor2.GetRendererCount(), 2u, TEST_LOCATION);
4678 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4679 DALI_TEST_EQUALS(actor2.GetRendererAt(1), renderer2, TEST_LOCATION);
4681 DALI_TEST_EQUALS(actor3.GetRendererCount(), 2u, TEST_LOCATION);
4682 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer1, TEST_LOCATION);
4683 DALI_TEST_EQUALS(actor3.GetRendererAt(1), renderer2, TEST_LOCATION);
4685 actor1.RemoveRenderer(0);
4686 actor2.RemoveRenderer(1);
4687 actor3.RemoveRenderer(0);
4688 application.SendNotification();
4689 application.Render();
4691 DALI_TEST_EQUALS(actor1.GetRendererCount(), 1u, TEST_LOCATION);
4692 DALI_TEST_EQUALS(actor1.GetRendererAt(0), renderer2, TEST_LOCATION);
4693 DALI_TEST_EQUALS(actor2.GetRendererCount(), 1u, TEST_LOCATION);
4694 DALI_TEST_EQUALS(actor2.GetRendererAt(0), renderer1, TEST_LOCATION);
4695 DALI_TEST_EQUALS(actor3.GetRendererCount(), 1u, TEST_LOCATION);
4696 DALI_TEST_EQUALS(actor3.GetRendererAt(0), renderer2, TEST_LOCATION);
4698 // Shut down whilst holding onto the renderer handle.
4702 int UtcDaliActorRemoveRendererN(void)
4704 tet_infoline("Testing Actor::RemoveRenderer");
4705 TestApplication application;
4707 Actor actor = Actor::New();
4709 DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
4711 Geometry geometry = CreateQuadGeometry();
4712 Shader shader = CreateShader();
4713 Renderer renderer = Renderer::New(geometry, shader);
4715 actor.AddRenderer(renderer);
4716 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4717 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4719 actor.RemoveRenderer(10);
4720 DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
4721 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
4726 int UtcDaliActorPropertyClippingP(void)
4728 // This test checks the clippingMode property.
4729 tet_infoline("Testing Actor::Property::ClippingMode: P");
4730 TestApplication application;
4732 Actor actor = Actor::New();
4734 // Check default clippingEnabled value.
4735 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4738 bool getValueResult = getValue.Get(value);
4739 DALI_TEST_CHECK(getValueResult);
4743 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4746 // Check setting the property to the stencil mode.
4747 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4749 // Check the new value was set.
4750 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4751 getValueResult = getValue.Get(value);
4752 DALI_TEST_CHECK(getValueResult);
4756 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
4759 // Check setting the property to the scissor mode.
4760 actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
4762 // Check the new value was set.
4763 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4764 getValueResult = getValue.Get(value);
4765 DALI_TEST_CHECK(getValueResult);
4769 DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
4774 int UtcDaliActorPropertyClippingN(void)
4776 // Negative test case for Clipping.
4777 tet_infoline("Testing Actor::Property::ClippingMode: N");
4778 TestApplication application;
4780 Actor actor = Actor::New();
4782 // Check default clippingEnabled value.
4783 Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
4786 bool getValueResult = getValue.Get(value);
4787 DALI_TEST_CHECK(getValueResult);
4791 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4794 // Check setting an invalid property value won't change the current property value.
4795 actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
4797 getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
4798 getValueResult = getValue.Get(value);
4799 DALI_TEST_CHECK(getValueResult);
4803 DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
4809 int UtcDaliActorPropertyClippingActor(void)
4811 // This test checks that an actor is correctly setup for clipping.
4812 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
4813 TestApplication application;
4815 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4816 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4817 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4818 size_t startIndex = 0u;
4820 // Create a clipping actor.
4821 Actor actorDepth1Clip = CreateActorWithContent16x16();
4822 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4823 application.GetScene().Add(actorDepth1Clip);
4825 // Gather the call trace.
4826 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4828 // Check we are writing to the color buffer.
4829 CheckColorMask(glAbstraction, true);
4831 // Check the stencil buffer was enabled.
4832 std::ostringstream oss;
4833 oss << std::hex << GL_STENCIL_TEST;
4834 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4836 // Check the stencil buffer was cleared.
4837 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4839 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4840 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4841 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4842 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4847 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4849 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4850 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
4851 TestApplication application;
4853 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4854 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4855 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4856 size_t startIndex = 0u;
4858 // Create a clipping actor.
4859 Actor actorDepth1Clip = CreateActorWithContent16x16();
4860 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4861 application.GetScene().Add(actorDepth1Clip);
4863 // Gather the call trace.
4864 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4866 // Check we are writing to the color buffer.
4867 CheckColorMask(glAbstraction, true);
4869 // Check the stencil buffer was enabled.
4870 std::ostringstream oss;
4871 oss << std::hex << GL_STENCIL_TEST;
4872 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4874 // Check the stencil buffer was cleared.
4875 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4877 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4878 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4879 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
4880 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4882 // Now disable the clipping
4883 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
4885 // Gather the call trace.
4886 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4888 // Check the stencil buffer was disabled.
4889 std::ostringstream stencil;
4890 stencil << std::hex << GL_STENCIL_TEST;
4891 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", stencil.str()));
4893 // Ensure all values in stencil-mask are set to 1.
4895 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
4900 int UtcDaliActorPropertyClippingNestedChildren(void)
4902 // This test checks that a hierarchy of actors are clipped correctly by
4903 // writing to and reading from the correct bit-planes of the stencil buffer.
4904 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
4905 TestApplication application;
4906 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4907 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4908 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4910 // Create a clipping actor.
4911 Actor actorDepth1Clip = CreateActorWithContent16x16();
4912 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4913 application.GetScene().Add(actorDepth1Clip);
4915 // Create a child actor.
4916 Actor childDepth2 = CreateActorWithContent16x16();
4917 actorDepth1Clip.Add(childDepth2);
4919 // Create another clipping actor.
4920 Actor childDepth2Clip = CreateActorWithContent16x16();
4921 childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
4922 childDepth2.Add(childDepth2Clip);
4924 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4925 // This tests the sort algorithm.
4926 Actor childDepth3 = CreateActorWithContent16x16();
4927 childDepth2Clip.Add(childDepth3);
4928 Actor childDepth4 = CreateActorWithContent16x16();
4929 childDepth3.Add(childDepth4);
4931 // Gather the call trace.
4932 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4934 // Check we are writing to the color buffer.
4935 CheckColorMask(glAbstraction, true);
4937 // Check the stencil buffer was enabled.
4938 std::ostringstream oss;
4939 oss << std::hex << GL_STENCIL_TEST;
4940 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", oss.str()));
4942 // Perform the test twice, once for 2D layer, and once for 3D.
4943 for(unsigned int i = 0u; i < 2u; ++i)
4945 size_t startIndex = 0u;
4947 // Check the stencil buffer was cleared.
4948 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
4950 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4951 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4952 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
4953 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4955 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4956 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 1", startIndex)); // 514 is GL_EQUAL
4957 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4959 // Check we are set up to write to the second bitplane of the stencil buffer (only).
4960 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4961 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
4962 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
4964 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4965 // (Both must be set to pass the check).
4966 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 3", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4967 DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
4969 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4972 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
4973 GenerateTrace(application, enabledDisableTrace, stencilTrace);
4980 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4982 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4983 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
4984 TestApplication application;
4985 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4986 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4988 /* We create a small tree of actors as follows:
4992 Clipping enabled -> B D
4996 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4999 for(int i = 0; i < 5; ++i)
5001 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
5002 Actor actor = CreateRenderableActor(image);
5004 // Setup dimensions and position so actor is not skipped by culling.
5005 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
5006 actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
5010 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5014 float b = i > 2 ? 1.0f : -1.0f;
5015 actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
5021 // Enable clipping on the actor at the top of the left branch.
5022 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5024 // Build the scene graph.
5025 application.GetScene().Add(actors[0]);
5028 actors[0].Add(actors[1]);
5029 actors[1].Add(actors[2]);
5032 actors[0].Add(actors[3]);
5033 actors[3].Add(actors[4]);
5035 // Gather the call trace.
5036 enabledDisableTrace.Reset();
5037 enabledDisableTrace.Enable(true);
5038 application.SendNotification();
5039 application.Render();
5040 enabledDisableTrace.Enable(false);
5042 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
5044 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
5045 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
5047 size_t startIndex = 0u;
5048 std::ostringstream blend;
5049 blend << std::hex << GL_BLEND;
5050 std::ostringstream stencil;
5051 stencil << std::hex << GL_STENCIL_TEST;
5053 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", blend.str(), startIndex));
5054 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5055 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5057 // Swap the clipping actor from top of left branch to top of right branch.
5058 actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
5059 actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5061 // Gather the call trace.
5062 enabledDisableTrace.Reset();
5063 enabledDisableTrace.Enable(true);
5064 application.SendNotification();
5065 application.Render();
5066 enabledDisableTrace.Enable(false);
5068 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
5069 // This proves the draw order has remained the same.
5071 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", stencil.str(), startIndex));
5072 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", stencil.str(), startIndex));
5077 int UtcDaliActorPropertyScissorClippingActor01(void)
5079 // This test checks that an actor is correctly setup for clipping.
5080 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
5081 TestApplication application;
5083 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5084 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5085 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5087 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5088 const Vector2 imageSize(16.0f, 16.0f);
5090 // Create a clipping actor.
5091 Actor clippingActorA = CreateActorWithContent16x16();
5092 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5093 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5094 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5095 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5096 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5097 application.GetScene().Add(clippingActorA);
5099 // Gather the call trace.
5100 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5102 // Check we are writing to the color buffer.
5103 CheckColorMask(glAbstraction, true);
5105 // Check scissor test was enabled.
5107 std::ostringstream scissor;
5108 scissor << std::hex << GL_SCISSOR_TEST;
5109 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5111 // Check the scissor was set, and the coordinates are correct.
5112 std::stringstream compareParametersString;
5113 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
5114 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5116 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5117 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5119 // Gather the call trace.
5120 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5122 // Check the scissor was set, and the coordinates are correct.
5123 compareParametersString.str(std::string());
5124 compareParametersString.clear();
5125 compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
5126 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5131 int UtcDaliActorPropertyScissorClippingActor02(void)
5133 // This test checks that an actor is correctly setup for clipping.
5134 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor with a transparent renderer");
5135 TestApplication application;
5137 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5138 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5139 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5141 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5142 const Vector2 actorSize(16.0f, 16.0f);
5144 // Create a clipping actor.
5145 Actor clippingActorA = CreateRenderableActor();
5146 clippingActorA[Actor::Property::SIZE] = actorSize;
5148 Renderer renderer = clippingActorA.GetRendererAt(0);
5149 DALI_TEST_CHECK(renderer);
5151 // Make Renderer opacity 0.
5152 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
5154 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5155 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5156 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
5157 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
5158 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5159 application.GetScene().Add(clippingActorA);
5161 // Gather the call trace.
5162 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5164 // Check we are writing to the color buffer.
5165 CheckColorMask(glAbstraction, true);
5167 // Check scissor test was enabled.
5169 std::ostringstream scissor;
5170 scissor << std::hex << GL_SCISSOR_TEST;
5171 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5173 // Check the scissor was set, and the coordinates are correct.
5174 std::stringstream compareParametersString;
5175 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5176 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5178 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
5179 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
5181 // Gather the call trace.
5182 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5184 // Check the scissor was set, and the coordinates are correct.
5185 compareParametersString.str(std::string());
5186 compareParametersString.clear();
5187 compareParametersString << (stageSize.x - actorSize.x) << ", " << (stageSize.y - actorSize.y) << ", " << actorSize.x << ", " << actorSize.y;
5188 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
5193 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
5195 // This test checks that an actor is correctly setup for clipping.
5196 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
5197 TestApplication application;
5199 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5200 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5201 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5203 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5204 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5205 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5207 // Create a clipping actors.
5208 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5209 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5211 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5212 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5213 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5215 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5216 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5217 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5219 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5220 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5222 application.GetScene().Add(clippingActorA);
5223 application.GetScene().Add(clippingActorB);
5225 // Gather the call trace.
5226 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5228 // Check we are writing to the color buffer.
5229 CheckColorMask(glAbstraction, true);
5231 // Check scissor test was enabled.
5232 std::ostringstream scissor;
5233 scissor << std::hex << GL_SCISSOR_TEST;
5234 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5236 // Check the scissor was set, and the coordinates are correct.
5237 std::stringstream compareParametersString;
5239 std::string clipA("0, 500, 480, 200");
5240 std::string clipB("0, 380, 480, 40");
5242 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5243 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5248 int UtcDaliActorPropertyScissorClippingActorNested01(void)
5250 // This test checks that an actor is correctly setup for clipping.
5251 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5252 TestApplication application;
5254 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5255 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5256 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5258 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5259 const Vector2 imageSize(16.0f, 16.0f);
5261 /* Create a nest of 2 scissors to test nesting (intersecting clips).
5263 A is drawn first - with scissor clipping on
5264 B is drawn second - also with scissor clipping on
5265 C is the generated clipping region, the intersection ( A ∩ B )
5269 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
5270 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
5271 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
5275 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
5278 // Create a clipping actor.
5279 Actor clippingActorA = CreateActorWithContent16x16();
5280 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5281 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5282 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5283 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5284 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5285 application.GetScene().Add(clippingActorA);
5287 // Create a child clipping actor.
5288 Actor clippingActorB = CreateActorWithContent16x16();
5289 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5290 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5291 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5292 clippingActorA.Add(clippingActorB);
5294 // positionModifiers is an array of positions to position B around.
5295 // expect is an array of expected scissor clip coordinate results.
5296 const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
5297 const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
5299 // Loop through each overlap combination.
5300 for(unsigned int test = 0u; test < 4u; ++test)
5302 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
5303 const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
5304 clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
5306 // Gather the call trace.
5307 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5309 // Check we are writing to the color buffer.
5310 CheckColorMask(glAbstraction, true);
5312 // Check scissor test was enabled.
5313 std::ostringstream scissor;
5314 scissor << std::hex << GL_SCISSOR_TEST;
5315 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5317 // Check the scissor was set, and the coordinates are correct.
5318 const Vector4& expectResults(expect[test]);
5319 std::stringstream compareParametersString;
5320 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
5321 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
5327 int UtcDaliActorPropertyScissorClippingActorNested02(void)
5329 // This test checks that an actor is correctly setup for clipping.
5330 tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
5331 TestApplication application;
5333 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5334 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5335 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5337 /* Create a nest of 2 scissors and siblings of the parent.
5347 const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
5348 const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
5349 const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
5350 const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
5351 const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
5352 const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
5354 // Create a clipping actors.
5355 Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
5356 Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
5357 Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
5358 Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
5359 Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
5361 clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5362 clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5363 clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5365 clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5366 clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5367 clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5369 clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5370 clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5371 clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5373 clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5374 clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5375 clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5377 clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
5378 clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
5380 clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
5381 clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5382 clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
5383 clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5384 clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
5386 application.GetScene().Add(clippingActorA);
5387 clippingActorA.Add(clippingActorB);
5388 application.GetScene().Add(clippingActorC);
5389 application.GetScene().Add(clippingActorD);
5390 clippingActorD.Add(clippingActorE);
5392 // Gather the call trace.
5393 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5395 // Check we are writing to the color buffer.
5396 CheckColorMask(glAbstraction, true);
5398 // Check scissor test was enabled.
5399 std::ostringstream scissor;
5400 scissor << std::hex << GL_SCISSOR_TEST;
5401 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5403 // Check the scissor was set, and the coordinates are correct.
5404 std::string clipA("0, 500, 480, 200");
5405 std::string clipB("0, 580, 480, 40");
5406 std::string clipC("0, 200, 480, 200");
5407 std::string clipD("0, 300, 480, 200");
5409 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
5410 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
5411 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
5412 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
5413 DALI_TEST_EQUALS(scissorTrace.CountMethod("Scissor"), 4, TEST_LOCATION); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
5418 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
5420 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
5421 tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
5422 TestApplication application;
5424 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5425 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
5426 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5428 // Create a clipping actor.
5429 Actor actorDepth1Clip = CreateActorWithContent16x16();
5430 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
5431 application.GetScene().Add(actorDepth1Clip);
5433 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
5434 actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
5436 // Gather the call trace.
5437 GenerateTrace(application, enabledDisableTrace, stencilTrace);
5439 // Check we are writing to the color buffer.
5440 CheckColorMask(glAbstraction, true);
5442 // Check the stencil buffer was not enabled.
5443 std::ostringstream stencil;
5444 stencil << std::hex << GL_STENCIL_TEST;
5445 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", stencil.str()));
5447 // Check stencil functions are not called.
5448 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
5449 DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
5451 // Check that scissor clipping is overriden by the renderer properties.
5452 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5454 actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
5456 // Gather the call trace.
5457 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5459 // Check the stencil buffer was not enabled.
5460 std::ostringstream scissor;
5461 scissor << std::hex << GL_SCISSOR_TEST;
5462 DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5464 DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
5469 int UtcDaliActorPropertyClippingActorCulled(void)
5471 // This test checks that child actors are clipped by an culled parent actor.
5472 tet_infoline("Testing child actors are clipped by an culled parent actor");
5473 TestApplication application;
5475 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5476 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
5477 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
5479 const Vector2 actorSize(160.0f, 160.0f);
5481 // Create a clipping actor.
5482 Actor clippingActorA = CreateRenderableActor();
5483 clippingActorA[Actor::Property::SIZE] = actorSize;
5485 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
5486 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
5487 clippingActorA[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5488 clippingActorA[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5489 clippingActorA[Actor::Property::CLIPPING_MODE] = ClippingMode::CLIP_TO_BOUNDING_BOX;
5490 application.GetScene().Add(clippingActorA);
5492 // Create a child actor
5493 Actor childActor = CreateRenderableActor();
5494 childActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::BOTTOM_LEFT;
5495 childActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_LEFT;
5496 childActor[Actor::Property::SIZE] = Vector2(50.0f, 50.0f);
5497 childActor[Actor::Property::INHERIT_POSITION] = false;
5499 // Gather the call trace.
5500 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5502 // Check scissor test was enabled.
5503 std::ostringstream scissor;
5504 scissor << std::hex << GL_SCISSOR_TEST;
5505 DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str()));
5507 // Check the scissor was set, and the coordinates are correct.
5508 std::stringstream compareParametersString;
5509 compareParametersString << "0, 0, " << actorSize.x << ", " << actorSize.y;
5510 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
5512 // Move the clipping actor out of screen
5513 clippingActorA[Actor::Property::POSITION] = Vector2(2000.0f, 2000.0f);
5515 // Gather the call trace.
5516 GenerateTrace(application, enabledDisableTrace, scissorTrace);
5518 // Check the scissor was set, and the coordinates are correct.
5519 compareParametersString.str(std::string());
5520 compareParametersString.clear();
5521 compareParametersString << 2000 << ", " << 0 << ", " << 0 << ", " << 0;
5522 DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Clipping area should be empty.
5527 int UtcDaliGetPropertyN(void)
5529 tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
5530 TestApplication application;
5532 Actor actor = Actor::New();
5534 unsigned int propertyCount = actor.GetPropertyCount();
5535 DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
5539 int UtcDaliActorRaiseLower(void)
5541 tet_infoline("UtcDaliActor Raise and Lower test\n");
5543 TestApplication application;
5545 Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
5547 Integration::Scene stage(application.GetScene());
5549 Actor actorA = Actor::New();
5550 Actor actorB = Actor::New();
5551 Actor actorC = Actor::New();
5553 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5554 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5556 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5557 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5559 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5560 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5562 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5563 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5565 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5566 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5568 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5569 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5575 ResetTouchCallbacks();
5577 application.SendNotification();
5578 application.Render();
5580 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5581 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5582 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5584 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5585 // Only top actor will get touched.
5586 actorA.TouchedSignal().Connect(TestTouchCallback);
5587 actorB.TouchedSignal().Connect(TestTouchCallback2);
5588 actorC.TouchedSignal().Connect(TestTouchCallback3);
5590 // Connect ChildOrderChangedSignal
5591 bool orderChangedSignal(false);
5592 Actor orderChangedActor;
5593 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5594 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5596 Dali::Integration::Point point;
5597 point.SetDeviceId(1);
5598 point.SetState(PointState::DOWN);
5599 point.SetScreenPosition(Vector2(10.f, 10.f));
5600 Dali::Integration::TouchEvent touchEvent;
5601 touchEvent.AddPoint(point);
5603 application.ProcessEvent(touchEvent);
5605 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5606 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5607 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5609 ResetTouchCallbacks();
5611 tet_printf("Testing Raising of Actor\n");
5613 int preActorOrder(0);
5614 int postActorOrder(0);
5616 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5617 value.Get(preActorOrder);
5619 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5621 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5622 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5624 // Ensure sort order is calculated before next touch event
5625 application.SendNotification();
5627 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5628 value.Get(postActorOrder);
5630 tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5632 application.ProcessEvent(touchEvent);
5634 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5635 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5636 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5638 ResetTouchCallbacks();
5640 tet_printf("Testing Lowering of Actor\n");
5642 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5643 value.Get(preActorOrder);
5645 orderChangedSignal = false;
5647 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5649 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5650 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5652 application.SendNotification(); // ensure sort order calculated before next touch event
5654 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
5655 value.Get(postActorOrder);
5657 tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
5659 application.ProcessEvent(touchEvent);
5661 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5662 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5663 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5665 ResetTouchCallbacks();
5667 Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
5672 int UtcDaliActorRaiseToTopLowerToBottom(void)
5674 tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
5676 TestApplication application;
5678 Integration::Scene stage(application.GetScene());
5680 Actor actorA = Actor::New();
5681 Actor actorB = Actor::New();
5682 Actor actorC = Actor::New();
5684 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5685 // enables checking of which actor the uniform is assigned too
5686 Shader shaderA = CreateShader();
5687 shaderA.RegisterProperty("uRendererColor", 1.f);
5689 Shader shaderB = CreateShader();
5690 shaderB.RegisterProperty("uRendererColor", 2.f);
5692 Shader shaderC = CreateShader();
5693 shaderC.RegisterProperty("uRendererColor", 3.f);
5695 Geometry geometry = CreateQuadGeometry();
5697 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5698 Renderer rendererA = Renderer::New(geometry, shaderA);
5699 actorA.AddRenderer(rendererA);
5701 Renderer rendererB = Renderer::New(geometry, shaderB);
5702 actorB.AddRenderer(rendererB);
5704 Renderer rendererC = Renderer::New(geometry, shaderC);
5705 actorC.AddRenderer(rendererC);
5707 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5708 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5710 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5711 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5713 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5714 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5716 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5717 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5719 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5720 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5722 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5723 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5729 ResetTouchCallbacks();
5731 // Connect ChildOrderChangedSignal
5732 bool orderChangedSignal(false);
5733 Actor orderChangedActor;
5734 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5735 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5737 // Set up gl abstraction trace so can query the set uniform order
5738 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5739 glAbstraction.EnableSetUniformCallTrace(true);
5740 glAbstraction.ResetSetUniformCallStack();
5742 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5744 application.SendNotification();
5745 application.Render();
5747 tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
5749 // Test order of uniforms in stack
5750 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5751 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5752 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5754 bool CBA = (indexC > indexB) && (indexB > indexA);
5756 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
5758 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5759 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5760 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5762 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5763 // Only top actor will get touched.
5764 actorA.TouchedSignal().Connect(TestTouchCallback);
5765 actorB.TouchedSignal().Connect(TestTouchCallback2);
5766 actorC.TouchedSignal().Connect(TestTouchCallback3);
5768 Dali::Integration::Point point;
5769 point.SetDeviceId(1);
5770 point.SetState(PointState::DOWN);
5771 point.SetScreenPosition(Vector2(10.f, 10.f));
5772 Dali::Integration::TouchEvent touchEvent;
5773 touchEvent.AddPoint(point);
5775 application.ProcessEvent(touchEvent);
5777 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5778 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5779 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5781 ResetTouchCallbacks();
5783 tet_printf("RaiseToTop ActorA\n");
5785 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5786 actorA.RaiseToTop();
5787 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5788 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5790 application.SendNotification(); // ensure sorting order is calculated before next touch event
5792 application.ProcessEvent(touchEvent);
5794 glSetUniformStack.Reset();
5796 application.SendNotification();
5797 application.Render();
5799 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5801 // Test order of uniforms in stack
5802 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5803 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5804 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5806 tet_infoline("Testing A above C and B at bottom\n");
5807 bool ACB = (indexA > indexC) && (indexC > indexB);
5809 DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
5811 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
5812 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5813 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5815 ResetTouchCallbacks();
5817 tet_printf("RaiseToTop ActorB\n");
5819 orderChangedSignal = false;
5821 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5822 actorB.RaiseToTop();
5823 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5824 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5826 application.SendNotification(); // Ensure sort order is calculated before next touch event
5828 application.ProcessEvent(touchEvent);
5830 glSetUniformStack.Reset();
5832 application.SendNotification();
5833 application.Render();
5835 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5837 // Test order of uniforms in stack
5838 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5839 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5840 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5842 tet_infoline("Testing B above A and C at bottom\n");
5843 bool BAC = (indexB > indexA) && (indexA > indexC);
5845 DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
5847 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5848 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5849 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5851 ResetTouchCallbacks();
5853 tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
5855 orderChangedSignal = false;
5857 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5858 actorA.LowerToBottom();
5859 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5860 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5862 application.SendNotification();
5863 application.Render();
5865 orderChangedSignal = false;
5867 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5868 actorB.LowerToBottom();
5869 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5870 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5872 application.SendNotification();
5873 application.Render();
5875 application.ProcessEvent(touchEvent);
5877 glSetUniformStack.Reset();
5879 application.SendNotification();
5880 application.Render();
5882 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
5884 // Test order of uniforms in stack
5885 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
5886 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
5887 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
5889 tet_infoline("Testing C above A and B at bottom\n");
5890 bool CAB = (indexC > indexA) && (indexA > indexB);
5892 DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
5894 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5895 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5896 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5898 ResetTouchCallbacks();
5903 int UtcDaliActorRaiseAbove(void)
5905 tet_infoline("UtcDaliActor RaiseToAbove test \n");
5907 TestApplication application;
5909 Integration::Scene stage(application.GetScene());
5911 Actor actorA = Actor::New();
5912 Actor actorB = Actor::New();
5913 Actor actorC = Actor::New();
5915 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5916 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5918 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5919 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5921 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
5922 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
5924 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5925 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5927 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5928 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5930 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
5931 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
5937 ResetTouchCallbacks();
5939 application.SendNotification();
5940 application.Render();
5942 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5943 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5944 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5946 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5947 // Only top actor will get touched.
5948 actorA.TouchedSignal().Connect(TestTouchCallback);
5949 actorB.TouchedSignal().Connect(TestTouchCallback2);
5950 actorC.TouchedSignal().Connect(TestTouchCallback3);
5952 bool orderChangedSignal(false);
5953 Actor orderChangedActor;
5954 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
5955 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
5957 Dali::Integration::Point point;
5958 point.SetDeviceId(1);
5959 point.SetState(PointState::DOWN);
5960 point.SetScreenPosition(Vector2(10.f, 10.f));
5961 Dali::Integration::TouchEvent touchEvent;
5962 touchEvent.AddPoint(point);
5964 application.ProcessEvent(touchEvent);
5966 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5967 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
5968 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
5970 ResetTouchCallbacks();
5972 tet_printf("Raise actor B Above Actor C\n");
5974 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5975 actorB.RaiseAbove(actorC);
5976 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5977 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
5979 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5980 application.SendNotification();
5981 application.ProcessEvent(touchEvent);
5983 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
5984 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
5985 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
5987 ResetTouchCallbacks();
5989 tet_printf("Raise actor A Above Actor B\n");
5991 orderChangedSignal = false;
5993 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
5994 actorA.RaiseAbove(actorB);
5995 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
5996 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
5998 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5999 application.SendNotification();
6001 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6003 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6004 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6005 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6007 ResetTouchCallbacks();
6012 int UtcDaliActorRaiseAbove2(void)
6014 tet_infoline("UtcDaliActor RaiseToAbove test using SIBLING_ORDER property\n");
6016 TestApplication application;
6018 Integration::Scene stage(application.GetScene());
6020 Actor actorA = Actor::New();
6021 Actor actorB = Actor::New();
6022 Actor actorC = Actor::New();
6024 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6025 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6027 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6028 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6030 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6031 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6033 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6034 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6036 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6037 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6039 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6040 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6046 ResetTouchCallbacks();
6048 application.SendNotification();
6049 application.Render();
6051 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6052 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6053 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6055 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6056 // Only top actor will get touched.
6057 actorA.TouchedSignal().Connect(TestTouchCallback);
6058 actorB.TouchedSignal().Connect(TestTouchCallback2);
6059 actorC.TouchedSignal().Connect(TestTouchCallback3);
6061 bool orderChangedSignal(false);
6062 Actor orderChangedActor;
6063 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6064 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6066 Dali::Integration::Point point;
6067 point.SetDeviceId(1);
6068 point.SetState(PointState::DOWN);
6069 point.SetScreenPosition(Vector2(10.f, 10.f));
6070 Dali::Integration::TouchEvent touchEvent;
6071 touchEvent.AddPoint(point);
6073 application.ProcessEvent(touchEvent);
6075 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6076 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6077 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6079 ResetTouchCallbacks();
6081 tet_printf("Raise actor B Above Actor C\n");
6083 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6084 int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
6085 actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
6086 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6087 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6089 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6090 application.SendNotification();
6091 application.ProcessEvent(touchEvent);
6093 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6094 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6095 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6097 ResetTouchCallbacks();
6099 tet_printf("Raise actor A Above Actor B\n");
6101 orderChangedSignal = false;
6103 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6104 newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
6105 actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
6106 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6107 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6109 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6110 application.SendNotification();
6112 application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
6114 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6115 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6116 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6118 ResetTouchCallbacks();
6123 int UtcDaliActorLowerBelow(void)
6125 tet_infoline("UtcDaliActor LowerBelow test \n");
6127 TestApplication application;
6129 Integration::Scene stage(application.GetScene());
6131 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6132 // enables checking of which actor the uniform is assigned too
6133 Shader shaderA = CreateShader();
6134 shaderA.RegisterProperty("uRendererColor", 1.f);
6136 Shader shaderB = CreateShader();
6137 shaderB.RegisterProperty("uRendererColor", 2.f);
6139 Shader shaderC = CreateShader();
6140 shaderC.RegisterProperty("uRendererColor", 3.f);
6142 Actor actorA = Actor::New();
6143 Actor actorB = Actor::New();
6144 Actor actorC = Actor::New();
6146 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6147 Geometry geometry = CreateQuadGeometry();
6149 Renderer rendererA = Renderer::New(geometry, shaderA);
6150 actorA.AddRenderer(rendererA);
6152 Renderer rendererB = Renderer::New(geometry, shaderB);
6153 actorB.AddRenderer(rendererB);
6155 Renderer rendererC = Renderer::New(geometry, shaderC);
6156 actorC.AddRenderer(rendererC);
6158 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6159 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6161 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6162 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6164 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6165 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6167 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6168 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6170 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6171 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6173 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6174 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6176 Actor container = Actor::New();
6177 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6178 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
6179 stage.Add(container);
6181 container.Add(actorA);
6182 container.Add(actorB);
6183 container.Add(actorC);
6185 ResetTouchCallbacks();
6187 // Connect ChildOrderChangedSignal
6188 bool orderChangedSignal(false);
6189 Actor orderChangedActor;
6190 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6191 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
6193 // Set up gl abstraction trace so can query the set uniform order
6194 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6195 glAbstraction.EnableSetUniformCallTrace(true);
6196 glAbstraction.ResetSetUniformCallStack();
6197 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6199 glAbstraction.ResetSetUniformCallStack();
6201 application.SendNotification();
6202 application.Render();
6204 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6206 // Test order of uniforms in stack
6207 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6208 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6209 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6211 tet_infoline("Testing C above B and A at bottom\n");
6212 bool CBA = (indexC > indexB) && (indexB > indexA);
6214 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6216 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6217 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6218 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6220 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6221 // Only top actor will get touched.
6222 actorA.TouchedSignal().Connect(TestTouchCallback);
6223 actorB.TouchedSignal().Connect(TestTouchCallback2);
6224 actorC.TouchedSignal().Connect(TestTouchCallback3);
6226 Dali::Integration::Point point;
6227 point.SetDeviceId(1);
6228 point.SetState(PointState::DOWN);
6229 point.SetScreenPosition(Vector2(10.f, 10.f));
6230 Dali::Integration::TouchEvent touchEvent;
6231 touchEvent.AddPoint(point);
6233 tet_infoline("UtcDaliActor Test Set up completed \n");
6235 application.ProcessEvent(touchEvent);
6237 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6238 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6239 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6241 ResetTouchCallbacks();
6243 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");
6245 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6246 actorC.LowerBelow(actorB);
6247 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6248 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6250 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6251 application.SendNotification();
6252 application.Render();
6254 application.ProcessEvent(touchEvent); // touch event
6256 glSetUniformStack.Reset();
6258 application.SendNotification();
6259 application.Render();
6261 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6263 // Test order of uniforms in stack
6264 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6265 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6266 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6268 tet_infoline("Testing render order is A, C, B");
6269 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
6270 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
6272 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6273 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6274 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6276 ResetTouchCallbacks();
6278 tet_printf("Lower actor C below Actor A leaving B on top\n");
6280 orderChangedSignal = false;
6282 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6283 actorC.LowerBelow(actorA);
6284 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6285 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6287 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6288 application.SendNotification();
6289 application.Render();
6291 application.ProcessEvent(touchEvent);
6293 glSetUniformStack.Reset();
6295 application.Render();
6296 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6298 // Test order of uniforms in stack
6299 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6300 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6301 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6303 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6304 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
6306 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6307 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6308 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6310 ResetTouchCallbacks();
6312 tet_printf("Lower actor B below Actor C leaving A on top\n");
6314 orderChangedSignal = false;
6316 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6317 actorB.LowerBelow(actorC);
6318 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6319 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6321 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6322 application.SendNotification();
6323 application.Render();
6325 application.ProcessEvent(touchEvent);
6327 glSetUniformStack.Reset();
6329 application.Render();
6330 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6332 // Test order of uniforms in stack
6333 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6334 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6335 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6337 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
6338 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6343 int UtcDaliActorLowerBelow2(void)
6345 tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
6347 TestApplication application;
6349 Integration::Scene stage(application.GetScene());
6351 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
6352 // enables checking of which actor the uniform is assigned too
6353 Shader shaderA = CreateShader();
6354 shaderA.RegisterProperty("uRendererColor", 1.f);
6356 Shader shaderB = CreateShader();
6357 shaderB.RegisterProperty("uRendererColor", 2.f);
6359 Shader shaderC = CreateShader();
6360 shaderC.RegisterProperty("uRendererColor", 3.f);
6362 Actor actorA = Actor::New();
6363 Actor actorB = Actor::New();
6364 Actor actorC = Actor::New();
6366 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
6367 Geometry geometry = CreateQuadGeometry();
6369 Renderer rendererA = Renderer::New(geometry, shaderA);
6370 actorA.AddRenderer(rendererA);
6372 Renderer rendererB = Renderer::New(geometry, shaderB);
6373 actorB.AddRenderer(rendererB);
6375 Renderer rendererC = Renderer::New(geometry, shaderC);
6376 actorC.AddRenderer(rendererC);
6378 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6379 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6381 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6382 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6384 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6385 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6387 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6388 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6390 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6391 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6393 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6394 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6396 Actor container = Actor::New();
6397 container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6398 container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
6399 stage.Add(container);
6401 container.Add(actorA);
6402 container.Add(actorB);
6403 container.Add(actorC);
6405 ResetTouchCallbacks();
6407 // Connect ChildOrderChangedSignal
6408 bool orderChangedSignal(false);
6409 Actor orderChangedActor;
6410 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6411 DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
6413 // Set up gl abstraction trace so can query the set uniform order
6414 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
6415 glAbstraction.EnableSetUniformCallTrace(true);
6416 glAbstraction.ResetSetUniformCallStack();
6417 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
6419 glAbstraction.ResetSetUniformCallStack();
6421 application.SendNotification();
6422 application.Render();
6424 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6426 // Test order of uniforms in stack
6427 int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6428 int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6429 int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6431 tet_infoline("Testing C above B and A at bottom\n");
6432 bool CBA = (indexC > indexB) && (indexB > indexA);
6434 DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
6436 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6437 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6438 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6440 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6441 // Only top actor will get touched.
6442 actorA.TouchedSignal().Connect(TestTouchCallback);
6443 actorB.TouchedSignal().Connect(TestTouchCallback2);
6444 actorC.TouchedSignal().Connect(TestTouchCallback3);
6446 Dali::Integration::Point point;
6447 point.SetDeviceId(1);
6448 point.SetState(PointState::DOWN);
6449 point.SetScreenPosition(Vector2(10.f, 10.f));
6450 Dali::Integration::TouchEvent touchEvent;
6451 touchEvent.AddPoint(point);
6453 tet_infoline("UtcDaliActor Test Set up completed \n");
6455 application.ProcessEvent(touchEvent);
6457 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6458 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6459 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6461 ResetTouchCallbacks();
6463 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");
6465 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6466 actorC[DevelActor::Property::SIBLING_ORDER] = 1;
6467 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6468 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6470 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6471 application.SendNotification();
6472 application.Render();
6474 application.ProcessEvent(touchEvent); // touch event
6476 glSetUniformStack.Reset();
6478 application.SendNotification();
6479 application.Render();
6481 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6483 // Test order of uniforms in stack
6484 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6485 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6486 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6488 tet_infoline("Testing render order is A, C, B");
6489 DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
6490 DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
6492 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6493 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6494 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6496 ResetTouchCallbacks();
6498 tet_printf("Lower actor C below Actor A leaving B on top\n");
6500 orderChangedSignal = false;
6502 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6503 actorC[DevelActor::Property::SIBLING_ORDER] = 0;
6504 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6505 DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
6507 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6508 application.SendNotification();
6509 application.Render();
6511 application.ProcessEvent(touchEvent);
6513 glSetUniformStack.Reset();
6515 application.Render();
6516 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6518 // Test order of uniforms in stack
6519 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6520 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6521 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6523 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6524 DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
6526 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6527 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6528 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6530 ResetTouchCallbacks();
6532 tet_printf("Lower actor B below Actor C leaving A on top\n");
6534 orderChangedSignal = false;
6536 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6537 actorB[DevelActor::Property::SIBLING_ORDER] = 0;
6538 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6539 DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
6541 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6542 application.SendNotification();
6543 application.Render();
6545 application.ProcessEvent(touchEvent);
6547 glSetUniformStack.Reset();
6549 application.Render();
6550 tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
6552 // Test order of uniforms in stack
6553 indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3.000000");
6554 indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2.000000");
6555 indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1.000000");
6557 DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
6558 DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
6563 int UtcDaliActorRaiseAboveDifferentParentsN(void)
6565 tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
6567 TestApplication application;
6569 Integration::Scene stage(application.GetScene());
6571 Actor parentA = Actor::New();
6572 Actor parentB = Actor::New();
6573 parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6574 parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6575 parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6576 parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6578 parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6579 parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6581 parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6582 parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6587 Actor actorA = Actor::New();
6588 Actor actorB = Actor::New();
6589 Actor actorC = Actor::New();
6591 parentA.Add(actorA);
6592 parentA.Add(actorB);
6594 tet_printf("Actor C added to different parent from A and B \n");
6595 parentB.Add(actorC);
6597 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6598 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6600 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6601 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6603 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6604 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6606 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6607 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6609 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6610 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6612 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6613 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6615 ResetTouchCallbacks();
6617 // Connect ChildOrderChangedSignal
6618 bool orderChangedSignal(false);
6619 Actor orderChangedActor;
6620 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6621 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6623 application.SendNotification();
6624 application.Render();
6626 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6627 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6628 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6630 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6631 // Only top actor will get touched.
6632 actorA.TouchedSignal().Connect(TestTouchCallback);
6633 actorB.TouchedSignal().Connect(TestTouchCallback2);
6634 actorC.TouchedSignal().Connect(TestTouchCallback3);
6636 Dali::Integration::Point point;
6637 point.SetDeviceId(1);
6638 point.SetState(PointState::DOWN);
6639 point.SetScreenPosition(Vector2(10.f, 10.f));
6640 Dali::Integration::TouchEvent touchEvent;
6641 touchEvent.AddPoint(point);
6643 application.ProcessEvent(touchEvent);
6645 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6646 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6647 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6649 ResetTouchCallbacks();
6651 tet_printf("Raise actor A Above Actor C which have different parents\n");
6653 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6654 actorA.RaiseAbove(actorC);
6655 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6657 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6658 application.SendNotification();
6660 application.ProcessEvent(touchEvent); // touch event
6662 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6663 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6664 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
6666 ResetTouchCallbacks();
6671 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
6673 tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
6675 TestApplication application;
6677 Integration::Scene stage(application.GetScene());
6679 Actor actorA = Actor::New();
6680 Actor actorB = Actor::New();
6681 Actor actorC = Actor::New();
6683 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6684 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6686 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6687 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6689 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6690 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6692 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6693 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6695 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6696 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6698 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6699 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6701 ResetTouchCallbacks();
6703 // Connect ChildOrderChangedSignal
6704 bool orderChangedSignal(false);
6705 Actor orderChangedActor;
6706 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6707 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6709 application.SendNotification();
6710 application.Render();
6712 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6713 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6714 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6716 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6717 // Only top actor will get touched.
6718 actorA.TouchedSignal().Connect(TestTouchCallback);
6719 actorB.TouchedSignal().Connect(TestTouchCallback2);
6720 actorC.TouchedSignal().Connect(TestTouchCallback3);
6722 Dali::Integration::Point point;
6723 point.SetDeviceId(1);
6724 point.SetState(PointState::DOWN);
6725 point.SetScreenPosition(Vector2(10.f, 10.f));
6726 Dali::Integration::TouchEvent touchEvent;
6727 touchEvent.AddPoint(point);
6729 tet_printf("Raise actor A Above Actor C which have no parents\n");
6731 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6732 actorA.RaiseAbove(actorC);
6733 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6735 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6736 application.SendNotification();
6738 application.ProcessEvent(touchEvent);
6740 tet_printf("Not parented so RaiseAbove should show no effect\n");
6742 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6743 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6744 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6746 ResetTouchCallbacks();
6748 orderChangedSignal = false;
6751 tet_printf("Lower actor A below Actor C when only A is not on stage \n");
6753 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6754 actorA.LowerBelow(actorC);
6755 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6757 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6758 application.SendNotification();
6759 application.Render();
6761 application.ProcessEvent(touchEvent);
6763 tet_printf("Actor A not parented so LowerBelow should show no effect\n");
6764 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6765 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6766 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6768 ResetTouchCallbacks();
6770 orderChangedSignal = false;
6772 tet_printf("Adding Actor A to stage, will be on top\n");
6775 application.SendNotification();
6776 application.Render();
6778 tet_printf("Raise actor B Above Actor C when only B has a parent\n");
6780 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6781 actorB.RaiseAbove(actorC);
6782 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6784 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6785 application.SendNotification();
6787 application.ProcessEvent(touchEvent);
6789 tet_printf("C not parented so RaiseAbove should show no effect\n");
6790 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6791 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6792 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6794 ResetTouchCallbacks();
6796 orderChangedSignal = false;
6798 tet_printf("Lower actor A below Actor C when only A has a parent\n");
6800 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6801 actorA.LowerBelow(actorC);
6802 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6804 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6805 application.SendNotification();
6807 application.ProcessEvent(touchEvent);
6809 tet_printf("C not parented so LowerBelow should show no effect\n");
6810 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6811 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6812 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6814 ResetTouchCallbacks();
6816 orderChangedSignal = false;
6820 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6821 actorA.RaiseAbove(actorC);
6822 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
6823 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
6825 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
6826 application.SendNotification();
6827 application.Render();
6829 application.ProcessEvent(touchEvent);
6831 tet_printf("Raise actor A Above Actor C, now both have same parent \n");
6832 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6833 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6834 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6839 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
6841 tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
6843 TestApplication application;
6845 Integration::Scene stage(application.GetScene());
6847 Actor actorA = Actor::New();
6848 Actor actorB = Actor::New();
6849 Actor actorC = Actor::New();
6851 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6852 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6854 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6855 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6857 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
6858 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
6860 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6861 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6863 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6864 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6866 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
6867 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
6869 ResetTouchCallbacks();
6871 // Connect ChildOrderChangedSignal
6872 bool orderChangedSignal(false);
6873 Actor orderChangedActor;
6874 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
6875 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
6877 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
6878 // Only top actor will get touched.
6879 actorA.TouchedSignal().Connect(TestTouchCallback);
6880 actorB.TouchedSignal().Connect(TestTouchCallback2);
6881 actorC.TouchedSignal().Connect(TestTouchCallback3);
6883 Dali::Integration::Point point;
6884 point.SetDeviceId(1);
6885 point.SetState(PointState::DOWN);
6886 point.SetScreenPosition(Vector2(10.f, 10.f));
6887 Dali::Integration::TouchEvent touchEvent;
6888 touchEvent.AddPoint(point);
6891 tet_printf("Raise actor B Above Actor C but B not parented\n");
6893 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6895 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6897 application.SendNotification();
6898 application.Render();
6900 application.ProcessEvent(touchEvent);
6902 tet_printf("Not parented so RaiseAbove should show no effect\n");
6904 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6905 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6906 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6908 tet_printf("Raise actor B Above Actor C but B not parented\n");
6909 ResetTouchCallbacks();
6911 orderChangedSignal = false;
6913 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6915 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6917 // Sort actor tree before next touch event
6918 application.SendNotification();
6919 application.Render();
6921 application.ProcessEvent(touchEvent);
6923 tet_printf("Not parented so RaiseAbove should show no effect\n");
6925 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6926 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6927 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6928 ResetTouchCallbacks();
6930 orderChangedSignal = false;
6932 tet_printf("Lower actor C below B but C not parented\n");
6934 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6936 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6938 // Sort actor tree before next touch event
6939 application.SendNotification();
6940 application.Render();
6942 application.ProcessEvent(touchEvent);
6944 tet_printf("Not parented so Lower should show no effect\n");
6946 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6947 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6948 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6949 ResetTouchCallbacks();
6951 orderChangedSignal = false;
6953 tet_printf("Raise actor B to top\n");
6955 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6956 actorB.RaiseToTop();
6957 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6959 // Sort actor tree before next touch event
6960 application.SendNotification();
6961 application.Render();
6963 application.ProcessEvent(touchEvent);
6965 tet_printf("Not parented so RaiseToTop should show no effect\n");
6967 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
6968 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
6969 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6970 ResetTouchCallbacks();
6972 orderChangedSignal = false;
6974 tet_printf("Add ActorB to stage so only Actor C not parented\n");
6978 tet_printf("Lower actor C to Bottom, B stays at top\n");
6980 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6981 actorC.LowerToBottom();
6982 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
6984 application.SendNotification();
6985 application.Render();
6987 application.ProcessEvent(touchEvent);
6989 tet_printf("Not parented so LowerToBottom should show no effect\n");
6991 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
6992 DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
6993 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
6994 ResetTouchCallbacks();
6999 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
7001 tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
7003 TestApplication application;
7005 Integration::Scene stage(application.GetScene());
7007 Actor actorA = Actor::New();
7008 Actor actorB = Actor::New();
7009 Actor actorC = Actor::New();
7011 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7012 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7014 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7015 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7017 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7018 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7020 actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7021 actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7023 actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7024 actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7026 actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
7027 actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
7033 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
7034 // Only top actor will get touched.
7035 actorA.TouchedSignal().Connect(TestTouchCallback);
7036 actorB.TouchedSignal().Connect(TestTouchCallback2);
7037 actorC.TouchedSignal().Connect(TestTouchCallback3);
7039 ResetTouchCallbacks();
7041 // Connect ChildOrderChangedSignal
7042 bool orderChangedSignal(false);
7043 Actor orderChangedActor;
7044 ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
7045 DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
7047 application.SendNotification();
7048 application.Render();
7050 Dali::Integration::Point point;
7051 point.SetDeviceId(1);
7052 point.SetState(PointState::DOWN);
7053 point.SetScreenPosition(Vector2(10.f, 10.f));
7054 Dali::Integration::TouchEvent touchEvent;
7055 touchEvent.AddPoint(point);
7057 application.ProcessEvent(touchEvent);
7059 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7060 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7061 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7063 ResetTouchCallbacks();
7065 tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
7067 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7068 actorA.RaiseAbove(actorA);
7069 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7070 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
7072 application.SendNotification();
7073 application.Render();
7075 application.ProcessEvent(touchEvent);
7077 tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
7079 DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
7080 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7081 DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
7083 ResetTouchCallbacks();
7085 orderChangedSignal = false;
7087 DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
7088 actorA.RaiseAbove(actorC);
7089 DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
7090 DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
7092 application.SendNotification();
7093 application.Render();
7095 application.ProcessEvent(touchEvent);
7097 tet_infoline("Raise actor A Above Actor C which will now be successful \n");
7098 DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
7099 DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
7100 DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
7105 int UtcDaliActorGetScreenPosition(void)
7107 tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
7109 TestApplication application;
7111 Integration::Scene stage(application.GetScene());
7113 Actor actorA = Actor::New();
7114 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7116 Vector2 size2(10.0f, 20.0f);
7117 actorA.SetProperty(Actor::Property::SIZE, size2);
7119 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7121 tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
7125 application.SendNotification();
7126 application.Render();
7128 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7129 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7131 tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
7132 tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
7134 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
7135 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
7137 tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
7139 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7141 application.SendNotification();
7142 application.Render();
7144 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7145 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7147 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
7148 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
7150 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
7151 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
7153 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
7155 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7157 application.SendNotification();
7158 application.Render();
7160 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7161 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7163 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
7164 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
7166 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
7167 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
7169 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
7171 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
7173 application.SendNotification();
7174 application.Render();
7176 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7177 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7179 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
7180 tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
7182 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
7183 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
7185 tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
7187 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
7189 application.SendNotification();
7190 application.Render();
7192 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7193 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7195 DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
7196 DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
7198 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
7199 tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
7201 tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
7203 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7204 actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
7206 Actor actorB = Actor::New();
7207 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7208 actorB.SetProperty(Actor::Property::SIZE, size2);
7209 actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
7212 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
7214 application.SendNotification();
7215 application.Render();
7217 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7219 DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
7220 DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
7225 int UtcDaliActorGetScreenPositionAfterScaling(void)
7227 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
7229 TestApplication application;
7231 Integration::Scene stage(application.GetScene());
7233 Actor actorA = Actor::New();
7234 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7236 Vector2 size2(10.0f, 20.0f);
7237 actorA.SetProperty(Actor::Property::SIZE, size2);
7238 actorA.SetProperty(Actor::Property::SCALE, 1.5f);
7239 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7241 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
7245 application.SendNotification();
7246 application.Render();
7248 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7249 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7251 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
7252 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7254 DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
7255 DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
7257 tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
7259 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7261 application.SendNotification();
7262 application.Render();
7264 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7265 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7267 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
7268 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7270 DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
7271 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
7276 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
7278 tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
7280 TestApplication application;
7282 Integration::Scene stage(application.GetScene());
7284 Actor actorA = Actor::New();
7285 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7286 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7287 Vector2 size2(10.0f, 20.0f);
7288 actorA.SetProperty(Actor::Property::SIZE, size2);
7289 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7291 tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
7295 application.SendNotification();
7296 application.Render();
7298 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7299 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7301 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
7302 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7304 DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
7305 DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
7307 tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
7309 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
7310 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7312 application.SendNotification();
7313 application.Render();
7315 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7316 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7318 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
7319 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7321 DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
7322 DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
7328 int UtcDaliActorGetScreenPositionWithChildActors(void)
7330 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
7332 TestApplication application;
7334 Integration::Scene stage(application.GetScene());
7336 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
7338 Actor actorA = Actor::New();
7339 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7340 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7341 Vector2 size1(10.0f, 20.0f);
7342 actorA.SetProperty(Actor::Property::SIZE, size1);
7343 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7345 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
7347 Actor parentActorA = Actor::New();
7348 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7349 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7350 Vector2 size2(30.0f, 60.0f);
7351 parentActorA.SetProperty(Actor::Property::SIZE, size2);
7352 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7354 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
7356 stage.Add(parentActorA);
7357 parentActorA.Add(actorA);
7359 application.SendNotification();
7360 application.Render();
7362 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7363 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7365 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
7366 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7368 DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
7369 DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
7371 tet_infoline("Test 2\n");
7373 tet_infoline("change parent anchor point and parent origin then check screen position \n");
7375 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
7376 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
7378 application.SendNotification();
7379 application.Render();
7381 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7382 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7384 tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
7385 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7387 DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
7388 DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
7393 int UtcDaliActorGetScreenPositionWithChildActors02(void)
7395 tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
7397 TestApplication application;
7399 Integration::Scene stage(application.GetScene());
7401 tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
7403 Actor actorA = Actor::New();
7404 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7405 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7406 Vector2 size1(10.0f, 20.0f);
7407 actorA.SetProperty(Actor::Property::SIZE, size1);
7408 actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7410 tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
7412 Actor parentActorA = Actor::New();
7413 parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7414 parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7415 Vector2 size2(30.0f, 60.0f);
7416 parentActorA.SetProperty(Actor::Property::SIZE, size2);
7417 parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7419 tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
7421 Actor grandParentActorA = Actor::New();
7422 grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
7423 grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
7424 Vector2 size3(60.0f, 120.0f);
7425 grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
7426 grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
7428 tet_infoline("Add Parent 1 to Grand Parent 1 \n");
7430 stage.Add(grandParentActorA);
7431 grandParentActorA.Add(parentActorA);
7433 tet_infoline("Add child 1 to Parent 1 and check screen position \n");
7435 parentActorA.Add(actorA);
7437 application.SendNotification();
7438 application.Render();
7440 Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
7441 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7443 tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
7444 tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
7446 DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
7447 DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
7452 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
7454 tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
7456 TestApplication application;
7458 Integration::Scene stage(application.GetScene());
7460 tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
7462 Actor actorA = Actor::New();
7463 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7464 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7465 actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7466 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
7469 tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
7471 Actor actorB = Actor::New();
7472 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7473 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7474 actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7475 Vector2 actorBSize(30.0f, 60.0f);
7476 actorB.SetProperty(Actor::Property::SIZE, actorBSize);
7479 tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
7481 Actor actorC = Actor::New();
7482 actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7483 actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7484 actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7485 Vector2 actorCSize(60.0f, 120.0f);
7486 actorC.SetProperty(Actor::Property::SIZE, actorCSize);
7489 application.SendNotification();
7490 application.Render();
7492 tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
7494 Vector2 center(stage.GetSize() * 0.5f);
7496 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7497 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7498 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
7500 tet_infoline("Add scale to all actors");
7502 actorA.SetProperty(Actor::Property::SCALE, 2.0f);
7503 actorB.SetProperty(Actor::Property::SCALE, 2.0f);
7504 actorC.SetProperty(Actor::Property::SCALE, 2.0f);
7506 application.SendNotification();
7507 application.Render();
7509 DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
7510 DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
7511 DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
7516 int UtcDaliActorGetScreenPositionResizeScene(void)
7518 tet_infoline("UtcDaliActorGetScreenPositionResizeScene Check screen position after resizing the scene size");
7520 TestApplication application;
7521 Integration::Scene scene = application.GetScene();
7523 Actor actorA = Actor::New();
7524 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7525 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7526 actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
7530 application.SendNotification();
7531 application.Render();
7533 Vector2 sceneSize = scene.GetSize();
7534 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7536 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
7539 Vector2 newSize(1000.0f, 2000.0f);
7540 DALI_TEST_CHECK(scene.GetSize() != newSize);
7542 scene.SurfaceResized(newSize.width, newSize.height);
7544 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7546 // The screen position should not be updated yet
7547 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
7549 application.SendNotification();
7550 application.Render();
7552 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7554 // The screen position should be updated
7555 sceneSize = scene.GetSize();
7556 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2, TEST_LOCATION);
7561 int UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D(void)
7563 tet_infoline("UtcDaliActorGetScreenPositionInCustomCameraAndLayer3D Check screen position under LAYER_3D and custom camera");
7565 TestApplication application;
7566 Integration::Scene scene = application.GetScene();
7569 Layer layer = scene.GetRootLayer();
7570 layer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
7572 // Build custom camera with top-view
7573 CameraActor cameraActor = scene.GetRenderTaskList().GetTask(0).GetCameraActor();
7575 // Default camera position at +z and looking -z axis. (orientation is [ Axis: [0, 1, 0], Angle: 180 degrees ])
7576 Vector3 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
7577 Quaternion cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
7580 std::ostringstream oss;
7581 oss << cameraPos << "\n";
7582 oss << cameraOrient << "\n";
7583 tet_printf("%s\n", oss.str().c_str());
7586 cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -cameraPos.z, 0.0f));
7587 cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS) * cameraOrient);
7589 // Now, upside : -Z, leftside : -X, foward : +Y
7591 cameraPos = cameraActor.GetProperty<Vector3>(Actor::Property::POSITION);
7592 cameraOrient = cameraActor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
7594 std::ostringstream oss;
7595 oss << cameraPos << "\n";
7596 oss << cameraOrient << "\n";
7597 tet_printf("%s\n", oss.str().c_str());
7601 Actor actorA = Actor::New();
7602 actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7603 actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7604 actorA.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
7605 actorA.SetProperty(Actor::Property::POSITION, Vector3(20.0f, 0.0f, 10.0f));
7607 Actor actorB = Actor::New();
7608 actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7609 actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7610 actorB.SetProperty(Actor::Property::SIZE, Vector3(10.0f, 10.0f, 10.0f));
7611 actorB.SetProperty(Actor::Property::POSITION, Vector3(-20.0f, 0.0f, -10.0f));
7616 application.SendNotification();
7617 application.Render();
7619 Vector2 sceneSize = scene.GetSize();
7620 Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7622 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 + Vector2(20.0f, 10.0f), TEST_LOCATION);
7624 actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
7626 DALI_TEST_EQUALS(actorScreenPosition, sceneSize / 2 - Vector2(20.0f, 10.0f), TEST_LOCATION);
7631 int utcDaliActorPositionUsesAnchorPoint(void)
7633 TestApplication application;
7634 tet_infoline("Check default behaviour\n");
7636 Actor actor = Actor::New();
7637 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7638 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7639 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7640 application.GetScene().Add(actor);
7642 application.SendNotification();
7643 application.Render();
7645 tet_infoline("Check that the world position is in the center\n");
7646 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7648 tet_infoline("Set the position uses anchor point property to false\n");
7649 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7651 application.SendNotification();
7652 application.Render();
7654 tet_infoline("Check that the world position has changed appropriately\n");
7655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7660 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
7662 TestApplication application;
7663 tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7665 Actor actor = Actor::New();
7666 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7667 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7668 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7669 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7670 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7671 application.GetScene().Add(actor);
7673 application.SendNotification();
7674 application.Render();
7676 tet_infoline("Check the world position is the same as it would be without a scale\n");
7677 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7679 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7680 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7681 application.SendNotification();
7682 application.Render();
7683 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
7685 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7686 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7687 application.SendNotification();
7688 application.Render();
7689 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
7694 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
7696 TestApplication application;
7697 tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7699 Actor actor = Actor::New();
7700 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7701 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7702 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7703 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7704 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7705 application.GetScene().Add(actor);
7707 application.SendNotification();
7708 application.Render();
7710 tet_infoline("Check the world position is the same as it would be without a rotation\n");
7711 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7713 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7714 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7715 application.SendNotification();
7716 application.Render();
7717 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
7719 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7720 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7721 application.SendNotification();
7722 application.Render();
7723 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
7728 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
7730 TestApplication application;
7731 tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7733 Actor actor = Actor::New();
7734 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7735 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7736 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7737 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
7738 actor.SetProperty(Actor::Property::SCALE, 2.0f);
7739 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7740 application.GetScene().Add(actor);
7742 application.SendNotification();
7743 application.Render();
7745 tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
7746 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
7748 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
7749 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7750 application.SendNotification();
7751 application.Render();
7752 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
7754 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
7755 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7756 application.SendNotification();
7757 application.Render();
7758 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
7763 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
7765 TestApplication application;
7766 tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
7768 Actor parent = Actor::New();
7770 application.GetScene().Add(parent);
7771 Vector2 stageSize(application.GetScene().GetSize());
7773 Actor actor = Actor::New();
7774 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
7775 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
7776 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
7777 actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
7778 actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
7779 actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
7782 application.SendNotification();
7783 application.Render();
7785 const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
7787 tet_infoline("Check the world position is in the right place\n");
7788 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7790 tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
7791 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
7792 application.SendNotification();
7793 application.Render();
7794 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7796 tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
7797 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
7798 application.SendNotification();
7799 application.Render();
7800 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
7805 int utcDaliActorVisibilityChangeSignalSelf(void)
7807 TestApplication application;
7808 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7810 Actor actor = Actor::New();
7812 VisibilityChangedFunctorData data;
7813 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7815 actor.SetProperty(Actor::Property::VISIBLE, false);
7817 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7819 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7822 actor.SetProperty(Actor::Property::VISIBLE, false);
7823 data.Check(false /* not called */, TEST_LOCATION);
7825 tet_infoline("Change the visibility using properties, ensure called");
7828 actor.SetProperty(Actor::Property::VISIBLE, true);
7829 data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7831 tet_infoline("Set the visibility to current using properties, ensure not called");
7834 actor.SetProperty(Actor::Property::VISIBLE, true);
7835 data.Check(false /* not called */, TEST_LOCATION);
7840 int utcDaliActorVisibilityChangeSignalChildren(void)
7842 TestApplication application;
7843 tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
7845 Actor parent = Actor::New();
7846 Actor child = Actor::New();
7849 Actor grandChild = Actor::New();
7850 child.Add(grandChild);
7852 VisibilityChangedFunctorData parentData;
7853 VisibilityChangedFunctorData childData;
7854 VisibilityChangedFunctorData grandChildData;
7856 tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
7857 DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
7858 DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
7860 parent.SetProperty(Actor::Property::VISIBLE, false);
7861 parentData.Check(false /* not called */, TEST_LOCATION);
7862 childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7863 grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7865 tet_infoline("Connect to the parent's signal as well and ensure all three are called");
7868 grandChildData.Reset();
7870 DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
7872 parent.SetProperty(Actor::Property::VISIBLE, true);
7873 parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7874 childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7875 grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
7877 tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
7880 grandChildData.Reset();
7882 parent.SetProperty(Actor::Property::VISIBLE, true);
7883 parentData.Check(false /* not called */, TEST_LOCATION);
7884 childData.Check(false /* not called */, TEST_LOCATION);
7885 grandChildData.Check(false /* not called */, TEST_LOCATION);
7890 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
7892 TestApplication application;
7893 tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
7895 Actor actor = Actor::New();
7896 application.GetScene().Add(actor);
7898 application.SendNotification();
7899 application.Render();
7901 VisibilityChangedFunctorData data;
7902 DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
7904 Animation animation = Animation::New(1.0f);
7905 animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
7907 data.Check(false, TEST_LOCATION);
7908 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7909 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7911 tet_infoline("Play the animation and check the property value");
7914 data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
7915 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7917 tet_infoline("Animation not currently finished, so the current visibility should still be true");
7918 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
7920 application.SendNotification();
7921 application.Render(1100); // After the animation
7923 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
7928 int utcDaliActorVisibilityChangeSignalByName(void)
7930 TestApplication application;
7931 tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
7933 Actor actor = Actor::New();
7935 bool signalCalled = false;
7936 actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
7937 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7938 actor.SetProperty(Actor::Property::VISIBLE, false);
7939 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7941 tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
7942 signalCalled = false;
7943 actor.SetProperty(Actor::Property::VISIBLE, false);
7944 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7946 tet_infoline("Change the visibility using properties, ensure called");
7947 actor.SetProperty(Actor::Property::VISIBLE, true);
7948 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
7950 tet_infoline("Set the visibility to current using properties, ensure not called");
7951 signalCalled = false;
7953 actor.SetProperty(Actor::Property::VISIBLE, true);
7954 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
7959 static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
7961 gLayoutDirectionType = type;
7964 int UtcDaliActorLayoutDirectionProperty(void)
7966 TestApplication application;
7967 tet_infoline("Check layout direction property");
7969 Actor actor0 = Actor::New();
7970 DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7971 application.GetScene().Add(actor0);
7973 application.SendNotification();
7974 application.Render();
7976 Actor actor1 = Actor::New();
7977 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7978 Actor actor2 = Actor::New();
7979 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7980 Actor actor3 = Actor::New();
7981 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7982 Actor actor4 = Actor::New();
7983 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7984 Actor actor5 = Actor::New();
7985 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7986 Actor actor6 = Actor::New();
7987 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7988 Actor actor7 = Actor::New();
7989 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7990 Actor actor8 = Actor::New();
7991 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7992 Actor actor9 = Actor::New();
7993 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
7996 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
7997 actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
7999 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
8000 actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
8001 DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
8003 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8004 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8005 DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
8007 actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
8009 DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8010 DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8012 application.GetScene().Add(actor3);
8019 actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
8020 actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
8022 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
8023 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
8024 DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
8026 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
8028 DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8029 DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8030 DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8031 DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8032 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8033 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8034 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8036 actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
8037 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8038 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8040 actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
8041 DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8042 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8043 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
8045 actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
8046 DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8047 DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8052 struct LayoutDirectionFunctor
8054 LayoutDirectionFunctor(bool& signalCalled)
8055 : mSignalCalled(signalCalled)
8059 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
8060 : mSignalCalled(rhs.mSignalCalled)
8066 mSignalCalled = true;
8069 bool& mSignalCalled;
8072 int UtcDaliActorLayoutDirectionSignal(void)
8074 TestApplication application;
8075 tet_infoline("Check changing layout direction property sends a signal");
8077 Actor actor = Actor::New();
8078 DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
8079 application.GetScene().Add(actor);
8080 bool signalCalled = false;
8081 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
8083 actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
8084 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
8086 // Test that writing the same value doesn't send a signal
8087 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
8088 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
8090 // Test that writing a different value sends the signal
8091 signalCalled = false;
8092 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
8093 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
8095 signalCalled = false;
8096 actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
8097 DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
8102 struct ChildAddedSignalCheck
8104 ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
8105 : mSignalReceived(signalReceived),
8106 mChildHandle(childHandle)
8110 void operator()(Actor childHandle)
8112 mSignalReceived = true;
8113 mChildHandle = childHandle;
8117 mSignalReceived = true;
8118 mChildHandle = Actor();
8121 bool& mSignalReceived;
8122 Actor& mChildHandle;
8125 int UtcDaliChildAddedSignalP1(void)
8127 TestApplication application;
8128 auto stage = application.GetScene();
8130 bool signalReceived = false;
8133 ChildAddedSignalCheck signal(signalReceived, childActor);
8134 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
8135 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8137 auto actorA = Actor::New();
8139 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8140 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
8141 signalReceived = false;
8143 auto actorB = Actor::New();
8145 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8146 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
8151 int UtcDaliChildAddedSignalP2(void)
8153 TestApplication application;
8154 auto stage = application.GetScene();
8156 bool signalReceived = false;
8159 ChildAddedSignalCheck signal(signalReceived, childActor);
8160 tet_infoline("Connect to childAdded signal by name");
8162 stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
8163 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8165 auto actorA = Actor::New();
8167 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8169 // Can't test which actor was added; signal signature is void() when connecting via name.
8170 signalReceived = false;
8172 auto actorB = Actor::New();
8174 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8179 int UtcDaliChildAddedSignalN(void)
8181 TestApplication application;
8182 auto stage = application.GetScene();
8184 bool signalReceived = false;
8187 ChildAddedSignalCheck signal(signalReceived, childActor);
8188 DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
8189 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8191 auto actorA = Actor::New();
8193 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8194 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
8195 signalReceived = false;
8197 auto actorB = Actor::New();
8199 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8203 struct ChildRemovedSignalCheck
8205 ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
8206 : mSignalReceived(signalReceived),
8207 mChildHandle(childHandle)
8211 void operator()(Actor childHandle)
8213 mSignalReceived = true;
8214 mChildHandle = childHandle;
8219 mSignalReceived = true;
8222 bool& mSignalReceived;
8223 Actor& mChildHandle;
8226 int UtcDaliChildRemovedSignalP1(void)
8228 TestApplication application;
8229 auto stage = application.GetScene();
8231 bool signalReceived = false;
8234 ChildRemovedSignalCheck signal(signalReceived, childActor);
8235 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
8236 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8238 auto actorA = Actor::New();
8240 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8241 DALI_TEST_CHECK(!childActor);
8243 stage.Remove(actorA);
8244 DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
8245 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8247 signalReceived = false;
8248 auto actorB = Actor::New();
8250 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8252 stage.Remove(actorB);
8253 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8254 DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
8259 int UtcDaliChildRemovedSignalP2(void)
8261 TestApplication application;
8262 auto stage = application.GetScene();
8264 bool signalReceived = false;
8267 ChildAddedSignalCheck signal(signalReceived, childActor);
8268 tet_infoline("Connect to childRemoved signal by name");
8270 stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
8271 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8273 auto actorA = Actor::New();
8275 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8277 stage.Remove(actorA);
8278 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8280 signalReceived = false;
8281 auto actorB = Actor::New();
8283 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8285 stage.Remove(actorB);
8286 DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
8291 int UtcDaliChildRemovedSignalN(void)
8293 TestApplication application;
8294 auto stage = application.GetScene();
8296 bool signalReceived = false;
8299 ChildRemovedSignalCheck signal(signalReceived, childActor);
8300 DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
8301 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8303 auto actorA = Actor::New();
8306 auto actorB = Actor::New();
8309 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8310 DALI_TEST_CHECK(!childActor);
8312 actorA.Remove(actorB);
8313 DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
8317 int UtcDaliChildMovedSignalP(void)
8319 TestApplication application;
8320 auto stage = application.GetScene();
8322 bool addedASignalReceived = false;
8323 bool removedASignalReceived = false;
8324 bool addedBSignalReceived = false;
8325 bool removedBSignalReceived = false;
8328 auto actorA = Actor::New();
8329 auto actorB = Actor::New();
8333 ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
8334 ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
8335 ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
8336 ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
8338 DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
8339 DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
8340 DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
8341 DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
8343 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
8344 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
8345 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
8346 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
8348 // Create a child of A
8350 auto child = Actor::New();
8353 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
8354 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
8355 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
8356 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
8357 DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
8360 addedASignalReceived = false;
8361 addedBSignalReceived = false;
8362 removedASignalReceived = false;
8363 removedBSignalReceived = false;
8365 actorB.Add(child); // Expect this child to be re-parented
8366 DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
8367 DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
8368 DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
8369 DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
8371 // Move child back to A:
8372 addedASignalReceived = false;
8373 addedBSignalReceived = false;
8374 removedASignalReceived = false;
8375 removedBSignalReceived = false;
8377 actorA.Add(child); // Expect this child to be re-parented
8378 DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
8379 DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
8380 DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
8381 DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
8386 int UtcDaliActorSwitchParentP(void)
8388 tet_infoline("Testing Actor::UtcDaliActorSwitchParentP");
8389 TestApplication application;
8391 Actor parent1 = Actor::New();
8392 Actor child = Actor::New();
8394 application.GetScene().Add(parent1);
8396 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
8398 child.OnSceneSignal().Connect(OnSceneCallback);
8399 child.OffSceneSignal().Connect(OffSceneCallback);
8402 DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
8403 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
8407 DALI_TEST_EQUALS(parent1.GetChildCount(), 1u, TEST_LOCATION);
8409 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
8410 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
8412 Actor parent2 = Actor::New();
8413 application.GetScene().Add(parent2);
8415 bool addSignalReceived = false;
8416 ChildAddedSignalCheck addedSignal(addSignalReceived, child);
8417 DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
8418 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
8420 bool removedSignalReceived = false;
8421 ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
8422 DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
8423 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
8425 DevelActor::SwitchParent(child, parent2);
8427 DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
8428 DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
8430 DALI_TEST_EQUALS(parent1.GetChildCount(), 0u, TEST_LOCATION);
8431 DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
8433 DALI_TEST_CHECK(gOnSceneCallBackCalled == 1);
8434 DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
8435 DALI_TEST_CHECK(child.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE));
8436 DALI_TEST_CHECK(child.GetParent() == parent2);
8441 int utcDaliActorCulled(void)
8443 TestApplication application;
8444 auto stage = application.GetScene();
8446 tet_infoline("Check that the actor is culled if the actor is out of the screen");
8448 Actor actor = Actor::New();
8449 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
8451 Geometry geometry = CreateQuadGeometry();
8452 Shader shader = CreateShader();
8453 Renderer renderer = Renderer::New(geometry, shader);
8454 actor.AddRenderer(renderer);
8458 application.SendNotification();
8459 application.Render(0);
8461 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
8463 PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
8464 notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
8466 // Connect NotifySignal
8467 bool propertyNotificationSignal(false);
8468 PropertyNotification source;
8469 CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
8470 notification.NotifySignal().Connect(&application, f);
8472 actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
8474 application.SendNotification();
8475 application.Render();
8477 application.SendNotification();
8479 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
8481 DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
8482 DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
8483 DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
8488 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
8490 TestApplication application;
8491 auto stage = application.GetScene();
8493 tet_infoline("Ensure we clear the screen when the last actor is removed");
8495 Actor actor = CreateRenderableActor();
8496 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
8499 application.SendNotification();
8500 application.Render();
8502 auto& glAbstraction = application.GetGlAbstraction();
8503 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
8507 application.SendNotification();
8508 application.Render();
8510 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
8515 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
8517 TestApplication application;
8518 auto stage = application.GetScene();
8520 tet_infoline("Ensure we clear the screen when the last actor is made invisible");
8522 Actor actor = CreateRenderableActor();
8523 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
8526 application.SendNotification();
8527 application.Render();
8529 auto& glAbstraction = application.GetGlAbstraction();
8530 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
8532 actor.SetProperty(Actor::Property::VISIBLE, false);
8534 application.SendNotification();
8535 application.Render();
8537 DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
8542 int utcDaliActorGetSizeAfterAnimation(void)
8544 TestApplication application;
8545 tet_infoline("Check the actor size before / after an animation is finished");
8547 Vector3 actorSize(100.0f, 100.0f, 0.0f);
8549 Actor actor = Actor::New();
8550 actor.SetProperty(Actor::Property::SIZE, actorSize);
8551 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8552 application.GetScene().Add(actor);
8554 // Size should be updated without rendering.
8555 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8556 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8558 application.SendNotification();
8559 application.Render();
8561 // Size and current size should be updated.
8562 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8563 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8564 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8565 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8566 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8568 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8569 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8570 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8571 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8572 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8575 actorSize = Vector3(200.0f, 200.0f, 0.0f);
8576 actor.SetProperty(Actor::Property::SIZE, actorSize);
8578 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8579 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8581 Vector3 targetValue(10.0f, 20.0f, 0.0f);
8583 Animation animation = Animation::New(1.0f);
8584 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8587 // Size should be updated without rendering.
8588 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8589 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8591 application.SendNotification();
8592 application.Render(1100); // After the animation
8594 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8595 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8596 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8597 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8598 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8600 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8601 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8602 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8603 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8604 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8606 targetValue.width = 50.0f;
8609 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
8612 application.SendNotification();
8613 application.Render(1100); // After the animation
8615 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8616 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8617 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8618 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8619 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8621 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8622 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8623 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8624 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8625 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8627 targetValue.height = 70.0f;
8630 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
8633 application.SendNotification();
8634 application.Render(1100); // After the animation
8636 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8637 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8638 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8639 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8640 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8642 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8643 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8644 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8645 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8646 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8648 Vector3 offset(10.0f, 20.0f, 0.0f);
8651 animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
8654 application.SendNotification();
8655 application.Render(1100); // After the animation
8657 targetValue += offset;
8659 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8660 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8661 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8662 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8663 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8665 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8666 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8667 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8668 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8669 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8671 offset.width = 20.0f;
8674 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
8677 application.SendNotification();
8678 application.Render(1100); // After the animation
8680 targetValue.width += offset.width;
8682 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8683 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8684 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8685 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8686 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8688 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8689 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8690 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8691 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8692 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8694 offset.height = 10.0f;
8697 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
8700 application.SendNotification();
8701 application.Render(1100); // After the animation
8703 targetValue.height += offset.height;
8705 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8706 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8707 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8708 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8709 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8711 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8712 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8713 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8714 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8715 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8718 actorSize = Vector3(300.0f, 300.0f, 0.0f);
8720 actor.SetProperty(Actor::Property::SIZE, actorSize);
8722 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8723 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8725 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8726 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8728 application.SendNotification();
8729 application.Render();
8731 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8732 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8734 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8735 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8740 int utcDaliActorGetSizeAfterAnimation2(void)
8742 TestApplication application;
8743 tet_infoline("Check the actor size before / after an animation is finished if before size is equal to animation target size");
8745 Vector3 actorSize(100.0f, 100.0f, 0.0f);
8747 Actor actor = Actor::New();
8748 actor.SetProperty(Actor::Property::SIZE, actorSize);
8749 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8750 application.GetScene().Add(actor);
8752 // Size should be updated without rendering.
8753 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8754 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8756 application.SendNotification();
8757 application.Render();
8759 // Size and current size should be updated.
8760 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8761 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8762 DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8763 DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8764 DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8766 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8767 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8768 DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8769 DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8770 DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8773 actorSize = Vector3(200.0f, 200.0f, 0.0f);
8774 actor.SetProperty(Actor::Property::SIZE, actorSize);
8776 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8777 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8779 Vector3 targetValue(actorSize);
8781 Animation animation = Animation::New(1.0f);
8782 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8785 // Size should be updated without rendering.
8786 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8787 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8789 application.SendNotification();
8790 application.Render(100); // During the animation
8792 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8793 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8794 DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8795 DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8796 DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8798 // We should get target value because targetValue is equal to current actor size.
8799 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8800 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8801 DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
8802 DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
8803 DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
8805 application.SendNotification();
8806 application.Render(1000); // After animation finished
8808 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8809 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8811 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8812 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8817 int utcDaliActorRelayoutAndAnimation(void)
8819 TestApplication application;
8820 tet_infoline("Check the actor size when relayoutting and playing animation");
8822 Vector3 parentSize(300.0f, 300.0f, 0.0f);
8823 Vector3 actorSize(100.0f, 100.0f, 0.0f);
8826 Actor parentA = Actor::New();
8827 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8828 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8829 application.GetScene().Add(parentA);
8831 Actor parentB = Actor::New();
8832 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8833 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8834 application.GetScene().Add(parentB);
8836 Actor actor = Actor::New();
8837 actor.SetProperty(Actor::Property::SIZE, actorSize);
8838 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8841 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8842 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8844 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8846 Animation animation = Animation::New(1.0f);
8847 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8850 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8851 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8853 application.SendNotification();
8854 application.Render(1100); // After the animation
8856 // Size and current size should be updated.
8857 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8858 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8860 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8861 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8866 application.SendNotification();
8867 application.Render();
8869 // Size and current size should be same.
8870 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8871 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8873 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8874 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8882 Actor parentA = Actor::New();
8883 parentA.SetProperty(Actor::Property::SIZE, parentSize);
8884 parentA.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8885 application.GetScene().Add(parentA);
8887 Actor parentB = Actor::New();
8888 parentB.SetProperty(Actor::Property::SIZE, parentSize);
8889 parentB.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8890 application.GetScene().Add(parentB);
8892 Actor actor = Actor::New();
8893 actor.SetProperty(Actor::Property::SIZE, actorSize);
8894 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8897 Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8898 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8900 application.SendNotification();
8901 application.Render();
8903 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8904 DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8906 Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8907 DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8909 Vector3 targetValue(200.0f, 200.0f, 0.0f);
8911 // Make an animation
8912 Animation animation = Animation::New(1.0f);
8913 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
8916 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8917 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8919 application.SendNotification();
8920 application.Render(1100); // After the animation
8922 // Size and current size should be updated.
8923 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8924 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8926 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8927 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8932 application.SendNotification();
8933 application.Render();
8935 // Size and current size should be same.
8936 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
8937 DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8939 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
8940 DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
8950 int utcDaliActorPartialUpdate(void)
8952 TestApplication application(
8953 TestApplication::DEFAULT_SURFACE_WIDTH,
8954 TestApplication::DEFAULT_SURFACE_HEIGHT,
8955 TestApplication::DEFAULT_HORIZONTAL_DPI,
8956 TestApplication::DEFAULT_VERTICAL_DPI,
8960 tet_infoline("Check the damaged area");
8962 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
8964 std::vector<Rect<int>> damagedRects;
8965 Rect<int> clippingRect;
8966 application.SendNotification();
8967 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8969 // First render pass, nothing to render, adaptor would just do swap buffer.
8970 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
8972 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
8973 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8975 Actor actor = CreateRenderableActor();
8976 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
8977 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
8978 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
8979 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
8980 application.GetScene().Add(actor);
8982 application.SendNotification();
8984 // 1. Actor added, damaged rect is added size of actor
8985 damagedRects.clear();
8986 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
8987 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
8990 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
8991 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
8992 application.RenderWithPartialUpdate(damagedRects, clippingRect);
8993 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
8994 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
8995 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
8996 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
8999 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0));
9000 application.SendNotification();
9002 damagedRects.clear();
9003 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9004 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9007 clippingRect = Rect<int>(16, 752, 48, 48); // in screen coordinates
9008 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9009 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9010 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9011 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9012 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9013 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9015 // 3. Set new position
9016 actor.SetProperty(Actor::Property::POSITION, Vector3(32.0f, 32.0f, 0));
9017 application.SendNotification();
9019 damagedRects.clear();
9020 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9021 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9024 clippingRect = Rect<int>(16, 736, 64, 64); // in screen coordinates
9025 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9026 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9027 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9028 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9029 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9030 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9032 application.GetScene().Remove(actor);
9033 application.SendNotification();
9035 // Actor removed, last a dirty rect is reported.
9036 damagedRects.clear();
9037 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9038 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9040 clippingRect = damagedRects[0];
9042 DALI_TEST_EQUALS(clippingRect.IsValid(), true, TEST_LOCATION);
9043 DALI_TEST_EQUALS<Rect<int>>(clippingRect, Rect<int>(32, 736, 48, 48), TEST_LOCATION);
9045 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9046 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9047 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9048 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9049 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9054 int utcDaliActorPartialUpdateSetColor(void)
9056 TestApplication application(
9057 TestApplication::DEFAULT_SURFACE_WIDTH,
9058 TestApplication::DEFAULT_SURFACE_HEIGHT,
9059 TestApplication::DEFAULT_HORIZONTAL_DPI,
9060 TestApplication::DEFAULT_VERTICAL_DPI,
9064 tet_infoline("Check uniform update");
9066 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9068 std::vector<Rect<int>> damagedRects;
9069 Rect<int> clippingRect;
9070 application.SendNotification();
9071 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9073 // First render pass, nothing to render, adaptor would just do swap buffer.
9074 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9076 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9077 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9079 Actor actor = CreateRenderableActor();
9080 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9081 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
9082 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9083 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9084 application.GetScene().Add(actor);
9086 application.SendNotification();
9088 // 1. Actor added, damaged rect is added size of actor
9089 damagedRects.clear();
9090 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9091 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9094 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
9095 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9096 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9097 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9098 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9099 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9100 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9102 damagedRects.clear();
9103 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9104 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9106 damagedRects.clear();
9107 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9108 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9111 actor.SetProperty(Actor::Property::COLOR, Vector3(1.0f, 0.0f, 0.0f));
9112 application.SendNotification();
9114 damagedRects.clear();
9115 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9116 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9119 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
9120 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9121 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9122 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9123 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9124 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9125 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9130 const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
9131 const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
9132 const std::string SHADER_SHADOW_COLOR_PROPERTY_NAME("uShadowColor");
9133 const char* const RENDER_SHADOW_VERTEX_SOURCE =
9134 " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
9135 " uniform mediump mat4 uLightCameraViewMatrix;\n"
9139 " gl_Position = uProjection * uModelView * vec4(aPosition,1.0);\n"
9140 " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vec4(aPosition,1.0);\n"
9141 " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
9144 const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
9145 "uniform lowp vec4 uShadowColor;\n"
9148 " lowp float alpha;\n"
9149 " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
9150 " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
9153 int utcDaliActorPartialUpdateSetProperty(void)
9155 TestApplication application(
9156 TestApplication::DEFAULT_SURFACE_WIDTH,
9157 TestApplication::DEFAULT_SURFACE_HEIGHT,
9158 TestApplication::DEFAULT_HORIZONTAL_DPI,
9159 TestApplication::DEFAULT_VERTICAL_DPI,
9163 tet_infoline("Set/Update property with partial update");
9165 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9167 std::vector<Rect<int>> damagedRects;
9168 Rect<int> clippingRect;
9169 application.SendNotification();
9170 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9172 // First render pass, nothing to render, adaptor would just do swap buffer.
9173 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9175 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9176 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9178 Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
9179 Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
9180 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9181 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
9182 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9183 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9184 application.GetScene().Add(actor);
9186 actor.RegisterProperty(SHADER_SHADOW_COLOR_PROPERTY_NAME, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
9188 damagedRects.clear();
9189 application.SendNotification();
9190 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9191 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9194 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
9195 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9196 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9197 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9198 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9199 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9200 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9202 Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
9203 actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
9205 damagedRects.clear();
9206 application.SendNotification();
9207 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9208 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9210 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9211 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9212 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9213 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9214 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9215 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9217 // Should be no damage rects, nothing changed
9218 damagedRects.clear();
9219 application.SendNotification();
9220 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9221 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9223 // Should be 1 damage rect due to change in size
9224 damagedRects.clear();
9225 actor.SetProperty(Actor::Property::SIZE, Vector3(26.0f, 26.0f, 0.0f));
9226 application.SendNotification();
9227 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9228 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9230 clippingRect = Rect<int>(16, 752, 32, 48); // new clipping rect size increased due to change in actor size
9231 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9232 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9233 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9234 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9235 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9236 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9238 damagedRects.clear();
9239 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9240 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9245 int utcDaliActorPartialUpdateTwoActors(void)
9247 TestApplication application(
9248 TestApplication::DEFAULT_SURFACE_WIDTH,
9249 TestApplication::DEFAULT_SURFACE_HEIGHT,
9250 TestApplication::DEFAULT_HORIZONTAL_DPI,
9251 TestApplication::DEFAULT_VERTICAL_DPI,
9255 tet_infoline("Check the damaged rects with partial update and two actors");
9257 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9259 Actor actor = CreateRenderableActor();
9260 actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
9261 actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 50.0f, 0.0f));
9262 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9263 application.GetScene().Add(actor);
9265 Actor actor2 = CreateRenderableActor();
9266 actor2.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 150.0f, 0.0f));
9267 actor2.SetProperty(Actor::Property::SIZE, Vector3(100.0f, 100.0f, 0.0f));
9268 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9269 application.GetScene().Add(actor2);
9271 application.SendNotification();
9272 std::vector<Rect<int>> damagedRects;
9273 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9275 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
9276 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64), Rect<int>(96, 592, 112, 112)}, true, TEST_LOCATION);
9278 // in screen coordinates, adaptor would calculate it using previous frames information
9279 Rect<int> clippingRect = Rect<int>(64, 592, 144, 192);
9280 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9282 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9283 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9284 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9285 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9287 // Change a Renderer of actor1
9288 Geometry geometry = CreateQuadGeometry();
9289 Shader shader = CreateShader();
9290 Renderer newRenderer = Renderer::New(geometry, shader);
9291 Renderer renderer = actor.GetRendererAt(0);
9293 actor.RemoveRenderer(renderer);
9294 actor.AddRenderer(newRenderer);
9296 damagedRects.clear();
9298 application.SendNotification();
9299 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9301 DALI_TEST_CHECK(damagedRects.size() > 0);
9302 DirtyRectChecker(damagedRects, {Rect<int>(64, 672, 64, 64)}, false, TEST_LOCATION);
9304 // in screen coordinates, adaptor would calculate it using previous frames information
9305 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9307 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9308 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9309 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9310 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9315 int utcDaliActorPartialUpdateActorsWithSizeHint01(void)
9317 TestApplication application(
9318 TestApplication::DEFAULT_SURFACE_WIDTH,
9319 TestApplication::DEFAULT_SURFACE_HEIGHT,
9320 TestApplication::DEFAULT_HORIZONTAL_DPI,
9321 TestApplication::DEFAULT_VERTICAL_DPI,
9325 tet_infoline("Check the damaged rect with partial update and update area hint");
9327 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9329 Actor actor = CreateRenderableActor();
9330 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
9331 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
9332 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
9333 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9334 application.GetScene().Add(actor);
9336 application.SendNotification();
9337 std::vector<Rect<int>> damagedRects;
9338 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9340 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9342 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
9343 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9345 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9347 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9348 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9349 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9350 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9355 damagedRects.clear();
9356 application.SendNotification();
9357 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9359 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9360 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9362 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9364 damagedRects.clear();
9365 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9366 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9368 // Ensure the damaged rect is empty
9369 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9371 // Chnage UPDATE_AREA_HINT
9372 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 32.0f, 32.0f));
9373 application.GetScene().Add(actor);
9375 application.SendNotification();
9376 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9378 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9380 clippingRect = Rect<int>(64, 704, 48, 48);
9381 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9383 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9385 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9386 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9387 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9388 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9393 damagedRects.clear();
9394 application.SendNotification();
9395 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9397 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9398 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9400 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9402 damagedRects.clear();
9403 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9404 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9406 // Ensure the damaged rect is empty
9407 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9409 // Chnage UPDATE_AREA_HINT
9410 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(-32.0f, -16.0f, 64.0f, 64.0f));
9411 application.GetScene().Add(actor);
9413 application.SendNotification();
9414 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9416 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9418 clippingRect = Rect<int>(0, 720, 80, 80);
9419 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9421 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9423 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9424 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9425 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9426 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9431 int utcDaliActorPartialUpdateActorsWithSizeHint02(void)
9433 TestApplication application(
9434 TestApplication::DEFAULT_SURFACE_WIDTH,
9435 TestApplication::DEFAULT_SURFACE_HEIGHT,
9436 TestApplication::DEFAULT_HORIZONTAL_DPI,
9437 TestApplication::DEFAULT_VERTICAL_DPI,
9441 tet_infoline("Check the damaged rect with partial update and update area hint");
9443 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9445 Actor actor = CreateRenderableActor();
9446 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
9447 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
9448 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9449 application.GetScene().Add(actor);
9451 application.SendNotification();
9452 std::vector<Rect<int>> damagedRects;
9453 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9455 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9457 Rect<int> clippingRect = Rect<int>(48, 720, 48, 48);
9458 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9460 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9462 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9463 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9464 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9465 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9467 damagedRects.clear();
9468 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9469 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9471 // Ensure the damaged rect is empty
9472 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9474 // Change UPDATE_AREA_HINT
9475 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
9477 application.SendNotification();
9478 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9480 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9482 clippingRect = Rect<int>(32, 704, 80, 80);
9483 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9485 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9487 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9488 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9489 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9490 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9492 damagedRects.clear();
9493 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9494 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9496 // Ensure the damaged rect is empty
9497 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9499 // Chnage UPDATE_AREA_HINT
9500 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(16.0f, 16.0f, 64.0f, 64.0f));
9501 application.GetScene().Add(actor);
9503 application.SendNotification();
9504 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9506 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9508 clippingRect = Rect<int>(32, 688, 96, 96);
9509 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9511 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9513 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9514 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9515 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9516 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9521 int utcDaliActorPartialUpdateActorsWithSizeHint03(void)
9523 TestApplication application(
9524 TestApplication::DEFAULT_SURFACE_WIDTH,
9525 TestApplication::DEFAULT_SURFACE_HEIGHT,
9526 TestApplication::DEFAULT_HORIZONTAL_DPI,
9527 TestApplication::DEFAULT_VERTICAL_DPI,
9531 tet_infoline("Check the damaged rect with partial update and update area hint");
9533 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9535 Actor actor = CreateRenderableActor();
9536 actor.SetProperty(Actor::Property::POSITION, Vector3(64.0f, 64.0f, 0.0f));
9537 actor.SetProperty(Actor::Property::SIZE, Vector3(32.0f, 32.0f, 0.0f));
9538 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 64.0f, 64.0f));
9539 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9540 application.GetScene().Add(actor);
9542 application.SendNotification();
9543 std::vector<Rect<int>> damagedRects;
9544 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9546 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9548 Rect<int> clippingRect = Rect<int>(32, 704, 80, 80);
9549 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9551 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9553 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9554 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9555 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9556 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9558 damagedRects.clear();
9559 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9560 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9562 // Ensure the damaged rect is empty
9563 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9565 // Set UPDATE_AREA_HINT twice before rendering
9566 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(0.0f, 0.0f, 32.0f, 32.0f));
9567 application.SendNotification();
9569 actor.SetProperty(Actor::Property::UPDATE_AREA_HINT, Vector4(32.0f, -32.0f, 32.0f, 32.0f));
9570 application.SendNotification();
9572 damagedRects.clear();
9573 application.PreRenderWithPartialUpdate(TestApplication::DEFAULT_RENDER_INTERVAL, nullptr, damagedRects);
9575 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9577 clippingRect = Rect<int>(32, 704, 96, 96);
9578 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9580 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9582 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9583 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9584 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9585 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9590 int utcDaliActorPartialUpdateAnimation(void)
9592 TestApplication application(
9593 TestApplication::DEFAULT_SURFACE_WIDTH,
9594 TestApplication::DEFAULT_SURFACE_HEIGHT,
9595 TestApplication::DEFAULT_HORIZONTAL_DPI,
9596 TestApplication::DEFAULT_VERTICAL_DPI,
9600 tet_infoline("Check the damaged area with partial update and animation");
9602 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
9603 drawTrace.Enable(true);
9606 Actor actor1 = CreateRenderableActor();
9607 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9608 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
9609 application.GetScene().Add(actor1);
9611 Actor actor2 = CreateRenderableActor();
9612 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9613 actor2.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9614 application.GetScene().Add(actor2);
9616 std::vector<Rect<int>> damagedRects;
9617 Rect<int> clippingRect;
9618 Rect<int> expectedRect1, expectedRect2;
9620 application.SendNotification();
9621 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9623 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
9626 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates, includes 1 last frames updates
9627 expectedRect2 = Rect<int>(0, 784, 32, 32); // in screen coordinates, includes 1 last frames updates
9628 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2}, true, TEST_LOCATION);
9630 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9631 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9633 // Make an animation
9634 Animation animation = Animation::New(1.0f);
9635 animation.AnimateTo(Property(actor2, Actor::Property::POSITION_X), 160.0f, TimePeriod(0.5f, 0.5f));
9638 application.SendNotification();
9640 damagedRects.clear();
9641 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9642 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9643 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9646 damagedRects.clear();
9648 // In animation deley time
9649 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9650 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9651 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9654 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
9657 damagedRects.clear();
9659 // Also in animation deley time
9660 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9661 application.PreRenderWithPartialUpdate(100, nullptr, damagedRects);
9662 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9665 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
9667 // Unparent 2 actors and make a new actor
9671 Actor actor3 = CreateRenderableActor();
9672 actor3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9673 actor3.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9674 application.GetScene().Add(actor3);
9676 application.SendNotification();
9678 // Started animation
9679 damagedRects.clear();
9680 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
9681 DALI_TEST_EQUALS(damagedRects.size(), 3, TEST_LOCATION);
9683 // One of dirty rect is actor3's.
9684 // We don't know the exact dirty rect of actor1 and actor2.
9685 DirtyRectChecker(damagedRects, {expectedRect1, expectedRect2, expectedRect2}, true, TEST_LOCATION);
9687 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9688 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9690 // Finished animation, but the actor was already unparented
9691 damagedRects.clear();
9692 application.PreRenderWithPartialUpdate(500, nullptr, damagedRects);
9694 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9696 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9697 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9702 int utcDaliActorPartialUpdateChangeVisibility(void)
9704 TestApplication application(
9705 TestApplication::DEFAULT_SURFACE_WIDTH,
9706 TestApplication::DEFAULT_SURFACE_HEIGHT,
9707 TestApplication::DEFAULT_HORIZONTAL_DPI,
9708 TestApplication::DEFAULT_VERTICAL_DPI,
9712 tet_infoline("Check the damaged rect with partial update and visibility change");
9714 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9716 Actor actor = CreateRenderableActor();
9717 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9718 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
9719 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9720 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9721 application.GetScene().Add(actor);
9723 application.SendNotification();
9725 std::vector<Rect<int>> damagedRects;
9726 Rect<int> clippingRect;
9728 // 1. Actor added, damaged rect is added size of actor
9729 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9730 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9733 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
9734 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9735 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9736 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9737 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9738 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9739 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9741 damagedRects.clear();
9742 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9743 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9745 // Ensure the damaged rect is empty
9746 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9748 // 2. Make the Actor invisible
9749 actor.SetProperty(Actor::Property::VISIBLE, false);
9750 application.SendNotification();
9752 damagedRects.clear();
9753 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9754 DALI_TEST_CHECK(damagedRects.size() > 0);
9755 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
9757 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9758 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9759 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9760 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9761 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9763 // 3. Make the Actor visible again
9764 actor.SetProperty(Actor::Property::VISIBLE, true);
9765 application.SendNotification();
9767 damagedRects.clear();
9768 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9769 DALI_TEST_CHECK(damagedRects.size() > 0);
9770 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
9772 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9773 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9774 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9775 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9776 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9781 int utcDaliActorPartialUpdateOnOffScene(void)
9783 TestApplication application(
9784 TestApplication::DEFAULT_SURFACE_WIDTH,
9785 TestApplication::DEFAULT_SURFACE_HEIGHT,
9786 TestApplication::DEFAULT_HORIZONTAL_DPI,
9787 TestApplication::DEFAULT_VERTICAL_DPI,
9791 tet_infoline("Check the damaged rect with partial update and on/off scene");
9793 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
9795 Actor actor = CreateRenderableActor();
9796 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9797 actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
9798 actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
9799 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
9800 application.GetScene().Add(actor);
9802 application.SendNotification();
9804 std::vector<Rect<int>> damagedRects;
9805 Rect<int> clippingRect;
9807 // 1. Actor added, damaged rect is added size of actor
9808 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9809 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9812 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
9813 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
9814 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9815 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9816 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9817 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9818 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9820 damagedRects.clear();
9821 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9822 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9824 damagedRects.clear();
9825 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9826 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9828 // Ensure the damaged rect is empty
9829 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9831 // 2. Remove the Actor from the Scene
9833 application.SendNotification();
9835 damagedRects.clear();
9836 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9837 DALI_TEST_CHECK(damagedRects.size() > 0);
9838 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
9840 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9841 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9842 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9843 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9844 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9846 // 3. Add the Actor to the Scene again
9847 application.GetScene().Add(actor);
9848 application.SendNotification();
9850 damagedRects.clear();
9851 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9852 DALI_TEST_CHECK(damagedRects.size() > 0);
9853 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
9855 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9856 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
9857 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
9858 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
9859 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
9864 int utcDaliActorPartialUpdateSkipRendering(void)
9866 TestApplication application(
9867 TestApplication::DEFAULT_SURFACE_WIDTH,
9868 TestApplication::DEFAULT_SURFACE_HEIGHT,
9869 TestApplication::DEFAULT_HORIZONTAL_DPI,
9870 TestApplication::DEFAULT_VERTICAL_DPI,
9874 tet_infoline("Check to skip rendering in case of the empty damaged rect");
9876 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
9877 drawTrace.Enable(true);
9880 Actor actor1 = CreateRenderableActor();
9881 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9882 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
9883 application.GetScene().Add(actor1);
9885 std::vector<Rect<int>> damagedRects;
9886 Rect<int> clippingRect;
9887 Rect<int> expectedRect1;
9889 application.SendNotification();
9890 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9892 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9895 expectedRect1 = Rect<int>(0, 720, 96, 96); // in screen coordinates
9896 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
9898 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9899 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9901 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9903 damagedRects.clear();
9904 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9905 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9906 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9911 application.SendNotification();
9913 damagedRects.clear();
9914 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9916 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
9918 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9919 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9921 // Render again without any change
9922 damagedRects.clear();
9924 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9926 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
9928 clippingRect = Rect<int>();
9929 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9932 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
9934 // Add the actor again
9935 application.GetScene().Add(actor1);
9937 application.SendNotification();
9939 damagedRects.clear();
9941 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9943 DirtyRectChecker(damagedRects, {expectedRect1}, true, TEST_LOCATION);
9945 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9946 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9948 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9953 int utcDaliActorPartialUpdate3DNode(void)
9955 TestApplication application(
9956 TestApplication::DEFAULT_SURFACE_WIDTH,
9957 TestApplication::DEFAULT_SURFACE_HEIGHT,
9958 TestApplication::DEFAULT_HORIZONTAL_DPI,
9959 TestApplication::DEFAULT_VERTICAL_DPI,
9963 tet_infoline("Partial update should be ignored in case of 3d layer of 3d node");
9965 TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
9966 drawTrace.Enable(true);
9969 Actor actor1 = CreateRenderableActor();
9970 actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
9971 actor1.SetProperty(Actor::Property::SIZE, Vector3(80.0f, 80.0f, 0.0f));
9972 application.GetScene().Add(actor1);
9974 std::vector<Rect<int>> damagedRects;
9975 Rect<int> clippingRect;
9977 application.SendNotification();
9978 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9980 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9982 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
9983 application.RenderWithPartialUpdate(damagedRects, clippingRect);
9985 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
9987 // Change the layer to 3D
9988 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
9990 application.SendNotification();
9992 damagedRects.clear();
9993 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
9995 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
9996 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
9998 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
10000 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10002 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
10004 // Change the layer to 2D
10005 application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
10007 application.SendNotification();
10009 damagedRects.clear();
10010 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10012 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10014 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
10015 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10017 // Make 3D transform
10018 actor1.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::YAXIS));
10020 application.SendNotification();
10022 damagedRects.clear();
10023 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10025 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10026 DirtyRectChecker(damagedRects, {TestApplication::DEFAULT_SURFACE_RECT}, true, TEST_LOCATION);
10028 clippingRect = TestApplication::DEFAULT_SURFACE_RECT;
10030 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10032 DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
10037 int utcDaliActorPartialUpdateNotRenderableActor(void)
10039 TestApplication application(
10040 TestApplication::DEFAULT_SURFACE_WIDTH,
10041 TestApplication::DEFAULT_SURFACE_HEIGHT,
10042 TestApplication::DEFAULT_HORIZONTAL_DPI,
10043 TestApplication::DEFAULT_VERTICAL_DPI,
10047 tet_infoline("Check the damaged rect with not renderable parent actor");
10049 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10051 Actor parent = Actor::New();
10052 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10053 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10054 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10055 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10056 application.GetScene().Add(parent);
10058 Actor child = CreateRenderableActor();
10059 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10060 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10061 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10064 application.SendNotification();
10066 std::vector<Rect<int>> damagedRects;
10068 // 1. Actor added, damaged rect is added size of actor
10069 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10070 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10073 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10074 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10076 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10077 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10078 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10079 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10080 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10082 damagedRects.clear();
10083 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10084 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10086 damagedRects.clear();
10087 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10088 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10090 // Ensure the damaged rect is empty
10091 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10096 int utcDaliActorPartialUpdateChangeTransparency(void)
10098 TestApplication application(
10099 TestApplication::DEFAULT_SURFACE_WIDTH,
10100 TestApplication::DEFAULT_SURFACE_HEIGHT,
10101 TestApplication::DEFAULT_HORIZONTAL_DPI,
10102 TestApplication::DEFAULT_VERTICAL_DPI,
10106 tet_infoline("Check the damaged rect with changing transparency");
10108 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10110 Actor actor = CreateRenderableActor();
10111 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10112 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10113 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10114 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10115 application.GetScene().Add(actor);
10117 application.SendNotification();
10119 std::vector<Rect<int>> damagedRects;
10121 // Actor added, damaged rect is added size of actor
10122 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10123 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10126 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10127 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10129 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10130 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10131 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10132 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10133 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10135 damagedRects.clear();
10136 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10137 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10139 // Ensure the damaged rect is empty
10140 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10142 // Make the actor transparent by changing opacity of the Renderer
10143 // It changes a uniform value
10144 Renderer renderer = actor.GetRendererAt(0);
10145 renderer[DevelRenderer::Property::OPACITY] = 0.0f;
10147 application.SendNotification();
10149 // The damaged rect should be same
10150 damagedRects.clear();
10151 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10152 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10153 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10154 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10156 damagedRects.clear();
10157 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10158 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10160 // Ensure the damaged rect is empty
10161 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10163 // Make the actor opaque again
10164 renderer[DevelRenderer::Property::OPACITY] = 1.0f;
10166 application.SendNotification();
10168 // The damaged rect should not be empty
10169 damagedRects.clear();
10170 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10171 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10172 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10173 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10175 damagedRects.clear();
10176 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10177 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10179 // Ensure the damaged rect is empty
10180 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10182 // Make the actor translucent
10183 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
10185 application.SendNotification();
10187 // The damaged rect should not be empty
10188 damagedRects.clear();
10189 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10190 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10191 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10192 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10194 damagedRects.clear();
10195 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10196 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10198 // Ensure the damaged rect is empty
10199 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10201 // Change Renderer opacity - also translucent
10202 renderer[DevelRenderer::Property::OPACITY] = 0.2f;
10204 application.SendNotification();
10206 // The damaged rect should not be empty
10207 damagedRects.clear();
10208 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10209 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10210 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10211 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10213 damagedRects.clear();
10214 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10215 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10217 // Ensure the damaged rect is empty
10218 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10220 // Make the actor culled
10221 actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
10223 application.SendNotification();
10225 // The damaged rect should be same
10226 damagedRects.clear();
10227 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10228 DALI_TEST_CHECK(damagedRects.size() > 0);
10229 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
10230 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10232 damagedRects.clear();
10233 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10234 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10236 // Ensure the damaged rect is empty
10237 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10239 // Make the actor not culled again
10240 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 16.0f);
10242 application.SendNotification();
10244 // The damaged rect should not be empty
10245 damagedRects.clear();
10246 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10247 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10248 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10249 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10254 int utcDaliActorPartialUpdateChangeParentOpacity(void)
10256 TestApplication application(
10257 TestApplication::DEFAULT_SURFACE_WIDTH,
10258 TestApplication::DEFAULT_SURFACE_HEIGHT,
10259 TestApplication::DEFAULT_HORIZONTAL_DPI,
10260 TestApplication::DEFAULT_VERTICAL_DPI,
10264 tet_infoline("Check the damaged rect with changing parent's opacity");
10266 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10268 Actor parent = Actor::New();
10269 parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10270 parent[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10271 parent[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10272 parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10273 application.GetScene().Add(parent);
10275 Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
10276 Actor child = CreateRenderableActor(texture);
10277 child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10278 child[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10279 child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10282 application.SendNotification();
10284 std::vector<Rect<int>> damagedRects;
10286 // Actor added, damaged rect is added size of actor
10287 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10288 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10291 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10292 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10294 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10295 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10296 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10297 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10298 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10300 damagedRects.clear();
10301 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10302 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10304 damagedRects.clear();
10305 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10306 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10308 // Ensure the damaged rect is empty
10309 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10311 // Change the parent's opacity
10312 parent[Actor::Property::OPACITY] = 0.5f;
10314 application.SendNotification();
10316 // The damaged rect should be same
10317 damagedRects.clear();
10318 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10319 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10320 DALI_TEST_CHECK(damagedRects.size() > 0);
10321 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
10326 int utcDaliActorPartialUpdateAddRemoveRenderer(void)
10328 TestApplication application(
10329 TestApplication::DEFAULT_SURFACE_WIDTH,
10330 TestApplication::DEFAULT_SURFACE_HEIGHT,
10331 TestApplication::DEFAULT_HORIZONTAL_DPI,
10332 TestApplication::DEFAULT_VERTICAL_DPI,
10336 tet_infoline("Check the damaged rect with adding / removing renderer");
10338 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10340 Actor actor = CreateRenderableActor();
10341 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10342 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10343 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10344 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10345 application.GetScene().Add(actor);
10347 application.SendNotification();
10349 std::vector<Rect<int>> damagedRects;
10351 // Actor added, damaged rect is added size of actor
10352 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10353 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10356 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10357 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10359 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10360 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10361 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10362 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10363 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10365 damagedRects.clear();
10366 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10367 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10369 damagedRects.clear();
10370 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10371 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10373 // Remove the Renderer
10374 Renderer renderer = actor.GetRendererAt(0);
10375 actor.RemoveRenderer(renderer);
10377 application.SendNotification();
10379 // The damaged rect should be the actor area
10380 damagedRects.clear();
10381 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10382 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10383 DALI_TEST_CHECK(damagedRects.size() > 0);
10384 DirtyRectChecker(damagedRects, {clippingRect}, false, TEST_LOCATION);
10386 damagedRects.clear();
10387 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10388 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10390 // Ensure the damaged rect is empty
10391 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10393 // Add the Renderer again
10394 actor.AddRenderer(renderer);
10396 application.SendNotification();
10398 // The damaged rect should be the actor area
10399 damagedRects.clear();
10400 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10401 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10402 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10403 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10408 int utcDaliActorPartialUpdate3DTransform(void)
10410 TestApplication application(
10411 TestApplication::DEFAULT_SURFACE_WIDTH,
10412 TestApplication::DEFAULT_SURFACE_HEIGHT,
10413 TestApplication::DEFAULT_HORIZONTAL_DPI,
10414 TestApplication::DEFAULT_VERTICAL_DPI,
10418 tet_infoline("Check the damaged rect with 3D transformed actors");
10420 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10422 Actor actor1 = CreateRenderableActor();
10423 actor1[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10424 actor1[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10425 actor1[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10426 actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10427 application.GetScene().Add(actor1);
10430 Actor actor2 = CreateRenderableActor();
10431 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10432 actor2[Actor::Property::POSITION] = Vector3(160.0f, 160.0f, 0.0f);
10433 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10434 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10435 application.GetScene().Add(actor2);
10437 application.SendNotification();
10439 std::vector<Rect<int>> damagedRects;
10441 // Actor added, damaged rect is added size of actor
10442 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10443 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
10446 Rect<int> clippingRect1 = Rect<int>(16, 768, 32, 32); // in screen coordinates
10447 Rect<int> clippingRect2 = Rect<int>(160, 624, 32, 32);
10448 DirtyRectChecker(damagedRects, {clippingRect1, clippingRect2}, true, TEST_LOCATION);
10450 Rect<int> surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10451 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10453 damagedRects.clear();
10454 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10455 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10456 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10458 damagedRects.clear();
10459 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10460 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10461 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10463 // Rotate actor1 on y axis
10464 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
10469 application.SendNotification();
10471 damagedRects.clear();
10472 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10474 // Should update full area
10475 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10476 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10477 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
10478 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10480 // Add actor2 again
10481 application.GetScene().Add(actor2);
10483 application.SendNotification();
10485 damagedRects.clear();
10486 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10488 // Should update full area
10489 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10490 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10491 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
10492 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10494 // Reset the orientation of actor1
10495 actor1[Actor::Property::ORIENTATION] = Quaternion::IDENTITY;
10497 application.SendNotification();
10499 damagedRects.clear();
10500 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10502 // Should update full area
10503 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10504 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10505 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
10506 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10508 // Make actor2 dirty
10509 actor2[Actor::Property::SIZE] = Vector3(32.0f, 32.0f, 0.0f);
10511 application.SendNotification();
10513 damagedRects.clear();
10514 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10516 clippingRect2 = Rect<int>(160, 608, 48, 48);
10517 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10518 DirtyRectChecker(damagedRects, {clippingRect2}, true, TEST_LOCATION);
10520 application.RenderWithPartialUpdate(damagedRects, clippingRect2);
10521 DALI_TEST_EQUALS(clippingRect2.x, glScissorParams.x, TEST_LOCATION);
10522 DALI_TEST_EQUALS(clippingRect2.y, glScissorParams.y, TEST_LOCATION);
10523 DALI_TEST_EQUALS(clippingRect2.width, glScissorParams.width, TEST_LOCATION);
10524 DALI_TEST_EQUALS(clippingRect2.height, glScissorParams.height, TEST_LOCATION);
10529 application.SendNotification();
10531 damagedRects.clear();
10532 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10533 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10534 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10536 // Rotate actor1 on y axis
10537 actor1[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0)), Vector3::YAXIS);
10539 // Add actor1 again
10540 application.GetScene().Add(actor1);
10542 application.SendNotification();
10544 damagedRects.clear();
10545 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10547 // Should update full area
10548 surfaceRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
10549 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10550 DirtyRectChecker(damagedRects, {surfaceRect}, true, TEST_LOCATION);
10551 application.RenderWithPartialUpdate(damagedRects, surfaceRect);
10556 int utcDaliActorPartialUpdateOneActorMultipleRenderers(void)
10558 TestApplication application(
10559 TestApplication::DEFAULT_SURFACE_WIDTH,
10560 TestApplication::DEFAULT_SURFACE_HEIGHT,
10561 TestApplication::DEFAULT_HORIZONTAL_DPI,
10562 TestApplication::DEFAULT_VERTICAL_DPI,
10566 tet_infoline("Check the damaged rect with one actor which has multiple renderers");
10568 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10570 Actor actor = CreateRenderableActor();
10572 // Create another renderer
10573 Geometry geometry = CreateQuadGeometry();
10574 Shader shader = CreateShader();
10575 Renderer renderer2 = Renderer::New(geometry, shader);
10576 actor.AddRenderer(renderer2);
10578 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10579 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10580 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10581 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10582 application.GetScene().Add(actor);
10584 application.SendNotification();
10586 DALI_TEST_EQUALS(actor.GetRendererCount(), 2u, TEST_LOCATION);
10588 std::vector<Rect<int>> damagedRects;
10590 // Actor added, damaged rect is added size of actor
10591 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10592 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
10595 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10596 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
10598 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10599 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10600 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10601 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10602 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10604 damagedRects.clear();
10605 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10606 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10608 // Ensure the damaged rect is empty
10609 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10611 // Make renderer2 dirty
10612 renderer2[DevelRenderer::Property::OPACITY] = 0.5f;
10614 application.SendNotification();
10616 // The damaged rect should be the actor area
10617 damagedRects.clear();
10618 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10620 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10621 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10622 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10624 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10626 damagedRects.clear();
10627 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10628 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10630 // Ensure the damaged rect is empty
10631 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10633 // Make renderer2 dirty
10634 renderer2[Renderer::Property::FACE_CULLING_MODE] = FaceCullingMode::BACK;
10636 application.SendNotification();
10638 // The damaged rect should be the actor area
10639 damagedRects.clear();
10640 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10642 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10643 DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
10644 DirtyRectChecker(damagedRects, {clippingRect}, true, TEST_LOCATION);
10646 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10648 damagedRects.clear();
10649 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10650 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10652 // Ensure the damaged rect is empty
10653 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10658 int utcDaliActorPartialUpdateMultipleActorsOneRenderer(void)
10660 TestApplication application(
10661 TestApplication::DEFAULT_SURFACE_WIDTH,
10662 TestApplication::DEFAULT_SURFACE_HEIGHT,
10663 TestApplication::DEFAULT_HORIZONTAL_DPI,
10664 TestApplication::DEFAULT_VERTICAL_DPI,
10668 tet_infoline("Check the damaged rect with multiple actors which share a same renderer");
10670 const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
10672 Actor actor = CreateRenderableActor();
10673 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10674 actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10675 actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10676 actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10677 application.GetScene().Add(actor);
10679 // Create another actor which has the same renderer with actor1
10680 Actor actor2 = Actor::New();
10681 Renderer renderer = actor.GetRendererAt(0);
10682 actor2.AddRenderer(renderer);
10683 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
10684 actor2[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f);
10685 actor2[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f);
10686 actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
10687 application.GetScene().Add(actor2);
10689 application.SendNotification();
10691 std::vector<Rect<int>> damagedRects;
10693 // Actor added, damaged rect is added size of actor
10694 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10695 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
10698 Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10699 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
10701 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10702 DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
10703 DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
10704 DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
10705 DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
10707 damagedRects.clear();
10708 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10709 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10711 // Ensure the damaged rect is empty
10712 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10714 // Make renderer dirty
10715 renderer[DevelRenderer::Property::OPACITY] = 0.5f;
10717 application.SendNotification();
10719 // The damaged rect should be the actor area
10720 damagedRects.clear();
10721 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10723 clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates
10724 DALI_TEST_EQUALS(damagedRects.size(), 2, TEST_LOCATION);
10725 DirtyRectChecker(damagedRects, {clippingRect, clippingRect}, true, TEST_LOCATION);
10727 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10729 damagedRects.clear();
10730 application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
10731 application.RenderWithPartialUpdate(damagedRects, clippingRect);
10733 // Ensure the damaged rect is empty
10734 DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
10739 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
10741 TestApplication application;
10743 Actor actor = Actor::New();
10744 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), false, TEST_LOCATION);
10745 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
10746 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START).Get<bool>(), true, TEST_LOCATION);
10747 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), Property::BOOLEAN, TEST_LOCATION);
10748 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), true, TEST_LOCATION);
10749 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
10750 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), false, TEST_LOCATION);
10751 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START), "captureAllTouchAfterStart", TEST_LOCATION);
10755 int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void)
10757 TestApplication application;
10759 Actor actor = Actor::New();
10761 // Make sure setting invalid types does not cause a crash
10764 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, 1.0f);
10765 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector2::ONE);
10766 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector3::ONE);
10767 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Vector4::ONE);
10768 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Map());
10769 actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, Property::Array());
10770 tet_result(TET_PASS);
10774 tet_result(TET_FAIL);
10779 int UtcDaliActorTouchAreaOffsetPropertyP(void)
10781 TestApplication application;
10783 Actor actor = Actor::New();
10784 Rect<int> touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
10785 DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), touchAreaOffset, TEST_LOCATION);
10786 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(10, 20, 30, 40));
10787 touchAreaOffset = actor.GetProperty(DevelActor::Property::TOUCH_AREA_OFFSET).Get<Rect<int>>();
10788 DALI_TEST_EQUALS(Rect<int>(10, 20, 30, 40), touchAreaOffset, TEST_LOCATION);
10792 int UtcDaliActorTouchAreaOffsetPropertyN(void)
10794 TestApplication application;
10796 Actor actor = Actor::New();
10798 // Make sure setting invalid types does not cause a crash
10801 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, 1.0f);
10802 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector2::ONE);
10803 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector3::ONE);
10804 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Vector4::ONE);
10805 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Map());
10806 actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Property::Array());
10807 tet_result(TET_PASS);
10811 tet_result(TET_FAIL);
10816 int UtcDaliActorLowerBelowNegative(void)
10818 TestApplication application;
10819 Dali::Actor instance;
10823 instance.LowerBelow(arg1);
10824 DALI_TEST_CHECK(false); // Should not get here
10828 DALI_TEST_CHECK(true); // We expect an assert
10833 int UtcDaliActorRaiseAboveNegative(void)
10835 TestApplication application;
10836 Dali::Actor instance;
10840 instance.RaiseAbove(arg1);
10841 DALI_TEST_CHECK(false); // Should not get here
10845 DALI_TEST_CHECK(true); // We expect an assert
10850 int UtcDaliActorRaiseToTopNegative(void)
10852 TestApplication application;
10853 Dali::Actor instance;
10856 instance.RaiseToTop();
10857 DALI_TEST_CHECK(false); // Should not get here
10861 DALI_TEST_CHECK(true); // We expect an assert
10866 int UtcDaliActorAddRendererNegative(void)
10868 TestApplication application;
10869 Dali::Actor instance;
10872 Dali::Renderer arg1;
10873 instance.AddRenderer(arg1);
10874 DALI_TEST_CHECK(false); // Should not get here
10878 DALI_TEST_CHECK(true); // We expect an assert
10883 int UtcDaliActorTouchedSignalNegative(void)
10885 TestApplication application;
10886 Dali::Actor instance;
10889 instance.TouchedSignal();
10890 DALI_TEST_CHECK(false); // Should not get here
10894 DALI_TEST_CHECK(true); // We expect an assert
10899 int UtcDaliActorTranslateByNegative(void)
10901 TestApplication application;
10902 Dali::Actor instance;
10905 Dali::Vector3 arg1;
10906 instance.TranslateBy(arg1);
10907 DALI_TEST_CHECK(false); // Should not get here
10911 DALI_TEST_CHECK(true); // We expect an assert
10916 int UtcDaliActorFindChildByIdNegative(void)
10918 TestApplication application;
10919 Dali::Actor instance;
10922 unsigned int arg1 = 0u;
10923 instance.FindChildById(arg1);
10924 DALI_TEST_CHECK(false); // Should not get here
10928 DALI_TEST_CHECK(true); // We expect an assert
10933 int UtcDaliActorGetRendererAtNegative(void)
10935 TestApplication application;
10936 Dali::Actor instance;
10939 unsigned int arg1 = 0u;
10940 instance.GetRendererAt(arg1);
10941 DALI_TEST_CHECK(false); // Should not get here
10945 DALI_TEST_CHECK(true); // We expect an assert
10950 int UtcDaliActorHoveredSignalNegative(void)
10952 TestApplication application;
10953 Dali::Actor instance;
10956 instance.HoveredSignal();
10957 DALI_TEST_CHECK(false); // Should not get here
10961 DALI_TEST_CHECK(true); // We expect an assert
10966 int UtcDaliActorLowerToBottomNegative(void)
10968 TestApplication application;
10969 Dali::Actor instance;
10972 instance.LowerToBottom();
10973 DALI_TEST_CHECK(false); // Should not get here
10977 DALI_TEST_CHECK(true); // We expect an assert
10982 int UtcDaliActorOnSceneSignalNegative(void)
10984 TestApplication application;
10985 Dali::Actor instance;
10988 instance.OnSceneSignal();
10989 DALI_TEST_CHECK(false); // Should not get here
10993 DALI_TEST_CHECK(true); // We expect an assert
10998 int UtcDaliActorOffSceneSignalNegative(void)
11000 TestApplication application;
11001 Dali::Actor instance;
11004 instance.OffSceneSignal();
11005 DALI_TEST_CHECK(false); // Should not get here
11009 DALI_TEST_CHECK(true); // We expect an assert
11014 int UtcDaliActorRemoveRendererNegative01(void)
11016 TestApplication application;
11017 Dali::Actor instance;
11020 unsigned int arg1 = 0u;
11021 instance.RemoveRenderer(arg1);
11022 DALI_TEST_CHECK(false); // Should not get here
11026 DALI_TEST_CHECK(true); // We expect an assert
11031 int UtcDaliActorRemoveRendererNegative02(void)
11033 TestApplication application;
11034 Dali::Actor instance;
11037 Dali::Renderer arg1;
11038 instance.RemoveRenderer(arg1);
11039 DALI_TEST_CHECK(false); // Should not get here
11043 DALI_TEST_CHECK(true); // We expect an assert
11048 int UtcDaliActorFindChildByNameNegative(void)
11050 TestApplication application;
11051 Dali::Actor instance;
11055 instance.FindChildByName(arg1);
11056 DALI_TEST_CHECK(false); // Should not get here
11060 DALI_TEST_CHECK(true); // We expect an assert
11065 int UtcDaliActorSetResizePolicyNegative(void)
11067 TestApplication application;
11068 Dali::Actor instance;
11071 Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
11072 Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
11073 instance.SetResizePolicy(arg1, arg2);
11074 DALI_TEST_CHECK(false); // Should not get here
11078 DALI_TEST_CHECK(true); // We expect an assert
11083 int UtcDaliActorOnRelayoutSignalNegative(void)
11085 TestApplication application;
11086 Dali::Actor instance;
11089 instance.OnRelayoutSignal();
11090 DALI_TEST_CHECK(false); // Should not get here
11094 DALI_TEST_CHECK(true); // We expect an assert
11099 int UtcDaliActorWheelEventSignalNegative(void)
11101 TestApplication application;
11102 Dali::Actor instance;
11105 instance.WheelEventSignal();
11106 DALI_TEST_CHECK(false); // Should not get here
11110 DALI_TEST_CHECK(true); // We expect an assert
11115 int UtcDaliActorGetHeightForWidthNegative(void)
11117 TestApplication application;
11118 Dali::Actor instance;
11122 instance.GetHeightForWidth(arg1);
11123 DALI_TEST_CHECK(false); // Should not get here
11127 DALI_TEST_CHECK(true); // We expect an assert
11132 int UtcDaliActorGetWidthForHeightNegative(void)
11134 TestApplication application;
11135 Dali::Actor instance;
11139 instance.GetWidthForHeight(arg1);
11140 DALI_TEST_CHECK(false); // Should not get here
11144 DALI_TEST_CHECK(true); // We expect an assert
11149 int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
11151 TestApplication application;
11152 Dali::Actor instance;
11155 instance.LayoutDirectionChangedSignal();
11156 DALI_TEST_CHECK(false); // Should not get here
11160 DALI_TEST_CHECK(true); // We expect an assert
11165 int UtcDaliActorAddNegative(void)
11167 TestApplication application;
11168 Dali::Actor instance;
11172 instance.Add(arg1);
11173 DALI_TEST_CHECK(false); // Should not get here
11177 DALI_TEST_CHECK(true); // We expect an assert
11182 int UtcDaliActorLowerNegative(void)
11184 TestApplication application;
11185 Dali::Actor instance;
11189 DALI_TEST_CHECK(false); // Should not get here
11193 DALI_TEST_CHECK(true); // We expect an assert
11198 int UtcDaliActorRaiseNegative(void)
11200 TestApplication application;
11201 Dali::Actor instance;
11205 DALI_TEST_CHECK(false); // Should not get here
11209 DALI_TEST_CHECK(true); // We expect an assert
11214 int UtcDaliActorRemoveNegative(void)
11216 TestApplication application;
11217 Dali::Actor instance;
11221 instance.Remove(arg1);
11222 DALI_TEST_CHECK(false); // Should not get here
11226 DALI_TEST_CHECK(true); // We expect an assert
11231 int UtcDaliActorScaleByNegative(void)
11233 TestApplication application;
11234 Dali::Actor instance;
11237 Dali::Vector3 arg1;
11238 instance.ScaleBy(arg1);
11239 DALI_TEST_CHECK(false); // Should not get here
11243 DALI_TEST_CHECK(true); // We expect an assert
11248 int UtcDaliActorGetLayerNegative(void)
11250 TestApplication application;
11251 Dali::Actor instance;
11254 instance.GetLayer();
11255 DALI_TEST_CHECK(false); // Should not get here
11259 DALI_TEST_CHECK(true); // We expect an assert
11264 int UtcDaliActorRotateByNegative01(void)
11266 TestApplication application;
11267 Dali::Actor instance;
11270 Dali::Quaternion arg1;
11271 instance.RotateBy(arg1);
11272 DALI_TEST_CHECK(false); // Should not get here
11276 DALI_TEST_CHECK(true); // We expect an assert
11281 int UtcDaliActorRotateByNegative02(void)
11283 TestApplication application;
11284 Dali::Actor instance;
11288 Dali::Vector3 arg2;
11289 instance.RotateBy(arg1, arg2);
11290 DALI_TEST_CHECK(false); // Should not get here
11294 DALI_TEST_CHECK(true); // We expect an assert
11299 int UtcDaliActorUnparentNegative(void)
11301 TestApplication application;
11302 Dali::Actor instance;
11305 instance.Unparent();
11306 DALI_TEST_CHECK(false); // Should not get here
11310 DALI_TEST_CHECK(true); // We expect an assert
11315 int UtcDaliActorGetChildAtNegative(void)
11317 TestApplication application;
11318 Dali::Actor instance;
11321 unsigned int arg1 = 0u;
11322 instance.GetChildAt(arg1);
11323 DALI_TEST_CHECK(false); // Should not get here
11327 DALI_TEST_CHECK(true); // We expect an assert
11332 int UtcDaliActorGetChildCountNegative(void)
11334 TestApplication application;
11335 Dali::Actor instance;
11338 instance.GetChildCount();
11339 DALI_TEST_CHECK(false); // Should not get here
11343 DALI_TEST_CHECK(true); // We expect an assert
11348 int UtcDaliActorGetTargetSizeNegative(void)
11350 TestApplication application;
11351 Dali::Actor instance;
11354 instance.GetTargetSize();
11355 DALI_TEST_CHECK(false); // Should not get here
11359 DALI_TEST_CHECK(true); // We expect an assert
11364 int UtcDaliActorScreenToLocalNegative(void)
11366 TestApplication application;
11367 Dali::Actor instance;
11374 instance.ScreenToLocal(arg1, arg2, arg3, arg4);
11375 DALI_TEST_CHECK(false); // Should not get here
11379 DALI_TEST_CHECK(true); // We expect an assert
11384 int UtcDaliActorGetNaturalSizeNegative(void)
11386 TestApplication application;
11387 Dali::Actor instance;
11390 instance.GetNaturalSize();
11391 DALI_TEST_CHECK(false); // Should not get here
11395 DALI_TEST_CHECK(true); // We expect an assert
11400 int UtcDaliActorGetRelayoutSizeNegative(void)
11402 TestApplication application;
11403 Dali::Actor instance;
11406 Dali::Dimension::Type arg1 = Dimension::HEIGHT;
11407 instance.GetRelayoutSize(arg1);
11408 DALI_TEST_CHECK(false); // Should not get here
11412 DALI_TEST_CHECK(true); // We expect an assert
11417 int UtcDaliActorGetResizePolicyNegative(void)
11419 TestApplication application;
11420 Dali::Actor instance;
11423 Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
11424 instance.GetResizePolicy(arg1);
11425 DALI_TEST_CHECK(false); // Should not get here
11429 DALI_TEST_CHECK(true); // We expect an assert
11434 int UtcDaliActorGetRendererCountNegative(void)
11436 TestApplication application;
11437 Dali::Actor instance;
11440 instance.GetRendererCount();
11441 DALI_TEST_CHECK(false); // Should not get here
11445 DALI_TEST_CHECK(true); // We expect an assert
11450 int UtcDaliActorGetParentNegative(void)
11452 TestApplication application;
11453 Dali::Actor instance;
11456 instance.GetParent();
11457 DALI_TEST_CHECK(false); // Should not get here
11461 DALI_TEST_CHECK(true); // We expect an assert
11466 int UtcDaliActorPropertyBlendEquation(void)
11468 TestApplication application;
11470 tet_infoline("Test SetProperty AdvancedBlendEquation");
11472 Geometry geometry = CreateQuadGeometry();
11473 Shader shader = CreateShader();
11474 Renderer renderer1 = Renderer::New(geometry, shader);
11476 Actor actor = Actor::New();
11477 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
11479 actor.AddRenderer(renderer1);
11480 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
11481 application.GetScene().Add(actor);
11483 if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
11485 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
11486 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
11487 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
11490 if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
11492 actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
11493 int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
11494 DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
11497 Renderer renderer2 = Renderer::New(geometry, shader);
11498 actor.AddRenderer(renderer2);
11503 int UtcDaliActorRegisterProperty(void)
11505 tet_infoline("Test property registration and uniform map update\n");
11507 TestApplication application;
11509 Geometry geometry = CreateQuadGeometry();
11510 Shader shader = CreateShader();
11511 Renderer renderer1 = Renderer::New(geometry, shader);
11512 Renderer renderer2 = Renderer::New(geometry, shader);
11514 Actor actor1 = Actor::New();
11515 actor1.AddRenderer(renderer1);
11516 actor1.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
11517 actor1.RegisterProperty("uCustom", 1);
11518 application.GetScene().Add(actor1);
11520 Actor actor2 = Actor::New();
11521 actor2.AddRenderer(renderer2);
11522 actor2.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
11523 application.GetScene().Add(actor2);
11525 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
11526 TraceCallStack& callStack = glAbstraction.GetSetUniformTrace();
11527 glAbstraction.EnableSetUniformCallTrace(true);
11529 application.SendNotification();
11530 application.Render();
11532 std::stringstream out;
11534 std::string params;
11536 // Test uniform value of the custom property
11537 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
11538 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
11541 actor1[Actor::Property::VISIBLE] = false;
11543 application.SendNotification();
11544 application.Render();
11546 // Make visible again
11547 actor1[Actor::Property::VISIBLE] = true;
11548 actor1["uCustom"] = 2;
11550 glAbstraction.ResetSetUniformCallStack();
11552 application.SendNotification();
11553 application.Render();
11557 // The uniform value should not be changed
11558 DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("uCustom", params));
11559 DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
11564 int UtcDaliActorDoesWantedHitTest(void)
11569 HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
11571 mTouchPoint(touchPoint),
11577 Vector2 mTouchPoint;
11581 TestApplication application;
11582 tet_infoline(" UtcDaliActorDoesWantedHitTest");
11584 // Fill a vector with different hit tests.
11585 struct HitTestData* hitTestData[] = {
11586 // scale touch point result
11587 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
11588 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
11589 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.
11590 new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
11591 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.
11595 // get the root layer
11596 Actor actor = Actor::New();
11597 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
11598 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
11600 Actor lowerActor = Actor::New();
11601 lowerActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
11602 lowerActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
11604 // actor and lowerActor have no relationship.
11605 application.GetScene().Add(lowerActor);
11606 application.GetScene().Add(actor);
11608 ResetTouchCallbacks();
11609 gHitTestTouchCallBackCalled = false;
11611 unsigned int index = 0;
11612 while(NULL != hitTestData[index])
11614 actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
11615 actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
11617 lowerActor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
11618 lowerActor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
11620 // flush the queue and render once
11621 application.SendNotification();
11622 application.Render();
11624 DALI_TEST_CHECK(!gTouchCallBackCalled);
11625 DALI_TEST_CHECK(!gTouchCallBackCalled2);
11626 DALI_TEST_CHECK(!gHitTestTouchCallBackCalled);
11628 // connect to its touch signal
11629 actor.TouchedSignal().Connect(TestTouchCallback);
11630 lowerActor.TouchedSignal().Connect(TestTouchCallback2);
11632 // connect to its hit-test signal
11633 Dali::DevelActor::HitTestResultSignal(actor).Connect(TestHitTestTouchCallback);
11635 Dali::Integration::Point point;
11636 point.SetState(PointState::DOWN);
11637 point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
11638 Dali::Integration::TouchEvent event;
11639 event.AddPoint(point);
11641 // flush the queue and render once
11642 application.SendNotification();
11643 application.Render();
11644 application.ProcessEvent(event);
11646 // check hit-test events
11647 DALI_TEST_CHECK(gHitTestTouchCallBackCalled == hitTestData[index]->mResult);
11648 // Passed all hit-tests of actor.
11649 DALI_TEST_CHECK(gTouchCallBackCalled == false);
11650 // The lowerActor was hit-tested.
11651 DALI_TEST_CHECK(gTouchCallBackCalled2 == hitTestData[index]->mResult);
11653 if(gTouchCallBackCalled2 != hitTestData[index]->mResult)
11654 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
11655 hitTestData[index]->mScale.x,
11656 hitTestData[index]->mScale.y,
11657 hitTestData[index]->mScale.z,
11658 hitTestData[index]->mTouchPoint.x,
11659 hitTestData[index]->mTouchPoint.y,
11660 hitTestData[index]->mResult);
11662 ResetTouchCallbacks();
11663 gHitTestTouchCallBackCalled = false;
11669 int UtcDaliActorAllowOnlyOwnTouchPropertyP(void)
11671 TestApplication application;
11673 Actor actor = Actor::New();
11674 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), false, TEST_LOCATION);
11675 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, true);
11676 DALI_TEST_EQUALS(actor.GetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH).Get<bool>(), true, TEST_LOCATION);
11677 DALI_TEST_EQUALS(actor.GetPropertyType(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), Property::BOOLEAN, TEST_LOCATION);
11678 DALI_TEST_EQUALS(actor.IsPropertyWritable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), true, TEST_LOCATION);
11679 DALI_TEST_EQUALS(actor.IsPropertyAnimatable(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
11680 DALI_TEST_EQUALS(actor.IsPropertyAConstraintInput(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), false, TEST_LOCATION);
11681 DALI_TEST_EQUALS(actor.GetPropertyName(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH), "allowOnlyOwnTouch", TEST_LOCATION);
11685 int UtcDaliActorAllowOnlyOwnTouchPropertyN(void)
11687 TestApplication application;
11689 Actor actor = Actor::New();
11691 // Make sure setting invalid types does not cause a crash
11694 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, 1.0f);
11695 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector2::ONE);
11696 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector3::ONE);
11697 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Vector4::ONE);
11698 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Map());
11699 actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, Property::Array());
11700 tet_result(TET_PASS);
11704 tet_result(TET_FAIL);
11709 int UtcDaliActorCalculateWorldTransform01(void)
11711 TestApplication application;
11713 tet_infoline("Test that actor position inheritance produces right transform matrix");
11715 Actor rootActor = Actor::New();
11716 Actor branchActor = Actor::New();
11717 Actor leafActor = Actor::New();
11719 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
11720 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
11721 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11723 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11724 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11725 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11727 // Set anchor point to the same value as parent origin
11728 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
11729 branchActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
11730 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
11732 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11733 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11734 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11736 application.GetScene().Add(rootActor);
11737 rootActor.Add(branchActor);
11738 branchActor.Add(leafActor);
11740 application.SendNotification();
11741 application.Render(0);
11742 application.SendNotification();
11743 application.Render(0);
11745 Matrix m = DevelActor::GetWorldTransform(leafActor);
11747 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11748 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11751 Vector3 worldScale;
11752 Quaternion worldRotation;
11753 m.GetTransformComponents(worldPos, worldRotation, worldScale);
11754 DALI_TEST_EQUALS(worldPos, Vector3(200.0f, 150.0f, 30.0f), 0.0001f, TEST_LOCATION);
11759 int UtcDaliActorCalculateWorldTransform02(void)
11761 TestApplication application;
11763 tet_infoline("Test that actor position produces right transform matrix");
11765 Actor rootActor = Actor::New();
11766 Actor branchActor = Actor::New();
11767 Actor leafActor = Actor::New();
11769 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
11770 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
11771 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11773 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11774 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11775 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11777 // Set anchor point to the same value as parent origin
11778 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11779 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11780 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11782 application.GetScene().Add(rootActor);
11783 rootActor.Add(branchActor);
11784 branchActor.Add(leafActor);
11786 leafActor[Actor::Property::INHERIT_POSITION] = false;
11787 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
11788 leafActor[Actor::Property::INHERIT_SCALE] = false;
11790 application.SendNotification();
11791 application.Render(0);
11792 application.SendNotification();
11793 application.Render(0);
11795 Matrix m = DevelActor::GetWorldTransform(leafActor);
11797 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11798 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11803 int UtcDaliActorCalculateWorldTransform03(void)
11805 TestApplication application;
11807 tet_infoline("Test that actor position produces right transform matrix");
11809 Actor rootActor = Actor::New();
11810 Actor branchActor = Actor::New();
11811 Actor leafActor = Actor::New();
11813 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
11814 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
11815 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11817 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11818 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11819 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11821 // Set anchor point to the same value as parent origin
11822 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11823 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11824 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11826 application.GetScene().Add(rootActor);
11827 rootActor.Add(branchActor);
11828 branchActor.Add(leafActor);
11830 leafActor[Actor::Property::INHERIT_POSITION] = true;
11831 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
11832 leafActor[Actor::Property::INHERIT_SCALE] = false;
11834 application.SendNotification();
11835 application.Render(0);
11836 application.SendNotification();
11837 application.Render(0);
11839 Matrix m = DevelActor::GetWorldTransform(leafActor);
11841 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11842 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11847 int UtcDaliActorCalculateWorldTransform04(void)
11849 TestApplication application;
11851 tet_infoline("Test that actor inheritance scale/orientation produces right transform matrix");
11853 Actor rootActor = Actor::New();
11854 Actor branchActor = Actor::New();
11855 Actor leafActor = Actor::New();
11857 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
11858 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
11859 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
11861 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11862 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11863 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11865 // Set anchor point to the same value as parent origin
11866 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
11867 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
11868 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11869 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11871 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
11872 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11874 application.GetScene().Add(rootActor);
11875 rootActor.Add(branchActor);
11876 branchActor.Add(leafActor);
11878 application.SendNotification();
11879 application.Render(0);
11880 application.SendNotification();
11881 application.Render(0);
11883 Matrix m = DevelActor::GetWorldTransform(leafActor);
11885 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11886 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11891 int UtcDaliActorCalculateWorldTransform05(void)
11893 TestApplication application;
11895 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
11897 Actor rootActor = Actor::New();
11898 Actor branchActor = Actor::New();
11899 Actor leafActor = Actor::New();
11901 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
11902 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
11903 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
11905 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11906 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11907 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11909 // Set anchor point to the same value as parent origin
11910 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
11911 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
11912 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11913 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11915 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 100.0f, 0.0f);
11916 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11918 leafActor[Actor::Property::INHERIT_POSITION] = false;
11919 leafActor[Actor::Property::INHERIT_ORIENTATION] = false;
11921 application.GetScene().Add(rootActor);
11922 rootActor.Add(branchActor);
11923 branchActor.Add(leafActor);
11925 application.SendNotification();
11926 application.Render(0);
11927 application.SendNotification();
11928 application.Render(0);
11930 Matrix m = DevelActor::GetWorldTransform(leafActor);
11932 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11933 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11938 int UtcDaliActorCalculateWorldTransform06(void)
11940 TestApplication application;
11942 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
11944 Actor rootActor = Actor::New();
11945 Actor branchActor = Actor::New();
11946 Actor leafActor = Actor::New();
11948 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
11949 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
11950 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
11952 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11953 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11954 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
11956 // Set anchor point to the same value as parent origin
11957 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
11958 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
11959 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11960 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
11962 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
11963 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
11964 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
11966 leafActor[Actor::Property::INHERIT_POSITION] = false;
11967 leafActor[Actor::Property::INHERIT_SCALE] = false;
11969 application.GetScene().Add(rootActor);
11970 rootActor.Add(branchActor);
11971 branchActor.Add(leafActor);
11973 application.SendNotification();
11974 application.Render(0);
11975 application.SendNotification();
11976 application.Render(0);
11978 Matrix m = DevelActor::GetWorldTransform(leafActor);
11980 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
11981 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
11986 int UtcDaliActorCalculateWorldTransform07(void)
11988 TestApplication application;
11990 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
11992 Actor rootActor = Actor::New();
11993 Actor branchActor = Actor::New();
11994 Actor leafActor = Actor::New();
11996 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
11997 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
11998 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12000 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12001 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12002 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12004 // Set anchor point to the same value as parent origin
12005 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
12006 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
12007 branchActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
12009 // This should be ignored.
12010 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
12011 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
12013 branchActor[Actor::Property::POSITION] = Vector3(100.0f, 30.0f, -50.0f);
12014 branchActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(45.0f), Vector3::XAXIS);
12015 leafActor[Actor::Property::POSITION] = Vector3(100.0f, 50.0f, 30.0f);
12017 leafActor[Actor::Property::INHERIT_POSITION] = false;
12018 leafActor[Actor::Property::INHERIT_SCALE] = false;
12019 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = false;
12021 application.GetScene().Add(rootActor);
12022 rootActor.Add(branchActor);
12023 branchActor.Add(leafActor);
12025 application.SendNotification();
12026 application.Render(0);
12027 application.SendNotification();
12028 application.Render(0);
12030 Matrix m = DevelActor::GetWorldTransform(leafActor);
12032 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
12033 DALI_TEST_EQUALS(m, actualMatrix, 0.001f, TEST_LOCATION);
12038 int UtcDaliActorCalculateWorldTransform08(void)
12040 TestApplication application;
12042 tet_infoline("Test that actor inheritance of scale produces right transform matrix");
12044 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)};
12052 TestCase testCases[] = {
12053 {false, false, true},
12054 {false, true, false},
12055 {true, false, false},
12056 {false, true, true},
12057 {true, false, true},
12058 {true, true, false},
12059 {false, false, false},
12060 {true, true, true},
12063 Actor rootActor = Actor::New();
12064 Actor leafActor = Actor::New();
12066 rootActor[Actor::Property::POSITION] = Vector3(0.0f, 0.0f, 0.0f);
12067 rootActor[Actor::Property::SCALE] = Vector3(1.0f, 2.0f, 1.0f);
12068 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12069 rootActor[Actor::Property::SIZE] = Vector2(200, 400);
12070 rootActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
12071 rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
12073 leafActor[Actor::Property::POSITION] = Vector3(0.0f, -50.0f, 0.0f);
12074 leafActor[Actor::Property::SCALE] = Vector3(1.0f, 1.0f, 1.0f);
12075 leafActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12076 leafActor[Actor::Property::SIZE] = Vector2(200, 400);
12077 leafActor[Actor::Property::ANCHOR_POINT] = AnchorPoint::BOTTOM_CENTER;
12078 leafActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_CENTER;
12079 leafActor[Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
12081 application.GetScene().Add(rootActor);
12082 rootActor.Add(leafActor);
12084 for(uint32_t i = 0; i < 8; ++i)
12086 leafActor[Actor::Property::INHERIT_POSITION] = testCases[i].translation;
12087 leafActor[Actor::Property::INHERIT_ORIENTATION] = testCases[i].rotation;
12088 leafActor[Actor::Property::INHERIT_SCALE] = testCases[i].scaling;
12090 application.SendNotification();
12091 application.Render(0);
12092 application.SendNotification();
12093 application.Render(0);
12095 Matrix m = DevelActor::GetWorldTransform(leafActor);
12096 Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
12098 Vector3 worldPosition1 = Vector3(m.GetTranslation());
12099 Vector3 worldPosition2 = Vector3(actualMatrix.GetTranslation());
12101 DALI_TEST_EQUALS(solutions[i], worldPosition1, 0.001f, TEST_LOCATION);
12102 DALI_TEST_EQUALS(solutions[i], worldPosition2, 0.001f, TEST_LOCATION);
12108 int UtcDaliActorCalculateWorldColor01(void)
12110 TestApplication application;
12112 tet_infoline("Test that actor inheritance of color produces right final color");
12114 Actor rootActor = Actor::New();
12115 Actor branchActor = Actor::New();
12116 Actor leafActor = Actor::New();
12118 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
12119 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
12120 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12122 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12123 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12124 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12126 rootActor[Actor::Property::COLOR] = Color::WHITE;
12127 Vector4 testColor1(1.0f, 1.0f, 0.5f, 0.8f);
12128 branchActor[Actor::Property::COLOR] = testColor1;
12129 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
12131 // Default is to inherit:
12132 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_ALPHA;
12134 application.GetScene().Add(rootActor);
12135 rootActor.Add(branchActor);
12136 branchActor.Add(leafActor);
12138 application.SendNotification();
12139 application.Render(16);
12140 Vector4 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
12141 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
12143 application.SendNotification();
12144 application.Render(16);
12145 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
12146 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
12148 application.SendNotification();
12149 application.Render(16);
12150 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
12151 DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
12153 color = DevelActor::GetWorldColor(leafActor);
12155 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
12156 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
12161 int UtcDaliActorCalculateWorldColor02(void)
12163 TestApplication application;
12165 tet_infoline("Test that actor uses own color");
12167 Actor rootActor = Actor::New();
12168 Actor branchActor = Actor::New();
12169 Actor leafActor = Actor::New();
12171 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
12172 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
12173 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12175 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12176 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12177 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12179 rootActor[Actor::Property::COLOR] = Color::WHITE;
12180 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
12181 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
12183 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_COLOR;
12185 application.GetScene().Add(rootActor);
12186 rootActor.Add(branchActor);
12187 branchActor.Add(leafActor);
12189 application.SendNotification();
12190 application.Render(0);
12192 Vector4 color = DevelActor::GetWorldColor(leafActor);
12194 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
12195 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
12196 DALI_TEST_EQUALS(color, Vector4(0.1f, 0.5f, 0.5f, 0.8f), 0.001f, TEST_LOCATION);
12200 int UtcDaliActorCalculateWorldColor03(void)
12202 TestApplication application;
12204 tet_infoline("Test that actor uses parent color");
12206 Actor rootActor = Actor::New();
12207 Actor branchActor = Actor::New();
12208 Actor leafActor = Actor::New();
12210 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
12211 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
12212 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12214 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12215 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12216 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12218 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
12219 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
12220 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
12222 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_PARENT_COLOR;
12224 application.GetScene().Add(rootActor);
12225 rootActor.Add(branchActor);
12226 branchActor.Add(leafActor);
12228 application.SendNotification();
12229 application.Render(0);
12231 Vector4 color = DevelActor::GetWorldColor(leafActor);
12233 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
12234 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
12235 DALI_TEST_EQUALS(color, Vector4(1.0f, 1.0f, 0.5f, 0.72f), 0.001f, TEST_LOCATION);
12239 int UtcDaliActorCalculateWorldColor04(void)
12241 TestApplication application;
12243 tet_infoline("Test that actor blends with parent color");
12245 Actor rootActor = Actor::New();
12246 Actor branchActor = Actor::New();
12247 Actor leafActor = Actor::New();
12249 rootActor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
12250 rootActor[Actor::Property::SCALE] = Vector3(2.0f, 2.0f, 2.0f);
12251 rootActor[Actor::Property::ORIENTATION] = AngleAxis(Degree(90.0f), Vector3::ZAXIS);
12253 rootActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12254 branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12255 leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
12257 rootActor[Actor::Property::COLOR] = Color::WHITE * 0.9f;
12258 branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
12259 leafActor[Actor::Property::COLOR] = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
12261 leafActor[Actor::Property::COLOR_MODE] = ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR;
12263 application.GetScene().Add(rootActor);
12264 rootActor.Add(branchActor);
12265 branchActor.Add(leafActor);
12267 application.SendNotification();
12268 application.Render(0);
12270 Vector4 color = DevelActor::GetWorldColor(leafActor);
12272 Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
12273 DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
12278 int UtcDaliActorCalculateLookAt(void)
12280 TestApplication application;
12282 tet_infoline("Test that actor rotate right value of orientation");
12284 Actor actor = Actor::New();
12286 actor[Actor::Property::POSITION] = Vector3(100.0f, 0.0f, 0.0f);
12287 actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
12288 actor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
12290 application.GetScene().Add(actor);
12292 application.SendNotification();
12293 application.Render(0);
12295 Quaternion actorQuaternion;
12297 tet_printf("Test with target only\n");
12298 Dali::DevelActor::LookAt(actor, Vector3::ZERO);
12299 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12300 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
12302 tet_printf("Test with target + up\n");
12303 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::ZAXIS);
12304 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12305 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::XAXIS) * Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_YAXIS), TEST_LOCATION);
12307 tet_printf("Test with target + up + localForward\n");
12308 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_XAXIS);
12309 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12310 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(180.0f)), Vector3::XAXIS), TEST_LOCATION);
12312 tet_printf("Test with target + up + localForward + localUp\n");
12313 Dali::DevelActor::LookAt(actor, Vector3::ZERO, Vector3::NEGATIVE_YAXIS, Vector3::NEGATIVE_YAXIS, Vector3::XAXIS);
12314 actorQuaternion = actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12315 DALI_TEST_EQUALS(actorQuaternion, Quaternion(Radian(Degree(90.0f)), Vector3::NEGATIVE_ZAXIS), TEST_LOCATION);
12317 // Reset quaternion
12318 actor[Actor::Property::ORIENTATION] = Quaternion();
12320 Actor actor2 = Actor::New();
12321 actor2[Actor::Property::POSITION] = Vector3(0.0f, 50.0f, -10.0f);
12322 actor2[Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
12323 actor2[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
12326 tet_printf("Test whether lookat calculate well by using event side values only\n");
12327 Dali::DevelActor::LookAt(actor2, Vector3(100.0f, 50.0f, 1.0f));
12328 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12329 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
12331 actor[Actor::Property::ORIENTATION] = Quaternion(Radian(Degree(90.0f)), Vector3::ZAXIS);
12333 DALI_TEST_EQUALS(Dali::DevelActor::GetWorldTransform(actor2).GetTranslation3(), Vector3(50.0f, 0.0f, -10.0f), TEST_LOCATION);
12335 tet_printf("Test whether lookat calculate well inherit by parent orientation\n");
12336 Dali::DevelActor::LookAt(actor2, Vector3(50.0f, 0.0f, 1.0f), Vector3::NEGATIVE_XAXIS);
12337 actorQuaternion = actor2.GetProperty<Quaternion>(Actor::Property::ORIENTATION);
12338 DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);