+
+int UtcDaliCustomActorDoAction(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::CustomActor::DoAction()");
+
+ TestCustomActor custom = TestCustomActor::New();
+
+ BaseHandle customActorObject = custom;
+
+ DALI_TEST_CHECK(customActorObject);
+
+ Property::Map attributes;
+
+ // Check that an invalid command is not performed
+ DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
+
+ // Check that the custom actor is visible
+ custom.SetVisible(true);
+ DALI_TEST_CHECK(custom.IsVisible() == true);
+
+ // Check the custom actor performed an action to hide itself
+ DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the custom actor is now invisible
+ DALI_TEST_CHECK(custom.IsVisible() == false);
+
+ // Check the custom actor performed an action to show itself
+ DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the custom actor is now visible
+ DALI_TEST_CHECK(custom.IsVisible() == true);
+ END_TEST;
+}
+
+int UtcDaliCustomActorCustomActor(void)
+{
+ Dali::CustomActor customA;
+ Dali::CustomActor customB( customA );
+
+ DALI_TEST_CHECK( customA == customB );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorImplRelayoutRequest(void)
+{
+ TestApplication application;
+
+ DALI_TEST_CHECK( gOnRelayout == false );
+
+ TestCustomActor custom = TestCustomActor::NewNegoSize();
+ Stage::GetCurrent().Add(custom);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( gOnRelayout == true );
+ gOnRelayout = false;
+
+ custom.TestRelayoutRequest();
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( gOnRelayout == true );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorImplGetHeightForWidthBase(void)
+{
+ TestApplication application;
+ TestCustomActor custom = TestCustomActor::NewNegoSize();
+
+ float width = 300.0f;
+ float v = 0.0f;
+
+ application.SendNotification();
+ application.Render();
+
+ v = custom.TestGetHeightForWidthBase( width );
+
+ DALI_TEST_CHECK( v == width );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorImplGetWidthForHeightBase(void)
+{
+ TestApplication application;
+ TestCustomActor custom = TestCustomActor::NewNegoSize();
+
+ float height = 300.0f;
+ float v = 0.0f;
+
+ application.SendNotification();
+ application.Render();
+
+ v = custom.TestGetWidthForHeightBase( height );
+
+ DALI_TEST_CHECK( v == height );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorImplCalculateChildSizeBase(void)
+{
+ TestApplication application;
+ TestCustomActor custom = TestCustomActor::NewNegoSize();
+
+ Actor child = Actor::New();
+ child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
+ child.SetSize(150, 150);
+
+ application.SendNotification();
+ application.Render();
+
+ float v = 9.99f;
+ v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
+ DALI_TEST_CHECK( v == 0.0f );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
+{
+ TestApplication application;
+ TestCustomActor custom = TestCustomActor::NewNegoSize();
+ custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
+
+ bool v = false;
+
+ v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( v == true );
+
+ custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
+ v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( v == false );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorTypeRegistry(void)
+{
+ TestApplication application;
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+
+ std::string name;
+ std::string exception;
+
+ try
+ {
+ name = handle.GetTypeName();
+ tet_result(TET_FAIL);
+ }
+ catch( DaliException& e )
+ {
+ exception = e.condition;
+ DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+
+int UtcDaliCustomActorGetExtensionP(void)
+{
+ TestApplication application;
+
+ TestCustomActor custom = TestCustomActor::NewVariant5();
+
+ DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() );
+
+ END_TEST;
+}
+
+int UtcDaliCustomActorOnConnectionDepth(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::CustomActor::OnStageConnection() hierarchy depth");
+
+ Stage stage = Stage::GetCurrent();
+
+ /* Build tree of actors:
+ *
+ * Depth
+ *
+ * A (parent) 1
+ * / \
+ * B C 2
+ * / \ \
+ * D E F 3
+ *
+ * OnStageConnection should return 1 for A, 2 for B and C, and 3 for D, E and F.
+ */
+
+ TestCustomActor actorA = TestCustomActor::New();
+ stage.Add( actorA );
+
+ TestCustomActor actorB = TestCustomActor::New();
+ actorA.Add( actorB );
+
+ TestCustomActor actorC = TestCustomActor::New();
+ actorA.Add( actorC );
+
+ TestCustomActor actorD = TestCustomActor::New();
+ actorB.Add( actorD );
+
+ TestCustomActor actorE = TestCustomActor::New();
+ actorB.Add( actorE );
+
+ TestCustomActor actorF = TestCustomActor::New();
+ actorC.Add( actorF );
+
+ // Excercise the message passing to Update thread
+ application.SendNotification();
+ application.Render();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1u, actorA.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 2u, actorB.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 2u, actorC.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 3u, actorD.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 3u, actorE.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 3u, actorF.GetDepth(), TEST_LOCATION );
+
+ END_TEST;
+}