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 // Render a,b,c as regular non-overlays. so order will be:
2501 Stage::GetCurrent().Add(a);
2502 Stage::GetCurrent().Add(b);
2503 Stage::GetCurrent().Add(c);
2505 app.SendNotification();
2508 // Should be 3 textures changes.
2509 const std::vector<GLuint>& boundTextures = app.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
2510 typedef std::vector<GLuint>::size_type TextureSize;
2511 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
2512 if( boundTextures.size() == 3 )
2514 DALI_TEST_CHECK( boundTextures[0] == 8u );
2515 DALI_TEST_CHECK( boundTextures[1] == 9u );
2516 DALI_TEST_CHECK( boundTextures[2] == 10u );
2519 // Now texture ids have been set, we can monitor their render order.
2520 // render a as an overlay (last), so order will be:
2524 a.SetDrawMode( DrawMode::OVERLAY_2D );
2525 app.GetGlAbstraction().ClearBoundTextures();
2527 app.SendNotification();
2530 // Should be 3 texture changes.
2531 DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
2532 if( boundTextures.size() == 3 )
2534 DALI_TEST_CHECK( boundTextures[0] == 9u );
2535 DALI_TEST_CHECK( boundTextures[1] == 10u );
2536 DALI_TEST_CHECK( boundTextures[2] == 8u );
2541 int UtcDaliActorGetCurrentWorldMatrix(void)
2543 TestApplication app;
2544 tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
2546 Actor parent = Actor::New();
2547 parent.SetParentOrigin(ParentOrigin::CENTER);
2548 parent.SetAnchorPoint(AnchorPoint::CENTER);
2549 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2550 Radian rotationAngle(Degree(85.0f));
2551 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2552 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2553 parent.SetPosition( parentPosition );
2554 parent.SetOrientation( parentRotation );
2555 parent.SetScale( parentScale );
2556 Stage::GetCurrent().Add( parent );
2558 Actor child = Actor::New();
2559 child.SetParentOrigin(ParentOrigin::CENTER);
2560 Vector3 childPosition( 0.0f, 0.0f, 100.0f );
2561 Radian childRotationAngle(Degree(23.0f));
2562 Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
2563 Vector3 childScale( 2.0f, 2.0f, 2.0f );
2564 child.SetPosition( childPosition );
2565 child.SetOrientation( childRotation );
2566 child.SetScale( childScale );
2567 parent.Add( child );
2569 app.SendNotification();
2572 app.SendNotification();
2574 Matrix parentMatrix(false);
2575 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2577 Matrix childMatrix(false);
2578 childMatrix.SetTransformComponents( childScale, childRotation, childPosition );
2580 //Child matrix should be the composition of child and parent
2581 Matrix childWorldMatrix(false);
2582 Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix);
2584 DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2585 DALI_TEST_EQUALS( child.GetCurrentWorldMatrix(), childWorldMatrix, 0.001, TEST_LOCATION );
2591 int UtcDaliActorConstrainedToWorldMatrix(void)
2593 TestApplication app;
2594 tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
2596 Actor parent = Actor::New();
2597 parent.SetParentOrigin(ParentOrigin::CENTER);
2598 parent.SetAnchorPoint(AnchorPoint::CENTER);
2599 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2600 Radian rotationAngle(Degree(85.0f));
2601 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2602 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2603 parent.SetPosition( parentPosition );
2604 parent.SetOrientation( parentRotation );
2605 parent.SetScale( parentScale );
2606 Stage::GetCurrent().Add( parent );
2608 Actor child = Actor::New();
2609 child.SetParentOrigin(ParentOrigin::CENTER);
2610 Constraint posConstraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, PositionComponentConstraint() );
2611 posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) );
2612 posConstraint.Apply();
2614 Stage::GetCurrent().Add( child );
2616 app.SendNotification();
2619 app.SendNotification();
2621 Matrix parentMatrix(false);
2622 parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
2624 DALI_TEST_EQUALS( parent.GetCurrentWorldMatrix(), parentMatrix, 0.001, TEST_LOCATION );
2625 DALI_TEST_EQUALS( child.GetCurrentPosition(), parent.GetCurrentPosition(), 0.001, TEST_LOCATION );
2629 int UtcDaliActorConstrainedToOrientation(void)
2631 TestApplication app;
2632 tet_infoline(" UtcDaliActorConstrainedToOrientation");
2634 Actor parent = Actor::New();
2635 parent.SetParentOrigin(ParentOrigin::CENTER);
2636 parent.SetAnchorPoint(AnchorPoint::CENTER);
2637 Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
2638 Radian rotationAngle(Degree(85.0f));
2639 Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
2640 Vector3 parentScale( 1.0f, 2.0f, 3.0f );
2641 parent.SetPosition( parentPosition );
2642 parent.SetOrientation( parentRotation );
2643 parent.SetScale( parentScale );
2644 Stage::GetCurrent().Add( parent );
2646 Actor child = Actor::New();
2647 child.SetParentOrigin(ParentOrigin::CENTER);
2648 Constraint posConstraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() );
2649 posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) );
2650 posConstraint.Apply();
2652 Stage::GetCurrent().Add( child );
2654 app.SendNotification();
2657 app.SendNotification();
2659 DALI_TEST_EQUALS( child.GetCurrentOrientation(), parent.GetCurrentOrientation(), 0.001, TEST_LOCATION );
2663 int UtcDaliActorUnparent(void)
2665 TestApplication app;
2666 tet_infoline(" UtcDaliActorUnparent");
2668 Actor parent = Actor::New();
2669 Stage::GetCurrent().Add( parent );
2671 Actor child = Actor::New();
2673 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2674 DALI_TEST_CHECK( !child.GetParent() );
2676 // Test that calling Unparent with no parent is a NOOP
2679 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2680 DALI_TEST_CHECK( !child.GetParent() );
2682 // Test that Unparent works
2683 parent.Add( child );
2685 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2686 DALI_TEST_CHECK( parent == child.GetParent() );
2690 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2691 DALI_TEST_CHECK( !child.GetParent() );
2693 // Test that UnparentAndReset works
2694 parent.Add( child );
2696 DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
2697 DALI_TEST_CHECK( parent == child.GetParent() );
2699 UnparentAndReset( child );
2701 DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
2702 DALI_TEST_CHECK( !child );
2704 // Test that UnparentAndReset is a NOOP with empty handle
2705 UnparentAndReset( child );
2707 DALI_TEST_CHECK( !child );
2711 int UtcDaliActorGetChildAt(void)
2713 TestApplication app;
2714 tet_infoline(" UtcDaliActorGetChildAt");
2716 Actor parent = Actor::New();
2717 Stage::GetCurrent().Add( parent );
2719 Actor child0 = Actor::New();
2720 parent.Add( child0 );
2722 Actor child1 = Actor::New();
2723 parent.Add( child1 );
2725 Actor child2 = Actor::New();
2726 parent.Add( child2 );
2728 DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
2729 DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
2730 DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
2734 int UtcDaliActorSetGetOverlay(void)
2736 TestApplication app;
2737 tet_infoline(" UtcDaliActorSetGetOverlay");
2739 Actor parent = Actor::New();
2740 parent.SetDrawMode(DrawMode::OVERLAY_2D );
2741 DALI_TEST_CHECK( parent.GetDrawMode() == DrawMode::OVERLAY_2D );
2746 int UtcDaliActorCreateDestroy(void)
2748 Actor* actor = new Actor;
2749 DALI_TEST_CHECK( actor );
2756 struct PropertyStringIndex
2758 const char * const name;
2759 const Property::Index index;
2760 const Property::Type type;
2763 const PropertyStringIndex PROPERTY_TABLE[] =
2765 { "parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3 },
2766 { "parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT },
2767 { "parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT },
2768 { "parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT },
2769 { "anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3 },
2770 { "anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT },
2771 { "anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT },
2772 { "anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT },
2773 { "size", Actor::Property::SIZE, Property::VECTOR3 },
2774 { "sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT },
2775 { "sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT },
2776 { "sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT },
2777 { "position", Actor::Property::POSITION, Property::VECTOR3 },
2778 { "positionX", Actor::Property::POSITION_X, Property::FLOAT },
2779 { "positionY", Actor::Property::POSITION_Y, Property::FLOAT },
2780 { "positionZ", Actor::Property::POSITION_Z, Property::FLOAT },
2781 { "worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3 },
2782 { "worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT },
2783 { "worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT },
2784 { "worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT },
2785 { "orientation", Actor::Property::ORIENTATION, Property::ROTATION },
2786 { "worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION },
2787 { "scale", Actor::Property::SCALE, Property::VECTOR3 },
2788 { "scaleX", Actor::Property::SCALE_X, Property::FLOAT },
2789 { "scaleY", Actor::Property::SCALE_Y, Property::FLOAT },
2790 { "scaleZ", Actor::Property::SCALE_Z, Property::FLOAT },
2791 { "worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3 },
2792 { "visible", Actor::Property::VISIBLE, Property::BOOLEAN },
2793 { "color", Actor::Property::COLOR, Property::VECTOR4 },
2794 { "colorRed", Actor::Property::COLOR_RED, Property::FLOAT },
2795 { "colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT },
2796 { "colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT },
2797 { "colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT },
2798 { "worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4 },
2799 { "worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX },
2800 { "name", Actor::Property::NAME, Property::STRING },
2801 { "sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN },
2802 { "leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN },
2803 { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN },
2804 { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN },
2805 { "colorMode", Actor::Property::COLOR_MODE, Property::STRING },
2806 { "positionInheritance", Actor::Property::POSITION_INHERITANCE, Property::STRING },
2807 { "drawMode", Actor::Property::DRAW_MODE, Property::STRING },
2808 { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 },
2809 { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING },
2810 { "heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING },
2811 { "sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::STRING },
2812 { "widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN },
2813 { "heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN },
2814 { "padding", Actor::Property::PADDING, Property::VECTOR4 },
2815 { "minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2 },
2816 { "maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2 },
2817 { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN },
2818 { "batchParent", DevelActor::Property::BATCH_PARENT, Property::BOOLEAN },
2819 { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING },
2821 const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
2822 } // unnamed namespace
2824 int UtcDaliActorProperties(void)
2826 TestApplication app;
2828 Actor actor = Actor::New();
2830 for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
2832 tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index );
2833 DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION );
2834 DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION );
2835 DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION );
2840 int UtcDaliRelayoutProperties_ResizePolicies(void)
2842 TestApplication app;
2844 Actor actor = Actor::New();
2847 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2848 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
2850 // Set resize policy for all dimensions
2851 actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
2852 for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
2854 DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
2857 // Set individual dimensions
2858 const char* const widthPolicy = "FILL_TO_PARENT";
2859 const char* const heightPolicy = "FIXED";
2861 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy );
2862 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy );
2864 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
2865 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
2867 // Set individual dimensions using enums
2868 ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
2869 ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
2871 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum );
2872 actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum );
2874 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION );
2875 DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION );
2880 int UtcDaliRelayoutProperties_SizeScalePolicy(void)
2882 TestApplication app;
2884 Actor actor = Actor::New();
2887 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), "USE_SIZE_SET", TEST_LOCATION );
2888 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
2890 SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
2891 actor.SetSizeScalePolicy( policy );
2892 DALI_TEST_EQUALS( actor.GetSizeScalePolicy(), policy, TEST_LOCATION );
2895 const char* const policy1 = "FIT_WITH_ASPECT_RATIO";
2896 const char* const policy2 = "FILL_WITH_ASPECT_RATIO";
2898 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
2899 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy1, TEST_LOCATION );
2901 actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
2902 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_SCALE_POLICY ).Get< std::string >(), policy2, TEST_LOCATION );
2907 int UtcDaliRelayoutProperties_SizeModeFactor(void)
2909 TestApplication app;
2911 Actor actor = Actor::New();
2914 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2915 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
2917 Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
2918 actor.SetSizeModeFactor( sizeMode );
2919 DALI_TEST_EQUALS( actor.GetSizeModeFactor(), sizeMode, TEST_LOCATION );
2922 Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
2924 actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
2925 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
2930 int UtcDaliRelayoutProperties_DimensionDependency(void)
2932 TestApplication app;
2934 Actor actor = Actor::New();
2937 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2938 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
2941 actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
2942 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
2944 actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
2945 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
2947 // Test setting another resize policy
2948 actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
2949 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
2954 int UtcDaliRelayoutProperties_Padding(void)
2956 TestApplication app;
2958 Actor actor = Actor::New();
2961 Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
2964 actor.SetProperty( Actor::Property::PADDING, padding );
2965 Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
2967 DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2972 int UtcDaliRelayoutProperties_MinimumMaximumSize(void)
2974 TestApplication app;
2976 Actor actor = Actor::New();
2979 Vector2 minSize( 1.0f, 2.0f );
2981 actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
2982 Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
2984 DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2986 Vector2 maxSize( 3.0f, 4.0f );
2988 actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
2989 Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
2991 DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
2996 int UtcDaliActorGetHeightForWidth(void)
2998 TestApplication app;
3000 Actor actor = Actor::New();
3002 DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
3007 int UtcDaliActorGetWidthForHeight(void)
3009 TestApplication app;
3011 Actor actor = Actor::New();
3013 DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
3018 int UtcDaliActorGetRelayoutSize(void)
3020 TestApplication app;
3022 Actor actor = Actor::New();
3024 // Add actor to stage
3025 Stage::GetCurrent().Add( actor );
3027 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
3029 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
3030 actor.SetSize( Vector2( 1.0f, 0.0f ) );
3032 // Flush the queue and render once
3033 app.SendNotification();
3036 DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
3041 int UtcDaliActorSetPadding(void)
3043 TestApplication app;
3045 Actor actor = Actor::New();
3048 actor.GetPadding( padding );
3050 DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
3051 DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
3052 DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
3053 DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
3055 Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
3056 actor.SetPadding( padding2 );
3058 actor.GetPadding( padding );
3060 DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
3061 DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
3062 DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
3063 DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
3068 int UtcDaliActorSetMinimumSize(void)
3070 TestApplication app;
3072 Actor actor = Actor::New();
3074 Vector2 size = actor.GetMinimumSize();
3076 DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
3077 DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
3079 Vector2 size2( 1.0f, 2.0f );
3080 actor.SetMinimumSize( size2 );
3082 size = actor.GetMinimumSize();
3084 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3085 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3090 int UtcDaliActorSetMaximumSize(void)
3092 TestApplication app;
3094 Actor actor = Actor::New();
3096 Vector2 size = actor.GetMaximumSize();
3098 DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
3099 DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
3101 Vector2 size2( 1.0f, 2.0f );
3102 actor.SetMaximumSize( size2 );
3104 size = actor.GetMaximumSize();
3106 DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
3107 DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
3112 int UtcDaliActorOnRelayoutSignal(void)
3114 tet_infoline("Testing Dali::Actor::OnRelayoutSignal()");
3116 TestApplication application;
3119 gOnRelayoutCallBackCalled = false;
3120 gActorNamesRelayout.clear();
3122 Actor actor = Actor::New();
3123 actor.SetName( "actor" );
3124 actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
3127 DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
3129 // Add actor to stage
3130 Stage::GetCurrent().Add( actor );
3132 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3133 actor.SetSize( Vector2( 1.0f, 2.0 ) );
3135 // Flush the queue and render once
3136 application.SendNotification();
3137 application.Render();
3139 // OnRelayout emitted
3140 DALI_TEST_EQUALS( gOnRelayoutCallBackCalled, true, TEST_LOCATION );
3141 DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
3146 int UtcDaliActorGetHierachyDepth(void)
3148 TestApplication application;
3149 tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
3152 /* Build tree of actors:
3162 * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
3164 Stage stage( Stage::GetCurrent() );
3166 Actor actorA = Actor::New();
3167 Actor actorB = Actor::New();
3168 Actor actorC = Actor::New();
3169 Actor actorD = Actor::New();
3170 Actor actorE = Actor::New();
3171 Actor actorF = Actor::New();
3173 //Test that root actor has depth equal 0
3174 DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetHierarchyDepth(), TEST_LOCATION );
3176 //Test actors return depth -1 when not connected to the tree
3177 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3178 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3179 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3180 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3181 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3182 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3184 //Create the hierarchy
3185 stage.Add( actorA );
3186 actorA.Add( actorB );
3187 actorA.Add( actorC );
3188 actorB.Add( actorD );
3189 actorB.Add( actorE );
3190 actorC.Add( actorF );
3192 //Test actors return correct depth
3193 DALI_TEST_EQUALS( 1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3194 DALI_TEST_EQUALS( 2, actorB.GetHierarchyDepth(), TEST_LOCATION );
3195 DALI_TEST_EQUALS( 2, actorC.GetHierarchyDepth(), TEST_LOCATION );
3196 DALI_TEST_EQUALS( 3, actorD.GetHierarchyDepth(), TEST_LOCATION );
3197 DALI_TEST_EQUALS( 3, actorE.GetHierarchyDepth(), TEST_LOCATION );
3198 DALI_TEST_EQUALS( 3, actorF.GetHierarchyDepth(), TEST_LOCATION );
3200 //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
3201 actorA.Remove( actorB );
3203 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3204 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3205 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3207 //Removing actorA from the stage. All actors should have depth equal -1
3208 stage.Remove( actorA );
3210 DALI_TEST_EQUALS( -1, actorA.GetHierarchyDepth(), TEST_LOCATION );
3211 DALI_TEST_EQUALS( -1, actorB.GetHierarchyDepth(), TEST_LOCATION );
3212 DALI_TEST_EQUALS( -1, actorC.GetHierarchyDepth(), TEST_LOCATION );
3213 DALI_TEST_EQUALS( -1, actorD.GetHierarchyDepth(), TEST_LOCATION );
3214 DALI_TEST_EQUALS( -1, actorE.GetHierarchyDepth(), TEST_LOCATION );
3215 DALI_TEST_EQUALS( -1, actorF.GetHierarchyDepth(), TEST_LOCATION );
3220 int UtcDaliActorAnchorPointPropertyAsString(void)
3222 TestApplication application;
3224 Actor actor = Actor::New();
3226 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
3227 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3229 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
3230 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3232 actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
3233 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3235 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
3236 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3238 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
3239 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER, TEST_LOCATION );
3241 actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
3242 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3244 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
3245 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3247 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
3248 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3250 actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
3251 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3253 // Invalid should not change anything
3254 actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
3255 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3260 int UtcDaliActorParentOriginPropertyAsString(void)
3262 TestApplication application;
3264 Actor actor = Actor::New();
3266 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
3267 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3269 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
3270 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
3272 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
3273 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
3275 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
3276 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
3278 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
3279 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER, TEST_LOCATION );
3281 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
3282 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
3284 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
3285 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
3287 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
3288 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
3290 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
3291 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3293 // Invalid should not change anything
3294 actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
3295 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
3300 int UtcDaliActorColorModePropertyAsString(void)
3302 TestApplication application;
3304 Actor actor = Actor::New();
3306 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
3307 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3309 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
3310 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3312 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
3313 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3315 actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
3316 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3318 // Invalid should not change anything
3319 actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
3320 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3325 int UtcDaliActorPositionInheritancePropertyAsString(void)
3327 TestApplication application;
3329 Actor actor = Actor::New();
3331 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INHERIT_PARENT_POSITION" );
3332 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
3334 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION" );
3335 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
3337 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "USE_PARENT_POSITION_PLUS_LOCAL_POSITION" );
3338 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
3340 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "DONT_INHERIT_POSITION" );
3341 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3343 // Invalid should not change anything
3344 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, "INVALID_ARG" );
3345 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3350 int UtcDaliActorDrawModePropertyAsString(void)
3352 TestApplication application;
3354 Actor actor = Actor::New();
3356 actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
3357 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3359 actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
3360 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3362 actor.SetProperty( Actor::Property::DRAW_MODE, "STENCIL" );
3363 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3365 // Invalid should not change anything
3366 actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
3367 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3372 int UtcDaliActorColorModePropertyAsEnum(void)
3374 TestApplication application;
3376 Actor actor = Actor::New();
3378 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
3379 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_COLOR, TEST_LOCATION );
3381 actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
3382 DALI_TEST_EQUALS( actor.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
3384 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
3385 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
3387 actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
3388 DALI_TEST_EQUALS( actor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
3393 int UtcDaliActorPositionInheritancePropertyAsEnum(void)
3395 TestApplication application;
3397 Actor actor = Actor::New();
3399 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, INHERIT_PARENT_POSITION );
3400 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), INHERIT_PARENT_POSITION, TEST_LOCATION );
3402 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION );
3403 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION, TEST_LOCATION );
3405 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
3406 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), USE_PARENT_POSITION_PLUS_LOCAL_POSITION, TEST_LOCATION );
3408 actor.SetProperty( Actor::Property::POSITION_INHERITANCE, DONT_INHERIT_POSITION );
3409 DALI_TEST_EQUALS( actor.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
3414 int UtcDaliActorDrawModePropertyAsEnum(void)
3416 TestApplication application;
3418 Actor actor = Actor::New();
3420 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
3421 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::NORMAL, TEST_LOCATION );
3423 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
3424 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION );
3426 actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::STENCIL );
3427 DALI_TEST_EQUALS( actor.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
3432 int UtcDaliActorAddRendererP(void)
3434 tet_infoline("Testing Actor::AddRenderer");
3435 TestApplication application;
3437 Actor actor = Actor::New();
3439 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3441 Geometry geometry = CreateQuadGeometry();
3442 Shader shader = CreateShader();
3443 Renderer renderer = Renderer::New(geometry, shader);
3445 actor.AddRenderer( renderer );
3446 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3447 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3452 int UtcDaliActorAddRendererN(void)
3454 tet_infoline("Testing Actor::AddRenderer");
3455 TestApplication application;
3457 Actor actor = Actor::New();
3463 actor.AddRenderer( renderer );
3464 tet_printf("Assertion test failed - no Exception\n" );
3465 tet_result(TET_FAIL);
3467 catch(Dali::DaliException& e)
3469 DALI_TEST_PRINT_ASSERT( e );
3470 DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
3471 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3475 tet_printf("Assertion test failed - wrong Exception\n" );
3476 tet_result(TET_FAIL);
3482 int UtcDaliActorAddRendererOnStage(void)
3484 tet_infoline("Testing Actor::AddRenderer");
3485 TestApplication application;
3487 Actor actor = Actor::New();
3488 Stage::GetCurrent().Add(actor);
3490 application.SendNotification();
3491 application.Render(0);
3493 Geometry geometry = CreateQuadGeometry();
3494 Shader shader = CreateShader();
3495 Renderer renderer = Renderer::New(geometry, shader);
3497 application.SendNotification();
3498 application.Render(0);
3502 actor.AddRenderer( renderer );
3503 tet_result(TET_PASS);
3507 tet_result(TET_FAIL);
3513 int UtcDaliActorRemoveRendererP1(void)
3515 tet_infoline("Testing Actor::RemoveRenderer");
3516 TestApplication application;
3518 Actor actor = Actor::New();
3520 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3522 Geometry geometry = CreateQuadGeometry();
3523 Shader shader = CreateShader();
3524 Renderer renderer = Renderer::New(geometry, shader);
3526 actor.AddRenderer( renderer );
3527 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3528 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3530 actor.RemoveRenderer(renderer);
3531 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3537 int UtcDaliActorRemoveRendererP2(void)
3539 tet_infoline("Testing Actor::RemoveRenderer");
3540 TestApplication application;
3542 Actor actor = Actor::New();
3544 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3546 Geometry geometry = CreateQuadGeometry();
3547 Shader shader = CreateShader();
3548 Renderer renderer = Renderer::New(geometry, shader);
3550 actor.AddRenderer( renderer );
3551 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3552 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3554 actor.RemoveRenderer(0);
3555 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3562 int UtcDaliActorRemoveRendererN(void)
3564 tet_infoline("Testing Actor::RemoveRenderer");
3565 TestApplication application;
3567 Actor actor = Actor::New();
3569 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
3571 Geometry geometry = CreateQuadGeometry();
3572 Shader shader = CreateShader();
3573 Renderer renderer = Renderer::New(geometry, shader);
3575 actor.AddRenderer( renderer );
3576 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3577 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3579 actor.RemoveRenderer(10);
3580 DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
3581 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
3586 // Clipping test helper functions:
3587 Actor CreateActorWithContent()
3589 BufferImage image = BufferImage::New( 16u, 16u );
3590 Actor actor = CreateRenderableActor( image );
3592 // Setup dimensions and position so actor is not skipped by culling.
3593 actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
3594 actor.SetSize( 16.0f, 16.0f );
3595 actor.SetParentOrigin( ParentOrigin::CENTER );
3596 actor.SetAnchorPoint( AnchorPoint::CENTER );
3601 void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace )
3603 enabledDisableTrace.Reset();
3604 stencilTrace.Reset();
3605 enabledDisableTrace.Enable( true );
3606 stencilTrace.Enable( true );
3608 application.SendNotification();
3609 application.Render();
3611 enabledDisableTrace.Enable( false );
3612 stencilTrace.Enable( false );
3615 void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue )
3617 const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
3619 DALI_TEST_EQUALS<bool>( colorMaskParams.red, maskValue, TEST_LOCATION );
3620 DALI_TEST_EQUALS<bool>( colorMaskParams.green, maskValue, TEST_LOCATION );
3621 DALI_TEST_EQUALS<bool>( colorMaskParams.blue, maskValue, TEST_LOCATION );
3622 DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, maskValue, TEST_LOCATION );
3625 int UtcDaliActorPropertyClippingP(void)
3627 // This test checks the clippingMode property.
3628 tet_infoline( "Testing Actor::Property::CLIPPING_MODE P" );
3629 TestApplication application;
3631 Actor actor = Actor::New();
3633 // Check default clippingEnabled value.
3634 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
3637 bool getValueResult = getValue.Get( value );
3638 DALI_TEST_CHECK( getValueResult );
3640 if( getValueResult )
3642 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3645 // Check setting the property.
3646 actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3648 // Check the new value was set.
3649 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
3650 getValueResult = getValue.Get( value );
3651 DALI_TEST_CHECK( getValueResult );
3653 if( getValueResult )
3655 DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION );
3661 int UtcDaliActorPropertyClippingN(void)
3663 // Negative test case for Clipping.
3664 tet_infoline( "Testing Actor::Property::CLIPPING_MODE N" );
3665 TestApplication application;
3667 Actor actor = Actor::New();
3669 // Check default clippingEnabled value.
3670 Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
3673 bool getValueResult = getValue.Get( value );
3674 DALI_TEST_CHECK( getValueResult );
3676 if( getValueResult )
3678 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3681 // Check setting an invalid property value won't change the current property value.
3682 actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" );
3684 getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
3685 getValueResult = getValue.Get( value );
3686 DALI_TEST_CHECK( getValueResult );
3688 if( getValueResult )
3690 DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
3696 int UtcDaliActorPropertyClippingActor(void)
3698 // This test checks that an actor is correctly setup for clipping.
3699 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor" );
3700 TestApplication application;
3702 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3703 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3704 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3705 size_t startIndex = 0u;
3707 // Create a clipping actor.
3708 Actor actorDepth1Clip = CreateActorWithContent();
3709 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3710 Stage::GetCurrent().Add( actorDepth1Clip );
3712 // Gather the call trace.
3713 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3715 // Check we are writing to the color buffer.
3716 CheckColorMask( glAbstraction, true );
3718 // Check the stencil buffer was enabled.
3719 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3721 // Check the stencil buffer was cleared.
3722 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3724 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3725 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3726 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
3727 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3732 int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
3734 // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
3735 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor enable and then disable" );
3736 TestApplication application;
3738 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3739 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3740 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3741 size_t startIndex = 0u;
3743 // Create a clipping actor.
3744 Actor actorDepth1Clip = CreateActorWithContent();
3745 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3746 Stage::GetCurrent().Add( actorDepth1Clip );
3748 // Gather the call trace.
3749 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3751 // Check we are writing to the color buffer.
3752 CheckColorMask( glAbstraction, true );
3754 // Check the stencil buffer was enabled.
3755 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3757 // Check the stencil buffer was cleared.
3758 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3760 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3761 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3762 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
3763 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3765 // Now disable the clipping
3766 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
3768 // Gather the call trace.
3769 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3771 // Check the stencil buffer was disabled.
3772 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3774 // Ensure all values in stencil-mask are set to 1.
3776 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
3782 int UtcDaliActorPropertyClippingNestedChildren(void)
3784 // This test checks that a hierarchy of actors are clipped correctly by
3785 // writing to and reading from the correct bit-planes of the stencil buffer.
3786 tet_infoline( "Testing Actor::Property::CLIPPING_MODE nested children" );
3787 TestApplication application;
3788 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3789 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3790 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3792 // Create a clipping actor.
3793 Actor actorDepth1Clip = CreateActorWithContent();
3794 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3795 Stage::GetCurrent().Add( actorDepth1Clip );
3797 // Create a child actor.
3798 Actor childDepth2 = CreateActorWithContent();
3799 actorDepth1Clip.Add( childDepth2 );
3801 // Create another clipping actor.
3802 Actor childDepth2Clip = CreateActorWithContent();
3803 childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3804 childDepth2.Add( childDepth2Clip );
3806 // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
3807 // This tests the sort algorithm.
3808 Actor childDepth3 = CreateActorWithContent();
3809 childDepth2Clip.Add( childDepth3 );
3810 Actor childDepth4 = CreateActorWithContent();
3811 childDepth3.Add( childDepth4 );
3813 // Gather the call trace.
3814 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3816 // Check we are writing to the color buffer.
3817 CheckColorMask( glAbstraction, true );
3819 // Check the stencil buffer was enabled.
3820 DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3822 // Perform the test twice, once for 2D layer, and once for 3D.
3823 for( unsigned int i = 0u ; i < 2u; ++i )
3825 size_t startIndex = 0u;
3827 // Check the stencil buffer was cleared.
3828 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
3830 // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
3831 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
3832 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); // Write to the first bit-plane
3833 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3835 // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
3836 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 255", startIndex ) ); // 514 is GL_EQUAL
3837 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
3839 // Check we are set up to write to the second bitplane of the stencil buffer (only).
3840 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 1", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
3841 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "3", startIndex ) ); // Write to second (and previous) bit-planes
3842 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
3844 // Check we are set up to test against both the first and second bit-planes of the stencil buffer.
3845 // (Both must be set to pass the check).
3846 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 255", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
3847 DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
3849 // If we are on the first loop, set the layer to 3D and loop to perform the test again.
3852 Stage::GetCurrent().GetRootLayer().SetBehavior( Layer::LAYER_3D );
3853 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3860 int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
3862 // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
3863 tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" );
3864 TestApplication application;
3866 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
3867 TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
3868 TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
3870 // Create a clipping actor.
3871 Actor actorDepth1Clip = CreateActorWithContent();
3872 actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
3873 Stage::GetCurrent().Add( actorDepth1Clip );
3875 // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
3876 actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
3878 // Gather the call trace.
3879 GenerateTrace( application, enabledDisableTrace, stencilTrace );
3881 // Check we are writing to the color buffer.
3882 CheckColorMask( glAbstraction, true );
3884 // Check the stencil buffer was not enabled.
3885 DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
3887 // Check stencil functions are not called.
3888 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) );
3889 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) );
3890 DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) );
3895 int UtcDaliGetPropertyN(void)
3897 tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" );
3898 TestApplication app;
3900 Actor actor = Actor::New();
3902 unsigned int propertyCount = actor.GetPropertyCount();
3903 DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );