[dali_1.2.32] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-CustomActor.cpp
index d02ed07..db7fca7 100644 (file)
@@ -876,6 +876,11 @@ int UtcDaliCustomActorOnSizeAnimation(void)
 
   Animation anim = Animation::New( 1.0f );
   anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) );
+  anim.Play();
+
+  application.SendNotification();
+  application.Render( static_cast<unsigned int>( 1000.0f ) );
+
   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
   DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
   DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION );
@@ -884,6 +889,38 @@ int UtcDaliCustomActorOnSizeAnimation(void)
   END_TEST;
 }
 
+int UtcDaliCustomActorSizeComponentAnimation(void)
+{
+  TestApplication application;
+  tet_infoline("Testing Size component animation");
+
+  Test::TestCustomActor custom = Test::TestCustomActor::New();
+  float intialWidth( 10.0f );
+
+  DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+  custom.SetSize( intialWidth, 10.0f); // First method
+
+  Animation anim = Animation::New( 1.0f );
+
+  DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+
+  anim.AnimateTo( Property( custom, Actor::Property::SIZE_WIDTH ), 20.0f );
+
+  DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+
+  anim.Play();   // Triggers second method ( OnSizeAnimation )
+
+  application.SendNotification();
+  application.Render( static_cast<unsigned int>( 1000.0f ) );
+
+  DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+
+  DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+
+  END_TEST;
+
+}
+
 int UtcDaliCustomActorOnTouchEvent(void)
 {
   TestApplication application;
@@ -1091,12 +1128,11 @@ int UtcDaliCustomActorImplGetHeightForWidthBase(void)
   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
 
   float width = 300.0f;
-  float v = 0.0f;
 
   application.SendNotification();
   application.Render();
 
-  v = custom.TestGetHeightForWidthBase( width );
+  float v = custom.TestGetHeightForWidthBase( width );
 
   DALI_TEST_CHECK( v == width );
 
@@ -1109,12 +1145,11 @@ int UtcDaliCustomActorImplGetWidthForHeightBase(void)
   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
 
   float height = 300.0f;
-  float v = 0.0f;
 
   application.SendNotification();
   application.Render();
 
-  v = custom.TestGetWidthForHeightBase( height );
+  float v = custom.TestGetWidthForHeightBase( height );
 
   DALI_TEST_CHECK( v == height );
 
@@ -1133,8 +1168,7 @@ int UtcDaliCustomActorImplCalculateChildSizeBase(void)
   application.SendNotification();
   application.Render();
 
-  float v = 9.99f;
-  v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
+  float v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
   DALI_TEST_CHECK( v == 0.0f );
 
   END_TEST;
@@ -1146,19 +1180,19 @@ int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
   custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
 
-  bool v = false;
+  bool v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
+  DALI_TEST_CHECK( v == true );
 
-  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 );
+  DALI_TEST_CHECK( v == false );
+
+  // why is this here?
   application.SendNotification();
   application.Render();
-  DALI_TEST_CHECK( v == false );
 
   END_TEST;
 }