2 * Copyright (c) 2017 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.
19 #include <dali/public-api/dali-core.h>
21 #include <cfloat> // For FLT_MAX
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali-test-suite-utils.h>
26 #include <mesh-builder.h>
34 void utc_dali_actor_startup(void)
36 test_return_value = TET_UNDEF;
39 void utc_dali_actor_cleanup(void)
41 test_return_value = TET_PASS;
46 bool gTouchCallBackCalled=false;
47 bool gHoverCallBackCalled=false;
49 static bool gTestConstraintCalled;
53 void operator()( Vector4& color, const PropertyInputContainer& /* inputs */ )
55 gTestConstraintCalled = true;
60 * TestConstraint reference.
61 * When constraint is called, the resultRef is updated
62 * with the value supplied.
65 struct TestConstraintRef
67 TestConstraintRef(unsigned int& resultRef, unsigned int value)
68 : mResultRef(resultRef),
73 void operator()( T& current, const PropertyInputContainer& /* inputs */ )
78 unsigned int& mResultRef;
82 static bool TestCallback(Actor actor, const TouchEvent& event)
84 gTouchCallBackCalled = true;
89 static bool TestCallback3(Actor actor, const HoverEvent& event)
91 gHoverCallBackCalled = true;
96 // validation stuff for onstage & offstage signals
97 static std::vector< std::string > gActorNamesOnOffStage;
98 static int gOnStageCallBackCalled;
99 void OnStageCallback( Actor actor )
101 ++gOnStageCallBackCalled;
102 gActorNamesOnOffStage.push_back( actor.GetName() );
103 DALI_TEST_CHECK( actor.OnStage() == true );
105 static int gOffStageCallBackCalled;
106 void OffStageCallback( Actor actor )
108 ++gOffStageCallBackCalled;
109 gActorNamesOnOffStage.push_back( actor.GetName() );
110 DALI_TEST_CHECK( actor.OnStage() == false );
113 struct PositionComponentConstraint
115 PositionComponentConstraint(){}
117 void operator()( Vector3& pos, const PropertyInputContainer& inputs )
119 const Matrix& m = inputs[0]->GetMatrix();
122 m.GetTransformComponents(pos, rot, scale);
126 struct OrientationComponentConstraint
128 OrientationComponentConstraint(){}
130 void operator()( Quaternion& orientation, const PropertyInputContainer& inputs )
132 const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
135 orientation = parentOrientation;
140 static bool gOnRelayoutCallBackCalled = false;
141 static std::vector< std::string > gActorNamesRelayout;
143 void OnRelayoutCallback( Actor actor )
145 gOnRelayoutCallBackCalled = true;
146 gActorNamesRelayout.push_back( actor.GetName() );
149 } // anonymous namespace
152 //& purpose: Testing New API
153 int UtcDaliActorNew(void)
155 TestApplication application;
157 Actor actor = Actor::New();
159 DALI_TEST_CHECK(actor);
163 //& purpose: Testing Dali::Actor::DownCast()
164 int UtcDaliActorDownCastP(void)
166 TestApplication application;
167 tet_infoline("Testing Dali::Actor::DownCast()");
169 Actor actor = Actor::New();
170 BaseHandle object(actor);
171 Actor actor2 = Actor::DownCast(object);
172 DALI_TEST_CHECK(actor2);
176 //& purpose: Testing Dali::Actor::DownCast()
177 int UtcDaliActorDownCastN(void)
179 TestApplication application;
180 tet_infoline("Testing Dali::Actor::DownCast()");
182 BaseHandle unInitializedObject;
183 Actor actor = Actor::DownCast(unInitializedObject);
184 DALI_TEST_CHECK(!actor);
188 //& purpose: Testing Dali::Actor::GetName()
189 int UtcDaliActorGetName(void)
191 TestApplication application;
193 Actor actor = Actor::New();
195 DALI_TEST_CHECK(actor.GetName().empty());
199 //& purpose: Testing Dali::Actor::SetName()
200 int UtcDaliActorSetName(void)
202 TestApplication application;
204 string str("ActorName");
205 Actor actor = Actor::New();
208 DALI_TEST_CHECK(actor.GetName() == str);
212 int UtcDaliActorGetId(void)
214 tet_infoline("Testing Dali::Actor::UtcDaliActorGetId()");
215 TestApplication application;
217 Actor first = Actor::New();
218 Actor second = Actor::New();
219 Actor third = Actor::New();
221 DALI_TEST_CHECK(first.GetId() != second.GetId());
222 DALI_TEST_CHECK(second.GetId() != third.GetId());
226 int UtcDaliActorIsRoot(void)
228 TestApplication application;
230 Actor actor = Actor::New();
231 DALI_TEST_CHECK(!actor.IsRoot());
233 // get the root layer
234 actor = Stage::GetCurrent().GetLayer( 0 );
235 DALI_TEST_CHECK( actor.IsRoot() );
239 int UtcDaliActorOnStage(void)
241 TestApplication application;
243 Actor actor = Actor::New();
244 DALI_TEST_CHECK( !actor.OnStage() );
246 // get the root layer
247 actor = Stage::GetCurrent().GetLayer( 0 );
248 DALI_TEST_CHECK( actor.OnStage() );
252 int UtcDaliActorIsLayer(void)
254 TestApplication application;
256 Actor actor = Actor::New();
257 DALI_TEST_CHECK( !actor.IsLayer() );
259 // get the root layer
260 actor = Stage::GetCurrent().GetLayer( 0 );
261 DALI_TEST_CHECK( actor.IsLayer() );
265 int UtcDaliActorGetLayer(void)
267 TestApplication application;
269 Actor actor = Actor::New();
270 Stage::GetCurrent().Add(actor);
271 Layer layer = actor.GetLayer();
273 DALI_TEST_CHECK(layer);
275 // get the root layers layer
276 actor = Stage::GetCurrent().GetLayer( 0 );
277 DALI_TEST_CHECK( actor.GetLayer() );
281 int UtcDaliActorAddP(void)
283 tet_infoline("Testing Actor::Add");
284 TestApplication application;
286 Actor parent = Actor::New();
287 Actor child = Actor::New();
289 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
293 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
295 Actor parent2 = Actor::New();
296 parent2.Add( child );
298 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
299 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
301 // try Adding to same parent again, works
302 parent2.Add( child );
303 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
305 // try reparenting an orphaned child
307 Actor temporaryParent = Actor::New();
308 temporaryParent.Add( child );
309 DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION );
311 // temporaryParent has now died, reparent the orphaned child
312 parent2.Add( child );
313 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
318 int UtcDaliActorAddN(void)
320 tet_infoline("Testing Actor::Add");
321 TestApplication application;
323 Actor child = Actor::New();
325 Actor parent2 = Actor::New();
326 parent2.Add( child );
331 parent2.Add( parent2 );
332 tet_printf("Assertion test failed - no Exception\n" );
333 tet_result(TET_FAIL);
335 catch(Dali::DaliException& e)
337 DALI_TEST_PRINT_ASSERT( e );
338 DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
339 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
343 tet_printf("Assertion test failed - wrong Exception\n" );
344 tet_result(TET_FAIL);
347 // try reparenting root
350 parent2.Add( Stage::GetCurrent().GetLayer( 0 ) );
351 tet_printf("Assertion test failed - no Exception\n" );
352 tet_result(TET_FAIL);
354 catch(Dali::DaliException& e)
356 DALI_TEST_PRINT_ASSERT( e );
357 DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
358 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
362 tet_printf("Assertion test failed - wrong Exception\n" );
363 tet_result(TET_FAIL);
370 parent2.Add( empty );
371 tet_printf("Assertion test failed - no Exception\n" );
372 tet_result(TET_FAIL);
374 catch(Dali::DaliException& e)
376 DALI_TEST_PRINT_ASSERT( e );
377 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
378 DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
382 tet_printf("Assertion test failed - wrong Exception\n" );
383 tet_result(TET_FAIL);
389 int UtcDaliActorRemoveN(void)
391 tet_infoline("Testing Actor::Remove");
392 TestApplication application;
394 Actor parent = Actor::New();
395 Actor child = Actor::New();
396 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
399 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
401 parent.Remove(child);
402 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
404 // remove again, no problem
405 parent.Remove(child);
406 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
410 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
411 // try Remove self, its a no-op
412 parent.Remove( parent );
413 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
419 parent.Remove( empty );
420 tet_printf("Assertion test failed - no Exception\n" );
421 tet_result(TET_FAIL);
423 catch(Dali::DaliException& e)
425 DALI_TEST_PRINT_ASSERT( e );
426 DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
427 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
431 tet_printf("Assertion test failed - wrong Exception\n" );
432 tet_result(TET_FAIL);
437 int UtcDaliActorRemoveP(void)
439 TestApplication application;
441 Actor parent = Actor::New();
442 Actor child = Actor::New();
443 Actor random = Actor::New();
445 Stage::GetCurrent().Add( parent );
447 DALI_TEST_CHECK(parent.GetChildCount() == 0);
451 DALI_TEST_CHECK(parent.GetChildCount() == 1);
453 parent.Remove(random);
455 DALI_TEST_CHECK(parent.GetChildCount() == 1);
457 Stage::GetCurrent().Remove( parent );
459 DALI_TEST_CHECK(parent.GetChildCount() == 1);
463 int UtcDaliActorGetChildCount(void)
465 TestApplication application;
467 Actor parent = Actor::New();
468 Actor child = Actor::New();
470 DALI_TEST_CHECK(parent.GetChildCount() == 0);
474 DALI_TEST_CHECK(parent.GetChildCount() == 1);
478 int UtcDaliActorGetChildren01(void)
480 TestApplication application;
482 Actor parent = Actor::New();
483 Actor first = Actor::New();
484 Actor second = Actor::New();
485 Actor third = Actor::New();
491 DALI_TEST_CHECK(parent.GetChildAt(0) == first);
492 DALI_TEST_CHECK(parent.GetChildAt(1) == second);
493 DALI_TEST_CHECK(parent.GetChildAt(2) == third);
497 int UtcDaliActorGetChildren02(void)
499 TestApplication application;
501 Actor parent = Actor::New();
502 Actor first = Actor::New();
503 Actor second = Actor::New();
504 Actor third = Actor::New();
510 const Actor& constParent = parent;
512 DALI_TEST_CHECK(constParent.GetChildAt(0) == first);
513 DALI_TEST_CHECK(constParent.GetChildAt(1) == second);
514 DALI_TEST_CHECK(constParent.GetChildAt(2) == third);
518 int UtcDaliActorGetParent01(void)
520 TestApplication application;
522 Actor parent = Actor::New();
523 Actor child = Actor::New();
527 DALI_TEST_CHECK(child.GetParent() == parent);
531 int UtcDaliActorGetParent02(void)
533 TestApplication application;
535 Actor actor = Actor::New();
537 DALI_TEST_CHECK(!actor.GetParent());
541 int UtcDaliActorSetParentOrigin(void)
543 TestApplication application;
545 Actor actor = Actor::New();
547 Vector3 vector(0.7f, 0.8f, 0.9f);
548 DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
550 actor.SetParentOrigin(vector);
552 // flush the queue and render once
553 application.SendNotification();
554 application.Render();
556 DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
558 Stage::GetCurrent().Add( actor );
560 actor.SetParentOrigin( Vector3( 0.1f, 0.2f, 0.3f ) );
562 // flush the queue and render once
563 application.SendNotification();
564 application.Render();
566 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentParentOrigin(), TEST_LOCATION );
568 Stage::GetCurrent().Remove( actor );
572 int UtcDaliActorSetParentOriginIndividual(void)
574 TestApplication application;
576 Actor actor = Actor::New();
578 Vector3 vector(0.7f, 0.8f, 0.9f);
579 DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
581 actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x );
583 // flush the queue and render once
584 application.SendNotification();
585 application.Render();
587 DALI_TEST_EQUALS( vector.x, actor.GetCurrentParentOrigin().x, TEST_LOCATION );
589 actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y );
591 // flush the queue and render once
592 application.SendNotification();
593 application.Render();
595 DALI_TEST_EQUALS( vector.y, actor.GetCurrentParentOrigin().y, TEST_LOCATION );
597 actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z );
599 // flush the queue and render once
600 application.SendNotification();
601 application.Render();
603 DALI_TEST_EQUALS( vector.z, actor.GetCurrentParentOrigin().z, TEST_LOCATION );
608 int UtcDaliActorGetCurrentParentOrigin(void)
610 TestApplication application;
612 Actor actor = Actor::New();
614 Vector3 vector(0.7f, 0.8f, 0.9f);
615 DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
617 actor.SetParentOrigin(vector);
619 // flush the queue and render once
620 application.SendNotification();
621 application.Render();
623 DALI_TEST_CHECK(vector == actor.GetCurrentParentOrigin());
627 int UtcDaliActorSetAnchorPoint(void)
629 TestApplication application;
631 Actor actor = Actor::New();
633 Vector3 vector(0.7f, 0.8f, 0.9f);
634 DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
636 actor.SetAnchorPoint(vector);
638 // flush the queue and render once
639 application.SendNotification();
640 application.Render();
642 DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
644 Stage::GetCurrent().Add( actor );
646 actor.SetAnchorPoint( Vector3( 0.1f, 0.2f, 0.3f ) );
647 // flush the queue and render once
648 application.SendNotification();
649 application.Render();
651 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentAnchorPoint(), TEST_LOCATION );
653 Stage::GetCurrent().Remove( actor );
657 int UtcDaliActorSetAnchorPointIndividual(void)
659 TestApplication application;
661 Actor actor = Actor::New();
663 Vector3 vector(0.7f, 0.8f, 0.9f);
664 DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
666 actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x );
668 // flush the queue and render once
669 application.SendNotification();
670 application.Render();
672 DALI_TEST_EQUALS( vector.x, actor.GetCurrentAnchorPoint().x, TEST_LOCATION );
674 actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y );
676 // flush the queue and render once
677 application.SendNotification();
678 application.Render();
680 DALI_TEST_EQUALS( vector.y, actor.GetCurrentAnchorPoint().y, TEST_LOCATION );
682 actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z );
684 // flush the queue and render once
685 application.SendNotification();
686 application.Render();
688 DALI_TEST_EQUALS( vector.z, actor.GetCurrentAnchorPoint().z, TEST_LOCATION );
693 int UtcDaliActorGetCurrentAnchorPoint(void)
695 TestApplication application;
697 Actor actor = Actor::New();
699 Vector3 vector(0.7f, 0.8f, 0.9f);
700 DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
702 actor.SetAnchorPoint(vector);
704 // flush the queue and render once
705 application.SendNotification();
706 application.Render();
708 DALI_TEST_CHECK(vector == actor.GetCurrentAnchorPoint());
712 // SetSize(float width, float height)
713 int UtcDaliActorSetSize01(void)
715 TestApplication application;
717 Actor actor = Actor::New();
718 Vector3 vector(100.0f, 100.0f, 0.0f);
720 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
722 actor.SetSize(vector.x, vector.y);
724 // flush the queue and render once
725 application.SendNotification();
726 application.Render();
728 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
732 // SetSize(float width, float height, float depth)
733 int UtcDaliActorSetSize02(void)
735 TestApplication application;
737 Actor actor = Actor::New();
738 Vector3 vector(100.0f, 100.0f, 100.0f);
740 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
742 actor.SetSize(vector.x, vector.y, vector.z);
744 // flush the queue and render once
745 application.SendNotification();
746 application.Render();
748 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
752 // SetSize(Vector2 size)
753 int UtcDaliActorSetSize03(void)
755 TestApplication application;
757 Actor actor = Actor::New();
758 Vector3 vector(100.0f, 100.0f, 0.0f);
760 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
762 actor.SetSize(Vector2(vector.x, vector.y));
764 // flush the queue and render once
765 application.SendNotification();
766 application.Render();
768 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
772 // SetSize(Vector3 size)
773 int UtcDaliActorSetSize04(void)
775 TestApplication application;
777 Actor actor = Actor::New();
778 Vector3 vector(100.0f, 100.0f, 100.0f);
780 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
782 actor.SetSize(vector);
784 // flush the queue and render once
785 application.SendNotification();
786 application.Render();
788 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
790 Stage::GetCurrent().Add( actor );
791 actor.SetSize( Vector3( 0.1f, 0.2f, 0.3f ) );
793 // flush the queue and render once
794 application.SendNotification();
795 application.Render();
797 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentSize(), TEST_LOCATION );
798 Stage::GetCurrent().Remove( actor );
802 int UtcDaliActorSetSizeIndividual(void)
804 TestApplication application;
806 Actor actor = Actor::New();
808 Vector3 vector(0.7f, 0.8f, 0.9f);
809 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
811 actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
813 // flush the queue and render once
814 application.SendNotification();
815 application.Render();
817 DALI_TEST_EQUALS( vector.width, actor.GetCurrentSize().width, TEST_LOCATION );
819 actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
821 // flush the queue and render once
822 application.SendNotification();
823 application.Render();
825 DALI_TEST_EQUALS( vector.height, actor.GetCurrentSize().height, TEST_LOCATION );
827 actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
829 // flush the queue and render once
830 application.SendNotification();
831 application.Render();
833 DALI_TEST_EQUALS( vector.depth, actor.GetCurrentSize().depth, TEST_LOCATION );
839 int UtcDaliActorGetCurrentSize(void)
841 TestApplication application;
843 Actor actor = Actor::New();
844 Vector3 vector(100.0f, 100.0f, 20.0f);
846 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
848 actor.SetSize(vector);
850 // flush the queue and render once
851 application.SendNotification();
852 application.Render();
854 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
858 int UtcDaliActorGetNaturalSize(void)
860 TestApplication application;
862 Actor actor = Actor::New();
863 Vector3 vector( 0.0f, 0.0f, 0.0f );
865 DALI_TEST_CHECK( actor.GetNaturalSize() == vector );
870 int UtcDaliActorGetCurrentSizeImmediate(void)
872 TestApplication application;
874 Actor actor = Actor::New();
875 Vector3 vector(100.0f, 100.0f, 20.0f);
877 DALI_TEST_CHECK(vector != actor.GetTargetSize());
878 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
880 actor.SetSize(vector);
882 DALI_TEST_CHECK(vector == actor.GetTargetSize());
883 DALI_TEST_CHECK(vector != actor.GetCurrentSize());
885 // flush the queue and render once
886 application.SendNotification();
887 application.Render();
889 DALI_TEST_CHECK(vector == actor.GetTargetSize());
890 DALI_TEST_CHECK(vector == actor.GetCurrentSize());
893 // Build the animation
894 const float durationSeconds = 2.0f;
895 Animation animation = Animation::New( durationSeconds );
896 const Vector3 targetValue( 10.0f, 20.0f, 30.0f );
897 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
899 DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
901 // Start the animation
904 application.SendNotification();
905 application.Render( static_cast<unsigned int>( durationSeconds * 1000.0f ) );
907 DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
912 // SetPosition(float x, float y)
913 int UtcDaliActorSetPosition01(void)
915 TestApplication application;
917 Actor actor = Actor::New();
919 // Set to random to start off with
920 actor.SetPosition(Vector3(120.0f, 120.0f, 0.0f));
922 Vector3 vector(100.0f, 100.0f, 0.0f);
924 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
926 actor.SetPosition(vector.x, vector.y);
927 // flush the queue and render once
928 application.SendNotification();
929 application.Render();
930 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
932 Stage::GetCurrent().Add( actor );
933 actor.SetPosition( Vector3( 0.1f, 0.2f, 0.3f ) );
934 // flush the queue and render once
935 application.SendNotification();
936 application.Render();
937 DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentPosition(), TEST_LOCATION );
942 // flush the queue and render once
943 application.SendNotification();
944 application.Render();
945 DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentPosition(), TEST_LOCATION );
947 actor.TranslateBy( Vector3( 0.1f, 0.1f, 0.1f ) );
948 // flush the queue and render once
949 application.SendNotification();
950 application.Render();
951 DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentPosition(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
953 Stage::GetCurrent().Remove( actor );
957 // SetPosition(float x, float y, float z)
958 int UtcDaliActorSetPosition02(void)
960 TestApplication application;
962 Actor actor = Actor::New();
964 // Set to random to start off with
965 actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
967 Vector3 vector(100.0f, 100.0f, 100.0f);
969 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
971 actor.SetPosition(vector.x, vector.y, vector.z);
973 // flush the queue and render once
974 application.SendNotification();
975 application.Render();
977 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
981 // SetPosition(Vector3 position)
982 int UtcDaliActorSetPosition03(void)
984 TestApplication application;
986 Actor actor = Actor::New();
988 // Set to random to start off with
989 actor.SetPosition(Vector3(120.0f, 120.0f, 120.0f));
991 Vector3 vector(100.0f, 100.0f, 100.0f);
993 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
995 actor.SetPosition(vector);
997 // flush the queue and render once
998 application.SendNotification();
999 application.Render();
1001 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1005 int UtcDaliActorSetX(void)
1007 TestApplication application;
1009 Actor actor = Actor::New();
1011 Vector3 vector(100.0f, 0.0f, 0.0f);
1013 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
1017 // flush the queue and render once
1018 application.SendNotification();
1019 application.Render();
1021 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1025 int UtcDaliActorSetY(void)
1027 TestApplication application;
1029 Actor actor = Actor::New();
1031 Vector3 vector(0.0f, 100.0f, 0.0f);
1033 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
1037 // flush the queue and render once
1038 application.SendNotification();
1039 application.Render();
1041 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1045 int UtcDaliActorSetZ(void)
1047 TestApplication application;
1049 Actor actor = Actor::New();
1051 Vector3 vector(0.0f, 0.0f, 100.0f);
1053 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
1057 // flush the queue and render once
1058 application.SendNotification();
1059 application.Render();
1061 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1065 int UtcDaliActorSetPositionProperties(void)
1067 TestApplication application;
1069 Actor actor = Actor::New();
1071 Vector3 vector(0.7f, 0.8f, 0.9f);
1072 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
1074 actor.SetProperty( Actor::Property::POSITION_X, vector.x );
1076 // flush the queue and render once
1077 application.SendNotification();
1078 application.Render();
1080 DALI_TEST_EQUALS( vector.x, actor.GetCurrentPosition().x, TEST_LOCATION );
1082 actor.SetProperty( Actor::Property::POSITION_Y, vector.y );
1084 // flush the queue and render once
1085 application.SendNotification();
1086 application.Render();
1088 DALI_TEST_EQUALS( vector.y, actor.GetCurrentPosition().y, TEST_LOCATION );
1090 actor.SetProperty( Actor::Property::POSITION_Z, vector.z );
1092 // flush the queue and render once
1093 application.SendNotification();
1094 application.Render();
1096 DALI_TEST_EQUALS( vector.z, actor.GetCurrentPosition().z, TEST_LOCATION );
1101 int UtcDaliActorTranslateBy(void)
1103 TestApplication application;
1105 Actor actor = Actor::New();
1106 Vector3 vector(100.0f, 100.0f, 100.0f);
1108 DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
1110 actor.SetPosition(vector);
1112 // flush the queue and render once
1113 application.SendNotification();
1114 application.Render();
1116 DALI_TEST_CHECK(vector == actor.GetCurrentPosition());
1118 actor.TranslateBy(vector);
1120 // flush the queue and render once
1121 application.SendNotification();
1122 application.Render();
1124 DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentPosition());
1128 int UtcDaliActorGetCurrentPosition(void)
1130 TestApplication application;
1132 Actor actor = Actor::New();
1133 Vector3 setVector(100.0f, 100.0f, 0.0f);
1134 actor.SetPosition(setVector);
1136 // flush the queue and render once
1137 application.SendNotification();
1138 application.Render();
1140 DALI_TEST_CHECK(actor.GetCurrentPosition() == setVector);
1144 int UtcDaliActorGetCurrentWorldPosition(void)
1146 TestApplication application;
1148 Actor parent = Actor::New();
1149 Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1150 parent.SetPosition( parentPosition );
1151 parent.SetParentOrigin( ParentOrigin::CENTER );
1152 parent.SetAnchorPoint( AnchorPoint::CENTER );
1153 Stage::GetCurrent().Add( parent );
1155 Actor child = Actor::New();
1156 child.SetParentOrigin( ParentOrigin::CENTER );
1157 child.SetAnchorPoint( AnchorPoint::CENTER );
1158 Vector3 childPosition( 6.0f, 6.0f, 6.0f );
1159 child.SetPosition( childPosition );
1160 parent.Add( child );
1162 // The actors should not have a world position yet
1163 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1164 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1166 application.SendNotification();
1167 application.Render(0);
1169 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1170 DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1172 // The actors should have a world position now
1173 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1174 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1178 int UtcDaliActorInheritPosition(void)
1180 tet_infoline("Testing Actor::SetPositionInheritanceMode");
1181 TestApplication application;
1183 Actor parent = Actor::New();
1184 Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1185 parent.SetPosition( parentPosition );
1186 parent.SetParentOrigin( ParentOrigin::CENTER );
1187 parent.SetAnchorPoint( AnchorPoint::CENTER );
1188 Stage::GetCurrent().Add( parent );
1190 Actor child = Actor::New();
1191 child.SetParentOrigin( ParentOrigin::CENTER );
1192 child.SetAnchorPoint( AnchorPoint::CENTER );
1193 Vector3 childPosition( 10.0f, 11.0f, 12.0f );
1194 child.SetPosition( childPosition );
1195 parent.Add( child );
1197 // The actors should not have a world position yet
1198 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1199 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1201 // first test default, which is to inherit position
1202 DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::INHERIT_PARENT_POSITION, TEST_LOCATION );
1203 application.SendNotification();
1204 application.Render(0); // should only really call Update as Render is not required to update scene
1205 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1206 DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1207 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1208 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1211 //Change child position
1212 Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1213 child.SetPosition( childOffset );
1215 // Change inheritance mode to not inherit
1216 child.SetPositionInheritanceMode( Dali::DONT_INHERIT_POSITION );
1217 DALI_TEST_EQUALS( child.GetPositionInheritanceMode(), Dali::DONT_INHERIT_POSITION, TEST_LOCATION );
1218 application.SendNotification();
1219 application.Render(0); // should only really call Update as Render is not required to update scene
1220 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1221 DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1222 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1223 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION );
1227 int UtcDaliActorSetInheritPosition(void)
1229 tet_infoline("Testing Actor::SetInheritPosition");
1230 TestApplication application;
1232 Actor parent = Actor::New();
1233 Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
1234 parent.SetPosition( parentPosition );
1235 parent.SetParentOrigin( ParentOrigin::CENTER );
1236 parent.SetAnchorPoint( AnchorPoint::CENTER );
1237 Stage::GetCurrent().Add( parent );
1239 Actor child = Actor::New();
1240 child.SetParentOrigin( ParentOrigin::CENTER );
1241 child.SetAnchorPoint( AnchorPoint::CENTER );
1242 Vector3 childPosition( 10.0f, 11.0f, 12.0f );
1243 child.SetPosition( childPosition );
1244 parent.Add( child );
1246 // The actors should not have a world position yet
1247 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1248 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), Vector3::ZERO, TEST_LOCATION );
1250 // first test default, which is to inherit position
1251 DALI_TEST_EQUALS( child.IsPositionInherited(), true, TEST_LOCATION );
1252 application.SendNotification();
1253 application.Render(0); // should only really call Update as Render is not required to update scene
1254 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1255 DALI_TEST_EQUALS( child.GetCurrentPosition(), childPosition, TEST_LOCATION );
1256 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1257 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childPosition, TEST_LOCATION );
1259 //Change child position
1260 Vector3 childOffset( -1.0f, 1.0f, 0.0f );
1261 child.SetPosition( childOffset );
1263 // Use local position as world postion
1264 child.SetInheritPosition( false );
1265 DALI_TEST_EQUALS( child.IsPositionInherited(), false, TEST_LOCATION );
1266 application.SendNotification();
1267 application.Render(0); // should only really call Update as Render is not required to update scene
1268 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1269 DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1270 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1271 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), childOffset, TEST_LOCATION );
1273 //Change back to inherit position from parent
1274 child.SetInheritPosition( true );
1275 DALI_TEST_EQUALS( child.IsPositionInherited(), true, TEST_LOCATION );
1276 application.SendNotification();
1277 application.Render(0); // should only really call Update as Render is not required to update scene
1278 DALI_TEST_EQUALS( parent.GetCurrentPosition(), parentPosition, TEST_LOCATION );
1279 DALI_TEST_EQUALS( child.GetCurrentPosition(), childOffset, TEST_LOCATION );
1280 DALI_TEST_EQUALS( parent.GetCurrentWorldPosition(), parentPosition, TEST_LOCATION );
1281 DALI_TEST_EQUALS( child.GetCurrentWorldPosition(), parentPosition + childOffset, TEST_LOCATION );
1285 // SetOrientation(float angleRadians, Vector3 axis)
1286 int UtcDaliActorSetOrientation01(void)
1288 TestApplication application;
1290 Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1291 Actor actor = Actor::New();
1293 actor.SetOrientation(rotation);
1295 // flush the queue and render once
1296 application.SendNotification();
1297 application.Render();
1299 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1303 int UtcDaliActorSetOrientation02(void)
1305 TestApplication application;
1307 Actor actor = Actor::New();
1309 Radian angle( 0.785f );
1310 Vector3 axis(1.0f, 1.0f, 0.0f);
1312 actor.SetOrientation( angle, axis);
1313 Quaternion rotation( angle, axis );
1314 // flush the queue and render once
1315 application.SendNotification();
1316 application.Render();
1317 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1319 Stage::GetCurrent().Add( actor );
1320 actor.RotateBy( Degree( 360 ), axis);
1321 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1323 actor.SetOrientation( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1324 Quaternion result( Radian( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
1325 // flush the queue and render once
1326 application.SendNotification();
1327 application.Render();
1328 DALI_TEST_EQUALS( result, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1330 actor.SetOrientation( angle, axis);
1331 // flush the queue and render once
1332 application.SendNotification();
1333 application.Render();
1334 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1336 Stage::GetCurrent().Remove( actor );
1340 // SetOrientation(float angleRadians, Vector3 axis)
1341 int UtcDaliActorSetOrientationProperty(void)
1343 TestApplication application;
1345 Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1346 Actor actor = Actor::New();
1348 actor.SetProperty( Actor::Property::ORIENTATION, rotation );
1350 // flush the queue and render once
1351 application.SendNotification();
1352 application.Render();
1354 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1358 // RotateBy(float angleRadians, Vector3 axis)
1359 int UtcDaliActorRotateBy01(void)
1361 TestApplication application;
1363 Actor actor = Actor::New();
1365 Radian angle( M_PI * 0.25f );
1366 actor.RotateBy(( angle ), Vector3::ZAXIS);
1367 // flush the queue and render once
1368 application.SendNotification();
1369 application.Render();
1370 DALI_TEST_EQUALS(Quaternion( angle, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1372 Stage::GetCurrent().Add( actor );
1374 actor.RotateBy( angle, Vector3::ZAXIS);
1375 // flush the queue and render once
1376 application.SendNotification();
1377 application.Render();
1378 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1380 Stage::GetCurrent().Remove( actor );
1384 // RotateBy(Quaternion relativeRotation)
1385 int UtcDaliActorRotateBy02(void)
1387 TestApplication application;
1389 Actor actor = Actor::New();
1391 Radian angle( M_PI * 0.25f );
1392 Quaternion rotation(angle, Vector3::ZAXIS);
1393 actor.RotateBy(rotation);
1394 // flush the queue and render once
1395 application.SendNotification();
1396 application.Render();
1397 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1399 actor.RotateBy(rotation);
1400 // flush the queue and render once
1401 application.SendNotification();
1402 application.Render();
1403 DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1407 int UtcDaliActorGetCurrentOrientation(void)
1409 TestApplication application;
1410 Actor actor = Actor::New();
1412 Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1413 actor.SetOrientation(rotation);
1414 // flush the queue and render once
1415 application.SendNotification();
1416 application.Render();
1417 DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
1421 int UtcDaliActorGetCurrentWorldOrientation(void)
1423 tet_infoline("Testing Actor::GetCurrentWorldRotation");
1424 TestApplication application;
1426 Actor parent = Actor::New();
1427 Radian rotationAngle( Degree(90.0f) );
1428 Quaternion rotation( rotationAngle, Vector3::YAXIS );
1429 parent.SetOrientation( rotation );
1430 Stage::GetCurrent().Add( parent );
1432 Actor child = Actor::New();
1433 child.SetOrientation( rotation );
1434 parent.Add( child );
1436 // The actors should not have a world rotation yet
1437 DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1438 DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
1440 application.SendNotification();
1441 application.Render(0);
1443 DALI_TEST_EQUALS( parent.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION );
1444 DALI_TEST_EQUALS( child.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION );
1446 // The actors should have a world rotation now
1447 DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1448 DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1450 // turn off child rotation inheritance
1451 child.SetInheritOrientation( false );
1452 DALI_TEST_EQUALS( child.IsOrientationInherited(), false, TEST_LOCATION );
1453 application.SendNotification();
1454 application.Render(0);
1456 // The actors should have a world rotation now
1457 DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
1458 DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), rotation, 0.001, TEST_LOCATION );
1462 // SetScale(float scale)
1463 int UtcDaliActorSetScale01(void)
1465 TestApplication application;
1467 Actor actor = Actor::New();
1469 // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1470 actor.SetScale(0.25f);
1472 Vector3 scale(10.0f, 10.0f, 10.0f);
1473 DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1475 actor.SetScale(scale.x);
1477 // flush the queue and render once
1478 application.SendNotification();
1479 application.Render();
1481 DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1485 // SetScale(float scaleX, float scaleY, float scaleZ)
1486 int UtcDaliActorSetScale02(void)
1488 TestApplication application;
1489 Vector3 scale(10.0f, 10.0f, 10.0f);
1491 Actor actor = Actor::New();
1493 // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1494 actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1496 DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1498 actor.SetScale(scale.x, scale.y, scale.z);
1499 // flush the queue and render once
1500 application.SendNotification();
1501 application.Render();
1502 DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1504 // add to stage and test
1505 Stage::GetCurrent().Add( actor );
1506 actor.SetScale( 2.0f, 2.0f, 2.0f );
1507 // flush the queue and render once
1508 application.SendNotification();
1509 application.Render();
1510 DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentScale(), 0.001, TEST_LOCATION);
1512 Stage::GetCurrent().Remove( actor );
1517 // SetScale(Vector3 scale)
1518 int UtcDaliActorSetScale03(void)
1520 TestApplication application;
1521 Vector3 scale(10.0f, 10.0f, 10.0f);
1523 Actor actor = Actor::New();
1525 // Set to random value first - GetCurrentScale() asserts if called before SetScale()
1526 actor.SetScale(Vector3(12.0f, 1.0f, 2.0f));
1528 DALI_TEST_CHECK(actor.GetCurrentScale() != scale);
1530 actor.SetScale(scale);
1532 // flush the queue and render once
1533 application.SendNotification();
1534 application.Render();
1536 DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1540 int UtcDaliActorSetScaleIndividual(void)
1542 TestApplication application;
1544 Actor actor = Actor::New();
1546 Vector3 vector(0.7f, 0.8f, 0.9f);
1547 DALI_TEST_CHECK(vector != actor.GetCurrentScale());
1549 actor.SetProperty( Actor::Property::SCALE_X, vector.x );
1551 // flush the queue and render once
1552 application.SendNotification();
1553 application.Render();
1555 DALI_TEST_EQUALS( vector.x, actor.GetCurrentScale().x, TEST_LOCATION );
1557 actor.SetProperty( Actor::Property::SCALE_Y, vector.y );
1559 // flush the queue and render once
1560 application.SendNotification();
1561 application.Render();
1563 DALI_TEST_EQUALS( vector.y, actor.GetCurrentScale().y, TEST_LOCATION );
1565 actor.SetProperty( Actor::Property::SCALE_Z, vector.z );
1567 // flush the queue and render once
1568 application.SendNotification();
1569 application.Render();
1571 DALI_TEST_EQUALS( vector.z, actor.GetCurrentScale().z, TEST_LOCATION );
1576 int UtcDaliActorScaleBy(void)
1578 TestApplication application;
1579 Actor actor = Actor::New();
1580 Vector3 vector(100.0f, 100.0f, 100.0f);
1582 DALI_TEST_CHECK(vector != actor.GetCurrentScale());
1584 actor.SetScale(vector);
1586 // flush the queue and render once
1587 application.SendNotification();
1588 application.Render();
1590 DALI_TEST_CHECK(vector == actor.GetCurrentScale());
1592 actor.ScaleBy(vector);
1594 // flush the queue and render once
1595 application.SendNotification();
1596 application.Render();
1598 DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentScale());
1602 int UtcDaliActorGetCurrentScale(void)
1604 TestApplication application;
1605 Vector3 scale(12.0f, 1.0f, 2.0f);
1607 Actor actor = Actor::New();
1609 actor.SetScale(scale);
1611 // flush the queue and render once
1612 application.SendNotification();
1613 application.Render();
1615 DALI_TEST_CHECK(actor.GetCurrentScale() == scale);
1619 int UtcDaliActorGetCurrentWorldScale(void)
1621 TestApplication application;
1623 Actor parent = Actor::New();
1624 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1625 parent.SetScale( parentScale );
1626 Stage::GetCurrent().Add( parent );
1628 Actor child = Actor::New();
1629 Vector3 childScale( 2.0f, 2.0f, 2.0f );
1630 child.SetScale( childScale );
1631 parent.Add( child );
1633 // The actors should not have a scale yet
1634 DALI_TEST_EQUALS( parent.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1635 DALI_TEST_EQUALS( child.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
1637 // The actors should not have a world scale yet
1638 DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1639 DALI_TEST_EQUALS( child.GetCurrentWorldScale(), Vector3::ONE, TEST_LOCATION );
1641 application.SendNotification();
1642 application.Render(0);
1644 DALI_TEST_EQUALS( parent.GetCurrentScale(), parentScale, TEST_LOCATION );
1645 DALI_TEST_EQUALS( child.GetCurrentScale(), childScale, TEST_LOCATION );
1647 // The actors should have a world scale now
1648 DALI_TEST_EQUALS( parent.GetCurrentWorldScale(), parentScale, TEST_LOCATION );
1649 DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1653 int UtcDaliActorInheritScale(void)
1655 tet_infoline("Testing Actor::SetInheritScale");
1656 TestApplication application;
1658 Actor parent = Actor::New();
1659 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
1660 parent.SetScale( parentScale );
1661 Stage::GetCurrent().Add( parent );
1663 Actor child = Actor::New();
1664 Vector3 childScale( 2.0f, 2.0f, 2.0f );
1665 child.SetScale( childScale );
1666 parent.Add( child );
1668 application.SendNotification();
1669 application.Render(0);
1671 DALI_TEST_EQUALS( child.IsScaleInherited(), true, TEST_LOCATION );
1672 DALI_TEST_EQUALS( child.GetCurrentWorldScale(), parentScale * childScale, TEST_LOCATION );
1674 child.SetInheritScale( false );
1675 DALI_TEST_EQUALS( child.IsScaleInherited(), false, TEST_LOCATION );
1677 application.SendNotification();
1678 application.Render(0);
1680 DALI_TEST_EQUALS( child.GetCurrentWorldScale(), childScale, TEST_LOCATION );
1684 int UtcDaliActorSetVisible(void)
1686 TestApplication application;
1688 Actor actor = Actor::New();
1689 actor.SetVisible(false);
1690 // flush the queue and render once
1691 application.SendNotification();
1692 application.Render();
1693 DALI_TEST_CHECK(actor.IsVisible() == false);
1695 actor.SetVisible(true);
1696 // flush the queue and render once
1697 application.SendNotification();
1698 application.Render();
1699 DALI_TEST_CHECK(actor.IsVisible() == true);
1701 // put actor on stage
1702 Stage::GetCurrent().Add( actor );
1703 actor.SetVisible(false);
1704 // flush the queue and render once
1705 application.SendNotification();
1706 application.Render();
1707 DALI_TEST_CHECK(actor.IsVisible() == false);
1711 int UtcDaliActorIsVisible(void)
1713 TestApplication application;
1715 Actor actor = Actor::New();
1717 DALI_TEST_CHECK(actor.IsVisible() == true);
1721 int UtcDaliActorSetOpacity(void)
1723 TestApplication application;
1725 Actor actor = Actor::New();
1726 // initial opacity is 1
1727 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
1729 actor.SetOpacity( 0.4f);
1730 // flush the queue and render once
1731 application.SendNotification();
1732 application.Render();
1733 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.4f, TEST_LOCATION );
1735 // change opacity, actor is on stage to change is not immediate
1736 actor.SetOpacity( actor.GetCurrentOpacity() + 0.1f );
1737 // flush the queue and render once
1738 application.SendNotification();
1739 application.Render();
1740 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1742 // put actor on stage
1743 Stage::GetCurrent().Add( actor );
1745 // change opacity, actor is on stage to change is not immediate
1746 actor.SetOpacity( 0.9f );
1747 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.5f, TEST_LOCATION );
1748 // flush the queue and render once
1749 application.SendNotification();
1750 application.Render();
1751 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.9f, TEST_LOCATION );
1753 // change opacity, actor is on stage to change is not immediate
1754 actor.SetOpacity( actor.GetCurrentOpacity() - 0.9f );
1755 // flush the queue and render once
1756 application.SendNotification();
1757 application.Render();
1758 DALI_TEST_EQUALS(actor.GetCurrentOpacity(), 0.0f, TEST_LOCATION );
1762 int UtcDaliActorGetCurrentOpacity(void)
1764 TestApplication application;
1766 Actor actor = Actor::New();
1767 DALI_TEST_CHECK(actor.GetCurrentOpacity() != 0.5f);
1769 actor.SetOpacity(0.5f);
1770 // flush the queue and render once
1771 application.SendNotification();
1772 application.Render();
1773 DALI_TEST_CHECK(actor.GetCurrentOpacity() == 0.5f);
1777 int UtcDaliActorSetSensitive(void)
1779 TestApplication application;
1780 Actor actor = Actor::New();
1782 bool sensitive = !actor.IsSensitive();
1784 actor.SetSensitive(sensitive);
1786 DALI_TEST_CHECK(sensitive == actor.IsSensitive());
1790 int UtcDaliActorIsSensitive(void)
1792 TestApplication application;
1793 Actor actor = Actor::New();
1794 actor.SetSensitive(false);
1796 DALI_TEST_CHECK(false == actor.IsSensitive());
1800 int UtcDaliActorSetColor(void)
1802 TestApplication application;
1803 Actor actor = Actor::New();
1804 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1806 DALI_TEST_CHECK(color != actor.GetCurrentColor());
1808 actor.SetColor(color);
1809 // flush the queue and render once
1810 application.SendNotification();
1811 application.Render();
1812 DALI_TEST_CHECK(color == actor.GetCurrentColor());
1814 actor.SetColor( actor.GetCurrentColor() + Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) );
1815 // flush the queue and render once
1816 application.SendNotification();
1817 application.Render();
1818 DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentColor(), TEST_LOCATION );
1820 Stage::GetCurrent().Add( actor );
1821 actor.SetColor( color );
1822 // flush the queue and render once
1823 application.SendNotification();
1824 application.Render();
1825 DALI_TEST_EQUALS( color, actor.GetCurrentColor(), TEST_LOCATION );
1827 actor.SetColor( actor.GetCurrentColor() + Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) );
1828 // flush the queue and render once
1829 application.SendNotification();
1830 application.Render();
1831 // Actor color is not clamped
1832 DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentColor(), TEST_LOCATION );
1833 // world color is clamped
1834 DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentWorldColor(), TEST_LOCATION );
1836 Stage::GetCurrent().Remove( actor );
1840 int UtcDaliActorSetColorIndividual(void)
1842 TestApplication application;
1844 Actor actor = Actor::New();
1846 Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
1847 DALI_TEST_CHECK(vector != actor.GetCurrentColor());
1849 actor.SetProperty( Actor::Property::COLOR_RED, vector.r );
1851 // flush the queue and render once
1852 application.SendNotification();
1853 application.Render();
1855 DALI_TEST_EQUALS( vector.r, actor.GetCurrentColor().r, TEST_LOCATION );
1857 actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g );
1859 // flush the queue and render once
1860 application.SendNotification();
1861 application.Render();
1863 DALI_TEST_EQUALS( vector.g, actor.GetCurrentColor().g, TEST_LOCATION );
1865 actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b );
1867 // flush the queue and render once
1868 application.SendNotification();
1869 application.Render();
1871 DALI_TEST_EQUALS( vector.b, actor.GetCurrentColor().b, TEST_LOCATION );
1873 actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a );
1875 // flush the queue and render once
1876 application.SendNotification();
1877 application.Render();
1879 DALI_TEST_EQUALS( vector.a, actor.GetCurrentColor().a, TEST_LOCATION );
1885 int UtcDaliActorGetCurrentColor(void)
1887 TestApplication application;
1888 Actor actor = Actor::New();
1889 Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
1891 actor.SetColor(color);
1892 // flush the queue and render once
1893 application.SendNotification();
1894 application.Render();
1895 DALI_TEST_CHECK(color == actor.GetCurrentColor());
1899 int UtcDaliActorGetCurrentWorldColor(void)
1901 tet_infoline("Actor::GetCurrentWorldColor");
1902 TestApplication application;
1904 Actor parent = Actor::New();
1905 Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f );
1906 parent.SetColor( parentColor );
1907 Stage::GetCurrent().Add( parent );
1909 Actor child = Actor::New();
1910 Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f );
1911 child.SetColor( childColor );
1912 parent.Add( child );
1914 DALI_TEST_EQUALS( parent.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1915 DALI_TEST_EQUALS( child.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
1917 // verify the default color mode
1918 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetColorMode(), TEST_LOCATION );
1920 // The actors should not have a world color yet
1921 DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1922 DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Color::WHITE, TEST_LOCATION );
1924 application.SendNotification();
1925 application.Render(0);
1927 DALI_TEST_EQUALS( parent.GetCurrentColor(), parentColor, TEST_LOCATION );
1928 DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1930 // The actors should have a world color now
1931 DALI_TEST_EQUALS( parent.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1932 DALI_TEST_EQUALS( child.GetCurrentWorldColor(), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION );
1935 child.SetColorMode( USE_OWN_COLOR );
1936 application.SendNotification();
1937 application.Render(0);
1938 DALI_TEST_EQUALS( child.GetCurrentWorldColor(), childColor, TEST_LOCATION );
1941 child.SetColorMode( USE_PARENT_COLOR );
1942 application.SendNotification();
1943 application.Render(0);
1944 DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1945 DALI_TEST_EQUALS( child.GetCurrentWorldColor(), parentColor, TEST_LOCATION );
1948 child.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1949 application.SendNotification();
1950 application.Render(0);
1951 Vector4 expectedColor( childColor );
1952 expectedColor.a *= parentColor.a;
1953 DALI_TEST_EQUALS( child.GetCurrentColor(), childColor, TEST_LOCATION );
1954 DALI_TEST_EQUALS( child.GetCurrentWorldColor(), expectedColor, TEST_LOCATION );
1958 int UtcDaliActorSetColorMode(void)
1960 tet_infoline("Actor::SetColorMode");
1961 TestApplication application;
1962 Actor actor = Actor::New();
1963 Actor child = Actor::New();
1966 actor.SetColorMode( USE_OWN_COLOR );
1967 DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetColorMode(), TEST_LOCATION );
1969 actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
1970 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1972 actor.SetColorMode( USE_PARENT_COLOR );
1973 DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetColorMode(), TEST_LOCATION );
1975 actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
1976 DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetColorMode(), TEST_LOCATION );
1980 int UtcDaliActorScreenToLocal(void)
1982 TestApplication application;
1983 Actor actor = Actor::New();
1984 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1985 actor.SetSize(100.0f, 100.0f);
1986 actor.SetPosition(10.0f, 10.0f);
1987 Stage::GetCurrent().Add(actor);
1989 // flush the queue and render once
1990 application.SendNotification();
1991 application.Render();
1996 application.SendNotification();
1997 application.Render();
1999 DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) );
2001 DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
2002 DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
2006 int UtcDaliActorSetLeaveRequired(void)
2008 TestApplication application;
2010 Actor actor = Actor::New();
2012 actor.SetLeaveRequired(false);
2013 DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
2015 actor.SetLeaveRequired(true);
2016 DALI_TEST_CHECK(actor.GetLeaveRequired() == true);
2020 int UtcDaliActorGetLeaveRequired(void)
2022 TestApplication application;
2024 Actor actor = Actor::New();
2026 DALI_TEST_CHECK(actor.GetLeaveRequired() == false);
2030 int UtcDaliActorSetKeyboardFocusable(void)
2032 TestApplication application;
2034 Actor actor = Actor::New();
2036 actor.SetKeyboardFocusable(true);
2037 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == true);
2039 actor.SetKeyboardFocusable(false);
2040 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
2044 int UtcDaliActorIsKeyboardFocusable(void)
2046 TestApplication application;
2048 Actor actor = Actor::New();
2050 DALI_TEST_CHECK(actor.IsKeyboardFocusable() == false);
2054 int UtcDaliActorRemoveConstraints(void)
2056 tet_infoline(" UtcDaliActorRemoveConstraints");
2057 TestApplication application;
2059 gTestConstraintCalled = false;
2061 Actor actor = Actor::New();
2063 Constraint constraint = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraint() );
2065 actor.RemoveConstraints();
2067 DALI_TEST_CHECK( gTestConstraintCalled == false );
2069 Stage::GetCurrent().Add( actor );
2072 // flush the queue and render once
2073 application.SendNotification();
2074 application.Render();
2076 actor.RemoveConstraints();
2078 DALI_TEST_CHECK( gTestConstraintCalled == true );
2082 int UtcDaliActorRemoveConstraintTag(void)
2084 tet_infoline(" UtcDaliActorRemoveConstraintTag");
2085 TestApplication application;
2087 Actor actor = Actor::New();
2089 // 1. Apply Constraint1 and Constraint2, and test...
2090 unsigned int result1 = 0u;
2091 unsigned int result2 = 0u;
2093 unsigned constraint1Tag = 1u;
2094 Constraint constraint1 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1) );
2095 constraint1.SetTag( constraint1Tag );
2096 constraint1.Apply();
2098 unsigned constraint2Tag = 2u;
2099 Constraint constraint2 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2) );
2100 constraint2.SetTag( constraint2Tag );
2101 constraint2.Apply();
2103 Stage::GetCurrent().Add( actor );
2104 // flush the queue and render once
2105 application.SendNotification();
2106 application.Render();
2108 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2109 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2111 // 2. Remove Constraint1 and test...
2114 actor.RemoveConstraints(constraint1Tag);
2115 // make color property dirty, which will trigger constraints to be reapplied.
2116 actor.SetColor( Color::WHITE );
2117 // flush the queue and render once
2118 application.SendNotification();
2119 application.Render();
2121 DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
2122 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2124 // 3. Re-Apply Constraint1 and test...
2127 constraint1.Apply();
2128 // make color property dirty, which will trigger constraints to be reapplied.
2129 actor.SetColor( Color::WHITE );
2130 // flush the queue and render once
2131 application.SendNotification();
2132 application.Render();
2134 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2135 DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
2137 // 2. Remove Constraint2 and test...
2140 actor.RemoveConstraints(constraint2Tag);
2141 // make color property dirty, which will trigger constraints to be reapplied.
2142 actor.SetColor( Color::WHITE );
2143 // flush the queue and render once
2144 application.SendNotification();
2145 application.Render();
2147 DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
2148 DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2150 // 2. Remove Constraint1 as well and test...
2153 actor.RemoveConstraints(constraint1Tag);
2154 // make color property dirty, which will trigger constraints to be reapplied.
2155 actor.SetColor( Color::WHITE );
2156 // flush the queue and render once
2157 application.SendNotification();
2158 application.Render();
2160 DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
2161 DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
2165 int UtcDaliActorTouchedSignal(void)
2167 TestApplication application;
2169 gTouchCallBackCalled = false;
2171 // get the root layer
2172 Actor actor = Stage::GetCurrent().GetRootLayer();
2173 DALI_TEST_CHECK( gTouchCallBackCalled == false );
2175 application.SendNotification();
2176 application.Render();
2178 // connect to its touch signal
2179 actor.TouchedSignal().Connect( TestCallback );
2181 // simulate a touch event in the middle of the screen
2182 Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
2183 Dali::Integration::Point point;
2184 point.SetDeviceId( 1 );
2185 point.SetState( PointState::DOWN );
2186 point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
2187 Dali::Integration::TouchEvent event;
2188 event.AddPoint( point );
2189 application.ProcessEvent( event );
2191 DALI_TEST_CHECK( gTouchCallBackCalled == true );
2195 int UtcDaliActorHoveredSignal(void)
2197 TestApplication application;
2199 gHoverCallBackCalled = false;
2201 // get the root layer
2202 Actor actor = Stage::GetCurrent().GetRootLayer();
2203 DALI_TEST_CHECK( gHoverCallBackCalled == false );
2205 application.SendNotification();
2206 application.Render();
2208 // connect to its hover signal
2209 actor.HoveredSignal().Connect( TestCallback3 );
2211 // simulate a hover event in the middle of the screen
2212 Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
2213 Dali::Integration::Point point;
2214 point.SetDeviceId( 1 );
2215 point.SetState( PointState::MOTION );
2216 point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
2217 Dali::Integration::HoverEvent event;
2218 event.AddPoint( point );
2219 application.ProcessEvent( event );
2221 DALI_TEST_CHECK( gHoverCallBackCalled == true );
2225 int UtcDaliActorOnOffStageSignal(void)
2227 tet_infoline("Testing Dali::Actor::OnStageSignal() and OffStageSignal()");
2229 TestApplication application;
2232 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2233 gActorNamesOnOffStage.clear();
2235 Actor parent = Actor::New();
2236 parent.SetName( "parent" );
2237 parent.OnStageSignal().Connect( OnStageCallback );
2238 parent.OffStageSignal().Connect( OffStageCallback );
2240 DALI_TEST_CHECK( gOnStageCallBackCalled == 0 );
2241 DALI_TEST_CHECK( gOffStageCallBackCalled == 0 );
2243 // add parent to stage
2244 Stage::GetCurrent().Add( parent );
2245 // onstage emitted, offstage not
2246 DALI_TEST_EQUALS( gOnStageCallBackCalled, 1, TEST_LOCATION );
2247 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2248 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2250 // test adding a child, should get onstage emitted
2252 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2253 gActorNamesOnOffStage.clear();
2255 Actor child = Actor::New();
2256 child.SetName( "child" );
2257 child.OnStageSignal().Connect( OnStageCallback );
2258 child.OffStageSignal().Connect( OffStageCallback );
2259 parent.Add( child ); // add child
2260 // onstage emitted, offstage not
2261 DALI_TEST_EQUALS( gOnStageCallBackCalled, 1, TEST_LOCATION );
2262 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2263 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2265 // test removing parent from stage
2267 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2268 gActorNamesOnOffStage.clear();
2270 Stage::GetCurrent().Remove( parent );
2271 // onstage not emitted, offstage is
2272 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2273 DALI_TEST_EQUALS( gOffStageCallBackCalled, 2, TEST_LOCATION );
2274 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2275 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2277 // test adding parent back to stage
2279 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2280 gActorNamesOnOffStage.clear();
2282 Stage::GetCurrent().Add( parent );
2283 // onstage emitted, offstage not
2284 DALI_TEST_EQUALS( gOnStageCallBackCalled, 2, TEST_LOCATION );
2285 DALI_TEST_EQUALS( gOffStageCallBackCalled, 0, TEST_LOCATION );
2286 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2287 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 1 ], TEST_LOCATION );
2289 // test removing child
2291 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2292 gActorNamesOnOffStage.clear();
2294 parent.Remove( child );
2295 // onstage not emitted, offstage is
2296 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2297 DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2298 DALI_TEST_EQUALS( "child", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2300 // test removing parent
2302 gOnStageCallBackCalled = gOffStageCallBackCalled = 0;
2303 gActorNamesOnOffStage.clear();
2305 Stage::GetCurrent().Remove( parent );
2306 // onstage not emitted, offstage is
2307 DALI_TEST_EQUALS( gOnStageCallBackCalled, 0, TEST_LOCATION );
2308 DALI_TEST_EQUALS( gOffStageCallBackCalled, 1, TEST_LOCATION );
2309 DALI_TEST_EQUALS( "parent", gActorNamesOnOffStage[ 0 ], TEST_LOCATION );
2313 int UtcDaliActorFindChildByName(void)
2315 tet_infoline("Testing Dali::Actor::FindChildByName()");
2316 TestApplication application;
2318 Actor parent = Actor::New();
2319 parent.SetName( "parent" );
2320 Actor first = Actor::New();
2321 first .SetName( "first" );
2322 Actor second = Actor::New();
2323 second.SetName( "second" );
2328 Actor found = parent.FindChildByName( "foo" );
2329 DALI_TEST_CHECK( !found );
2331 found = parent.FindChildByName( "parent" );
2332 DALI_TEST_CHECK( found == parent );
2334 found = parent.FindChildByName( "first" );
2335 DALI_TEST_CHECK( found == first );
2337 found = parent.FindChildByName( "second" );
2338 DALI_TEST_CHECK( found == second );
2342 int UtcDaliActorFindChildById(void)
2344 tet_infoline("Testing Dali::Actor::UtcDaliActorFindChildById()");
2345 TestApplication application;
2347 Actor parent = Actor::New();
2348 Actor first = Actor::New();
2349 Actor second = Actor::New();
2354 Actor found = parent.FindChildById( 100000 );
2355 DALI_TEST_CHECK( !found );
2357 found = parent.FindChildById( parent.GetId() );
2358 DALI_TEST_CHECK( found == parent );
2360 found = parent.FindChildById( first.GetId() );
2361 DALI_TEST_CHECK( found == first );
2363 found = parent.FindChildById( second.GetId() );
2364 DALI_TEST_CHECK( found == second );
2368 int UtcDaliActorHitTest(void)
2373 HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result )
2375 mTouchPoint( touchPoint ),
2380 Vector2 mTouchPoint;
2384 TestApplication application;
2385 tet_infoline(" UtcDaliActorHitTest");
2387 // Fill a vector with different hit tests.
2388 struct HitTestData* hitTestData[] = {
2389 // scale touch point result
2390 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ), // touch point close to the right edge (inside)
2391 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside)
2392 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.
2393 new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside)
2394 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.
2398 // get the root layer
2399 Actor actor = Actor::New();
2400 actor.SetAnchorPoint( AnchorPoint::CENTER );
2401 actor.SetParentOrigin( ParentOrigin::CENTER );
2403 Stage::GetCurrent().Add( actor );
2405 gTouchCallBackCalled = false;
2407 unsigned int index = 0;
2408 while( NULL != hitTestData[index] )
2410 actor.SetSize( 1.f, 1.f );
2411 actor.SetScale( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z );
2413 // flush the queue and render once
2414 application.SendNotification();
2415 application.Render();
2417 DALI_TEST_CHECK( !gTouchCallBackCalled );
2419 // connect to its touch signal
2420 actor.TouchedSignal().Connect(TestCallback);
2422 Dali::Integration::Point point;
2423 point.SetState( PointState::DOWN );
2424 point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) );
2425 Dali::Integration::TouchEvent event;
2426 event.AddPoint( point );
2428 // flush the queue and render once
2429 application.SendNotification();
2430 application.Render();
2431 application.ProcessEvent( event );
2433 DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult );
2435 if( gTouchCallBackCalled != hitTestData[index]->mResult )
2436 tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
2437 hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z,
2438 hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
2439 hitTestData[index]->mResult );
2441 gTouchCallBackCalled = false;
2447 int UtcDaliActorSetDrawMode(void)
2449 TestApplication app;
2450 tet_infoline(" UtcDaliActorSetDrawModeOverlay");
2452 Actor a = Actor::New();
2454 Stage::GetCurrent().Add(a);
2455 app.SendNotification();
2457 app.SendNotification();
2460 DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Ensure overlay is off by default
2462 a.SetDrawMode( DrawMode::OVERLAY_2D );
2463 app.SendNotification();
2466 DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetDrawMode() ); // Check Actor is overlay
2468 a.SetDrawMode( DrawMode::NORMAL );
2469 app.SendNotification();
2472 DALI_TEST_CHECK( DrawMode::NORMAL == a.GetDrawMode() ); // Check Actor is normal
2476 int UtcDaliActorSetDrawModeOverlayRender(void)
2478 TestApplication app;
2479 tet_infoline(" UtcDaliActorSetDrawModeOverlayRender");
2481 app.SendNotification();
2484 std::vector<GLuint> ids;
2485 ids.push_back( 8 ); // first rendered actor
2486 ids.push_back( 9 ); // second rendered actor
2487 ids.push_back( 10 ); // third rendered actor
2488 app.GetGlAbstraction().SetNextTextureIds( ids );
2490 BufferImage imageA = BufferImage::New(16, 16);
2491 BufferImage imageB = BufferImage::New(16, 16);
2492 BufferImage imageC = BufferImage::New(16, 16);
2493 Actor a = CreateRenderableActor( imageA );
2494 Actor b = CreateRenderableActor( imageB );
2495 Actor c = CreateRenderableActor( imageC );
2497 app.SendNotification();
2500 //Textures are bound when first created. Clear bound textures vector
2501 app.GetGlAbstraction().ClearBoundTextures();
2503 // Render a,b,c as regular non-overlays. so order will be:
2507 Stage::GetCurrent().Add(a);
2508 Stage::GetCurrent().Add(b);
2509 Stage::GetCurrent().Add(c);
2511 app.SendNotification();
2514 // Should be 3 textures changes.
2515 const std::vector<GLuint>& boundTextures = app.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
2516 typedef std::vector<GLuint>::size_type TextureSize;
2517 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
2518 if( boundTextures.size() == 3 )
2520 DALI_TEST_CHECK( boundTextures[0] == 8u );
2521 DALI_TEST_CHECK( boundTextures[1] == 9u );
2522 DALI_TEST_CHECK( boundTextures[2] == 10u );
2525 // Now texture ids have been set, we can monitor their render order.
2526 // render a as an overlay (last), so order will be:
2530 a.SetDrawMode( DrawMode::OVERLAY_2D );
2531 app.GetGlAbstraction().ClearBoundTextures();
2533 app.SendNotification();
2536 // Should be 3 texture changes.
2537 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
2538 if( boundTextures.size() == 3 )
2540 DALI_TEST_CHECK( boundTextures[0] == 9u );
2541 DALI_TEST_CHECK( boundTextures[1] == 10u );
2542 DALI_TEST_CHECK( boundTextures[2] == 8u );
2547 int UtcDaliActorGetCurrentWorldMatrix(void)
2549 TestApplication app;
2550 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
2552 Actor parent = Actor::New();
2553 parent.SetParentOrigin(ParentOrigin::CENTER);
2554 parent.SetAnchorPoint(AnchorPoint::CENTER);
2555 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2556 Radian rotationAngle(Degree(85.0f));
2557 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2558 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2559 parent.SetPosition( parentPosition );
2560 parent.SetOrientation( parentRotation );
2561 parent.SetScale( parentScale );
2562 Stage::GetCurrent().Add( parent );
2564 Actor child = Actor::New();
2565 child.SetParentOrigin(ParentOrigin::CENTER);
2566 Vector3 childPosition( 0.0f, 0.0f, 100.0f );
2567 Radian childRotationAngle(Degree(23.0f));
2568 Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
2569 Vector3 childScale( 2.0f, 2.0f, 2.0f );
2570 child.SetPosition( childPosition );
2571 child.SetOrientation( childRotation );
2572 child.SetScale( childScale );
2573 parent.Add( child );
2575 app.SendNotification();
2578 app.SendNotification();
2580 Matrix parentMatrix(false);
2581 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2583 Matrix childMatrix(false);
2584 childMatrix.SetTransformComponents( childScale, childRotation, childPosition );
2586 //Child matrix should be the composition of child and parent
2587 Matrix childWorldMatrix(false);
2588 Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix);
2590 DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2591 DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), childWorldMatrix, 0.001, TEST_LOCATION );
2597 int UtcDaliActorConstrainedToWorldMatrix(void)
2599 TestApplication app;
2600 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
2602 Actor parent = Actor::New();
2603 parent.SetParentOrigin(ParentOrigin::CENTER);
2604 parent.SetAnchorPoint(AnchorPoint::CENTER);
2605 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2606 Radian rotationAngle(Degree(85.0f));
2607 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2608 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2609 parent.SetPosition( parentPosition );
2610 parent.SetOrientation( parentRotation );
2611 parent.SetScale( parentScale );
2612 Stage::GetCurrent().Add( parent );
2614 Actor child = Actor::New();
2615 child.SetParentOrigin(ParentOrigin::CENTER);
2616 Constraint posConstraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, PositionComponentConstraint() );
2617 posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) );
2618 posConstraint.Apply();
2620 Stage::GetCurrent().Add( child );
2622 app.SendNotification();
2625 app.SendNotification();
2627 Matrix parentMatrix(false);
2628 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2630 DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2631 DALI_TEST_EQUALS( child.GetCurrentPosition(), parent.GetCurrentPosition(), 0.001, TEST_LOCATION );
2635 int UtcDaliActorConstrainedToOrientation(void)
2637 TestApplication app;
2638 tet_infoline(" UtcDaliActorConstrainedToOrientation");
2640 Actor parent = Actor::New();
2641 parent.SetParentOrigin(ParentOrigin::CENTER);
2642 parent.SetAnchorPoint(AnchorPoint::CENTER);
2643 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2644 Radian rotationAngle(Degree(85.0f));
2645 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2646 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2647 parent.SetPosition( parentPosition );
2648 parent.SetOrientation( parentRotation );
2649 parent.SetScale( parentScale );
2650 Stage::GetCurrent().Add( parent );
2652 Actor child = Actor::New();
2653 child.SetParentOrigin(ParentOrigin::CENTER);
2654 Constraint posConstraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() );
2655 posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) );
2656 posConstraint.Apply();
2658 Stage::GetCurrent().Add( child );
2660 app.SendNotification();
2663 app.SendNotification();
2665 DALI_TEST_EQUALS( child.GetCurrentOrientation(), parent.GetCurrentOrientation(), 0.001, TEST_LOCATION );
2669 int UtcDaliActorUnparent(void)
2671 TestApplication app;
2672 tet_infoline(" UtcDaliActorUnparent");
2674 Actor parent = Actor::New();
2675 Stage::GetCurrent().Add( parent );
2677 Actor child = Actor::New();
2679 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2680 DALI_TEST_CHECK( !child.GetParent() );
2682 // Test that calling Unparent with no parent is a NOOP
2685 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2686 DALI_TEST_CHECK( !child.GetParent() );
2688 // Test that Unparent works
2689 parent.Add( child );
2691 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2692 DALI_TEST_CHECK( parent == child.GetParent() );
2696 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2697 DALI_TEST_CHECK( !child.GetParent() );
2699 // Test that UnparentAndReset works
2700 parent.Add( child );
2702 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2703 DALI_TEST_CHECK( parent == child.GetParent() );
2705 UnparentAndReset( child );
2707 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2708 DALI_TEST_CHECK( !child );
2710 // Test that UnparentAndReset is a NOOP with empty handle
2711 UnparentAndReset( child );
2713 DALI_TEST_CHECK( !child );
2717 int UtcDaliActorGetChildAt(void)
2719 TestApplication app;
2720 tet_infoline(" UtcDaliActorGetChildAt");
2722 Actor parent = Actor::New();
2723 Stage::GetCurrent().Add( parent );
2725 Actor child0 = Actor::New();
2726 parent.Add( child0 );
2728 Actor child1 = Actor::New();
2729 parent.Add( child1 );
2731 Actor child2 = Actor::New();
2732 parent.Add( child2 );
2734 DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
2735 DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
2736 DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
2740 int UtcDaliActorSetGetOverlay(void)
2742 TestApplication app;
2743 tet_infoline(" UtcDaliActorSetGetOverlay");
2745 Actor parent = Actor::New();
2746 parent.SetDrawMode(DrawMode::OVERLAY_2D );
2747 DALI_TEST_CHECK( parent.GetDrawMode() == DrawMode::OVERLAY_2D );
2752 int UtcDaliActorCreateDestroy(void)
2754 Actor* actor = new Actor;
2755 DALI_TEST_CHECK( actor );
2762 struct PropertyStringIndex
2764 const char * const name;
2765 const Property::Index index;
2766 const Property::Type type;
2769 const PropertyStringIndex PROPERTY_TABLE[] =
2771 { "parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3 },
2772 { "parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT },
2773 { "parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT },
2774 { "parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT },
2775 { "anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3 },
2776 { "anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT },
2777 { "anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT },
2778 { "anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT },
2779 { "size", Actor::Property::SIZE, Property::VECTOR3 },
2780 { "sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT },
2781 { "sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT },
2782 { "sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT },
2783 { "position", Actor::Property::POSITION, Property::VECTOR3 },
2784 { "positionX", Actor::Property::POSITION_X, Property::FLOAT },
2785 { "positionY", Actor::Property::POSITION_Y, Property::FLOAT },
2786 { "positionZ", Actor::Property::POSITION_Z, Property::FLOAT },
2787 { "worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3 },
2788 { "worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT },
2789 { "worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT },
2790 { "worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT },
2791 { "orientation", Actor::Property::ORIENTATION, Property::ROTATION },
2792 { "worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION },
2793 { "scale", Actor::Property::SCALE, Property::VECTOR3 },
2794 { "scaleX", Actor::Property::SCALE_X, Property::FLOAT },
2795 { "scaleY", Actor::Property::SCALE_Y, Property::FLOAT },
2796 { "scaleZ", Actor::Property::SCALE_Z, Property::FLOAT },
2797 { "worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3 },
2798 { "visible", Actor::Property::VISIBLE, Property::BOOLEAN },
2799 { "color", Actor::Property::COLOR, Property::VECTOR4 },
2800 { "colorRed", Actor::Property::COLOR_RED, Property::FLOAT },
2801 { "colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT },
2802 { "colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT },
2803 { "colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT },
2804 { "worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4 },
2805 { "worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX },
2806 { "name", Actor::Property::NAME, Property::STRING },
2807 { "sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN },
2808 { "leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN },
2809 { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN },
2810 { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN },
2811 { "colorMode", Actor::Property::COLOR_MODE, Property::STRING },
2812 { "positionInheritance", Actor::Property::POSITION_INHERITANCE, Property::STRING },
2813 { "drawMode", Actor::Property::DRAW_MODE, Property::STRING },
2814 { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 },
2815 { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING },
2816 { "heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING },
2817 { "sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::STRING },
2818 { "widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN },
2819 { "heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN },
2820 { "padding", Actor::Property::PADDING, Property::VECTOR4 },
2821 { "minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2 },
2822 { "maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2 },
2823 { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN },
2824 { "batchParent", DevelActor::Property::BATCH_PARENT, Property::BOOLEAN },
2825 { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING },
2827 const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
2828 } // unnamed namespace
2830 int UtcDaliActorProperties(void)
2832 TestApplication app;
2834 Actor actor = Actor::New();
2836 for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
2838 tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index );
2839 DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION );
2840 DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION );
2841 DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION );
2846 int UtcDaliRelayoutProperties_ResizePolicies(void)
2848 TestApplication app;
2850 Actor actor = Actor::New();
2853 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2854 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2856 // Set resize policy for all dimensions
2857 actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
2858 for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
2860 DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
2863 // Set individual dimensions
2864 const char* const widthPolicy = "FILL_TO_PARENT";
2865 const char* const heightPolicy = "FIXED";
2867 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy );
2868 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy );
2870 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
2871 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
2873 // Set individual dimensions using enums
2874 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
2875 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
2877 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum );
2878 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum );
2880 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION );
2881 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION );
2886 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
2888 TestApplication app;
2890 Actor actor = Actor::New();
2893 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), "USE_SIZE_SET", TEST_LOCATION );
2894 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
2896 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
2897 actor.SetSizeScalePolicy( policy );
2898 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), policy, TEST_LOCATION );
2901 const char* const policy1 = "FIT_WITH_ASPECT_RATIO";
2902 const char* const policy2 = "FILL_WITH_ASPECT_RATIO";
2904 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
2905 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy1, TEST_LOCATION );
2907 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
2908 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy2, TEST_LOCATION );
2913 int UtcDaliRelayoutProperties_SizeModeFactor(void)
2915 TestApplication app;
2917 Actor actor = Actor::New();
2920 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2921 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2923 Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
2924 actor.SetSizeModeFactor( sizeMode );
2925 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), sizeMode, TEST_LOCATION );
2928 Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
2930 actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
2931 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
2936 int UtcDaliRelayoutProperties_DimensionDependency(void)
2938 TestApplication app;
2940 Actor actor = Actor::New();
2943 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2944 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
2947 actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
2948 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
2950 actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
2951 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
2953 // Test setting another resize policy
2954 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
2955 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2960 int UtcDaliRelayoutProperties_Padding(void)
2962 TestApplication app;
2964 Actor actor = Actor::New();
2967 Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
2970 actor.SetProperty( Actor::Property::PADDING, padding );
2971 Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
2973 DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2978 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
2980 TestApplication app;
2982 Actor actor = Actor::New();
2985 Vector2 minSize( 1.0f, 2.0f );
2987 actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
2988 Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
2990 DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2992 Vector2 maxSize( 3.0f, 4.0f );
2994 actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
2995 Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
2997 DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
3002 int UtcDaliActorGetHeightForWidth(void)
3004 TestApplication app;
3006 Actor actor = Actor::New();
3008 DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
3013 int UtcDaliActorGetWidthForHeight(void)
3015 TestApplication app;
3017 Actor actor = Actor::New();
3019 DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
3024 int UtcDaliActorGetRelayoutSize(void)
3026 TestApplication app;
3028 Actor actor = Actor::New();
3030 // Add actor to stage
3031 Stage::GetCurrent().Add( actor );
3033 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
3035 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
3036 actor.SetSize( Vector2( 1.0f, 0.0f ) );
3038 // Flush the queue and render once
3039 app.SendNotification();
3042 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
3047 int UtcDaliActorSetPadding(void)
3049 TestApplication app;
3051 Actor actor = Actor::New();
3054 actor.GetPadding( padding );
3056 DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
3057 DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
3058 DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
3059 DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
3061 Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
3062 actor.SetPadding( padding2 );
3064 actor.GetPadding( padding );
3066 DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
3067 DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
3068 DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
3069 DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
3074 int UtcDaliActorSetMinimumSize(void)
3076 TestApplication app;
3078 Actor actor = Actor::New();
3080 Vector2 size = actor.GetMinimumSize();
3082 DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
3083 DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
3085 Vector2 size2( 1.0f, 2.0f );
3086 actor.SetMinimumSize( size2 );
3088 size = actor.GetMinimumSize();
3090 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3091 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3096 int UtcDaliActorSetMaximumSize(void)
3098 TestApplication app;
3100 Actor actor = Actor::New();
3102 Vector2 size = actor.GetMaximumSize();
3104 DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
3105 DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
3107 Vector2 size2( 1.0f, 2.0f );
3108 actor.SetMaximumSize( size2 );
3110 size = actor.GetMaximumSize();
3112 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3113 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3118 int UtcDaliActorOnRelayoutSignal(void)
3120 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3122 TestApplication application;
3125 gOnRelayoutCallBackCalled = false;
3126 gActorNamesRelayout.clear();
3128 Actor actor = Actor::New();
3129 actor.SetName( "actor" );
3130 actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
3133 DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
3135 // Add actor to stage
3136 Stage::GetCurrent().Add( actor );
3138 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3139 actor.SetSize( Vector2( 1.0f, 2.0 ) );
3141 // Flush the queue and render once
3142 application.SendNotification();
3143 application.Render();
3145 // OnRelayout emitted
3146 DALI_TEST_EQUALS( gOnRelayoutCallBackCalled, true, TEST_LOCATION );
3147 DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
3152 int UtcDaliActorGetHierachyDepth(void)
3154 TestApplication application;
3155 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3158 /* Build tree of actors:
3168 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3170 Stage stage( Stage::GetCurrent() );
3172 Actor actorA = Actor::New();
3173 Actor actorB = Actor::New();
3174 Actor actorC = Actor::New();
3175 Actor actorD = Actor::New();
3176 Actor actorE = Actor::New();
3177 Actor actorF = Actor::New();
3179 //Test that root actor has depth equal 0
3180 DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetHierarchyDepth(), TEST_LOCATION );
3182 //Test actors return depth -1 when not connected to the tree
3183 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3184 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3185 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3186 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3187 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3188 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3190 //Create the hierarchy
3191 stage.Add( actorA );
3192 actorA.Add( actorB );
3193 actorA.Add( actorC );
3194 actorB.Add( actorD );
3195 actorB.Add( actorE );
3196 actorC.Add( actorF );
3198 //Test actors return correct depth
3199 DALI_TEST_EQUALS( 1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3200 DALI_TEST_EQUALS( 2, actorB.GetHierarchyDepth(), TEST_LOCATION );
3201 DALI_TEST_EQUALS( 2, actorC.GetHierarchyDepth(), TEST_LOCATION );
3202 DALI_TEST_EQUALS( 3, actorD.GetHierarchyDepth(), TEST_LOCATION );
3203 DALI_TEST_EQUALS( 3, actorE.GetHierarchyDepth(), TEST_LOCATION );
3204 DALI_TEST_EQUALS( 3, actorF.GetHierarchyDepth(), TEST_LOCATION );
3206 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3207 actorA.Remove( actorB );
3209 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3210 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3211 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3213 //Removing actorA from the stage. All actors should have depth equal -1
3214 stage.Remove( actorA );
3216 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3217 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3218 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3219 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3220 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3221 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3226 int UtcDaliActorAnchorPointPropertyAsString(void)
3228 TestApplication application;
3230 Actor actor = Actor::New();
3232 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
3233 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3235 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
3236 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3238 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
3239 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3241 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
3242 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3244 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
3245 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER, TEST_LOCATION );
3247 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
3248 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3250 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
3251 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3253 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
3254 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3256 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
3257 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3259 // Invalid should not change anything
3260 actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
3261 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3266 int UtcDaliActorParentOriginPropertyAsString(void)
3268 TestApplication application;
3270 Actor actor = Actor::New();
3272 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
3273 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3275 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
3276 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3278 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
3279 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3281 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
3282 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3284 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
3285 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER, TEST_LOCATION );
3287 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
3288 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3290 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
3291 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3293 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
3294 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3296 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
3297 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3299 // Invalid should not change anything
3300 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
3301 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3306 int UtcDaliActorColorModePropertyAsString(void)
3308 TestApplication application;
3310 Actor actor = Actor::New();
3312 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
3313 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3315 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
3316 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3318 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
3319 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3321 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
3322 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3324 // Invalid should not change anything
3325 actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
3326 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3331 int UtcDaliActorPositionInheritancePropertyAsString(void)
3333 TestApplication application;
3335 Actor actor = Actor::New();
3337 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INHERIT_PARENT_POSITION" );
3338 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
3340 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION" );
3341 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
3343 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION_PLUS_LOCAL_POSITION" );
3344 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
3346 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "DONT_INHERIT_POSITION" );
3347 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3349 // Invalid should not change anything
3350 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INVALID_ARG" );
3351 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3356 int UtcDaliActorDrawModePropertyAsString(void)
3358 TestApplication application;
3360 Actor actor = Actor::New();
3362 actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
3363 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3365 actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
3366 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3368 actor.SetProperty( Actor::Property::DRAW_MODE, "STENCIL" );
3369 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3371 // Invalid should not change anything
3372 actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
3373 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3378 int UtcDaliActorColorModePropertyAsEnum(void)
3380 TestApplication application;
3382 Actor actor = Actor::New();
3384 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
3385 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3387 actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
3388 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3390 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
3391 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3393 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
3394 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3399 int UtcDaliActorPositionInheritancePropertyAsEnum(void)
3401 TestApplication application;
3403 Actor actor = Actor::New();
3405 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, INHERIT_PARENT_POSITION );
3406 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
3408 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION );
3409 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
3411 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
3412 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
3414 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, DONT_INHERIT_POSITION );
3415 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3420 int UtcDaliActorDrawModePropertyAsEnum(void)
3422 TestApplication application;
3424 Actor actor = Actor::New();
3426 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
3427 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3429 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
3430 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3432 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::STENCIL );
3433 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3438 int UtcDaliActorAddRendererP(void)
3440 tet_infoline("Testing Actor::AddRenderer");
3441 TestApplication application;
3443 Actor actor = Actor::New();
3445 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3447 Geometry geometry = CreateQuadGeometry();
3448 Shader shader = CreateShader();
3449 Renderer renderer = Renderer::New(geometry, shader);
3451 actor.AddRenderer( renderer );
3452 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3453 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3458 int UtcDaliActorAddRendererN(void)
3460 tet_infoline("Testing Actor::AddRenderer");
3461 TestApplication application;
3463 Actor actor = Actor::New();
3469 actor.AddRenderer( renderer );
3470 tet_printf("Assertion test failed - no Exception\n" );
3471 tet_result(TET_FAIL);
3473 catch(Dali::DaliException& e)
3475 DALI_TEST_PRINT_ASSERT( e );
3476 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3477 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3481 tet_printf("Assertion test failed - wrong Exception\n" );
3482 tet_result(TET_FAIL);
3488 int UtcDaliActorAddRendererOnStage(void)
3490 tet_infoline("Testing Actor::AddRenderer");
3491 TestApplication application;
3493 Actor actor = Actor::New();
3494 Stage::GetCurrent().Add(actor);
3496 application.SendNotification();
3497 application.Render(0);
3499 Geometry geometry = CreateQuadGeometry();
3500 Shader shader = CreateShader();
3501 Renderer renderer = Renderer::New(geometry, shader);
3503 application.SendNotification();
3504 application.Render(0);
3508 actor.AddRenderer( renderer );
3509 tet_result(TET_PASS);
3513 tet_result(TET_FAIL);
3519 int UtcDaliActorRemoveRendererP1(void)
3521 tet_infoline("Testing Actor::RemoveRenderer");
3522 TestApplication application;
3524 Actor actor = Actor::New();
3526 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3528 Geometry geometry = CreateQuadGeometry();
3529 Shader shader = CreateShader();
3530 Renderer renderer = Renderer::New(geometry, shader);
3532 actor.AddRenderer( renderer );
3533 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3534 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3536 actor.RemoveRenderer(renderer);
3537 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3543 int UtcDaliActorRemoveRendererP2(void)
3545 tet_infoline("Testing Actor::RemoveRenderer");
3546 TestApplication application;
3548 Actor actor = Actor::New();
3550 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3552 Geometry geometry = CreateQuadGeometry();
3553 Shader shader = CreateShader();
3554 Renderer renderer = Renderer::New(geometry, shader);
3556 actor.AddRenderer( renderer );
3557 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3558 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3560 actor.RemoveRenderer(0);
3561 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3568 int UtcDaliActorRemoveRendererN(void)
3570 tet_infoline("Testing Actor::RemoveRenderer");
3571 TestApplication application;
3573 Actor actor = Actor::New();
3575 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3577 Geometry geometry = CreateQuadGeometry();
3578 Shader shader = CreateShader();
3579 Renderer renderer = Renderer::New(geometry, shader);
3581 actor.AddRenderer( renderer );
3582 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3583 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3585 actor.RemoveRenderer(10);
3586 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3587 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3592 // Clipping test helper functions:
3593 Actor CreateActorWithContent()
3595 BufferImage image = BufferImage::New( 16u, 16u );
3596 Actor actor = CreateRenderableActor( image );
3598 // Setup dimensions and position so actor is not skipped by culling.
3599 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3600 actor.SetSize( 16.0f, 16.0f );
3601 actor.SetParentOrigin( ParentOrigin::CENTER );
3602 actor.SetAnchorPoint( AnchorPoint::CENTER );
3607 void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace )
3609 enabledDisableTrace.Reset();
3610 stencilTrace.Reset();
3611 enabledDisableTrace.Enable( true );
3612 stencilTrace.Enable( true );
3614 application.SendNotification();
3615 application.Render();
3617 enabledDisableTrace.Enable( false );
3618 stencilTrace.Enable( false );
3621 void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue )
3623 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
3625 DALI_TEST_EQUALS<bool>( colorMaskParams.red, maskValue, TEST_LOCATION );
3626 DALI_TEST_EQUALS<bool>( colorMaskParams.green, maskValue, TEST_LOCATION );
3627 DALI_TEST_EQUALS<bool>( colorMaskParams.blue, maskValue, TEST_LOCATION );
3628 DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, maskValue, TEST_LOCATION );
3631 int UtcDaliActorPropertyClippingP(void)
3633 // This test checks the clippingMode property.
3634 tet_infoline( "Testing Actor::Property::CLIPPING_MODE P" );
3635 TestApplication application;
3637 Actor actor = Actor::New();
3639 // Check default clippingEnabled value.
3640 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
3643 bool getValueResult = getValue.Get( value );
3644 DALI_TEST_CHECK( getValueResult );
3646 if( getValueResult )
3648 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3651 // Check setting the property.
3652 actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3654 // Check the new value was set.
3655 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
3656 getValueResult = getValue.Get( value );
3657 DALI_TEST_CHECK( getValueResult );
3659 if( getValueResult )
3661 DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION );
3667 int UtcDaliActorPropertyClippingN(void)
3669 // Negative test case for Clipping.
3670 tet_infoline( "Testing Actor::Property::CLIPPING_MODE N" );
3671 TestApplication application;
3673 Actor actor = Actor::New();
3675 // Check default clippingEnabled value.
3676 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
3679 bool getValueResult = getValue.Get( value );
3680 DALI_TEST_CHECK( getValueResult );
3682 if( getValueResult )
3684 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3687 // Check setting an invalid property value won't change the current property value.
3688 actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" );
3690 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
3691 getValueResult = getValue.Get( value );
3692 DALI_TEST_CHECK( getValueResult );
3694 if( getValueResult )
3696 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3702 int UtcDaliActorPropertyClippingActor(void)
3704 // This test checks that an actor is correctly setup for clipping.
3705 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor" );
3706 TestApplication application;
3708 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3709 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3710 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3711 size_t startIndex = 0u;
3713 // Create a clipping actor.
3714 Actor actorDepth1Clip = CreateActorWithContent();
3715 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3716 Stage::GetCurrent().Add( actorDepth1Clip );
3718 // Gather the call trace.
3719 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3721 // Check we are writing to the color buffer.
3722 CheckColorMask( glAbstraction, true );
3724 // Check the stencil buffer was enabled.
3725 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3727 // Check the stencil buffer was cleared.
3728 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3730 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3731 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3732 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
3733 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3738 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
3740 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
3741 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor enable and then disable" );
3742 TestApplication application;
3744 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3745 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3746 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3747 size_t startIndex = 0u;
3749 // Create a clipping actor.
3750 Actor actorDepth1Clip = CreateActorWithContent();
3751 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3752 Stage::GetCurrent().Add( actorDepth1Clip );
3754 // Gather the call trace.
3755 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3757 // Check we are writing to the color buffer.
3758 CheckColorMask( glAbstraction, true );
3760 // Check the stencil buffer was enabled.
3761 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3763 // Check the stencil buffer was cleared.
3764 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3766 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3767 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3768 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
3769 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3771 // Now disable the clipping
3772 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
3774 // Gather the call trace.
3775 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3777 // Check the stencil buffer was disabled.
3778 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3780 // Ensure all values in stencil-mask are set to 1.
3782 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
3788 int UtcDaliActorPropertyClippingNestedChildren(void)
3790 // This test checks that a hierarchy of actors are clipped correctly by
3791 // writing to and reading from the correct bit-planes of the stencil buffer.
3792 tet_infoline( "Testing Actor::Property::CLIPPING_MODE nested children" );
3793 TestApplication application;
3794 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3795 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3796 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3798 // Create a clipping actor.
3799 Actor actorDepth1Clip = CreateActorWithContent();
3800 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3801 Stage::GetCurrent().Add( actorDepth1Clip );
3803 // Create a child actor.
3804 Actor childDepth2 = CreateActorWithContent();
3805 actorDepth1Clip.Add( childDepth2 );
3807 // Create another clipping actor.
3808 Actor childDepth2Clip = CreateActorWithContent();
3809 childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3810 childDepth2.Add( childDepth2Clip );
3812 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
3813 // This tests the sort algorithm.
3814 Actor childDepth3 = CreateActorWithContent();
3815 childDepth2Clip.Add( childDepth3 );
3816 Actor childDepth4 = CreateActorWithContent();
3817 childDepth3.Add( childDepth4 );
3819 // Gather the call trace.
3820 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3822 // Check we are writing to the color buffer.
3823 CheckColorMask( glAbstraction, true );
3825 // Check the stencil buffer was enabled.
3826 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3828 // Perform the test twice, once for 2D layer, and once for 3D.
3829 for( unsigned int i = 0u ; i < 2u; ++i )
3831 size_t startIndex = 0u;
3833 // Check the stencil buffer was cleared.
3834 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3836 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3837 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3838 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); // Write to the first bit-plane
3839 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3841 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
3842 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 255", startIndex ) ); // 514 is GL_EQUAL
3843 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
3845 // Check we are set up to write to the second bitplane of the stencil buffer (only).
3846 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 1", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
3847 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "3", startIndex ) ); // Write to second (and previous) bit-planes
3848 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3850 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
3851 // (Both must be set to pass the check).
3852 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 255", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
3853 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
3855 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
3858 Stage::GetCurrent().GetRootLayer().SetBehavior( Layer::LAYER_3D );
3859 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3866 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
3868 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
3869 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" );
3870 TestApplication application;
3872 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3873 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3874 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3876 // Create a clipping actor.
3877 Actor actorDepth1Clip = CreateActorWithContent();
3878 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3879 Stage::GetCurrent().Add( actorDepth1Clip );
3881 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
3882 actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
3884 // Gather the call trace.
3885 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3887 // Check we are writing to the color buffer.
3888 CheckColorMask( glAbstraction, true );
3890 // Check the stencil buffer was not enabled.
3891 DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3893 // Check stencil functions are not called.
3894 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) );
3895 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) );
3896 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) );
3901 int UtcDaliGetPropertyN(void)
3903 tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" );
3904 TestApplication app;
3906 Actor actor = Actor::New();
3908 unsigned int propertyCount = actor.GetPropertyCount();
3909 DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );