2 * Copyright (c) 2019 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
22 #include <dali/public-api/dali-core.h>
24 #include <cfloat> // For FLT_MAX
25 #include <dali/devel-api/actors/actor-devel.h>
26 #include <dali/integration-api/events/touch-event-integ.h>
27 #include <dali/integration-api/events/hover-event-integ.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali-test-suite-utils.h>
30 #include <mesh-builder.h>
38 void utc_dali_actor_startup(void)
40 test_return_value = TET_UNDEF;
43 void utc_dali_actor_cleanup(void)
45 test_return_value = TET_PASS;
50 bool gTouchCallBackCalled=false;
51 bool gTouchCallBackCalled2=false;
52 bool gTouchCallBackCalled3=false;
54 bool gHoverCallBackCalled=false;
56 static bool gTestConstraintCalled;
58 LayoutDirection::Type gLayoutDirectionType;
62 void operator()( Vector4& color, const PropertyInputContainer& /* inputs */ )
64 gTestConstraintCalled = true;
69 * TestConstraint reference.
70 * When constraint is called, the resultRef is updated
71 * with the value supplied.
74 struct TestConstraintRef
76 TestConstraintRef(unsigned int& resultRef, unsigned int value)
77 : mResultRef(resultRef),
82 void operator()( T& current, const PropertyInputContainer& /* inputs */ )
87 unsigned int& mResultRef;
91 static bool TestCallback(Actor actor, const TouchEvent& event)
93 gTouchCallBackCalled = true;
98 static bool TestTouchCallback(Actor actor, const TouchData& touchData )
100 gTouchCallBackCalled = true;
105 static bool TestTouchCallback2(Actor actor, const TouchData& touchData )
107 gTouchCallBackCalled2 = true;
112 static bool TestTouchCallback3(Actor actor, const TouchData& touchData )
114 gTouchCallBackCalled3 = true;
119 static void ResetTouchCallbacks()
121 gTouchCallBackCalled = false;
122 gTouchCallBackCalled2 = false;
123 gTouchCallBackCalled3 = false;
126 static bool TestCallback3(Actor actor, const HoverEvent& event)
128 gHoverCallBackCalled = true;
133 // validation stuff for onstage & offstage signals
134 static std::vector< std::string > gActorNamesOnOffStage;
135 static int gOnStageCallBackCalled;
136 void OnStageCallback( Actor actor )
138 ++gOnStageCallBackCalled;
139 gActorNamesOnOffStage.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
140 DALI_TEST_CHECK( actor.OnStage() == true );
142 static int gOffStageCallBackCalled;
143 void OffStageCallback( Actor actor )
145 ++gOffStageCallBackCalled;
146 gActorNamesOnOffStage.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
147 DALI_TEST_CHECK( actor.OnStage() == false );
150 struct PositionComponentConstraint
152 PositionComponentConstraint(){}
154 void operator()( Vector3& pos, const PropertyInputContainer& inputs )
156 const Matrix& m = inputs[0]->GetMatrix();
159 m.GetTransformComponents(pos, rot, scale);
163 struct OrientationComponentConstraint
165 OrientationComponentConstraint(){}
167 void operator()( Quaternion& orientation, const PropertyInputContainer& inputs )
169 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
172 orientation = parentOrientation;
177 static bool gOnRelayoutCallBackCalled = false;
178 static std::vector< std::string > gActorNamesRelayout;
180 void OnRelayoutCallback( Actor actor )
182 gOnRelayoutCallBackCalled = true;
183 gActorNamesRelayout.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
186 struct VisibilityChangedFunctorData
188 VisibilityChangedFunctorData()
191 type( DevelActor::VisibilityChange::SELF ),
200 type = DevelActor::VisibilityChange::SELF;
204 void Check( bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char * location )
206 DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) );
207 DALI_TEST_EQUALS( actor, compareActor, TEST_INNER_LOCATION( location ) );
208 DALI_TEST_EQUALS( visible, compareVisible, TEST_INNER_LOCATION( location ) );
209 DALI_TEST_EQUALS( (int)type, (int)compareType, TEST_INNER_LOCATION( location ) );
212 void Check( bool compareCalled, const std::string& location )
214 DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) );
219 DevelActor::VisibilityChange::Type type;
223 struct VisibilityChangedFunctor
225 VisibilityChangedFunctor( VisibilityChangedFunctorData& dataVar ) : data( dataVar ) { }
227 void operator()( Actor actor, bool visible, DevelActor::VisibilityChange::Type type )
230 data.visible = visible;
235 VisibilityChangedFunctorData& data;
239 struct VisibilityChangedVoidFunctor
241 VisibilityChangedVoidFunctor(bool& signalCalled)
242 : mSignalCalled( signalCalled )
247 mSignalCalled = true;
253 struct ChildOrderChangedFunctor
255 ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
256 : mSignalCalled( signalCalled ),
260 void operator()( Actor actor )
262 mSignalCalled = true;
270 struct CulledPropertyNotificationFunctor
272 CulledPropertyNotificationFunctor( bool& signalCalled, PropertyNotification& propertyNotification )
273 : mSignalCalled( signalCalled ),
274 mPropertyNotification( propertyNotification )
277 void operator()( PropertyNotification& source )
279 mSignalCalled = true;
280 mPropertyNotification = source;
284 PropertyNotification& mPropertyNotification;
287 } // anonymous namespace
290 //& purpose: Testing New API
291 int UtcDaliActorNew(void)
293 TestApplication application;
295 Actor actor = Actor::New();
297 DALI_TEST_CHECK(actor);
301 //& purpose: Testing Dali::Actor::DownCast()
302 int UtcDaliActorDownCastP(void)
304 TestApplication application;
305 tet_infoline("Testing Dali::Actor::DownCast()");
307 Actor actor = Actor::New();
308 BaseHandle object(actor);
309 Actor actor2 = Actor::DownCast(object);
310 DALI_TEST_CHECK(actor2);
314 //& purpose: Testing Dali::Actor::DownCast()
315 int UtcDaliActorDownCastN(void)
317 TestApplication application;
318 tet_infoline("Testing Dali::Actor::DownCast()");
320 BaseHandle unInitializedObject;
321 Actor actor = Actor::DownCast(unInitializedObject);
322 DALI_TEST_CHECK(!actor);
326 //& purpose: Testing Dali::Actor::GetName()
327 int UtcDaliActorGetName(void)
329 TestApplication application;
331 Actor actor = Actor::New();
333 DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ).empty());
337 //& purpose: Testing Dali::Actor::SetName()
338 int UtcDaliActorSetName(void)
340 TestApplication application;
342 string str("ActorName");
343 Actor actor = Actor::New();
345 actor.SetProperty( Actor::Property::NAME,str);
346 DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ) == str);
350 int UtcDaliActorGetId(void)
352 tet_infoline("Testing Dali::Actor::UtcDaliActorGetId()");
353 TestApplication application;
355 Actor first = Actor::New();
356 Actor second = Actor::New();
357 Actor third = Actor::New();
359 DALI_TEST_CHECK(first.GetId() != second.GetId());
360 DALI_TEST_CHECK(second.GetId() != third.GetId());
364 int UtcDaliActorIsRoot(void)
366 TestApplication application;
368 Actor actor = Actor::New();
369 DALI_TEST_CHECK(!actor.IsRoot());
371 // get the root layer
372 actor = Stage::GetCurrent().GetLayer( 0 );
373 DALI_TEST_CHECK( actor.IsRoot() );
377 int UtcDaliActorOnStage(void)
379 TestApplication application;
381 Actor actor = Actor::New();
382 DALI_TEST_CHECK( !actor.OnStage() );
384 // get the root layer
385 actor = Stage::GetCurrent().GetLayer( 0 );
386 DALI_TEST_CHECK( actor.OnStage() );
390 int UtcDaliActorIsLayer(void)
392 TestApplication application;
394 Actor actor = Actor::New();
395 DALI_TEST_CHECK( !actor.IsLayer() );
397 // get the root layer
398 actor = Stage::GetCurrent().GetLayer( 0 );
399 DALI_TEST_CHECK( actor.IsLayer() );
403 int UtcDaliActorGetLayer(void)
405 TestApplication application;
407 Actor actor = Actor::New();
408 Stage::GetCurrent().Add(actor);
409 Layer layer = actor.GetLayer();
411 DALI_TEST_CHECK(layer);
413 // get the root layers layer
414 actor = Stage::GetCurrent().GetLayer( 0 );
415 DALI_TEST_CHECK( actor.GetLayer() );
419 int UtcDaliActorAddP(void)
421 tet_infoline("Testing Actor::Add");
422 TestApplication application;
424 Actor parent = Actor::New();
425 Actor child = Actor::New();
427 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
431 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
433 Actor parent2 = Actor::New();
434 parent2.Add( child );
436 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
437 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
439 // try Adding to same parent again, works
440 parent2.Add( child );
441 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
443 // try reparenting an orphaned child
445 Actor temporaryParent = Actor::New();
446 temporaryParent.Add( child );
447 DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION );
449 // temporaryParent has now died, reparent the orphaned child
450 parent2.Add( child );
451 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
456 int UtcDaliActorAddN(void)
458 tet_infoline("Testing Actor::Add");
459 TestApplication application;
461 Actor child = Actor::New();
463 Actor parent2 = Actor::New();
464 parent2.Add( child );
469 parent2.Add( parent2 );
470 tet_printf("Assertion test failed - no Exception\n" );
471 tet_result(TET_FAIL);
473 catch(Dali::DaliException& e)
475 DALI_TEST_PRINT_ASSERT( e );
476 DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
477 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
481 tet_printf("Assertion test failed - wrong Exception\n" );
482 tet_result(TET_FAIL);
485 // try reparenting root
488 parent2.Add( Stage::GetCurrent().GetLayer( 0 ) );
489 tet_printf("Assertion test failed - no Exception\n" );
490 tet_result(TET_FAIL);
492 catch(Dali::DaliException& e)
494 DALI_TEST_PRINT_ASSERT( e );
495 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
496 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
500 tet_printf("Assertion test failed - wrong Exception\n" );
501 tet_result(TET_FAIL);
508 parent2.Add( empty );
509 tet_printf("Assertion test failed - no Exception\n" );
510 tet_result(TET_FAIL);
512 catch(Dali::DaliException& e)
514 DALI_TEST_PRINT_ASSERT( e );
515 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
516 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
520 tet_printf("Assertion test failed - wrong Exception\n" );
521 tet_result(TET_FAIL);
527 int UtcDaliActorRemoveN(void)
529 tet_infoline("Testing Actor::Remove");
530 TestApplication application;
532 Actor parent = Actor::New();
533 Actor child = Actor::New();
534 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
537 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
539 parent.Remove(child);
540 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
542 // remove again, no problem
543 parent.Remove(child);
544 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
548 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
549 // try Remove self, its a no-op
550 parent.Remove( parent );
551 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
557 parent.Remove( empty );
558 tet_printf("Assertion test failed - no Exception\n" );
559 tet_result(TET_FAIL);
561 catch(Dali::DaliException& e)
563 DALI_TEST_PRINT_ASSERT( e );
564 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
565 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
569 tet_printf("Assertion test failed - wrong Exception\n" );
570 tet_result(TET_FAIL);
575 int UtcDaliActorRemoveP(void)
577 TestApplication application;
579 Actor parent = Actor::New();
580 Actor child = Actor::New();
581 Actor random = Actor::New();
583 Stage::GetCurrent().Add( parent );
585 DALI_TEST_CHECK(parent.GetChildCount() == 0);
589 DALI_TEST_CHECK(parent.GetChildCount() == 1);
591 parent.Remove(random);
593 DALI_TEST_CHECK(parent.GetChildCount() == 1);
595 Stage::GetCurrent().Remove( parent );
597 DALI_TEST_CHECK(parent.GetChildCount() == 1);
601 int UtcDaliActorGetChildCount(void)
603 TestApplication application;
605 Actor parent = Actor::New();
606 Actor child = Actor::New();
608 DALI_TEST_CHECK(parent.GetChildCount() == 0);
612 DALI_TEST_CHECK(parent.GetChildCount() == 1);
616 int UtcDaliActorGetChildren01(void)
618 TestApplication application;
620 Actor parent = Actor::New();
621 Actor first = Actor::New();
622 Actor second = Actor::New();
623 Actor third = Actor::New();
629 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
630 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
631 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
635 int UtcDaliActorGetChildren02(void)
637 TestApplication application;
639 Actor parent = Actor::New();
640 Actor first = Actor::New();
641 Actor second = Actor::New();
642 Actor third = Actor::New();
648 const Actor& constParent = parent;
650 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
651 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
652 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
656 int UtcDaliActorGetParent01(void)
658 TestApplication application;
660 Actor parent = Actor::New();
661 Actor child = Actor::New();
665 DALI_TEST_CHECK(child.GetParent() == parent);
669 int UtcDaliActorGetParent02(void)
671 TestApplication application;
673 Actor actor = Actor::New();
675 DALI_TEST_CHECK(!actor.GetParent());
679 int UtcDaliActorCustomProperty(void)
681 TestApplication application;
683 Actor actor = Actor::New();
684 Stage::GetCurrent().Add( actor );
686 float startValue(1.0f);
687 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
688 DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
690 application.SendNotification();
691 application.Render(0);
692 DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
694 actor.SetProperty( index, 5.0f );
696 application.SendNotification();
697 application.Render(0);
698 DALI_TEST_CHECK( actor.GetProperty<float>(index) == 5.0f );
702 int UtcDaliActorCustomPropertyIntToFloat(void)
704 TestApplication application;
706 Actor actor = Actor::New();
707 Stage::GetCurrent().Add( actor );
709 float startValue(5.0f);
710 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
711 DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
713 application.SendNotification();
714 application.Render(0);
715 DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
717 actor.SetProperty( index, int(1) );
719 application.SendNotification();
720 application.Render(0);
721 DALI_TEST_CHECK( actor.GetProperty<float>(index) == 1.0f );
725 int UtcDaliActorCustomPropertyFloatToInt(void)
727 TestApplication application;
729 Actor actor = Actor::New();
730 Stage::GetCurrent().Add( actor );
733 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
734 DALI_TEST_CHECK( actor.GetProperty<int>(index) == startValue );
736 application.SendNotification();
737 application.Render(0);
738 DALI_TEST_CHECK( actor.GetProperty<int>(index) == startValue );
740 actor.SetProperty( index, float(1.5) );
742 application.SendNotification();
743 application.Render(0);
744 DALI_TEST_CHECK( actor.GetProperty<int>(index) == 1 );
748 int UtcDaliActorSetParentOrigin(void)
750 TestApplication application;
752 Actor actor = Actor::New();
754 Vector3 vector(0.7f, 0.8f, 0.9f);
755 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
757 actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector );
759 // flush the queue and render once
760 application.SendNotification();
761 application.Render();
763 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
765 Stage::GetCurrent().Add( actor );
767 actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.1f, 0.2f, 0.3f ) );
769 // flush the queue and render once
770 application.SendNotification();
771 application.Render();
773 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), TEST_LOCATION );
775 Stage::GetCurrent().Remove( actor );
779 int UtcDaliActorSetParentOriginIndividual(void)
781 TestApplication application;
783 Actor actor = Actor::New();
785 Vector3 vector(0.7f, 0.8f, 0.9f);
786 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
788 actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x );
790 // flush the queue and render once
791 application.SendNotification();
792 application.Render();
794 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, TEST_LOCATION );
796 actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y );
798 // flush the queue and render once
799 application.SendNotification();
800 application.Render();
802 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, TEST_LOCATION );
804 actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z );
806 // flush the queue and render once
807 application.SendNotification();
808 application.Render();
810 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, TEST_LOCATION );
815 int UtcDaliActorGetCurrentParentOrigin(void)
817 TestApplication application;
819 Actor actor = Actor::New();
821 Vector3 vector(0.7f, 0.8f, 0.9f);
822 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
824 actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector );
826 // flush the queue and render once
827 application.SendNotification();
828 application.Render();
830 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
834 int UtcDaliActorSetAnchorPoint(void)
836 TestApplication application;
838 Actor actor = Actor::New();
840 Vector3 vector(0.7f, 0.8f, 0.9f);
841 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
843 actor.SetProperty( Actor::Property::ANCHOR_POINT, vector );
845 // flush the queue and render once
846 application.SendNotification();
847 application.Render();
849 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
851 Stage::GetCurrent().Add( actor );
853 actor.SetProperty( Actor::Property::ANCHOR_POINT, Vector3( 0.1f, 0.2f, 0.3f ) );
854 // flush the queue and render once
855 application.SendNotification();
856 application.Render();
858 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), TEST_LOCATION );
860 Stage::GetCurrent().Remove( actor );
864 int UtcDaliActorSetAnchorPointIndividual(void)
866 TestApplication application;
868 Actor actor = Actor::New();
870 Vector3 vector(0.7f, 0.8f, 0.9f);
871 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
873 actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x );
875 // flush the queue and render once
876 application.SendNotification();
877 application.Render();
879 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, TEST_LOCATION );
881 actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y );
883 // flush the queue and render once
884 application.SendNotification();
885 application.Render();
887 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, TEST_LOCATION );
889 actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z );
891 // flush the queue and render once
892 application.SendNotification();
893 application.Render();
895 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, TEST_LOCATION );
900 int UtcDaliActorGetCurrentAnchorPoint(void)
902 TestApplication application;
904 Actor actor = Actor::New();
906 Vector3 vector(0.7f, 0.8f, 0.9f);
907 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
909 actor.SetProperty( Actor::Property::ANCHOR_POINT, vector);
911 // flush the queue and render once
912 application.SendNotification();
913 application.Render();
915 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
919 // SetSize(float width, float height)
920 int UtcDaliActorSetSize01(void)
922 TestApplication application;
924 Actor actor = Actor::New();
925 Vector3 vector(100.0f, 100.0f, 0.0f);
927 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
929 actor.SetSize(vector.x, vector.y);
931 // Immediately retrieve the size after setting
932 Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
933 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
934 DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
935 DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
936 DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
938 // Flush the queue and render once
939 application.SendNotification();
940 application.Render();
942 // Check the size in the new frame
943 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
945 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
946 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
947 DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
948 DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
949 DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
951 // Check async behaviour
952 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
953 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
954 DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
955 DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
956 DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
958 // Change the resize policy and check whether the size stays the same
959 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
961 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
962 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
964 // Set a new size after resize policy is changed and check the new size
965 actor.SetSize( Vector3( 0.1f, 0.2f, 0.0f ) );
967 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
968 DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
970 // Change the resize policy again and check whether the new size stays the same
971 actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
973 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
974 DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
976 // Set another new size after resize policy is changed and check the new size
977 actor.SetSize( Vector3( 50.0f, 60.0f, 0.0f ) );
979 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
980 DALI_TEST_EQUALS( currentSize, Vector3( 50.0f, 60.0f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
985 // SetSize(float width, float height, float depth)
986 int UtcDaliActorSetSize02(void)
988 TestApplication application;
990 Actor actor = Actor::New();
991 Vector3 vector(100.0f, 100.0f, 100.0f);
993 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
995 actor.SetSize(vector.x, vector.y, vector.z);
997 // Immediately check the size after setting
998 Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
999 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1001 // flush the queue and render once
1002 application.SendNotification();
1003 application.Render();
1005 // Check the size in the new frame
1006 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1008 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1009 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1014 // SetSize(Vector2 size)
1015 int UtcDaliActorSetSize03(void)
1017 TestApplication application;
1019 Actor actor = Actor::New();
1020 Vector3 vector(100.0f, 100.0f, 0.0f);
1022 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1024 actor.SetSize(Vector2(vector.x, vector.y));
1026 // Immediately check the size after setting
1027 Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1028 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1030 // flush the queue and render once
1031 application.SendNotification();
1032 application.Render();
1034 // Check the size in the new frame
1035 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1037 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1038 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1043 // SetSize(Vector3 size)
1044 int UtcDaliActorSetSize04(void)
1046 TestApplication application;
1048 Actor actor = Actor::New();
1049 Vector3 vector(100.0f, 100.0f, 100.0f);
1051 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1053 actor.SetSize(vector);
1055 // Immediately check the size after setting
1056 Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1057 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1059 // flush the queue and render once
1060 application.SendNotification();
1061 application.Render();
1063 // Check the size in the new frame
1064 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1066 Stage::GetCurrent().Add( actor );
1067 actor.SetSize( Vector3( 0.1f, 0.2f, 0.3f ) );
1069 // Immediately check the size after setting
1070 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1071 DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
1073 // flush the queue and render once
1074 application.SendNotification();
1075 application.Render();
1077 // Check the size in the new frame
1078 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), TEST_LOCATION );
1080 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
1081 DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
1083 Stage::GetCurrent().Remove( actor );
1087 int UtcDaliActorSetSizeIndividual(void)
1089 TestApplication application;
1091 Actor actor = Actor::New();
1093 Vector3 vector(0.7f, 0.8f, 0.9f);
1094 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1096 actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
1098 // Immediately check the width after setting
1099 float sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
1100 DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1102 // flush the queue and render once
1103 application.SendNotification();
1104 application.Render();
1106 // Check the width in the new frame
1107 DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION );
1109 sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
1110 DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1112 actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
1114 // Immediately check the height after setting
1115 float sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
1116 DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1118 // flush the queue and render once
1119 application.SendNotification();
1120 application.Render();
1122 // Check the height in the new frame
1123 DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION );
1125 sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
1126 DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1128 actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
1130 // Immediately check the depth after setting
1131 float sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
1132 DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1134 // flush the queue and render once
1135 application.SendNotification();
1136 application.Render();
1138 // Check the depth in the new frame
1139 DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, TEST_LOCATION );
1141 sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
1142 DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1144 // Change the resize policy and check whether the size stays the same
1145 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
1147 sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
1148 DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1150 sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
1151 DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1153 sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
1154 DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1156 // Change the resize policy again and check whether the size stays the same
1157 actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
1159 sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
1160 DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1162 sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
1163 DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1165 sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
1166 DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1171 int UtcDaliActorSetSizeIndividual02(void)
1173 TestApplication application;
1175 Actor actor = Actor::New();
1176 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
1177 Stage::GetCurrent().Add( actor );
1179 Vector3 vector( 100.0f, 200.0f, 400.0f );
1180 DALI_TEST_CHECK( vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
1182 actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
1183 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1185 actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
1186 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1188 actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
1189 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1191 // flush the queue and render once
1192 application.SendNotification();
1193 application.Render();
1195 // Check the width in the new frame
1196 DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION );
1197 DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION );
1203 int UtcDaliActorGetCurrentSize(void)
1205 TestApplication application;
1207 Actor actor = Actor::New();
1208 Vector3 vector(100.0f, 100.0f, 20.0f);
1210 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1212 actor.SetSize(vector);
1214 // flush the queue and render once
1215 application.SendNotification();
1216 application.Render();
1218 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1222 int UtcDaliActorGetNaturalSize(void)
1224 TestApplication application;
1226 Actor actor = Actor::New();
1227 Vector3 vector( 0.0f, 0.0f, 0.0f );
1229 DALI_TEST_CHECK( actor.GetNaturalSize() == vector );
1234 int UtcDaliActorGetCurrentSizeImmediate(void)
1236 TestApplication application;
1238 Actor actor = Actor::New();
1239 Vector3 vector(100.0f, 100.0f, 20.0f);
1241 DALI_TEST_CHECK(vector != actor.GetTargetSize());
1242 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1244 actor.SetSize(vector);
1246 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1247 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1249 // flush the queue and render once
1250 application.SendNotification();
1251 application.Render();
1253 DALI_TEST_CHECK(vector == actor.GetTargetSize());
1254 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
1257 // Build the animation
1258 const float durationSeconds = 2.0f;
1259 Animation animation = Animation::New( durationSeconds );
1260 const Vector3 targetValue( 10.0f, 20.0f, 30.0f );
1261 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
1263 DALI_TEST_CHECK( actor.GetTargetSize() == vector );
1265 // Start the animation
1268 application.SendNotification();
1269 application.Render( static_cast<unsigned int>( durationSeconds * 1000.0f ) );
1271 DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
1276 int UtcDaliActorCalculateScreenExtents(void)
1278 TestApplication application;
1280 Actor actor = Actor::New();
1282 actor.SetPosition(Vector3(2.0f, 2.0f, 16.0f));
1283 actor.SetSize(Vector3{ 1.0f, 1.0f, 1.0f });
1285 application.SendNotification();
1286 application.Render();
1288 auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f };
1289 auto actualExtent = DevelActor::CalculateScreenExtents( actor );
1290 DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
1291 DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
1292 DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
1293 DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
1295 Stage::GetCurrent().Remove( actor );
1299 // SetPosition(float x, float y)
1300 int UtcDaliActorSetPosition01(void)
1302 TestApplication application;
1304 Actor actor = Actor::New();
1306 // Set to random to start off with
1307 actor.SetPosition(Vector3(120.0f, 120.0f, 0.0f));
1309 Vector3 vector(100.0f, 100.0f, 0.0f);
1311 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1313 actor.SetPosition(vector.x, vector.y);
1314 // flush the queue and render once
1315 application.SendNotification();
1316 application.Render();
1317 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1319 Stage::GetCurrent().Add( actor );
1320 actor.SetPosition( Vector3( 0.1f, 0.2f, 0.3f ) );
1321 // flush the queue and render once
1322 application.SendNotification();
1323 application.Render();
1324 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1329 // flush the queue and render once
1330 application.SendNotification();
1331 application.Render();
1332 DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1334 actor.TranslateBy( Vector3( 0.1f, 0.1f, 0.1f ) );
1335 // flush the queue and render once
1336 application.SendNotification();
1337 application.Render();
1338 DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
1340 Stage::GetCurrent().Remove( actor );
1344 // SetPosition(float x, float y, float z)
1345 int UtcDaliActorSetPosition02(void)
1347 TestApplication application;
1349 Actor actor = Actor::New();
1351 // Set to random to start off with
1352 actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
1354 Vector3 vector(100.0f, 100.0f, 100.0f);
1356 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1358 actor.SetPosition(vector.x, vector.y, vector.z);
1360 // flush the queue and render once
1361 application.SendNotification();
1362 application.Render();
1364 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1368 // SetPosition(Vector3 position)
1369 int UtcDaliActorSetPosition03(void)
1371 TestApplication application;
1373 Actor actor = Actor::New();
1375 // Set to random to start off with
1376 actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
1378 Vector3 vector(100.0f, 100.0f, 100.0f);
1380 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1382 actor.SetPosition(vector);
1384 // flush the queue and render once
1385 application.SendNotification();
1386 application.Render();
1388 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1392 int UtcDaliActorSetX(void)
1394 TestApplication application;
1396 Actor actor = Actor::New();
1398 Vector3 vector(100.0f, 0.0f, 0.0f);
1400 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1404 // flush the queue and render once
1405 application.SendNotification();
1406 application.Render();
1408 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1412 int UtcDaliActorSetY(void)
1414 TestApplication application;
1416 Actor actor = Actor::New();
1418 Vector3 vector(0.0f, 100.0f, 0.0f);
1420 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1424 // flush the queue and render once
1425 application.SendNotification();
1426 application.Render();
1428 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1432 int UtcDaliActorSetZ(void)
1434 TestApplication application;
1436 Actor actor = Actor::New();
1438 Vector3 vector(0.0f, 0.0f, 100.0f);
1440 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1444 // flush the queue and render once
1445 application.SendNotification();
1446 application.Render();
1448 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1452 int UtcDaliActorSetPositionProperties(void)
1454 TestApplication application;
1456 Actor actor = Actor::New();
1458 Vector3 vector(0.7f, 0.8f, 0.9f);
1459 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1461 actor.SetProperty( Actor::Property::POSITION_X, vector.x );
1462 DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
1463 DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
1465 // flush the queue and render once
1466 application.SendNotification();
1467 application.Render();
1469 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
1470 DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
1471 DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
1472 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
1473 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
1475 actor.SetProperty( Actor::Property::POSITION_Y, vector.y );
1476 DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
1477 DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
1479 // flush the queue and render once
1480 application.SendNotification();
1481 application.Render();
1483 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
1484 DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
1485 DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
1486 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
1487 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
1489 actor.SetProperty( Actor::Property::POSITION_Z, vector.z );
1490 DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
1491 DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
1493 // flush the queue and render once
1494 application.SendNotification();
1495 application.Render();
1497 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
1498 DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
1499 DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
1500 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
1501 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
1506 int UtcDaliActorTranslateBy(void)
1508 TestApplication application;
1510 Actor actor = Actor::New();
1511 Vector3 vector(100.0f, 100.0f, 100.0f);
1513 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1515 actor.SetPosition(vector);
1517 // flush the queue and render once
1518 application.SendNotification();
1519 application.Render();
1521 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1523 actor.TranslateBy(vector);
1525 // flush the queue and render once
1526 application.SendNotification();
1527 application.Render();
1529 DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
1533 int UtcDaliActorGetCurrentPosition(void)
1535 TestApplication application;
1537 Actor actor = Actor::New();
1538 Vector3 setVector(100.0f, 100.0f, 0.0f);
1539 actor.SetPosition(setVector);
1541 // flush the queue and render once
1542 application.SendNotification();
1543 application.Render();
1545 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) == setVector);
1549 int UtcDaliActorGetCurrentWorldPosition(void)
1551 TestApplication application;
1553 Actor parent = Actor::New();
1554 Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1555 parent.SetPosition( parentPosition );
1556 parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1557 parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1558 Stage::GetCurrent().Add( parent );
1560 Actor child = Actor::New();
1561 child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1562 child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1563 Vector3 childPosition( 6.0f, 6.0f, 6.0f );
1564 child.SetPosition( childPosition );
1565 parent.Add( child );
1567 // The actors should not have a world position yet
1568 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
1569 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
1571 application.SendNotification();
1572 application.Render(0);
1574 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
1575 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION );
1577 // The actors should have a world position now
1578 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
1579 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION );
1583 int UtcDaliActorSetInheritPosition(void)
1585 tet_infoline("Testing Actor::SetInheritPosition");
1586 TestApplication application;
1588 Actor parent = Actor::New();
1589 Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1590 parent.SetPosition( parentPosition );
1591 parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1592 parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1593 Stage::GetCurrent().Add( parent );
1595 Actor child = Actor::New();
1596 child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
1597 child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
1598 Vector3 childPosition( 10.0f, 11.0f, 12.0f );
1599 child.SetPosition( childPosition );
1600 parent.Add( child );
1602 // The actors should not have a world position yet
1603 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
1604 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
1606 // first test default, which is to inherit position
1607 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION );
1608 application.SendNotification();
1609 application.Render(0); // should only really call Update as Render is not required to update scene
1610 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
1611 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION );
1612 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
1613 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION );
1615 //Change child position
1616 Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1617 child.SetPosition( childOffset );
1619 // Use local position as world postion
1620 child.SetProperty( Actor::Property::INHERIT_POSITION, false );
1621 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), false, TEST_LOCATION );
1622 application.SendNotification();
1623 application.Render(0); // should only really call Update as Render is not required to update scene
1624 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
1625 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION );
1626 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
1627 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), childOffset, TEST_LOCATION );
1629 //Change back to inherit position from parent
1630 child.SetProperty( Actor::Property::INHERIT_POSITION, true );
1631 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION );
1632 application.SendNotification();
1633 application.Render(0); // should only really call Update as Render is not required to update scene
1634 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
1635 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION );
1636 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
1637 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childOffset, TEST_LOCATION );
1641 int UtcDaliActorInheritOpacity(void)
1643 tet_infoline("Testing Actor::Inherit Opacity");
1644 TestApplication application;
1646 Actor parent = Actor::New();
1647 Actor child = Actor::New();
1648 parent.Add( child );
1649 Stage::GetCurrent().Add( parent );
1651 DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
1652 DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
1654 // flush the queue and render once
1655 application.SendNotification();
1656 application.Render();
1658 parent.SetProperty( DevelActor::Property::OPACITY, 0.1f );
1660 DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
1661 DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
1663 application.SendNotification();
1664 application.Render();
1666 DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
1667 DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
1668 DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
1669 DALI_TEST_EQUALS( child.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
1670 DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
1671 DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.f, 0.0001f, TEST_LOCATION );
1676 // SetOrientation(float angleRadians, Vector3 axis)
1677 int UtcDaliActorSetOrientation01(void)
1679 TestApplication application;
1681 Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1682 Actor actor = Actor::New();
1684 actor.SetOrientation(rotation);
1686 // flush the queue and render once
1687 application.SendNotification();
1688 application.Render();
1690 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1694 int UtcDaliActorSetOrientation02(void)
1696 TestApplication application;
1698 Actor actor = Actor::New();
1700 Radian angle( 0.785f );
1701 Vector3 axis(1.0f, 1.0f, 0.0f);
1703 actor.SetOrientation( angle, axis);
1704 Quaternion rotation( angle, axis );
1705 // flush the queue and render once
1706 application.SendNotification();
1707 application.Render();
1708 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1710 Stage::GetCurrent().Add( actor );
1711 actor.RotateBy( Degree( 360 ), axis);
1712 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1714 actor.SetOrientation( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1715 Quaternion result( Radian( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1716 // flush the queue and render once
1717 application.SendNotification();
1718 application.Render();
1719 DALI_TEST_EQUALS( result, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1721 actor.SetOrientation( angle, axis);
1722 // flush the queue and render once
1723 application.SendNotification();
1724 application.Render();
1725 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1727 Stage::GetCurrent().Remove( actor );
1731 // SetOrientation(float angleRadians, Vector3 axis)
1732 int UtcDaliActorSetOrientationProperty(void)
1734 TestApplication application;
1736 Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1737 Actor actor = Actor::New();
1739 actor.SetProperty( Actor::Property::ORIENTATION, rotation );
1740 DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1742 // flush the queue and render once
1743 application.SendNotification();
1744 application.Render();
1746 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1747 DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1748 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1752 // RotateBy(float angleRadians, Vector3 axis)
1753 int UtcDaliActorRotateBy01(void)
1755 TestApplication application;
1757 Actor actor = Actor::New();
1759 Radian angle( M_PI * 0.25f );
1760 actor.RotateBy(( angle ), Vector3::ZAXIS);
1761 // flush the queue and render once
1762 application.SendNotification();
1763 application.Render();
1764 DALI_TEST_EQUALS(Quaternion( angle, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1766 Stage::GetCurrent().Add( actor );
1768 actor.RotateBy( angle, Vector3::ZAXIS);
1769 // flush the queue and render once
1770 application.SendNotification();
1771 application.Render();
1772 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1774 Stage::GetCurrent().Remove( actor );
1778 // RotateBy(Quaternion relativeRotation)
1779 int UtcDaliActorRotateBy02(void)
1781 TestApplication application;
1783 Actor actor = Actor::New();
1785 Radian angle( M_PI * 0.25f );
1786 Quaternion rotation(angle, Vector3::ZAXIS);
1787 actor.RotateBy(rotation);
1788 // flush the queue and render once
1789 application.SendNotification();
1790 application.Render();
1791 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1793 actor.RotateBy(rotation);
1794 // flush the queue and render once
1795 application.SendNotification();
1796 application.Render();
1797 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1801 int UtcDaliActorGetCurrentOrientation(void)
1803 TestApplication application;
1804 Actor actor = Actor::New();
1806 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1807 actor.SetOrientation(rotation);
1808 // flush the queue and render once
1809 application.SendNotification();
1810 application.Render();
1811 DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
1815 int UtcDaliActorGetCurrentWorldOrientation(void)
1817 tet_infoline("Testing Actor::GetCurrentWorldRotation");
1818 TestApplication application;
1820 Actor parent = Actor::New();
1821 Radian rotationAngle( Degree(90.0f) );
1822 Quaternion rotation( rotationAngle, Vector3::YAXIS );
1823 parent.SetOrientation( rotation );
1824 Stage::GetCurrent().Add( parent );
1826 Actor child = Actor::New();
1827 child.SetOrientation( rotation );
1828 parent.Add( child );
1830 // The actors should not have a world rotation yet
1831 DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1832 DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1834 application.SendNotification();
1835 application.Render(0);
1837 DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION );
1838 DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION );
1840 // The actors should have a world rotation now
1841 DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1842 DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1844 // turn off child rotation inheritance
1845 child.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
1846 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION );
1847 application.SendNotification();
1848 application.Render(0);
1850 // The actors should have a world rotation now
1851 DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1852 DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), rotation, 0.001, TEST_LOCATION );
1856 // SetScale(float scale)
1857 int UtcDaliActorSetScale01(void)
1859 TestApplication application;
1861 Actor actor = Actor::New();
1863 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1864 actor.SetScale(0.25f);
1866 Vector3 scale(10.0f, 10.0f, 10.0f);
1867 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
1869 actor.SetScale(scale.x);
1871 // flush the queue and render once
1872 application.SendNotification();
1873 application.Render();
1875 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
1879 // SetScale(float scaleX, float scaleY, float scaleZ)
1880 int UtcDaliActorSetScale02(void)
1882 TestApplication application;
1883 Vector3 scale(10.0f, 10.0f, 10.0f);
1885 Actor actor = Actor::New();
1887 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1888 actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1890 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
1892 actor.SetScale(scale.x, scale.y, scale.z);
1893 // flush the queue and render once
1894 application.SendNotification();
1895 application.Render();
1896 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
1898 // add to stage and test
1899 Stage::GetCurrent().Add( actor );
1900 actor.SetScale( 2.0f, 2.0f, 2.0f );
1901 // flush the queue and render once
1902 application.SendNotification();
1903 application.Render();
1904 DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), 0.001, TEST_LOCATION);
1906 Stage::GetCurrent().Remove( actor );
1911 // SetScale(Vector3 scale)
1912 int UtcDaliActorSetScale03(void)
1914 TestApplication application;
1915 Vector3 scale(10.0f, 10.0f, 10.0f);
1917 Actor actor = Actor::New();
1919 // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
1920 actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1922 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
1924 actor.SetScale(scale);
1926 // flush the queue and render once
1927 application.SendNotification();
1928 application.Render();
1930 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
1934 int UtcDaliActorSetScaleIndividual(void)
1936 TestApplication application;
1938 Actor actor = Actor::New();
1940 Vector3 vector(0.7f, 0.8f, 0.9f);
1941 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
1943 actor.SetProperty( Actor::Property::SCALE_X, vector.x );
1944 DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
1946 // flush the queue and render once
1947 application.SendNotification();
1948 application.Render();
1950 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, TEST_LOCATION );
1951 DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
1952 DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
1954 actor.SetProperty( Actor::Property::SCALE_Y, vector.y );
1955 DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
1957 // flush the queue and render once
1958 application.SendNotification();
1959 application.Render();
1961 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, TEST_LOCATION );
1962 DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
1963 DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
1965 actor.SetProperty( Actor::Property::SCALE_Z, vector.z );
1966 DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
1968 // flush the queue and render once
1969 application.SendNotification();
1970 application.Render();
1972 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, TEST_LOCATION );
1973 DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
1974 DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
1976 DALI_TEST_EQUALS( vector, actor.GetProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION );
1977 DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION );
1982 int UtcDaliActorScaleBy(void)
1984 TestApplication application;
1985 Actor actor = Actor::New();
1986 Vector3 vector(100.0f, 100.0f, 100.0f);
1988 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
1990 actor.SetScale(vector);
1992 // flush the queue and render once
1993 application.SendNotification();
1994 application.Render();
1996 DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
1998 actor.ScaleBy(vector);
2000 // flush the queue and render once
2001 application.SendNotification();
2002 application.Render();
2004 DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
2008 int UtcDaliActorGetCurrentScale(void)
2010 TestApplication application;
2011 Vector3 scale(12.0f, 1.0f, 2.0f);
2013 Actor actor = Actor::New();
2015 actor.SetScale(scale);
2017 // flush the queue and render once
2018 application.SendNotification();
2019 application.Render();
2021 DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
2025 int UtcDaliActorGetCurrentWorldScale(void)
2027 TestApplication application;
2029 Actor parent = Actor::New();
2030 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2031 parent.SetScale( parentScale );
2032 Stage::GetCurrent().Add( parent );
2034 Actor child = Actor::New();
2035 Vector3 childScale( 2.0f, 2.0f, 2.0f );
2036 child.SetScale( childScale );
2037 parent.Add( child );
2039 // The actors should not have a scale yet
2040 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
2041 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
2043 // The actors should not have a world scale yet
2044 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION );
2045 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION );
2047 application.SendNotification();
2048 application.Render(0);
2050 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), parentScale, TEST_LOCATION );
2051 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), childScale, TEST_LOCATION );
2053 // The actors should have a world scale now
2054 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale, TEST_LOCATION );
2055 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION );
2059 int UtcDaliActorInheritScale(void)
2061 tet_infoline("Testing Actor::SetInheritScale");
2062 TestApplication application;
2064 Actor parent = Actor::New();
2065 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2066 parent.SetScale( parentScale );
2067 Stage::GetCurrent().Add( parent );
2069 Actor child = Actor::New();
2070 Vector3 childScale( 2.0f, 2.0f, 2.0f );
2071 child.SetScale( childScale );
2072 parent.Add( child );
2074 application.SendNotification();
2075 application.Render(0);
2077 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), true, TEST_LOCATION );
2078 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION );
2080 child.SetProperty( Actor::Property::INHERIT_SCALE, false );
2081 DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION );
2083 application.SendNotification();
2084 application.Render(0);
2086 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), childScale, TEST_LOCATION );
2090 int UtcDaliActorSetVisible(void)
2092 TestApplication application;
2094 Actor actor = Actor::New();
2095 actor.SetProperty( Actor::Property::VISIBLE,false);
2096 // flush the queue and render once
2097 application.SendNotification();
2098 application.Render();
2099 DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
2101 actor.SetProperty( Actor::Property::VISIBLE,true);
2102 // flush the queue and render once
2103 application.SendNotification();
2104 application.Render();
2105 DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
2107 // put actor on stage
2108 Stage::GetCurrent().Add( actor );
2109 actor.SetProperty( Actor::Property::VISIBLE,false);
2110 // flush the queue and render once
2111 application.SendNotification();
2112 application.Render();
2113 DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
2117 int UtcDaliActorIsVisible(void)
2119 TestApplication application;
2121 Actor actor = Actor::New();
2123 DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
2127 int UtcDaliActorSetOpacity(void)
2129 TestApplication application;
2131 Actor actor = Actor::New();
2132 // initial opacity is 1
2133 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 1.0f, TEST_LOCATION );
2135 actor.SetProperty( DevelActor::Property::OPACITY, 0.4f);
2136 // flush the queue and render once
2137 application.SendNotification();
2138 application.Render();
2139 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.4f, TEST_LOCATION );
2141 // change opacity, actor is on stage to change is not immediate
2142 actor.SetProperty( DevelActor::Property::OPACITY, actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ) + 0.1f );
2143 // flush the queue and render once
2144 application.SendNotification();
2145 application.Render();
2146 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.5f, TEST_LOCATION );
2148 // put actor on stage
2149 Stage::GetCurrent().Add( actor );
2151 // change opacity, actor is on stage to change is not immediate
2152 actor.SetProperty( DevelActor::Property::OPACITY, 0.9f );
2153 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.5f, TEST_LOCATION );
2154 // flush the queue and render once
2155 application.SendNotification();
2156 application.Render();
2157 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.9f, TEST_LOCATION );
2159 // change opacity, actor is on stage to change is not immediate
2160 actor.SetProperty( DevelActor::Property::OPACITY, actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ) - 0.9f );
2161 // flush the queue and render once
2162 application.SendNotification();
2163 application.Render();
2164 DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.0f, TEST_LOCATION );
2168 int UtcDaliActorGetCurrentOpacity(void)
2170 TestApplication application;
2172 Actor actor = Actor::New();
2173 DALI_TEST_CHECK(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ) != 0.5f);
2175 actor.SetProperty( DevelActor::Property::OPACITY,0.5f);
2176 // flush the queue and render once
2177 application.SendNotification();
2178 application.Render();
2179 DALI_TEST_CHECK(actor.GetCurrentProperty< float >( DevelActor::Property::OPACITY ) == 0.5f);
2183 int UtcDaliActorSetSensitive(void)
2185 TestApplication application;
2186 Actor actor = Actor::New();
2188 bool sensitive = !actor.GetProperty< bool >( Actor::Property::SENSITIVE );
2190 actor.SetProperty( Actor::Property::SENSITIVE,sensitive);
2192 DALI_TEST_CHECK(sensitive == actor.GetProperty< bool >( Actor::Property::SENSITIVE ));
2196 int UtcDaliActorIsSensitive(void)
2198 TestApplication application;
2199 Actor actor = Actor::New();
2200 actor.SetProperty( Actor::Property::SENSITIVE,false);
2202 DALI_TEST_CHECK(false == actor.GetProperty< bool >( Actor::Property::SENSITIVE ));
2206 int UtcDaliActorSetColor(void)
2208 TestApplication application;
2209 Actor actor = Actor::New();
2210 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2212 DALI_TEST_CHECK(color != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
2214 actor.SetProperty( Actor::Property::COLOR,color);
2215 // flush the queue and render once
2216 application.SendNotification();
2217 application.Render();
2218 DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
2220 actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) );
2221 // flush the queue and render once
2222 application.SendNotification();
2223 application.Render();
2224 DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2226 Stage::GetCurrent().Add( actor );
2227 actor.SetProperty( Actor::Property::COLOR, color );
2228 // flush the queue and render once
2229 application.SendNotification();
2230 application.Render();
2231 DALI_TEST_EQUALS( color, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2233 actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) );
2234 // flush the queue and render once
2235 application.SendNotification();
2236 application.Render();
2237 // Actor color is not clamped
2238 DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2239 // world color is clamped
2240 DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), TEST_LOCATION );
2242 actor.SetProperty( Actor::Property::COLOR, color );
2243 DALI_TEST_EQUALS( color, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2245 Vector3 newColor( 1.0f, 0.0f, 0.0f );
2246 actor.SetProperty( Actor::Property::COLOR, newColor );
2247 DALI_TEST_EQUALS( Vector4( newColor.r, newColor.g, newColor.b, 1.0f ), actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2249 Stage::GetCurrent().Remove( actor );
2253 int UtcDaliActorSetColorIndividual(void)
2255 TestApplication application;
2257 Actor actor = Actor::New();
2259 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
2260 DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
2262 actor.SetProperty( Actor::Property::COLOR_RED, vector.r );
2263 DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
2265 // flush the queue and render once
2266 application.SendNotification();
2267 application.Render();
2269 DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, TEST_LOCATION );
2270 DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
2271 DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
2273 actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g );
2274 DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
2276 // flush the queue and render once
2277 application.SendNotification();
2278 application.Render();
2280 DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, TEST_LOCATION );
2281 DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
2282 DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
2284 actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b );
2285 DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
2287 // flush the queue and render once
2288 application.SendNotification();
2289 application.Render();
2291 DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, TEST_LOCATION );
2292 DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
2293 DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
2296 actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a );
2297 DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
2299 // flush the queue and render once
2300 application.SendNotification();
2301 application.Render();
2303 DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION );
2304 DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
2305 DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
2307 DALI_TEST_EQUALS( vector, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2308 DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
2310 actor.SetProperty( DevelActor::Property::OPACITY, 0.2f );
2313 // flush the queue and render once
2314 application.SendNotification();
2315 application.Render();
2317 DALI_TEST_EQUALS( 0.2f, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION );
2323 int UtcDaliActorGetCurrentColor(void)
2325 TestApplication application;
2326 Actor actor = Actor::New();
2327 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
2329 actor.SetProperty( Actor::Property::COLOR,color);
2330 // flush the queue and render once
2331 application.SendNotification();
2332 application.Render();
2333 DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
2337 int UtcDaliActorGetCurrentWorldColor(void)
2339 tet_infoline("Actor::GetCurrentWorldColor");
2340 TestApplication application;
2342 Actor parent = Actor::New();
2343 Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f );
2344 parent.SetProperty( Actor::Property::COLOR, parentColor );
2345 Stage::GetCurrent().Add( parent );
2347 Actor child = Actor::New();
2348 Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f );
2349 child.SetProperty( Actor::Property::COLOR, childColor );
2350 parent.Add( child );
2352 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
2353 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
2355 // verify the default color mode
2356 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetColorMode(), TEST_LOCATION );
2358 // The actors should not have a world color yet
2359 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION );
2360 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION );
2362 application.SendNotification();
2363 application.Render(0);
2365 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), parentColor, TEST_LOCATION );
2366 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
2368 // The actors should have a world color now
2369 DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION );
2370 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION );
2373 child.SetColorMode( USE_OWN_COLOR );
2374 application.SendNotification();
2375 application.Render(0);
2376 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), childColor, TEST_LOCATION );
2379 child.SetColorMode( USE_PARENT_COLOR );
2380 application.SendNotification();
2381 application.Render(0);
2382 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
2383 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION );
2386 child.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
2387 application.SendNotification();
2388 application.Render(0);
2389 Vector4 expectedColor( childColor );
2390 expectedColor.a *= parentColor.a;
2391 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
2392 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), expectedColor, TEST_LOCATION );
2396 int UtcDaliActorSetColorMode(void)
2398 tet_infoline("Actor::SetColorMode");
2399 TestApplication application;
2400 Actor actor = Actor::New();
2401 Actor child = Actor::New();
2404 actor.SetColorMode( USE_OWN_COLOR );
2405 DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetColorMode(), TEST_LOCATION );
2407 actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
2408 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
2410 actor.SetColorMode( USE_PARENT_COLOR );
2411 DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
2413 actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
2414 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetColorMode(), TEST_LOCATION );
2418 int UtcDaliActorScreenToLocal(void)
2420 TestApplication application;
2421 Actor actor = Actor::New();
2422 actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
2423 actor.SetSize(100.0f, 100.0f);
2424 actor.SetPosition(10.0f, 10.0f);
2425 Stage::GetCurrent().Add(actor);
2427 // flush the queue and render once
2428 application.SendNotification();
2429 application.Render();
2434 application.SendNotification();
2435 application.Render();
2437 DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) );
2439 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2440 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2444 int UtcDaliActorSetLeaveRequired(void)
2446 TestApplication application;
2448 Actor actor = Actor::New();
2450 actor.SetProperty( Actor::Property::LEAVE_REQUIRED,false);
2451 DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false);
2453 actor.SetProperty( Actor::Property::LEAVE_REQUIRED,true);
2454 DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == true);
2458 int UtcDaliActorGetLeaveRequired(void)
2460 TestApplication application;
2462 Actor actor = Actor::New();
2464 DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false);
2468 int UtcDaliActorSetKeyboardFocusable(void)
2470 TestApplication application;
2472 Actor actor = Actor::New();
2474 actor.SetKeyboardFocusable(true);
2475 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == true);
2477 actor.SetKeyboardFocusable(false);
2478 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
2482 int UtcDaliActorIsKeyboardFocusable(void)
2484 TestApplication application;
2486 Actor actor = Actor::New();
2488 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
2492 int UtcDaliActorRemoveConstraints(void)
2494 tet_infoline(" UtcDaliActorRemoveConstraints");
2495 TestApplication application;
2497 gTestConstraintCalled = false;
2499 Actor actor = Actor::New();
2501 Constraint constraint = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraint() );
2503 actor.RemoveConstraints();
2505 DALI_TEST_CHECK( gTestConstraintCalled == false );
2507 Stage::GetCurrent().Add( actor );
2510 // flush the queue and render once
2511 application.SendNotification();
2512 application.Render();
2514 actor.RemoveConstraints();
2516 DALI_TEST_CHECK( gTestConstraintCalled == true );
2520 int UtcDaliActorRemoveConstraintTag(void)
2522 tet_infoline(" UtcDaliActorRemoveConstraintTag");
2523 TestApplication application;
2525 Actor actor = Actor::New();
2527 // 1. Apply Constraint1 and Constraint2, and test...
2528 unsigned int result1 = 0u;
2529 unsigned int result2 = 0u;
2531 unsigned constraint1Tag = 1u;
2532 Constraint constraint1 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1) );
2533 constraint1.SetTag( constraint1Tag );
2534 constraint1.Apply();
2536 unsigned constraint2Tag = 2u;
2537 Constraint constraint2 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2) );
2538 constraint2.SetTag( constraint2Tag );
2539 constraint2.Apply();
2541 Stage::GetCurrent().Add( actor );
2542 // flush the queue and render once
2543 application.SendNotification();
2544 application.Render();
2546 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2547 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2549 // 2. Remove Constraint1 and test...
2552 actor.RemoveConstraints(constraint1Tag);
2553 // make color property dirty, which will trigger constraints to be reapplied.
2554 actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
2555 // flush the queue and render once
2556 application.SendNotification();
2557 application.Render();
2559 DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
2560 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2562 // 3. Re-Apply Constraint1 and test...
2565 constraint1.Apply();
2566 // make color property dirty, which will trigger constraints to be reapplied.
2567 actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
2568 // flush the queue and render once
2569 application.SendNotification();
2570 application.Render();
2572 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2573 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2575 // 2. Remove Constraint2 and test...
2578 actor.RemoveConstraints(constraint2Tag);
2579 // make color property dirty, which will trigger constraints to be reapplied.
2580 actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
2581 // flush the queue and render once
2582 application.SendNotification();
2583 application.Render();
2585 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2586 DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2588 // 2. Remove Constraint1 as well and test...
2591 actor.RemoveConstraints(constraint1Tag);
2592 // make color property dirty, which will trigger constraints to be reapplied.
2593 actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
2594 // flush the queue and render once
2595 application.SendNotification();
2596 application.Render();
2598 DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
2599 DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2603 int UtcDaliActorTouchedSignal(void)
2605 TestApplication application;
2607 ResetTouchCallbacks();
2609 // get the root layer
2610 Actor actor = Stage::GetCurrent().GetRootLayer();
2611 DALI_TEST_CHECK( gTouchCallBackCalled == false );
2613 application.SendNotification();
2614 application.Render();
2616 // connect to its touch signal
2617 actor.TouchedSignal().Connect( TestCallback );
2619 // simulate a touch event in the middle of the screen
2620 Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
2621 Dali::Integration::Point point;
2622 point.SetDeviceId( 1 );
2623 point.SetState( PointState::DOWN );
2624 point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
2625 Dali::Integration::TouchEvent touchEvent;
2626 touchEvent.AddPoint( point );
2627 application.ProcessEvent( touchEvent );
2629 DALI_TEST_CHECK( gTouchCallBackCalled == true );
2633 int UtcDaliActorHoveredSignal(void)
2635 TestApplication application;
2637 gHoverCallBackCalled = false;
2639 // get the root layer
2640 Actor actor = Stage::GetCurrent().GetRootLayer();
2641 DALI_TEST_CHECK( gHoverCallBackCalled == false );
2643 application.SendNotification();
2644 application.Render();
2646 // connect to its hover signal
2647 actor.HoveredSignal().Connect( TestCallback3 );
2649 // simulate a hover event in the middle of the screen
2650 Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
2651 Dali::Integration::Point point;
2652 point.SetDeviceId( 1 );
2653 point.SetState( PointState::MOTION );
2654 point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
2655 Dali::Integration::HoverEvent hoverEvent;
2656 hoverEvent.AddPoint( point );
2657 application.ProcessEvent( hoverEvent );
2659 DALI_TEST_CHECK( gHoverCallBackCalled == true );
2663 int UtcDaliActorOnOffStageSignal(void)
2665 tet_infoline("Testing Dali::Actor::OnStageSignal() and OffStageSignal()");
2667 TestApplication application;
2670 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2671 gActorNamesOnOffStage.clear();
2673 Actor parent = Actor::New();
2674 parent.SetProperty( Actor::Property::NAME, "parent" );
2675 parent.OnStageSignal().Connect( OnStageCallback );
2676 parent.OffStageSignal().Connect( OffStageCallback );
2678 DALI_TEST_CHECK( gOnStageCallBackCalled == 0 );
2679 DALI_TEST_CHECK( gOffStageCallBackCalled == 0 );
2681 // add parent to stage
2682 Stage::GetCurrent().Add( parent );
2683 // onstage emitted, offstage not
2684 DALI_TEST_EQUALS( gOnStageCallBackCalled, 1, TEST_LOCATION );
2685 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2686 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2688 // test adding a child, should get onstage emitted
2690 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2691 gActorNamesOnOffStage.clear();
2693 Actor child = Actor::New();
2694 child.SetProperty( Actor::Property::NAME, "child" );
2695 child.OnStageSignal().Connect( OnStageCallback );
2696 child.OffStageSignal().Connect( OffStageCallback );
2697 parent.Add( child ); // add child
2698 // onstage emitted, offstage not
2699 DALI_TEST_EQUALS( gOnStageCallBackCalled, 1, TEST_LOCATION );
2700 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2701 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2703 // test removing parent from stage
2705 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2706 gActorNamesOnOffStage.clear();
2708 Stage::GetCurrent().Remove( parent );
2709 // onstage not emitted, offstage is
2710 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2711 DALI_TEST_EQUALS( gOffStageCallBackCalled, 2, TEST_LOCATION );
2712 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2713 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2715 // test adding parent back to stage
2717 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2718 gActorNamesOnOffStage.clear();
2720 Stage::GetCurrent().Add( parent );
2721 // onstage emitted, offstage not
2722 DALI_TEST_EQUALS( gOnStageCallBackCalled, 2, TEST_LOCATION );
2723 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2724 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2725 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2727 // test removing child
2729 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2730 gActorNamesOnOffStage.clear();
2732 parent.Remove( child );
2733 // onstage not emitted, offstage is
2734 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2735 DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2736 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2738 // test removing parent
2740 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2741 gActorNamesOnOffStage.clear();
2743 Stage::GetCurrent().Remove( parent );
2744 // onstage not emitted, offstage is
2745 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2746 DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2747 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2751 int UtcDaliActorFindChildByName(void)
2753 tet_infoline("Testing Dali::Actor::FindChildByName()");
2754 TestApplication application;
2756 Actor parent = Actor::New();
2757 parent.SetProperty( Actor::Property::NAME, "parent" );
2758 Actor first = Actor::New();
2759 first .SetProperty( Actor::Property::NAME, "first" );
2760 Actor second = Actor::New();
2761 second.SetProperty( Actor::Property::NAME, "second" );
2766 Actor found = parent.FindChildByName( "foo" );
2767 DALI_TEST_CHECK( !found );
2769 found = parent.FindChildByName( "parent" );
2770 DALI_TEST_CHECK( found == parent );
2772 found = parent.FindChildByName( "first" );
2773 DALI_TEST_CHECK( found == first );
2775 found = parent.FindChildByName( "second" );
2776 DALI_TEST_CHECK( found == second );
2780 int UtcDaliActorFindChildById(void)
2782 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2783 TestApplication application;
2785 Actor parent = Actor::New();
2786 Actor first = Actor::New();
2787 Actor second = Actor::New();
2792 Actor found = parent.FindChildById( 100000 );
2793 DALI_TEST_CHECK( !found );
2795 found = parent.FindChildById( parent.GetId() );
2796 DALI_TEST_CHECK( found == parent );
2798 found = parent.FindChildById( first.GetId() );
2799 DALI_TEST_CHECK( found == first );
2801 found = parent.FindChildById( second.GetId() );
2802 DALI_TEST_CHECK( found == second );
2806 int UtcDaliActorHitTest(void)
2811 HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result )
2813 mTouchPoint( touchPoint ),
2818 Vector2 mTouchPoint;
2822 TestApplication application;
2823 tet_infoline(" UtcDaliActorHitTest");
2825 // Fill a vector with different hit tests.
2826 struct HitTestData* hitTestData[] = {
2827 // scale touch point result
2828 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ), // touch point close to the right edge (inside)
2829 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside)
2830 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.
2831 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside)
2832 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.
2836 // get the root layer
2837 Actor actor = Actor::New();
2838 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
2839 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
2841 Stage::GetCurrent().Add( actor );
2843 ResetTouchCallbacks();
2845 unsigned int index = 0;
2846 while( NULL != hitTestData[index] )
2848 actor.SetSize( 1.f, 1.f );
2849 actor.SetScale( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z );
2851 // flush the queue and render once
2852 application.SendNotification();
2853 application.Render();
2855 DALI_TEST_CHECK( !gTouchCallBackCalled );
2857 // connect to its touch signal
2858 actor.TouchedSignal().Connect(TestCallback);
2860 Dali::Integration::Point point;
2861 point.SetState( PointState::DOWN );
2862 point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) );
2863 Dali::Integration::TouchEvent event;
2864 event.AddPoint( point );
2866 // flush the queue and render once
2867 application.SendNotification();
2868 application.Render();
2869 application.ProcessEvent( event );
2871 DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult );
2873 if( gTouchCallBackCalled != hitTestData[index]->mResult )
2874 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2875 hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z,
2876 hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
2877 hitTestData[index]->mResult );
2879 ResetTouchCallbacks();
2885 int UtcDaliActorSetDrawMode(void)
2887 TestApplication app;
2888 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2890 Actor a = Actor::New();
2892 Stage::GetCurrent().Add(a);
2893 app.SendNotification();
2895 app.SendNotification();
2898 DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Ensure overlay is off by default
2900 a.SetDrawMode( DrawMode::OVERLAY_2D );
2901 app.SendNotification();
2904 DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetDrawMode() ); // Check Actor is overlay
2906 a.SetDrawMode( DrawMode::NORMAL );
2907 app.SendNotification();
2910 DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Check Actor is normal
2914 int UtcDaliActorSetDrawModeOverlayRender(void)
2916 TestApplication app;
2917 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2919 app.SendNotification();
2922 std::vector<GLuint> ids;
2923 ids.push_back( 8 ); // first rendered actor
2924 ids.push_back( 9 ); // second rendered actor
2925 ids.push_back( 10 ); // third rendered actor
2926 app.GetGlAbstraction().SetNextTextureIds( ids );
2928 BufferImage imageA = BufferImage::New(16, 16);
2929 BufferImage imageB = BufferImage::New(16, 16);
2930 BufferImage imageC = BufferImage::New(16, 16);
2931 Actor a = CreateRenderableActor( imageA );
2932 Actor b = CreateRenderableActor( imageB );
2933 Actor c = CreateRenderableActor( imageC );
2935 app.SendNotification();
2938 //Textures are bound when first created. Clear bound textures vector
2939 app.GetGlAbstraction().ClearBoundTextures();
2941 // Render a,b,c as regular non-overlays. so order will be:
2945 Stage::GetCurrent().Add(a);
2946 Stage::GetCurrent().Add(b);
2947 Stage::GetCurrent().Add(c);
2949 app.SendNotification();
2952 // Should be 3 textures changes.
2953 const std::vector<GLuint>& boundTextures = app.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
2954 typedef std::vector<GLuint>::size_type TextureSize;
2955 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
2956 if( boundTextures.size() == 3 )
2958 DALI_TEST_CHECK( boundTextures[0] == 8u );
2959 DALI_TEST_CHECK( boundTextures[1] == 9u );
2960 DALI_TEST_CHECK( boundTextures[2] == 10u );
2963 // Now texture ids have been set, we can monitor their render order.
2964 // render a as an overlay (last), so order will be:
2968 a.SetDrawMode( DrawMode::OVERLAY_2D );
2969 app.GetGlAbstraction().ClearBoundTextures();
2971 app.SendNotification();
2974 // Should be 3 texture changes.
2975 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
2976 if( boundTextures.size() == 3 )
2978 DALI_TEST_CHECK( boundTextures[0] == 9u );
2979 DALI_TEST_CHECK( boundTextures[1] == 10u );
2980 DALI_TEST_CHECK( boundTextures[2] == 8u );
2985 int UtcDaliActorGetCurrentWorldMatrix(void)
2987 TestApplication app;
2988 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
2990 Actor parent = Actor::New();
2991 parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
2992 parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
2993 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2994 Radian rotationAngle(Degree(85.0f));
2995 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2996 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2997 parent.SetPosition( parentPosition );
2998 parent.SetOrientation( parentRotation );
2999 parent.SetScale( parentScale );
3000 Stage::GetCurrent().Add( parent );
3002 Actor child = Actor::New();
3003 child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
3004 Vector3 childPosition( 0.0f, 0.0f, 100.0f );
3005 Radian childRotationAngle(Degree(23.0f));
3006 Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
3007 Vector3 childScale( 2.0f, 2.0f, 2.0f );
3008 child.SetPosition( childPosition );
3009 child.SetOrientation( childRotation );
3010 child.SetScale( childScale );
3011 parent.Add( child );
3013 app.SendNotification();
3016 app.SendNotification();
3018 Matrix parentMatrix(false);
3019 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3021 Matrix childMatrix(false);
3022 childMatrix.SetTransformComponents( childScale, childRotation, childPosition );
3024 //Child matrix should be the composition of child and parent
3025 Matrix childWorldMatrix(false);
3026 Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix);
3028 DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION );
3029 DALI_TEST_EQUALS( child.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), childWorldMatrix, 0.001, TEST_LOCATION );
3035 int UtcDaliActorConstrainedToWorldMatrix(void)
3037 TestApplication app;
3038 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
3040 Actor parent = Actor::New();
3041 parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
3042 parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
3043 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
3044 Radian rotationAngle(Degree(85.0f));
3045 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3046 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
3047 parent.SetPosition( parentPosition );
3048 parent.SetOrientation( parentRotation );
3049 parent.SetScale( parentScale );
3050 Stage::GetCurrent().Add( parent );
3052 Actor child = Actor::New();
3053 child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
3054 Constraint posConstraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, PositionComponentConstraint() );
3055 posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) );
3056 posConstraint.Apply();
3058 Stage::GetCurrent().Add( child );
3060 app.SendNotification();
3063 app.SendNotification();
3065 Matrix parentMatrix(false);
3066 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
3068 DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION );
3069 DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001, TEST_LOCATION );
3073 int UtcDaliActorConstrainedToOrientation(void)
3075 TestApplication app;
3076 tet_infoline(" UtcDaliActorConstrainedToOrientation");
3078 Actor parent = Actor::New();
3079 parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
3080 parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
3081 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
3082 Radian rotationAngle(Degree(85.0f));
3083 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
3084 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
3085 parent.SetPosition( parentPosition );
3086 parent.SetOrientation( parentRotation );
3087 parent.SetScale( parentScale );
3088 Stage::GetCurrent().Add( parent );
3090 Actor child = Actor::New();
3091 child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
3092 Constraint posConstraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() );
3093 posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) );
3094 posConstraint.Apply();
3096 Stage::GetCurrent().Add( child );
3098 app.SendNotification();
3101 app.SendNotification();
3103 DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION );
3107 int UtcDaliActorConstrainedToOpacity(void)
3109 TestApplication app;
3110 tet_infoline(" UtcDaliActorConstrainedToOpacity");
3112 Actor parent = Actor::New();
3113 parent.SetProperty( DevelActor::Property::OPACITY, 0.7f );
3114 Stage::GetCurrent().Add( parent );
3116 Actor child = Actor::New();
3117 Constraint opacityConstraint = Constraint::New<float>( child, DevelActor::Property::OPACITY, EqualToConstraint() );
3118 opacityConstraint.AddSource( Source( parent, DevelActor::Property::OPACITY ) );
3119 opacityConstraint.Apply();
3121 Stage::GetCurrent().Add( child );
3123 app.SendNotification();
3126 app.SendNotification();
3128 DALI_TEST_EQUALS( child.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), parent.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.001f, TEST_LOCATION );
3130 parent.SetProperty( DevelActor::Property::OPACITY, 0.3f );
3132 app.SendNotification();
3135 app.SendNotification();
3137 DALI_TEST_EQUALS( child.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), parent.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.001f, TEST_LOCATION );
3142 int UtcDaliActorUnparent(void)
3144 TestApplication app;
3145 tet_infoline(" UtcDaliActorUnparent");
3147 Actor parent = Actor::New();
3148 Stage::GetCurrent().Add( parent );
3150 Actor child = Actor::New();
3152 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
3153 DALI_TEST_CHECK( !child.GetParent() );
3155 // Test that calling Unparent with no parent is a NOOP
3158 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
3159 DALI_TEST_CHECK( !child.GetParent() );
3161 // Test that Unparent works
3162 parent.Add( child );
3164 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
3165 DALI_TEST_CHECK( parent == child.GetParent() );
3169 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
3170 DALI_TEST_CHECK( !child.GetParent() );
3172 // Test that UnparentAndReset works
3173 parent.Add( child );
3175 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
3176 DALI_TEST_CHECK( parent == child.GetParent() );
3178 UnparentAndReset( child );
3180 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
3181 DALI_TEST_CHECK( !child );
3183 // Test that UnparentAndReset is a NOOP with empty handle
3184 UnparentAndReset( child );
3186 DALI_TEST_CHECK( !child );
3190 int UtcDaliActorGetChildAt(void)
3192 TestApplication app;
3193 tet_infoline(" UtcDaliActorGetChildAt");
3195 Actor parent = Actor::New();
3196 Stage::GetCurrent().Add( parent );
3198 Actor child0 = Actor::New();
3199 parent.Add( child0 );
3201 Actor child1 = Actor::New();
3202 parent.Add( child1 );
3204 Actor child2 = Actor::New();
3205 parent.Add( child2 );
3207 DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
3208 DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
3209 DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
3213 int UtcDaliActorSetGetOverlay(void)
3215 TestApplication app;
3216 tet_infoline(" UtcDaliActorSetGetOverlay");
3218 Actor parent = Actor::New();
3219 parent.SetDrawMode(DrawMode::OVERLAY_2D );
3220 DALI_TEST_CHECK( parent.GetDrawMode() == DrawMode::OVERLAY_2D );
3225 int UtcDaliActorCreateDestroy(void)
3227 Actor* actor = new Actor;
3228 DALI_TEST_CHECK( actor );
3235 struct PropertyStringIndex
3237 const char * const name;
3238 const Property::Index index;
3239 const Property::Type type;
3242 const PropertyStringIndex PROPERTY_TABLE[] =
3244 { "parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3 },
3245 { "parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT },
3246 { "parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT },
3247 { "parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT },
3248 { "anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3 },
3249 { "anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT },
3250 { "anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT },
3251 { "anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT },
3252 { "size", Actor::Property::SIZE, Property::VECTOR3 },
3253 { "sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT },
3254 { "sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT },
3255 { "sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT },
3256 { "position", Actor::Property::POSITION, Property::VECTOR3 },
3257 { "positionX", Actor::Property::POSITION_X, Property::FLOAT },
3258 { "positionY", Actor::Property::POSITION_Y, Property::FLOAT },
3259 { "positionZ", Actor::Property::POSITION_Z, Property::FLOAT },
3260 { "worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3 },
3261 { "worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT },
3262 { "worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT },
3263 { "worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT },
3264 { "orientation", Actor::Property::ORIENTATION, Property::ROTATION },
3265 { "worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION },
3266 { "scale", Actor::Property::SCALE, Property::VECTOR3 },
3267 { "scaleX", Actor::Property::SCALE_X, Property::FLOAT },
3268 { "scaleY", Actor::Property::SCALE_Y, Property::FLOAT },
3269 { "scaleZ", Actor::Property::SCALE_Z, Property::FLOAT },
3270 { "worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3 },
3271 { "visible", Actor::Property::VISIBLE, Property::BOOLEAN },
3272 { "color", Actor::Property::COLOR, Property::VECTOR4 },
3273 { "colorRed", Actor::Property::COLOR_RED, Property::FLOAT },
3274 { "colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT },
3275 { "colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT },
3276 { "colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT },
3277 { "worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4 },
3278 { "worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX },
3279 { "name", Actor::Property::NAME, Property::STRING },
3280 { "sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN },
3281 { "leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN },
3282 { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN },
3283 { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN },
3284 { "colorMode", Actor::Property::COLOR_MODE, Property::STRING },
3285 { "drawMode", Actor::Property::DRAW_MODE, Property::STRING },
3286 { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 },
3287 { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING },
3288 { "heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING },
3289 { "sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::STRING },
3290 { "widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN },
3291 { "heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN },
3292 { "padding", Actor::Property::PADDING, Property::VECTOR4 },
3293 { "minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2 },
3294 { "maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2 },
3295 { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN },
3296 { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING },
3297 { "opacity", DevelActor::Property::OPACITY, Property::FLOAT },
3299 const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
3300 } // unnamed namespace
3302 int UtcDaliActorProperties(void)
3304 TestApplication app;
3306 Actor actor = Actor::New();
3308 for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
3310 tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index );
3311 DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION );
3312 DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION );
3313 DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION );
3318 int UtcDaliRelayoutProperties_ResizePolicies(void)
3320 TestApplication app;
3322 Actor actor = Actor::New();
3325 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
3326 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
3328 // Set resize policy for all dimensions
3329 actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
3330 for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
3332 DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
3335 // Set individual dimensions
3336 const char* const widthPolicy = "FILL_TO_PARENT";
3337 const char* const heightPolicy = "FIXED";
3339 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy );
3340 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy );
3342 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
3343 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
3345 // Set individual dimensions using enums
3346 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
3347 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
3349 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum );
3350 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum );
3352 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION );
3353 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION );
3358 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
3360 TestApplication app;
3362 Actor actor = Actor::New();
3365 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), "USE_SIZE_SET", TEST_LOCATION );
3366 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
3368 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
3369 actor.SetSizeScalePolicy( policy );
3370 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), policy, TEST_LOCATION );
3373 const char* const policy1 = "FIT_WITH_ASPECT_RATIO";
3374 const char* const policy2 = "FILL_WITH_ASPECT_RATIO";
3376 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
3377 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy1, TEST_LOCATION );
3379 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
3380 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy2, TEST_LOCATION );
3385 int UtcDaliRelayoutProperties_SizeModeFactor(void)
3387 TestApplication app;
3389 Actor actor = Actor::New();
3392 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
3393 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
3395 Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
3396 actor.SetSizeModeFactor( sizeMode );
3397 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), sizeMode, TEST_LOCATION );
3400 Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
3402 actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
3403 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
3408 int UtcDaliRelayoutProperties_DimensionDependency(void)
3410 TestApplication app;
3412 Actor actor = Actor::New();
3415 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
3416 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
3419 actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
3420 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
3422 actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
3423 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
3425 // Test setting another resize policy
3426 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
3427 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
3432 int UtcDaliRelayoutProperties_Padding(void)
3434 TestApplication app;
3436 Actor actor = Actor::New();
3439 Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
3442 actor.SetProperty( Actor::Property::PADDING, padding );
3443 Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
3445 DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3450 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
3452 TestApplication app;
3454 Actor actor = Actor::New();
3457 Vector2 minSize( 1.0f, 2.0f );
3459 actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
3460 Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
3462 DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3464 Vector2 maxSize( 3.0f, 4.0f );
3466 actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
3467 Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
3469 DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3474 int UtcDaliActorGetHeightForWidth(void)
3476 TestApplication app;
3478 Actor actor = Actor::New();
3480 DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
3485 int UtcDaliActorGetWidthForHeight(void)
3487 TestApplication app;
3489 Actor actor = Actor::New();
3491 DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
3496 int UtcDaliActorGetRelayoutSize(void)
3498 TestApplication app;
3500 Actor actor = Actor::New();
3502 // Add actor to stage
3503 Stage::GetCurrent().Add( actor );
3505 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
3507 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
3508 actor.SetSize( Vector2( 1.0f, 0.0f ) );
3510 // Flush the queue and render once
3511 app.SendNotification();
3514 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
3519 int UtcDaliActorSetPadding(void)
3521 TestApplication app;
3523 Actor actor = Actor::New();
3526 actor.GetPadding( padding );
3528 DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
3529 DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
3530 DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
3531 DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
3533 Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
3534 actor.SetPadding( padding2 );
3536 actor.GetPadding( padding );
3538 DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
3539 DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
3540 DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
3541 DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
3546 int UtcDaliActorSetMinimumSize(void)
3548 TestApplication app;
3550 Actor actor = Actor::New();
3552 Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
3554 DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
3555 DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
3557 Vector2 size2( 1.0f, 2.0f );
3558 actor.SetProperty( Actor::Property::MINIMUM_SIZE, size2 );
3560 size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
3562 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3563 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3568 int UtcDaliActorSetMaximumSize(void)
3570 TestApplication app;
3572 Actor actor = Actor::New();
3574 Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
3576 DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
3577 DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
3579 Vector2 size2( 1.0f, 2.0f );
3580 actor.SetProperty( Actor::Property::MAXIMUM_SIZE, size2 );
3582 size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
3584 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3585 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3590 int UtcDaliActorOnRelayoutSignal(void)
3592 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3594 TestApplication application;
3597 gOnRelayoutCallBackCalled = false;
3598 gActorNamesRelayout.clear();
3600 Actor actor = Actor::New();
3601 actor.SetProperty( Actor::Property::NAME, "actor" );
3602 actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
3605 DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
3607 // Add actor to stage
3608 Stage::GetCurrent().Add( actor );
3610 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3611 actor.SetSize( Vector2( 1.0f, 2.0 ) );
3613 // Flush the queue and render once
3614 application.SendNotification();
3615 application.Render();
3617 // OnRelayout emitted
3618 DALI_TEST_EQUALS( gOnRelayoutCallBackCalled, true, TEST_LOCATION );
3619 DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
3624 int UtcDaliActorGetHierachyDepth(void)
3626 TestApplication application;
3627 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3630 /* Build tree of actors:
3640 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3642 Stage stage( Stage::GetCurrent() );
3644 Actor actorA = Actor::New();
3645 Actor actorB = Actor::New();
3646 Actor actorC = Actor::New();
3647 Actor actorD = Actor::New();
3648 Actor actorE = Actor::New();
3649 Actor actorF = Actor::New();
3651 //Test that root actor has depth equal 0
3652 DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetHierarchyDepth(), TEST_LOCATION );
3654 //Test actors return depth -1 when not connected to the tree
3655 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3656 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3657 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3658 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3659 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3660 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3662 //Create the hierarchy
3663 stage.Add( actorA );
3664 actorA.Add( actorB );
3665 actorA.Add( actorC );
3666 actorB.Add( actorD );
3667 actorB.Add( actorE );
3668 actorC.Add( actorF );
3670 //Test actors return correct depth
3671 DALI_TEST_EQUALS( 1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3672 DALI_TEST_EQUALS( 2, actorB.GetHierarchyDepth(), TEST_LOCATION );
3673 DALI_TEST_EQUALS( 2, actorC.GetHierarchyDepth(), TEST_LOCATION );
3674 DALI_TEST_EQUALS( 3, actorD.GetHierarchyDepth(), TEST_LOCATION );
3675 DALI_TEST_EQUALS( 3, actorE.GetHierarchyDepth(), TEST_LOCATION );
3676 DALI_TEST_EQUALS( 3, actorF.GetHierarchyDepth(), TEST_LOCATION );
3678 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3679 actorA.Remove( actorB );
3681 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3682 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3683 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3685 //Removing actorA from the stage. All actors should have depth equal -1
3686 stage.Remove( actorA );
3688 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3689 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3690 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3691 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3692 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3693 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3698 int UtcDaliActorAnchorPointPropertyAsString(void)
3700 TestApplication application;
3702 Actor actor = Actor::New();
3704 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
3705 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3707 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
3708 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3710 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
3711 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3713 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
3714 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3716 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
3717 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER, TEST_LOCATION );
3719 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
3720 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3722 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
3723 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3725 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
3726 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3728 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
3729 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3731 // Invalid should not change anything
3732 actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
3733 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3738 int UtcDaliActorParentOriginPropertyAsString(void)
3740 TestApplication application;
3742 Actor actor = Actor::New();
3744 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
3745 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3747 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
3748 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3750 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
3751 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3753 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
3754 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3756 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
3757 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER, TEST_LOCATION );
3759 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
3760 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3762 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
3763 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3765 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
3766 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3768 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
3769 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3771 // Invalid should not change anything
3772 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
3773 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3778 int UtcDaliActorColorModePropertyAsString(void)
3780 TestApplication application;
3782 Actor actor = Actor::New();
3784 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
3785 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3787 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
3788 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3790 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
3791 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3793 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
3794 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3796 // Invalid should not change anything
3797 actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
3798 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3803 int UtcDaliActorDrawModePropertyAsString(void)
3805 TestApplication application;
3807 Actor actor = Actor::New();
3809 actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
3810 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3812 actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
3813 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3815 // Invalid should not change anything
3816 actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
3817 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3822 int UtcDaliActorColorModePropertyAsEnum(void)
3824 TestApplication application;
3826 Actor actor = Actor::New();
3828 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
3829 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3831 actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
3832 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3834 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
3835 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3837 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
3838 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3843 int UtcDaliActorDrawModePropertyAsEnum(void)
3845 TestApplication application;
3847 Actor actor = Actor::New();
3849 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
3850 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3852 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
3853 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3858 int UtcDaliActorAddRendererP(void)
3860 tet_infoline("Testing Actor::AddRenderer");
3861 TestApplication application;
3863 Actor actor = Actor::New();
3865 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3867 Geometry geometry = CreateQuadGeometry();
3868 Shader shader = CreateShader();
3869 Renderer renderer = Renderer::New(geometry, shader);
3871 actor.AddRenderer( renderer );
3872 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3873 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3878 int UtcDaliActorAddRendererN(void)
3880 tet_infoline("Testing Actor::AddRenderer");
3881 TestApplication application;
3883 Actor actor = Actor::New();
3889 actor.AddRenderer( renderer );
3890 tet_printf("Assertion test failed - no Exception\n" );
3891 tet_result(TET_FAIL);
3893 catch(Dali::DaliException& e)
3895 DALI_TEST_PRINT_ASSERT( e );
3896 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3897 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3901 tet_printf("Assertion test failed - wrong Exception\n" );
3902 tet_result(TET_FAIL);
3908 int UtcDaliActorAddRendererOnStage(void)
3910 tet_infoline("Testing Actor::AddRenderer");
3911 TestApplication application;
3913 Actor actor = Actor::New();
3914 Stage::GetCurrent().Add(actor);
3916 application.SendNotification();
3917 application.Render(0);
3919 Geometry geometry = CreateQuadGeometry();
3920 Shader shader = CreateShader();
3921 Renderer renderer = Renderer::New(geometry, shader);
3923 application.SendNotification();
3924 application.Render(0);
3928 actor.AddRenderer( renderer );
3929 tet_result(TET_PASS);
3933 tet_result(TET_FAIL);
3939 int UtcDaliActorRemoveRendererP1(void)
3941 tet_infoline("Testing Actor::RemoveRenderer");
3942 TestApplication application;
3944 Actor actor = Actor::New();
3946 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3949 Geometry geometry = CreateQuadGeometry();
3950 Shader shader = CreateShader();
3951 Renderer renderer = Renderer::New(geometry, shader);
3953 actor.AddRenderer( renderer );
3954 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3955 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3957 application.SendNotification();
3958 application.Render();
3962 Renderer renderer = actor.GetRendererAt(0);
3963 actor.RemoveRenderer(renderer);
3964 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3966 application.SendNotification();
3967 application.Render();
3970 // Call one final time to ensure that the renderer is actually removed after
3971 // the handle goes out of scope, and excercises the deletion code path in
3972 // scene graph and render.
3973 application.SendNotification();
3974 application.Render();
3979 int UtcDaliActorRemoveRendererP2(void)
3981 tet_infoline("Testing Actor::RemoveRenderer");
3982 TestApplication application;
3984 Actor actor = Actor::New();
3986 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3988 Geometry geometry = CreateQuadGeometry();
3989 Shader shader = CreateShader();
3990 Renderer renderer = Renderer::New(geometry, shader);
3992 actor.AddRenderer( renderer );
3993 application.SendNotification();
3994 application.Render();
3996 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3997 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3999 actor.RemoveRenderer(0);
4000 application.SendNotification();
4001 application.Render();
4003 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
4005 // Shut down whilst holding onto the renderer handle.
4010 int UtcDaliActorRemoveRendererN(void)
4012 tet_infoline("Testing Actor::RemoveRenderer");
4013 TestApplication application;
4015 Actor actor = Actor::New();
4017 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
4019 Geometry geometry = CreateQuadGeometry();
4020 Shader shader = CreateShader();
4021 Renderer renderer = Renderer::New(geometry, shader);
4023 actor.AddRenderer( renderer );
4024 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
4025 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
4027 actor.RemoveRenderer(10);
4028 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
4029 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
4034 // Clipping test helper functions:
4035 Actor CreateActorWithContent( uint32_t width, uint32_t height)
4037 BufferImage image = BufferImage::New( width, height );
4038 Actor actor = CreateRenderableActor( image );
4040 // Setup dimensions and position so actor is not skipped by culling.
4041 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
4042 actor.SetSize( width, height );
4043 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4044 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4049 Actor CreateActorWithContent16x16()
4051 return CreateActorWithContent( 16, 16 );
4054 void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace )
4056 enabledDisableTrace.Reset();
4057 stencilTrace.Reset();
4058 enabledDisableTrace.Enable( true );
4059 stencilTrace.Enable( true );
4061 application.SendNotification();
4062 application.Render();
4064 enabledDisableTrace.Enable( false );
4065 stencilTrace.Enable( false );
4068 void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue )
4070 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
4072 DALI_TEST_EQUALS<bool>( colorMaskParams.red, maskValue, TEST_LOCATION );
4073 DALI_TEST_EQUALS<bool>( colorMaskParams.green, maskValue, TEST_LOCATION );
4074 DALI_TEST_EQUALS<bool>( colorMaskParams.blue, maskValue, TEST_LOCATION );
4075 DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, maskValue, TEST_LOCATION );
4078 int UtcDaliActorPropertyClippingP(void)
4080 // This test checks the clippingMode property.
4081 tet_infoline( "Testing Actor::Property::ClippingMode: P" );
4082 TestApplication application;
4084 Actor actor = Actor::New();
4086 // Check default clippingEnabled value.
4087 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
4090 bool getValueResult = getValue.Get( value );
4091 DALI_TEST_CHECK( getValueResult );
4093 if( getValueResult )
4095 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4098 // Check setting the property to the stencil mode.
4099 actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4101 // Check the new value was set.
4102 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4103 getValueResult = getValue.Get( value );
4104 DALI_TEST_CHECK( getValueResult );
4106 if( getValueResult )
4108 DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION );
4111 // Check setting the property to the scissor mode.
4112 actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4114 // Check the new value was set.
4115 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4116 getValueResult = getValue.Get( value );
4117 DALI_TEST_CHECK( getValueResult );
4119 if( getValueResult )
4121 DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION );
4126 int UtcDaliActorPropertyClippingN(void)
4128 // Negative test case for Clipping.
4129 tet_infoline( "Testing Actor::Property::ClippingMode: N" );
4130 TestApplication application;
4132 Actor actor = Actor::New();
4134 // Check default clippingEnabled value.
4135 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
4138 bool getValueResult = getValue.Get( value );
4139 DALI_TEST_CHECK( getValueResult );
4141 if( getValueResult )
4143 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4146 // Check setting an invalid property value won't change the current property value.
4147 actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" );
4149 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
4150 getValueResult = getValue.Get( value );
4151 DALI_TEST_CHECK( getValueResult );
4153 if( getValueResult )
4155 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
4161 int UtcDaliActorPropertyClippingActor(void)
4163 // This test checks that an actor is correctly setup for clipping.
4164 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor" );
4165 TestApplication application;
4167 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4168 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4169 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4170 size_t startIndex = 0u;
4172 // Create a clipping actor.
4173 Actor actorDepth1Clip = CreateActorWithContent16x16();
4174 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4175 Stage::GetCurrent().Add( actorDepth1Clip );
4177 // Gather the call trace.
4178 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4180 // Check we are writing to the color buffer.
4181 CheckColorMask( glAbstraction, true );
4183 // Check the stencil buffer was enabled.
4184 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
4186 // Check the stencil buffer was cleared.
4187 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4189 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4190 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4191 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
4192 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4197 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
4199 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
4200 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable" );
4201 TestApplication application;
4203 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4204 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4205 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4206 size_t startIndex = 0u;
4208 // Create a clipping actor.
4209 Actor actorDepth1Clip = CreateActorWithContent16x16();
4210 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4211 Stage::GetCurrent().Add( actorDepth1Clip );
4213 // Gather the call trace.
4214 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4216 // Check we are writing to the color buffer.
4217 CheckColorMask( glAbstraction, true );
4219 // Check the stencil buffer was enabled.
4220 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
4222 // Check the stencil buffer was cleared.
4223 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4225 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4226 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4227 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
4228 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4230 // Now disable the clipping
4231 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
4233 // Gather the call trace.
4234 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4236 // Check the stencil buffer was disabled.
4237 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) ); // 2960 is GL_STENCIL_TEST
4239 // Ensure all values in stencil-mask are set to 1.
4241 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
4246 int UtcDaliActorPropertyClippingNestedChildren(void)
4248 // This test checks that a hierarchy of actors are clipped correctly by
4249 // writing to and reading from the correct bit-planes of the stencil buffer.
4250 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children" );
4251 TestApplication application;
4252 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4253 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4254 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4256 // Create a clipping actor.
4257 Actor actorDepth1Clip = CreateActorWithContent16x16();
4258 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4259 Stage::GetCurrent().Add( actorDepth1Clip );
4261 // Create a child actor.
4262 Actor childDepth2 = CreateActorWithContent16x16();
4263 actorDepth1Clip.Add( childDepth2 );
4265 // Create another clipping actor.
4266 Actor childDepth2Clip = CreateActorWithContent16x16();
4267 childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4268 childDepth2.Add( childDepth2Clip );
4270 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
4271 // This tests the sort algorithm.
4272 Actor childDepth3 = CreateActorWithContent16x16();
4273 childDepth2Clip.Add( childDepth3 );
4274 Actor childDepth4 = CreateActorWithContent16x16();
4275 childDepth3.Add( childDepth4 );
4277 // Gather the call trace.
4278 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4280 // Check we are writing to the color buffer.
4281 CheckColorMask( glAbstraction, true );
4283 // Check the stencil buffer was enabled.
4284 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
4286 // Perform the test twice, once for 2D layer, and once for 3D.
4287 for( unsigned int i = 0u ; i < 2u; ++i )
4289 size_t startIndex = 0u;
4291 // Check the stencil buffer was cleared.
4292 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
4294 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
4295 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
4296 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); // Write to the first bit-plane
4297 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4299 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
4300 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 255", startIndex ) ); // 514 is GL_EQUAL
4301 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
4303 // Check we are set up to write to the second bitplane of the stencil buffer (only).
4304 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 1", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4305 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "3", startIndex ) ); // Write to second (and previous) bit-planes
4306 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
4308 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
4309 // (Both must be set to pass the check).
4310 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 255", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
4311 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
4313 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
4316 Stage::GetCurrent().GetRootLayer().SetBehavior( Layer::LAYER_3D );
4317 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4324 int UtcDaliActorPropertyClippingActorDrawOrder(void)
4326 // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
4327 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order" );
4328 TestApplication application;
4329 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4330 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4332 /* We create a small tree of actors as follows:
4336 Clipping enabled -> B D
4340 The correct draw order is "ABCDE" (the same as if clipping was not enabled).
4343 for( int i = 0; i < 5; ++i )
4345 BufferImage image = BufferImage::New( 16u, 16u );
4346 Actor actor = CreateRenderableActor( image );
4348 // Setup dimensions and position so actor is not skipped by culling.
4349 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
4350 actor.SetSize( 16.0f, 16.0f );
4354 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4358 float b = i > 2 ? 1.0f : -1.0f;
4359 actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5 + ( 0.2f * b ), 0.8f, 0.8f ) );
4365 // Enable clipping on the actor at the top of the left branch.
4366 actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4368 // Build the scene graph.
4369 Stage::GetCurrent().Add( actors[0] );
4372 actors[0].Add( actors[1] );
4373 actors[1].Add( actors[2] );
4376 actors[0].Add( actors[3] );
4377 actors[3].Add( actors[4] );
4379 // Gather the call trace.
4380 enabledDisableTrace.Reset();
4381 enabledDisableTrace.Enable( true );
4382 application.SendNotification();
4383 application.Render();
4384 enabledDisableTrace.Enable( false );
4386 /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
4388 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
4389 Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
4391 size_t startIndex = 0u;
4392 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "3042", startIndex ) );
4393 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) ); // 2960 is GL_STENCIL_TEST
4394 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
4396 // Swap the clipping actor from top of left branch to top of right branch.
4397 actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
4398 actors[3].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4400 // Gather the call trace.
4401 enabledDisableTrace.Reset();
4402 enabledDisableTrace.Enable( true );
4403 application.SendNotification();
4404 application.Render();
4405 enabledDisableTrace.Enable( false );
4407 // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
4408 // This proves the draw order has remained the same.
4410 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) );
4411 DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
4416 int UtcDaliActorPropertyScissorClippingActor(void)
4418 // This test checks that an actor is correctly setup for clipping.
4419 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor" );
4420 TestApplication application;
4422 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4423 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4424 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4426 const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4427 const Vector2 imageSize( 16.0f, 16.0f );
4429 // Create a clipping actor.
4430 Actor clippingActorA = CreateActorWithContent16x16();
4431 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4432 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4433 clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
4434 clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
4435 clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4436 Stage::GetCurrent().Add( clippingActorA );
4438 // Gather the call trace.
4439 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4441 // Check we are writing to the color buffer.
4442 CheckColorMask( glAbstraction, true );
4444 // Check scissor test was enabled.
4445 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4447 // Check the scissor was set, and the coordinates are correct.
4448 std::stringstream compareParametersString;
4449 compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
4450 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 0, 0, 16, 16
4452 clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
4453 clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
4455 // Gather the call trace.
4456 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4458 // Check the scissor was set, and the coordinates are correct.
4459 compareParametersString.str( std::string() );
4460 compareParametersString.clear();
4461 compareParametersString << ( stageSize.x - imageSize.x ) << ", " << ( stageSize.y - imageSize.y ) << ", " << imageSize.x << ", " << imageSize.y;
4462 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 464, 784, 16, 16
4467 int UtcDaliActorPropertyScissorClippingActorSiblings(void)
4469 // This test checks that an actor is correctly setup for clipping.
4470 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings" );
4471 TestApplication application;
4474 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4475 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4476 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4478 const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4479 const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
4480 const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
4482 // Create a clipping actors.
4483 Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
4484 Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
4486 clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4487 clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4488 clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4490 clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4491 clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4492 clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4494 clippingActorA.SetPosition( 0.0f, -200.0f, 0.0f );
4495 clippingActorB.SetPosition( 0.0f, 0.0f, 0.0f );
4497 Stage::GetCurrent().Add( clippingActorA );
4498 Stage::GetCurrent().Add( clippingActorB );
4500 // Gather the call trace.
4501 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4503 // Check we are writing to the color buffer.
4504 CheckColorMask( glAbstraction, true );
4506 // Check scissor test was enabled.
4507 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4509 // Check the scissor was set, and the coordinates are correct.
4510 std::stringstream compareParametersString;
4512 std::string clipA( "0, 500, 480, 200" );
4513 std::string clipB( "0, 380, 480, 40" );
4515 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
4516 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
4521 int UtcDaliActorPropertyScissorClippingActorNested01(void)
4523 // This test checks that an actor is correctly setup for clipping.
4524 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
4525 TestApplication application;
4527 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4528 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4529 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4531 const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4532 const Vector2 imageSize( 16.0f, 16.0f );
4534 /* Create a nest of 2 scissors to test nesting (intersecting clips).
4536 A is drawn first - with scissor clipping on
4537 B is drawn second - also with scissor clipping on
4538 C is the generated clipping region, the intersection ( A ∩ B )
4542 ┌───╂┄┄┄┐ ┃ ┌┄┄┄╆━━━┓ │
4543 │ ┃ ┊ ┃ ━━━━━> ┊ ┃ C ┃ │
4544 │ ┗━━━┿━━━┛ ┊ ┗━━━╃───┘
4548 We then reposition B around each corner of A to test the 4 overlap combinations (thus testing intersecting works correctly).
4551 // Create a clipping actor.
4552 Actor clippingActorA = CreateActorWithContent16x16();
4553 // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
4554 // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
4555 clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4556 clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4557 clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4558 Stage::GetCurrent().Add( clippingActorA );
4560 // Create a child clipping actor.
4561 Actor clippingActorB = CreateActorWithContent16x16();
4562 clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4563 clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4564 clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4565 clippingActorA.Add( clippingActorB );
4567 // positionModifiers is an array of positions to position B around.
4568 // expect is an array of expected scissor clip coordinate results.
4569 const Vector2 positionModifiers[4] = { Vector2( 1.0f, 1.0f ), Vector2( -1.0f, 1.0f ), Vector2( -1.0f, -1.0f ), Vector2( 1.0f, -1.0f ) };
4570 const Vector4 expect[4] = { Vector4( 240, 392, 8, 8 ), Vector4( 232, 392, 8, 8 ), Vector4( 232, 400, 8, 8 ), Vector4( 240, 400, 8, 8 ) };
4572 // Loop through each overlap combination.
4573 for( unsigned int test = 0u; test < 4u; ++test )
4575 // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
4576 const Vector2 position = ( imageSize / 2.0f ) * positionModifiers[test];
4577 clippingActorB.SetPosition( position.x, position.y );
4579 // Gather the call trace.
4580 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4582 // Check we are writing to the color buffer.
4583 CheckColorMask( glAbstraction, true );
4585 // Check scissor test was enabled.
4586 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4588 // Check the scissor was set, and the coordinates are correct.
4589 const Vector4& expectResults( expect[test] );
4590 std::stringstream compareParametersString;
4591 compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
4592 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with the expected result
4598 int UtcDaliActorPropertyScissorClippingActorNested02(void)
4600 // This test checks that an actor is correctly setup for clipping.
4601 tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
4602 TestApplication application;
4604 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4605 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4606 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4608 /* Create a nest of 2 scissors and siblings of the parent.
4618 const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
4619 const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
4620 const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
4621 const Vector2 sizeC{ stageSize.width, stageSize.height * 0.25f };
4622 const Vector2 sizeD{ stageSize.width, stageSize.height * 0.25f };
4623 const Vector2 sizeE{ stageSize.width, stageSize.height * 0.05f };
4625 // Create a clipping actors.
4626 Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
4627 Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
4628 Actor clippingActorC = CreateActorWithContent( sizeC.width, sizeC.height );
4629 Actor clippingActorD = CreateActorWithContent( sizeD.width, sizeD.height );
4630 Actor clippingActorE = CreateActorWithContent( sizeE.width, sizeE.height );
4632 clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4633 clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4634 clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4636 clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4637 clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4638 clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4640 clippingActorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4641 clippingActorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4642 clippingActorC.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4644 clippingActorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4645 clippingActorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4646 clippingActorD.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4648 clippingActorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
4649 clippingActorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
4651 clippingActorA.SetPosition( 0.0f, -200.0f, 0.0f );
4652 clippingActorB.SetPosition( 0.0f, 0.0f, 0.0f );
4653 clippingActorC.SetPosition( 0.0f, 100.0f, 0.0f );
4654 clippingActorD.SetPosition( 0.0f, 0.0f, 0.0f );
4655 clippingActorE.SetPosition( 0.0f, 0.0f, 0.0f );
4657 Stage::GetCurrent().Add( clippingActorA );
4658 clippingActorA.Add( clippingActorB );
4659 Stage::GetCurrent().Add( clippingActorC );
4660 Stage::GetCurrent().Add( clippingActorD );
4661 clippingActorD.Add( clippingActorE );
4663 // Gather the call trace.
4664 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4666 // Check we are writing to the color buffer.
4667 CheckColorMask( glAbstraction, true );
4669 // Check scissor test was enabled.
4670 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4672 // Check the scissor was set, and the coordinates are correct.
4673 std::string clipA( "0, 500, 480, 200" );
4674 std::string clipB( "0, 580, 480, 40" );
4675 std::string clipC( "0, 200, 480, 200" );
4676 std::string clipD( "0, 300, 480, 200" );
4678 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
4679 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
4680 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipC ) );
4681 DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipD ) );
4682 DALI_TEST_CHECK( scissorTrace.CountMethod( "Scissor" ) == 4 ); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
4687 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
4689 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
4690 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" );
4691 TestApplication application;
4693 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4694 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
4695 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
4697 // Create a clipping actor.
4698 Actor actorDepth1Clip = CreateActorWithContent16x16();
4699 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
4700 Stage::GetCurrent().Add( actorDepth1Clip );
4702 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
4703 actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
4705 // Gather the call trace.
4706 GenerateTrace( application, enabledDisableTrace, stencilTrace );
4708 // Check we are writing to the color buffer.
4709 CheckColorMask( glAbstraction, true );
4711 // Check the stencil buffer was not enabled.
4712 DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
4714 // Check stencil functions are not called.
4715 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) );
4716 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) );
4717 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) );
4719 // Check that scissor clipping is overriden by the renderer properties.
4720 TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
4722 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
4724 // Gather the call trace.
4725 GenerateTrace( application, enabledDisableTrace, scissorTrace );
4727 // Check the stencil buffer was not enabled.
4728 DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
4730 DALI_TEST_CHECK( !scissorTrace.FindMethod( "StencilFunc" ) );
4735 int UtcDaliGetPropertyN(void)
4737 tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" );
4738 TestApplication app;
4740 Actor actor = Actor::New();
4742 unsigned int propertyCount = actor.GetPropertyCount();
4743 DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );
4747 int UtcDaliActorRaiseLower(void)
4749 tet_infoline( "UtcDaliActor Raise and Lower test\n" );
4751 TestApplication application;
4753 Debug::Filter::SetGlobalLogLevel( Debug::Verbose );
4755 Stage stage( Stage::GetCurrent() );
4757 Actor actorA = Actor::New();
4758 Actor actorB = Actor::New();
4759 Actor actorC = Actor::New();
4761 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4762 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4764 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4765 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4767 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4768 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4770 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4771 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4773 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4774 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4776 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4777 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4779 stage.Add( actorA );
4780 stage.Add( actorB );
4781 stage.Add( actorC );
4783 ResetTouchCallbacks();
4785 application.SendNotification();
4786 application.Render();
4788 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4789 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4790 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
4792 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4793 // Only top actor will get touched.
4794 actorA.TouchSignal().Connect( TestTouchCallback );
4795 actorB.TouchSignal().Connect( TestTouchCallback2 );
4796 actorC.TouchSignal().Connect( TestTouchCallback3 );
4798 // Connect ChildOrderChangedSignal
4799 bool orderChangedSignal( false );
4800 Actor orderChangedActor;
4801 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
4802 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
4804 Dali::Integration::Point point;
4805 point.SetDeviceId( 1 );
4806 point.SetState( PointState::DOWN );
4807 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
4808 Dali::Integration::TouchEvent touchEvent;
4809 touchEvent.AddPoint( point );
4811 application.ProcessEvent( touchEvent );
4813 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4814 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4815 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
4817 ResetTouchCallbacks();
4819 tet_printf( "Testing Raising of Actor\n" );
4821 int preActorOrder( 0 );
4822 int postActorOrder( 0 );
4824 Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4825 value.Get( preActorOrder );
4827 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4829 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4830 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
4832 // Ensure sort order is calculated before next touch event
4833 application.SendNotification();
4835 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4836 value.Get( postActorOrder );
4838 tet_printf( "Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
4840 application.ProcessEvent( touchEvent );
4842 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4843 DALI_TEST_EQUALS( gTouchCallBackCalled2, true , TEST_LOCATION );
4844 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
4846 ResetTouchCallbacks();
4848 tet_printf( "Testing Lowering of Actor\n" );
4850 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4851 value.Get( preActorOrder );
4853 orderChangedSignal = false;
4855 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4857 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4858 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
4860 application.SendNotification(); // ensure sort order calculated before next touch event
4862 value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
4863 value.Get( postActorOrder );
4865 tet_printf( "Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
4867 application.ProcessEvent( touchEvent );
4869 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4870 DALI_TEST_EQUALS( gTouchCallBackCalled2, false , TEST_LOCATION );
4871 DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
4873 ResetTouchCallbacks();
4875 Debug::Filter::SetGlobalLogLevel( Debug::NoLogging );
4880 int UtcDaliActorRaiseToTopLowerToBottom(void)
4882 tet_infoline( "UtcDaliActorRaiseToTop and LowerToBottom test \n" );
4884 TestApplication application;
4886 Stage stage( Stage::GetCurrent() );
4888 Actor actorA = Actor::New();
4889 Actor actorB = Actor::New();
4890 Actor actorC = Actor::New();
4892 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
4893 // enables checking of which actor the uniform is assigned too
4894 Shader shaderA = CreateShader();
4895 shaderA.RegisterProperty( "uRendererColor",1.f);
4897 Shader shaderB = CreateShader();
4898 shaderB.RegisterProperty( "uRendererColor", 2.f );
4900 Shader shaderC = CreateShader();
4901 shaderC.RegisterProperty( "uRendererColor", 3.f );
4903 Geometry geometry = CreateQuadGeometry();
4905 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
4906 Renderer rendererA = Renderer::New(geometry, shaderA);
4907 actorA.AddRenderer(rendererA);
4909 Renderer rendererB = Renderer::New(geometry, shaderB);
4910 actorB.AddRenderer(rendererB);
4912 Renderer rendererC = Renderer::New(geometry, shaderC);
4913 actorC.AddRenderer(rendererC);
4915 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4916 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4918 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4919 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4921 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
4922 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
4924 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4925 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4927 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4928 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4930 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
4931 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
4933 stage.Add( actorA );
4934 stage.Add( actorB );
4935 stage.Add( actorC );
4937 ResetTouchCallbacks();
4939 // Connect ChildOrderChangedSignal
4940 bool orderChangedSignal( false );
4941 Actor orderChangedActor;
4942 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
4943 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
4945 // Set up gl abstraction trace so can query the set uniform order
4946 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
4947 glAbstraction.EnableSetUniformCallTrace(true);
4948 glAbstraction.ResetSetUniformCallStack();
4950 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
4952 application.SendNotification();
4953 application.Render();
4955 tet_printf( "Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str() );
4958 // Test order of uniforms in stack
4959 int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
4960 int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
4961 int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
4963 bool CBA = ( indexC > indexB) && ( indexB > indexA );
4965 DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
4967 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4968 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4969 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
4971 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
4972 // Only top actor will get touched.
4973 actorA.TouchSignal().Connect( TestTouchCallback );
4974 actorB.TouchSignal().Connect( TestTouchCallback2 );
4975 actorC.TouchSignal().Connect( TestTouchCallback3 );
4977 Dali::Integration::Point point;
4978 point.SetDeviceId( 1 );
4979 point.SetState( PointState::DOWN );
4980 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
4981 Dali::Integration::TouchEvent touchEvent;
4982 touchEvent.AddPoint( point );
4984 application.ProcessEvent( touchEvent );
4986 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
4987 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
4988 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
4990 ResetTouchCallbacks();
4992 tet_printf( "RaiseToTop ActorA\n" );
4994 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
4995 actorA.RaiseToTop();
4996 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
4997 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
4999 application.SendNotification(); // ensure sorting order is calculated before next touch event
5001 application.ProcessEvent( touchEvent );
5003 glAbstraction.ResetSetUniformCallStack();
5004 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5006 application.SendNotification();
5007 application.Render();
5009 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5011 // Test order of uniforms in stack
5012 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5013 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5014 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5016 tet_infoline( "Testing A above C and B at bottom\n" );
5017 bool ACB = ( indexA > indexC) && ( indexC > indexB );
5019 DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
5021 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5022 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5023 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5025 ResetTouchCallbacks();
5027 tet_printf( "RaiseToTop ActorB\n" );
5029 orderChangedSignal = false;
5031 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5032 actorB.RaiseToTop();
5033 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5034 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5036 application.SendNotification(); // Ensure sort order is calculated before next touch event
5038 application.ProcessEvent( touchEvent );
5040 glAbstraction.ResetSetUniformCallStack();
5041 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5043 application.SendNotification();
5044 application.Render();
5046 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5048 // Test order of uniforms in stack
5049 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5050 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5051 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5053 tet_infoline( "Testing B above A and C at bottom\n" );
5054 bool BAC = ( indexB > indexA ) && ( indexA > indexC );
5056 DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
5058 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5059 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5060 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5062 ResetTouchCallbacks();
5064 tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" );
5066 orderChangedSignal = false;
5068 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5069 actorA.LowerToBottom();
5070 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5071 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5073 application.SendNotification();
5074 application.Render();
5076 orderChangedSignal = false;
5078 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5079 actorB.LowerToBottom();
5080 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5081 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5083 application.SendNotification();
5084 application.Render();
5086 application.ProcessEvent( touchEvent );
5088 glAbstraction.ResetSetUniformCallStack();
5089 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5091 application.SendNotification();
5092 application.Render();
5094 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5096 // Test order of uniforms in stack
5097 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5098 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5099 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5101 tet_infoline( "Testing C above A and B at bottom\n" );
5102 bool CAB = ( indexC > indexA ) && ( indexA > indexB );
5104 DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
5106 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5107 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5108 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5110 ResetTouchCallbacks();
5115 int UtcDaliActorRaiseAbove(void)
5117 tet_infoline( "UtcDaliActor RaiseToAbove test \n" );
5119 TestApplication application;
5121 Stage stage( Stage::GetCurrent() );
5123 Actor actorA = Actor::New();
5124 Actor actorB = Actor::New();
5125 Actor actorC = Actor::New();
5127 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5128 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5130 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5131 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5133 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5134 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5136 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5137 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5139 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5140 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5142 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5143 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5145 stage.Add( actorA );
5146 stage.Add( actorB );
5147 stage.Add( actorC );
5149 ResetTouchCallbacks();
5151 application.SendNotification();
5152 application.Render();
5154 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5155 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5156 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5158 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5159 // Only top actor will get touched.
5160 actorA.TouchSignal().Connect( TestTouchCallback );
5161 actorB.TouchSignal().Connect( TestTouchCallback2 );
5162 actorC.TouchSignal().Connect( TestTouchCallback3 );
5164 bool orderChangedSignal( false );
5165 Actor orderChangedActor;
5166 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5167 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5169 Dali::Integration::Point point;
5170 point.SetDeviceId( 1 );
5171 point.SetState( PointState::DOWN );
5172 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5173 Dali::Integration::TouchEvent touchEvent;
5174 touchEvent.AddPoint( point );
5176 application.ProcessEvent( touchEvent );
5178 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5179 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5180 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5182 ResetTouchCallbacks();
5184 tet_printf( "Raise actor B Above Actor C\n" );
5186 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5187 actorB.RaiseAbove( actorC );
5188 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5189 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5191 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5192 application.SendNotification();
5193 application.ProcessEvent( touchEvent );
5195 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5196 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5197 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5199 ResetTouchCallbacks();
5201 tet_printf( "Raise actor A Above Actor B\n" );
5203 orderChangedSignal = false;
5205 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5206 actorA.RaiseAbove( actorB );
5207 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5208 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5210 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5211 application.SendNotification();
5213 application.ProcessEvent( touchEvent ); // process a touch event on ordered actors.
5215 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5216 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5217 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5219 ResetTouchCallbacks();
5224 int UtcDaliActorLowerBelow(void)
5226 tet_infoline( "UtcDaliActor LowerBelow test \n" );
5228 TestApplication application;
5230 Stage stage( Stage::GetCurrent() );
5232 // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
5233 // enables checking of which actor the uniform is assigned too
5234 Shader shaderA = CreateShader();
5235 shaderA.RegisterProperty( "uRendererColor",1.f);
5237 Shader shaderB = CreateShader();
5238 shaderB.RegisterProperty( "uRendererColor", 2.f );
5240 Shader shaderC = CreateShader();
5241 shaderC.RegisterProperty( "uRendererColor", 3.f );
5243 Actor actorA = Actor::New();
5244 Actor actorB = Actor::New();
5245 Actor actorC = Actor::New();
5247 // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
5248 Geometry geometry = CreateQuadGeometry();
5250 Renderer rendererA = Renderer::New(geometry, shaderA);
5251 actorA.AddRenderer(rendererA);
5253 Renderer rendererB = Renderer::New(geometry, shaderB);
5254 actorB.AddRenderer(rendererB);
5256 Renderer rendererC = Renderer::New(geometry, shaderC);
5257 actorC.AddRenderer(rendererC);
5259 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5260 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5262 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5263 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5265 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5266 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5268 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5269 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5271 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5272 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5274 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5275 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5277 Actor container = Actor::New();
5278 container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5279 container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
5280 stage.Add( container );
5282 container.Add( actorA );
5283 container.Add( actorB );
5284 container.Add( actorC );
5286 ResetTouchCallbacks();
5288 // Connect ChildOrderChangedSignal
5289 bool orderChangedSignal( false );
5290 Actor orderChangedActor;
5291 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5292 DevelActor::ChildOrderChangedSignal( container ).Connect( &application, f ) ;
5294 // Set up gl abstraction trace so can query the set uniform order
5295 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
5296 glAbstraction.EnableSetUniformCallTrace(true);
5297 glAbstraction.ResetSetUniformCallStack();
5298 TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
5300 glAbstraction.ResetSetUniformCallStack();
5302 application.SendNotification();
5303 application.Render();
5305 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5307 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5309 // Test order of uniforms in stack
5310 int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5311 int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5312 int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5314 tet_infoline( "Testing C above B and A at bottom\n" );
5315 bool CBA = ( indexC > indexB) && ( indexB > indexA );
5317 DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
5319 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5320 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5321 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5323 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5324 // Only top actor will get touched.
5325 actorA.TouchSignal().Connect( TestTouchCallback );
5326 actorB.TouchSignal().Connect( TestTouchCallback2 );
5327 actorC.TouchSignal().Connect( TestTouchCallback3 );
5329 Dali::Integration::Point point;
5330 point.SetDeviceId( 1 );
5331 point.SetState( PointState::DOWN );
5332 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5333 Dali::Integration::TouchEvent touchEvent;
5334 touchEvent.AddPoint( point );
5336 tet_infoline( "UtcDaliActor Test Set up completed \n" );
5338 application.ProcessEvent( touchEvent );
5340 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5341 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5342 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5344 ResetTouchCallbacks();
5346 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" );
5348 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5349 actorC.LowerBelow( actorB );
5350 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5351 DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
5353 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5354 application.SendNotification();
5355 application.Render();
5357 application.ProcessEvent( touchEvent ); // touch event
5359 glAbstraction.ResetSetUniformCallStack();
5360 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5362 application.SendNotification();
5363 application.Render();
5365 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5367 // Test order of uniforms in stack
5368 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5369 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5370 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5372 tet_infoline( "Testing render order is A, C, B" );
5373 DALI_TEST_EQUALS( indexC > indexA, true, TEST_LOCATION );
5374 DALI_TEST_EQUALS( indexB > indexC, true, TEST_LOCATION );
5376 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5377 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5378 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5380 ResetTouchCallbacks();
5382 tet_printf( "Lower actor C below Actor A leaving B on top\n" );
5384 orderChangedSignal = false;
5386 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5387 actorC.LowerBelow( actorA );
5388 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5389 DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
5391 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5392 application.SendNotification();
5393 application.Render();
5395 application.ProcessEvent( touchEvent );
5397 glAbstraction.ResetSetUniformCallStack();
5398 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5400 application.Render();
5401 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5403 // Test order of uniforms in stack
5404 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5405 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5406 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5408 DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
5409 DALI_TEST_EQUALS( indexB > indexA, true, TEST_LOCATION );
5411 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5412 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5413 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5415 ResetTouchCallbacks();
5417 tet_printf( "Lower actor B below Actor C leaving A on top\n" );
5419 orderChangedSignal = false;
5421 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5422 actorB.LowerBelow( actorC );
5423 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5424 DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
5426 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5427 application.SendNotification();
5428 application.Render();
5430 application.ProcessEvent( touchEvent );
5432 glAbstraction.ResetSetUniformCallStack();
5433 glSetUniformStack = glAbstraction.GetSetUniformTrace();
5435 application.Render();
5436 tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
5438 // Test order of uniforms in stack
5439 indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
5440 indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
5441 indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
5443 DALI_TEST_EQUALS( indexC > indexB, true, TEST_LOCATION );
5444 DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
5450 int UtcDaliActorRaiseAboveDifferentParentsN(void)
5452 tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" );
5454 TestApplication application;
5456 Stage stage( Stage::GetCurrent() );
5458 Actor parentA = Actor::New();
5459 Actor parentB = Actor::New();
5460 parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5461 parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5462 parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5463 parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5465 parentA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5466 parentA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5468 parentB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5469 parentB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5471 stage.Add( parentA );
5472 stage.Add( parentB );
5474 Actor actorA = Actor::New();
5475 Actor actorB = Actor::New();
5476 Actor actorC = Actor::New();
5478 parentA.Add( actorA );
5479 parentA.Add( actorB );
5481 tet_printf( "Actor C added to different parent from A and B \n" );
5482 parentB.Add( actorC );
5484 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5485 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5487 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5488 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5490 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5491 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5493 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5494 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5496 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5497 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5499 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5500 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5502 ResetTouchCallbacks();
5504 // Connect ChildOrderChangedSignal
5505 bool orderChangedSignal( false );
5506 Actor orderChangedActor;
5507 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5508 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5510 application.SendNotification();
5511 application.Render();
5513 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5514 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5515 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5517 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5518 // Only top actor will get touched.
5519 actorA.TouchSignal().Connect( TestTouchCallback );
5520 actorB.TouchSignal().Connect( TestTouchCallback2 );
5521 actorC.TouchSignal().Connect( TestTouchCallback3 );
5523 Dali::Integration::Point point;
5524 point.SetDeviceId( 1 );
5525 point.SetState( PointState::DOWN );
5526 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5527 Dali::Integration::TouchEvent touchEvent;
5528 touchEvent.AddPoint( point );
5530 application.ProcessEvent( touchEvent );
5532 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5533 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5534 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5536 ResetTouchCallbacks();
5538 tet_printf( "Raise actor A Above Actor C which have different parents\n" );
5540 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5541 actorA.RaiseAbove( actorC );
5542 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5544 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5545 application.SendNotification();
5547 application.ProcessEvent( touchEvent ); // touch event
5549 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5550 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5551 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5553 ResetTouchCallbacks();
5558 int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
5560 tet_infoline( "UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n" );
5562 TestApplication application;
5564 Stage stage( Stage::GetCurrent() );
5566 Actor actorA = Actor::New();
5567 Actor actorB = Actor::New();
5568 Actor actorC = Actor::New();
5570 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5571 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5573 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5574 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5576 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5577 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5579 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5580 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5582 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5583 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5585 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5586 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5588 ResetTouchCallbacks();
5590 // Connect ChildOrderChangedSignal
5591 bool orderChangedSignal( false );
5592 Actor orderChangedActor;
5593 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5594 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5596 application.SendNotification();
5597 application.Render();
5599 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5600 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5601 DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
5603 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5604 // Only top actor will get touched.
5605 actorA.TouchSignal().Connect( TestTouchCallback );
5606 actorB.TouchSignal().Connect( TestTouchCallback2 );
5607 actorC.TouchSignal().Connect( TestTouchCallback3 );
5609 Dali::Integration::Point point;
5610 point.SetDeviceId( 1 );
5611 point.SetState( PointState::DOWN );
5612 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5613 Dali::Integration::TouchEvent touchEvent;
5614 touchEvent.AddPoint( point );
5616 tet_printf( "Raise actor A Above Actor C which have no parents\n" );
5618 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5619 actorA.RaiseAbove( actorC );
5620 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5622 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5623 application.SendNotification();
5625 application.ProcessEvent( touchEvent );
5627 tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5629 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5630 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5631 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5633 ResetTouchCallbacks();
5635 orderChangedSignal = false;
5637 stage.Add ( actorB );
5638 tet_printf( "Lower actor A below Actor C when only A is not on stage \n" );
5640 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5641 actorA.LowerBelow( actorC );
5642 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5644 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5645 application.SendNotification();
5646 application.Render();
5648 application.ProcessEvent( touchEvent );
5650 tet_printf( "Actor A not parented so LowerBelow should show no effect\n" );
5651 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5652 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5653 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5655 ResetTouchCallbacks();
5657 orderChangedSignal = false;
5659 tet_printf( "Adding Actor A to stage, will be on top\n" );
5661 stage.Add ( actorA );
5662 application.SendNotification();
5663 application.Render();
5665 tet_printf( "Raise actor B Above Actor C when only B has a parent\n" );
5667 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5668 actorB.RaiseAbove( actorC );
5669 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5671 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5672 application.SendNotification();
5674 application.ProcessEvent( touchEvent );
5676 tet_printf( "C not parented so RaiseAbove should show no effect\n" );
5677 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5678 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5679 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5681 ResetTouchCallbacks();
5683 orderChangedSignal = false;
5685 tet_printf( "Lower actor A below Actor C when only A has a parent\n" );
5687 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5688 actorA.LowerBelow( actorC );
5689 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5691 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5692 application.SendNotification();
5694 application.ProcessEvent( touchEvent );
5696 tet_printf( "C not parented so LowerBelow should show no effect\n" );
5697 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5698 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5699 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5701 ResetTouchCallbacks();
5703 orderChangedSignal = false;
5705 stage.Add ( actorC );
5707 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5708 actorA.RaiseAbove( actorC );
5709 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5710 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5712 // Ensure sorting happens at end of Core::ProcessEvents() before next touch
5713 application.SendNotification();
5714 application.Render();
5716 application.ProcessEvent( touchEvent );
5718 tet_printf( "Raise actor A Above Actor C, now both have same parent \n" );
5719 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5720 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5721 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5726 int UtcDaliActorTestAllAPIwhenActorNotParented(void)
5728 tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" );
5730 TestApplication application;
5732 Stage stage( Stage::GetCurrent() );
5734 Actor actorA = Actor::New();
5735 Actor actorB = Actor::New();
5736 Actor actorC = Actor::New();
5738 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5739 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5741 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5742 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5744 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5745 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5747 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5748 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5750 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5751 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5753 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5754 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5756 ResetTouchCallbacks();
5758 // Connect ChildOrderChangedSignal
5759 bool orderChangedSignal( false );
5760 Actor orderChangedActor;
5761 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5762 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5764 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5765 // Only top actor will get touched.
5766 actorA.TouchSignal().Connect( TestTouchCallback );
5767 actorB.TouchSignal().Connect( TestTouchCallback2 );
5768 actorC.TouchSignal().Connect( TestTouchCallback3 );
5770 Dali::Integration::Point point;
5771 point.SetDeviceId( 1 );
5772 point.SetState( PointState::DOWN );
5773 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5774 Dali::Integration::TouchEvent touchEvent;
5775 touchEvent.AddPoint( point );
5777 stage.Add ( actorA );
5778 tet_printf( "Raise actor B Above Actor C but B not parented\n" );
5780 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5782 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5784 application.SendNotification();
5785 application.Render();
5787 application.ProcessEvent( touchEvent );
5789 tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5791 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5792 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5793 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5795 tet_printf( "Raise actor B Above Actor C but B not parented\n" );
5796 ResetTouchCallbacks();
5798 orderChangedSignal = false;
5800 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5802 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5804 // Sort actor tree before next touch event
5805 application.SendNotification();
5806 application.Render();
5808 application.ProcessEvent( touchEvent );
5810 tet_printf( "Not parented so RaiseAbove should show no effect\n" );
5812 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5813 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5814 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5815 ResetTouchCallbacks();
5817 orderChangedSignal = false;
5819 tet_printf( "Lower actor C below B but C not parented\n" );
5821 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5823 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5825 // Sort actor tree before next touch event
5826 application.SendNotification();
5827 application.Render();
5829 application.ProcessEvent( touchEvent );
5831 tet_printf( "Not parented so Lower should show no effect\n" );
5833 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5834 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5835 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5836 ResetTouchCallbacks();
5838 orderChangedSignal = false;
5840 tet_printf( "Raise actor B to top\n" );
5842 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5843 actorB.RaiseToTop();
5844 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5846 // Sort actor tree before next touch event
5847 application.SendNotification();
5848 application.Render();
5850 application.ProcessEvent( touchEvent );
5852 tet_printf( "Not parented so RaiseToTop should show no effect\n" );
5854 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5855 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5856 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5857 ResetTouchCallbacks();
5859 orderChangedSignal = false;
5861 tet_printf( "Add ActorB to stage so only Actor C not parented\n" );
5863 stage.Add ( actorB );
5865 tet_printf( "Lower actor C to Bottom, B stays at top\n" );
5867 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5868 actorC.LowerToBottom();
5869 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5871 application.SendNotification();
5872 application.Render();
5874 application.ProcessEvent( touchEvent );
5876 tet_printf( "Not parented so LowerToBottom should show no effect\n" );
5878 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5879 DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
5880 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5881 ResetTouchCallbacks();
5887 int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
5889 tet_infoline( "UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n" );
5891 TestApplication application;
5893 Stage stage( Stage::GetCurrent() );
5895 Actor actorA = Actor::New();
5896 Actor actorB = Actor::New();
5897 Actor actorC = Actor::New();
5899 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5900 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5902 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5903 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5905 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
5906 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
5908 actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5909 actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5911 actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5912 actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5914 actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
5915 actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
5917 stage.Add( actorA );
5918 stage.Add( actorB );
5919 stage.Add( actorC );
5921 // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
5922 // Only top actor will get touched.
5923 actorA.TouchSignal().Connect( TestTouchCallback );
5924 actorB.TouchSignal().Connect( TestTouchCallback2 );
5925 actorC.TouchSignal().Connect( TestTouchCallback3 );
5927 ResetTouchCallbacks();
5929 // Connect ChildOrderChangedSignal
5930 bool orderChangedSignal( false );
5931 Actor orderChangedActor;
5932 ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
5933 DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
5935 application.SendNotification();
5936 application.Render();
5938 Dali::Integration::Point point;
5939 point.SetDeviceId( 1 );
5940 point.SetState( PointState::DOWN );
5941 point.SetScreenPosition( Vector2( 10.f, 10.f ) );
5942 Dali::Integration::TouchEvent touchEvent;
5943 touchEvent.AddPoint( point );
5945 application.ProcessEvent( touchEvent );
5947 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5948 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5949 DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
5951 ResetTouchCallbacks();
5953 tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" );
5955 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5956 actorA.RaiseAbove( actorA );
5957 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5958 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5960 application.SendNotification();
5961 application.Render();
5963 application.ProcessEvent( touchEvent );
5965 tet_infoline( "No target is source Actor so RaiseAbove should show no effect\n" );
5967 DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
5968 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5969 DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
5971 ResetTouchCallbacks();
5973 orderChangedSignal = false;
5975 DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
5976 actorA.RaiseAbove( actorC );
5977 DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
5978 DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
5980 application.SendNotification();
5981 application.Render();
5983 application.ProcessEvent( touchEvent );
5985 tet_infoline( "Raise actor A Above Actor C which will now be successful \n" );
5986 DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
5987 DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
5988 DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
5993 int UtcDaliActorGetScreenPosition(void)
5995 tet_infoline( "UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n" );
5997 TestApplication application;
5999 Stage stage( Stage::GetCurrent() );
6001 Actor actorA = Actor::New();
6002 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6004 Vector2 size2( 10.0f, 20.0f );
6005 actorA.SetSize( size2 );
6007 actorA.SetPosition( 0.f, 0.f );
6009 tet_infoline( "UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n" );
6011 stage.Add( actorA );
6013 application.SendNotification();
6014 application.Render();
6016 Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6017 Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6019 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
6020 tet_printf( "Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y );
6022 DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
6023 DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
6025 tet_infoline( "UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n" );
6027 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6029 application.SendNotification();
6030 application.Render();
6032 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6033 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6035 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
6036 tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y );
6038 DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
6039 DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
6041 tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n" );
6043 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6045 application.SendNotification();
6046 application.Render();
6048 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6049 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6051 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
6052 tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y );
6054 DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
6055 DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
6057 tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n" );
6059 actorA.SetPosition( 30.0, 0.0 );
6061 application.SendNotification();
6062 application.Render();
6064 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6065 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6067 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y );
6068 tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y );
6070 DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
6071 DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
6073 tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n" );
6075 actorA.SetPosition( 30.0, 420.0 );
6077 application.SendNotification();
6078 application.Render();
6080 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6081 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6083 DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
6084 DALI_TEST_EQUALS( actorScreenPosition.y, 420lu , TEST_LOCATION );
6086 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y );
6087 tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y );
6089 tet_infoline( "UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n" );
6091 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6092 actorA.SetPosition( 30.0, 30.0 );
6094 Actor actorB = Actor::New();
6095 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6096 actorB.SetSize( size2 );
6097 actorB.SetPosition( 10.f, 10.f );
6098 actorA.Add( actorB );
6100 actorA.SetScale( 2.0f );
6102 application.SendNotification();
6103 application.Render();
6105 actorScreenPosition = actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6107 DALI_TEST_EQUALS( actorScreenPosition.x, 50lu , TEST_LOCATION );
6108 DALI_TEST_EQUALS( actorScreenPosition.y, 50lu , TEST_LOCATION );
6113 int UtcDaliActorGetScreenPositionAfterScaling(void)
6115 tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n" );
6117 TestApplication application;
6119 Stage stage( Stage::GetCurrent() );
6121 Actor actorA = Actor::New();
6122 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6124 Vector2 size2( 10.0f, 20.0f );
6125 actorA.SetSize( size2 );
6126 actorA.SetScale( 1.5f );
6127 actorA.SetPosition( 0.f, 0.f );
6129 tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n" );
6131 stage.Add( actorA );
6133 application.SendNotification();
6134 application.Render();
6136 Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6137 Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6139 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
6140 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6142 DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
6143 DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
6145 tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n" );
6147 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6149 application.SendNotification();
6150 application.Render();
6152 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6153 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6155 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
6156 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6158 DALI_TEST_EQUALS( actorScreenPosition.x , 0.0f , TEST_LOCATION );
6159 DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
6164 int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
6166 tet_infoline( "UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n" );
6168 TestApplication application;
6170 Stage stage( Stage::GetCurrent() );
6172 Actor actorA = Actor::New();
6173 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6174 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6175 Vector2 size2( 10.0f, 20.0f );
6176 actorA.SetSize( size2 );
6177 actorA.SetPosition( 0.f, 0.f );
6179 tet_infoline( " TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6181 stage.Add( actorA );
6183 application.SendNotification();
6184 application.Render();
6186 Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6187 Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6189 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
6190 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6192 DALI_TEST_EQUALS( actorScreenPosition.x, 240.0f , TEST_LOCATION );
6193 DALI_TEST_EQUALS( actorScreenPosition.y, 400.0f , TEST_LOCATION );
6195 tet_infoline( " BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n" );
6197 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
6198 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6200 application.SendNotification();
6201 application.Render();
6203 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6204 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6206 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
6207 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6209 DALI_TEST_EQUALS( actorScreenPosition.x , 480.0f , TEST_LOCATION );
6210 DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
6216 int UtcDaliActorGetScreenPositionWithChildActors(void)
6218 tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n" );
6220 TestApplication application;
6222 Stage stage( Stage::GetCurrent() );
6224 tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6226 Actor actorA = Actor::New();
6227 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6228 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6229 Vector2 size1( 10.0f, 20.0f );
6230 actorA.SetSize( size1 );
6231 actorA.SetPosition( 0.f, 0.f );
6233 tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6235 Actor parentActorA = Actor::New();
6236 parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6237 parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6238 Vector2 size2( 30.0f, 60.0f );
6239 parentActorA.SetSize( size2 );
6240 parentActorA.SetPosition( 0.f, 0.f );
6242 tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
6244 stage.Add( parentActorA );
6245 parentActorA.Add ( actorA );
6247 application.SendNotification();
6248 application.Render();
6250 Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6251 Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6253 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
6254 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6256 DALI_TEST_EQUALS( actorScreenPosition.x, 255.0f , TEST_LOCATION );
6257 DALI_TEST_EQUALS( actorScreenPosition.y, 430.0f , TEST_LOCATION );
6259 tet_infoline( "Test 2\n");
6261 tet_infoline( "change parent anchor point and parent origin then check screen position \n" );
6263 parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
6264 parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
6266 application.SendNotification();
6267 application.Render();
6269 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6270 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6272 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
6273 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6275 DALI_TEST_EQUALS( actorScreenPosition.x, 15.0f , TEST_LOCATION );
6276 DALI_TEST_EQUALS( actorScreenPosition.y, -30.0f , TEST_LOCATION );
6281 int UtcDaliActorGetScreenPositionWithChildActors02(void)
6283 tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n" );
6285 TestApplication application;
6287 Stage stage( Stage::GetCurrent() );
6289 tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6291 Actor actorA = Actor::New();
6292 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6293 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6294 Vector2 size1( 10.0f, 20.0f );
6295 actorA.SetSize( size1 );
6296 actorA.SetPosition( 0.f, 0.f );
6298 tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
6300 Actor parentActorA = Actor::New();
6301 parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6302 parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6303 Vector2 size2( 30.0f, 60.0f );
6304 parentActorA.SetSize( size2 );
6305 parentActorA.SetPosition( 0.f, 0.f );
6307 tet_infoline( "Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n" );
6309 Actor grandParentActorA = Actor::New();
6310 grandParentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
6311 grandParentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
6312 Vector2 size3( 60.0f, 120.0f );
6313 grandParentActorA.SetSize( size3 );
6314 grandParentActorA.SetPosition( 0.f, 0.f );
6316 tet_infoline( "Add Parent 1 to Grand Parent 1 \n" );
6318 stage.Add( grandParentActorA );
6319 grandParentActorA.Add ( parentActorA );
6321 tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
6323 parentActorA.Add ( actorA );
6325 application.SendNotification();
6326 application.Render();
6328 Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
6329 Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
6331 tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
6332 tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
6334 DALI_TEST_EQUALS( actorScreenPosition.x, 45.0f , TEST_LOCATION );
6335 DALI_TEST_EQUALS( actorScreenPosition.y, 770.0f , TEST_LOCATION );
6340 int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
6342 tet_infoline( "UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point" );
6344 TestApplication application;
6346 Stage stage( Stage::GetCurrent() );
6348 tet_infoline( "Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6350 Actor actorA = Actor::New();
6351 actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6352 actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6353 actorA.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6354 actorA.SetSize( 10.0f, 20.0f );
6355 stage.Add( actorA );
6357 tet_infoline( "Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6359 Actor actorB = Actor::New();
6360 actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6361 actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6362 actorB.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6363 Vector2 actorBSize( 30.0f, 60.0f );
6364 actorB.SetSize( actorBSize );
6365 stage.Add( actorB );
6367 tet_infoline( "Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
6369 Actor actorC = Actor::New();
6370 actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6371 actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6372 actorC.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6373 Vector2 actorCSize( 60.0f, 120.0f );
6374 actorC.SetSize( actorCSize );
6375 stage.Add( actorC );
6377 application.SendNotification();
6378 application.Render();
6380 tet_infoline( "Despite differing sizes and anchor-points, the screen position for all actors is the same");
6382 Vector2 center( stage.GetSize() * 0.5f );
6384 DALI_TEST_EQUALS( actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6385 DALI_TEST_EQUALS( actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6386 DALI_TEST_EQUALS( actorC.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
6388 tet_infoline( "Add scale to all actors" );
6390 actorA.SetScale( 2.0f );
6391 actorB.SetScale( 2.0f );
6392 actorC.SetScale( 2.0f );
6394 application.SendNotification();
6395 application.Render();
6397 DALI_TEST_EQUALS( actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center /* TOP_LEFT Anchor */, TEST_LOCATION );
6398 DALI_TEST_EQUALS( actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION );
6399 DALI_TEST_EQUALS( actorC.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION );
6404 int utcDaliActorPositionUsesAnchorPoint(void)
6406 TestApplication application;
6407 tet_infoline( "Check default behaviour\n" );
6409 Actor actor = Actor::New();
6410 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6411 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6412 actor.SetSize( 100.0f, 100.0f );
6413 Stage::GetCurrent().Add( actor );
6415 application.SendNotification();
6416 application.Render();
6418 tet_infoline( "Check that the world position is in the center\n" );
6419 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
6421 tet_infoline( "Set the position uses anchor point property to false\n" );
6422 actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6424 application.SendNotification();
6425 application.Render();
6427 tet_infoline( "Check that the world position has changed appropriately\n" );
6428 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6433 int utcDaliActorPositionUsesAnchorPointCheckScale(void)
6435 TestApplication application;
6436 tet_infoline( "Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6438 Actor actor = Actor::New();
6439 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6440 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6441 actor.SetSize( 100.0f, 100.0f );
6442 actor.SetScale( 2.0f );
6443 actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6444 Stage::GetCurrent().Add( actor );
6446 application.SendNotification();
6447 application.Render();
6449 tet_infoline( "Check the world position is the same as it would be without a scale\n" );
6450 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6452 tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6453 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6454 application.SendNotification();
6455 application.Render();
6456 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), TEST_LOCATION );
6458 tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6459 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6460 application.SendNotification();
6461 application.Render();
6462 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
6467 int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
6469 TestApplication application;
6470 tet_infoline( "Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6472 Actor actor = Actor::New();
6473 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6474 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6475 actor.SetSize( 100.0f, 100.0f );
6476 actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
6477 actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6478 Stage::GetCurrent().Add( actor );
6480 application.SendNotification();
6481 application.Render();
6483 tet_infoline( "Check the world position is the same as it would be without a rotation\n" );
6484 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6486 tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6487 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6488 application.SendNotification();
6489 application.Render();
6490 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6492 tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6493 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6494 application.SendNotification();
6495 application.Render();
6496 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 150.0f, 50.0f, 0.0f ), TEST_LOCATION );
6501 int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
6503 TestApplication application;
6504 tet_infoline( "Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6506 Actor actor = Actor::New();
6507 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6508 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6509 actor.SetSize( 100.0f, 100.0f );
6510 actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
6511 actor.SetScale( 2.0f );
6512 actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6513 Stage::GetCurrent().Add( actor );
6515 application.SendNotification();
6516 application.Render();
6518 tet_infoline( "Check the world position is the same as it would be without a scale and rotation\n" );
6519 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
6521 tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
6522 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6523 application.SendNotification();
6524 application.Render();
6525 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -100.0f, 100.0f, 0.0f ), TEST_LOCATION );
6527 tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
6528 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6529 application.SendNotification();
6530 application.Render();
6531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), TEST_LOCATION );
6536 int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
6538 TestApplication application;
6539 tet_infoline( "Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
6541 Actor parent = Actor::New();
6543 Stage::GetCurrent().Add( parent );
6544 Vector2 stageSize( Stage::GetCurrent().GetSize() );
6546 Actor actor = Actor::New();
6547 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
6548 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
6549 actor.SetSize( 100.0f, 100.0f );
6550 actor.SetProperty( Actor::Property::INHERIT_SCALE, false );
6551 actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
6552 actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
6553 parent.Add( actor );
6555 application.SendNotification();
6556 application.Render();
6558 const Vector3 expectedWorldPosition( -stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f );
6560 tet_infoline( "Check the world position is in the right place\n" );
6561 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6563 tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed" );
6564 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
6565 application.SendNotification();
6566 application.Render();
6567 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6569 tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed" );
6570 actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
6571 application.SendNotification();
6572 application.Render();
6573 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
6578 int utcDaliActorVisibilityChangeSignalSelf(void)
6580 TestApplication application;
6581 tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
6583 Actor actor = Actor::New();
6585 VisibilityChangedFunctorData data;
6586 DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
6588 actor.SetProperty( Actor::Property::VISIBLE, false );
6590 data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6592 tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
6595 actor.SetProperty( Actor::Property::VISIBLE, false );
6596 data.Check( false /* not called */, TEST_LOCATION );
6598 tet_infoline( "Change the visibility using properties, ensure called" );
6601 actor.SetProperty( Actor::Property::VISIBLE, true );
6602 data.Check( true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6604 tet_infoline( "Set the visibility to current using properties, ensure not called" );
6607 actor.SetProperty( Actor::Property::VISIBLE, true );
6608 data.Check( false /* not called */, TEST_LOCATION );
6613 int utcDaliActorVisibilityChangeSignalChildren(void)
6615 TestApplication application;
6616 tet_infoline( "Check that the visibility change signal is called for the children when the visibility changes for the parent" );
6618 Actor parent = Actor::New();
6619 Actor child = Actor::New();
6620 parent.Add( child );
6622 Actor grandChild = Actor::New();
6623 child.Add( grandChild );
6625 VisibilityChangedFunctorData parentData;
6626 VisibilityChangedFunctorData childData;
6627 VisibilityChangedFunctorData grandChildData;
6629 tet_infoline( "Only connect the child and grandchild, ensure they are called and not the parent" );
6630 DevelActor::VisibilityChangedSignal( child ).Connect( &application, VisibilityChangedFunctor( childData ) );
6631 DevelActor::VisibilityChangedSignal( grandChild ).Connect( &application, VisibilityChangedFunctor( grandChildData ) );
6633 parent.SetProperty( Actor::Property::VISIBLE, false );
6634 parentData.Check( false /* not called */, TEST_LOCATION );
6635 childData.Check( true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6636 grandChildData.Check( true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6638 tet_infoline( "Connect to the parent's signal as well and ensure all three are called" );
6641 grandChildData.Reset();
6643 DevelActor::VisibilityChangedSignal( parent ).Connect( &application, VisibilityChangedFunctor( parentData ) );
6645 parent.SetProperty( Actor::Property::VISIBLE, true );
6646 parentData.Check( true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6647 childData.Check( true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6648 grandChildData.Check( true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
6650 tet_infoline( "Ensure none of the functors are called if we attempt to change the visibility to what it already is at" );
6653 grandChildData.Reset();
6655 parent.SetProperty( Actor::Property::VISIBLE, true );
6656 parentData.Check( false /* not called */, TEST_LOCATION );
6657 childData.Check( false /* not called */, TEST_LOCATION );
6658 grandChildData.Check( false /* not called */, TEST_LOCATION );
6663 int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
6665 TestApplication application;
6666 tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" );
6668 Actor actor = Actor::New();
6669 Stage::GetCurrent().Add( actor );
6671 application.SendNotification();
6672 application.Render();
6674 VisibilityChangedFunctorData data;
6675 DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
6677 Animation animation = Animation::New( 1.0f );
6678 animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false );
6680 data.Check( false, TEST_LOCATION );
6681 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6682 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6684 tet_infoline( "Play the animation and check the property value" );
6687 data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
6688 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
6690 tet_infoline( "Animation not currently finished, so the current visibility should still be true" );
6691 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
6693 application.SendNotification();
6694 application.Render( 1100 ); // After the animation
6696 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
6702 int utcDaliActorVisibilityChangeSignalByName(void)
6704 TestApplication application;
6705 tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
6707 Actor actor = Actor::New();
6709 bool signalCalled=false;
6710 actor.ConnectSignal( &application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled) );
6711 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6712 actor.SetProperty( Actor::Property::VISIBLE, false );
6713 DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6715 tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
6716 signalCalled = false;
6717 actor.SetProperty( Actor::Property::VISIBLE, false );
6718 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6720 tet_infoline( "Change the visibility using properties, ensure called" );
6721 actor.SetProperty( Actor::Property::VISIBLE, true );
6722 DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6724 tet_infoline( "Set the visibility to current using properties, ensure not called" );
6725 signalCalled = false;
6727 actor.SetProperty( Actor::Property::VISIBLE, true );
6728 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6734 static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type )
6736 gLayoutDirectionType = type;
6739 int UtcDaliActorLayoutDirectionProperty(void)
6741 TestApplication application;
6742 tet_infoline( "Check layout direction property" );
6744 Actor actor0 = Actor::New();
6745 DALI_TEST_EQUALS( actor0.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6746 Stage::GetCurrent().Add( actor0 );
6748 application.SendNotification();
6749 application.Render();
6751 Actor actor1 = Actor::New();
6752 DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6753 Actor actor2 = Actor::New();
6754 DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6755 Actor actor3 = Actor::New();
6756 DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6757 Actor actor4 = Actor::New();
6758 DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6759 Actor actor5 = Actor::New();
6760 DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6761 Actor actor6 = Actor::New();
6762 DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6763 Actor actor7 = Actor::New();
6764 DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6765 Actor actor8 = Actor::New();
6766 DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6767 Actor actor9 = Actor::New();
6768 DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6770 actor1.Add( actor2 );
6771 gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
6772 actor2.LayoutDirectionChangedSignal().Connect( LayoutDirectionChanged );
6774 DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
6775 actor1.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6776 DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
6778 DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6779 DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6780 DALI_TEST_EQUALS( gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION );
6782 actor1.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
6783 actor0.Add( actor1 );
6784 DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6785 DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6787 Stage::GetCurrent().Add( actor3 );
6788 actor3.Add( actor4 );
6789 actor4.Add( actor5 );
6790 actor5.Add( actor6 );
6791 actor5.Add( actor7 );
6792 actor7.Add( actor8 );
6793 actor8.Add( actor9 );
6794 actor3.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6795 actor5.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6797 DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
6798 actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, false );
6799 DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
6801 actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6803 DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6804 DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6805 DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6806 DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6807 DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6808 DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6809 DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6811 actor8.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
6812 DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6813 DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6815 actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6816 DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6817 DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6818 DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
6820 actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
6821 DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6822 DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6828 struct LayoutDirectionFunctor
6830 LayoutDirectionFunctor(bool& signalCalled)
6831 : mSignalCalled( signalCalled )
6835 LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
6836 : mSignalCalled( rhs.mSignalCalled )
6842 mSignalCalled = true;
6845 bool& mSignalCalled;
6848 int UtcDaliActorLayoutDirectionSignal(void)
6850 TestApplication application;
6851 tet_infoline( "Check changing layout direction property sends a signal" );
6853 Actor actor = Actor::New();
6854 DALI_TEST_EQUALS( actor.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
6855 Stage::GetCurrent().Add( actor );
6856 bool signalCalled = false;
6857 LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
6859 actor.ConnectSignal( &application, "layoutDirectionChanged", layoutDirectionFunctor );
6860 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6862 // Test that writing the same value doesn't send a signal
6863 actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
6864 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6866 // Test that writing a different value sends the signal
6867 signalCalled = false;
6868 actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6869 DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
6871 signalCalled = false;
6872 actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
6873 DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
6878 struct ChildAddedSignalCheck
6880 ChildAddedSignalCheck( bool& signalReceived, Actor& childHandle )
6881 : mSignalReceived( signalReceived ),
6882 mChildHandle( childHandle )
6886 void operator() ( Actor childHandle )
6888 mSignalReceived = true;
6889 mChildHandle = childHandle;
6893 mSignalReceived = true;
6894 mChildHandle = Actor();
6897 bool& mSignalReceived;
6898 Actor& mChildHandle;
6901 int UtcDaliChildAddedSignalP1(void)
6903 TestApplication application;
6904 auto stage = Stage::GetCurrent();
6906 bool signalReceived=false;
6909 ChildAddedSignalCheck signal( signalReceived, childActor );
6910 DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
6911 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6913 auto actorA = Actor::New();
6914 stage.Add( actorA );
6915 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6916 DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
6917 signalReceived = false;
6919 auto actorB = Actor::New();
6920 stage.Add( actorB );
6921 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6922 DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
6928 int UtcDaliChildAddedSignalP2(void)
6930 TestApplication application;
6931 auto stage = Stage::GetCurrent();
6933 bool signalReceived=false;
6936 ChildAddedSignalCheck signal( signalReceived, childActor );
6937 tet_infoline( "Connect to childAdded signal by name" );
6939 stage.GetRootLayer().ConnectSignal( &application, "childAdded", signal );
6940 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6942 auto actorA = Actor::New();
6943 stage.Add( actorA );
6944 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6946 // Can't test which actor was added; signal signature is void() when connecting via name.
6947 signalReceived = false;
6949 auto actorB = Actor::New();
6950 stage.Add( actorB );
6951 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6956 int UtcDaliChildAddedSignalN(void)
6958 TestApplication application;
6959 auto stage = Stage::GetCurrent();
6961 bool signalReceived=false;
6964 ChildAddedSignalCheck signal( signalReceived, childActor );
6965 DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
6966 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6968 auto actorA = Actor::New();
6969 stage.Add( actorA );
6970 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
6971 DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
6972 signalReceived = false;
6974 auto actorB = Actor::New();
6975 actorA.Add( actorB );
6976 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
6981 struct ChildRemovedSignalCheck
6983 ChildRemovedSignalCheck( bool& signalReceived, Actor& childHandle )
6984 : mSignalReceived( signalReceived ),
6985 mChildHandle( childHandle )
6989 void operator() ( Actor childHandle )
6991 mSignalReceived = true;
6992 mChildHandle = childHandle;
6997 mSignalReceived = true;
7000 bool& mSignalReceived;
7001 Actor& mChildHandle;
7004 int UtcDaliChildRemovedSignalP1(void)
7006 TestApplication application;
7007 auto stage = Stage::GetCurrent();
7009 bool signalReceived=false;
7012 ChildRemovedSignalCheck signal( signalReceived, childActor );
7013 DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
7014 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7016 auto actorA = Actor::New();
7017 stage.Add( actorA );
7018 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7019 DALI_TEST_CHECK( !childActor );
7021 stage.Remove( actorA );
7022 DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
7023 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7025 signalReceived = false;
7026 auto actorB = Actor::New();
7027 stage.Add( actorB );
7028 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7030 stage.Remove( actorB );
7031 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7032 DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
7037 int UtcDaliChildRemovedSignalP2(void)
7039 TestApplication application;
7040 auto stage = Stage::GetCurrent();
7042 bool signalReceived=false;
7045 ChildAddedSignalCheck signal( signalReceived, childActor );
7046 tet_infoline( "Connect to childRemoved signal by name" );
7048 stage.GetRootLayer().ConnectSignal( &application, "childRemoved", signal );
7049 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7051 auto actorA = Actor::New();
7052 stage.Add( actorA );
7053 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7055 stage.Remove( actorA );
7056 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7058 signalReceived = false;
7059 auto actorB = Actor::New();
7060 stage.Add( actorB );
7061 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7063 stage.Remove( actorB );
7064 DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
7070 int UtcDaliChildRemovedSignalN(void)
7072 TestApplication application;
7073 auto stage = Stage::GetCurrent();
7075 bool signalReceived=false;
7078 ChildRemovedSignalCheck signal( signalReceived, childActor );
7079 DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
7080 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7082 auto actorA = Actor::New();
7083 stage.Add( actorA );
7085 auto actorB = Actor::New();
7086 actorA.Add( actorB );
7088 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7089 DALI_TEST_CHECK( ! childActor );
7091 actorA.Remove( actorB );
7092 DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
7097 int UtcDaliChildMovedSignalP(void)
7099 TestApplication application;
7100 auto stage = Stage::GetCurrent();
7102 bool addedASignalReceived = false;
7103 bool removedASignalReceived = false;
7104 bool addedBSignalReceived = false;
7105 bool removedBSignalReceived = false;
7108 auto actorA = Actor::New();
7109 auto actorB = Actor::New();
7110 stage.Add( actorA );
7111 stage.Add( actorB );
7113 ChildAddedSignalCheck addedSignalA( addedASignalReceived, childActor );
7114 ChildRemovedSignalCheck removedSignalA( removedASignalReceived, childActor );
7115 ChildAddedSignalCheck addedSignalB( addedBSignalReceived, childActor );
7116 ChildRemovedSignalCheck removedSignalB( removedBSignalReceived, childActor );
7118 DevelActor::ChildAddedSignal( actorA ).Connect( &application, addedSignalA );
7119 DevelActor::ChildRemovedSignal( actorA ).Connect( &application, removedSignalA );
7120 DevelActor::ChildAddedSignal( actorB ).Connect( &application, addedSignalB );
7121 DevelActor::ChildRemovedSignal( actorB ).Connect( &application, removedSignalB );
7123 DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
7124 DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7125 DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7126 DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7128 // Create a child of A
7130 auto child = Actor::New();
7131 actorA.Add( child );
7133 DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
7134 DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7135 DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7136 DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7137 DALI_TEST_EQUALS( childActor, child, TEST_LOCATION );
7140 addedASignalReceived = false;
7141 addedBSignalReceived = false;
7142 removedASignalReceived = false;
7143 removedBSignalReceived = false;
7145 actorB.Add( child ); // Expect this child to be re-parented
7146 DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
7147 DALI_TEST_EQUALS( removedASignalReceived, true, TEST_LOCATION );
7148 DALI_TEST_EQUALS( addedBSignalReceived, true, TEST_LOCATION );
7149 DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
7151 // Move child back to A:
7152 addedASignalReceived = false;
7153 addedBSignalReceived = false;
7154 removedASignalReceived = false;
7155 removedBSignalReceived = false;
7157 actorA.Add( child ); // Expect this child to be re-parented
7158 DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
7159 DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
7160 DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
7161 DALI_TEST_EQUALS( removedBSignalReceived, true, TEST_LOCATION );
7167 int utcDaliActorCulled(void)
7169 TestApplication application;
7170 auto stage = Stage::GetCurrent();
7172 tet_infoline( "Check that the actor is culled if the actor is out of the screen" );
7174 Actor actor = Actor::New();
7175 actor.SetSize( 10.0f, 10.0f );
7177 Geometry geometry = CreateQuadGeometry();
7178 Shader shader = CreateShader();
7179 Renderer renderer = Renderer::New(geometry, shader);
7180 actor.AddRenderer( renderer );
7184 application.SendNotification();
7185 application.Render( 0 );
7187 DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), false, TEST_LOCATION );
7189 PropertyNotification notification = actor.AddPropertyNotification( DevelActor::Property::CULLED, LessThanCondition( 0.5f ) );
7190 notification.SetNotifyMode( PropertyNotification::NotifyOnChanged );
7192 // Connect NotifySignal
7193 bool propertyNotificationSignal( false );
7194 PropertyNotification source;
7195 CulledPropertyNotificationFunctor f( propertyNotificationSignal, source );
7196 notification.NotifySignal().Connect( &application, f ) ;
7198 actor.SetPosition( 1000.0f, 1000.0f );
7200 application.SendNotification();
7201 application.Render();
7203 application.SendNotification();
7205 DALI_TEST_EQUALS( actor.GetProperty< bool >( DevelActor::Property::CULLED ), true, TEST_LOCATION );
7207 DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION );
7208 DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( DevelActor::Property::CULLED ), TEST_LOCATION );
7209 DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION );
7214 int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
7216 TestApplication application;
7217 auto stage = Stage::GetCurrent();
7219 tet_infoline( "Ensure we clear the screen when the last actor is removed" );
7221 Actor actor = CreateRenderableActor();
7222 actor.SetSize( 100.0f, 100.0f );
7225 application.SendNotification();
7226 application.Render();
7228 auto& glAbstraction = application.GetGlAbstraction();
7229 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7233 application.SendNotification();
7234 application.Render();
7236 DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
7241 int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
7243 TestApplication application;
7244 auto stage = Stage::GetCurrent();
7246 tet_infoline( "Ensure we clear the screen when the last actor is made invisible" );
7248 Actor actor = CreateRenderableActor();
7249 actor.SetSize( 100.0f, 100.0f );
7252 application.SendNotification();
7253 application.Render();
7255 auto& glAbstraction = application.GetGlAbstraction();
7256 const auto clearCountBefore = glAbstraction.GetClearCountCalled();
7258 actor.SetProperty( Actor::Property::VISIBLE, false );
7260 application.SendNotification();
7261 application.Render();
7263 DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
7268 int utcDaliActorGetSizeAfterAnimation(void)
7270 TestApplication application;
7271 tet_infoline( "Check the actor size when an animation is finished" );
7273 Vector3 vector( 100.0f, 100.0f, 0.0f );
7275 Actor actor = Actor::New();
7276 actor.SetSize( vector.x, vector.y );
7277 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
7278 Stage::GetCurrent().Add( actor );
7280 application.SendNotification();
7281 application.Render();
7283 Vector3 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7284 DALI_TEST_EQUALS( size, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7285 DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7286 DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7287 DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7289 Vector3 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7290 DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7291 DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7292 DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7293 DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7295 Vector3 targetValue( 10.0f, 20.0f, 30.0f );
7297 Animation animation = Animation::New( 1.0f );
7298 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
7301 application.SendNotification();
7302 application.Render( 1100 ); // After the animation
7304 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7305 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7306 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7307 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7308 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7310 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7311 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7312 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7313 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7314 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7316 targetValue.width = 50.0f;
7319 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetValue.width );
7322 application.SendNotification();
7323 application.Render( 1100 ); // After the animation
7325 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7326 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7327 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7328 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7329 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7331 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7332 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7333 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7334 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7335 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7337 targetValue.height = 70.0f;
7340 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetValue.height );
7343 application.SendNotification();
7344 application.Render( 1100 ); // After the animation
7346 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7347 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7348 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7349 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7350 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7352 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7353 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7354 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7355 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7356 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7358 Vector3 offset( 10.0f, 20.0f, 30.0f );
7361 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), offset );
7364 application.SendNotification();
7365 application.Render( 1100 ); // After the animation
7367 targetValue += offset;
7369 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7370 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7371 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7372 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7373 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7375 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7376 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7377 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7378 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7379 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7381 offset.width = 20.0f;
7384 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), offset.width );
7387 application.SendNotification();
7388 application.Render( 1100 ); // After the animation
7390 targetValue.width += offset.width;
7392 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7393 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7394 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7395 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7396 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7398 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7399 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7400 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7401 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7402 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7404 offset.height = 10.0f;
7407 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), offset.height );
7410 application.SendNotification();
7411 application.Render( 1100 ); // After the animation
7413 targetValue.height += offset.height;
7415 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
7416 DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7417 DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7418 DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7419 DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
7421 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
7422 DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
7423 DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
7424 DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
7425 DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );