X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-LayoutingAnimation.cpp;h=2bf827acf2added1968b344782649b1623d283c5;hp=c7e2e4f1c256ef11f3f3c3c8de796a6366269729;hb=118f87dfe57967bfed8ccdf9143a078eaef1b119;hpb=c021084d852437ece9f71cce1feab7933bc839da diff --git a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp index c7e2e4f..2bf827a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp @@ -199,7 +199,7 @@ int UtcDaliLayouting_LayoutTransitionDataSetGetTransition(void) int UtcDaliLayouting_SetLayoutTransition01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_SetLayoutTransition01"); + tet_infoline(" UtcDaliLayouting_SetLayoutTransition01" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -382,7 +382,7 @@ int UtcDaliLayouting_SetLayoutTransition01(void) int UtcDaliLayouting_AddChildLayoutTransition01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition01"); + tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition01" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -479,7 +479,7 @@ int UtcDaliLayouting_AddChildLayoutTransition01(void) int UtcDaliLayouting_RemoveChildLayoutTransition01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_RemoveChildLayoutTransition01"); + tet_infoline(" UtcDaliLayouting_RemoveChildLayoutTransition01" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -679,7 +679,7 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) int UtcDaliLayouting_FocusChildLayoutTransition01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition01"); + tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition01" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -734,7 +734,7 @@ int UtcDaliLayouting_FocusChildLayoutTransition01(void) map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" ) .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); @@ -743,11 +743,12 @@ int UtcDaliLayouting_FocusChildLayoutTransition01(void) { // Shrink the lost focus child Property::Map map; + map[ "affectsSiblings" ] = false; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 80.0f, 80.0f, 0 ); map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" ) .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); @@ -756,6 +757,7 @@ int UtcDaliLayouting_FocusChildLayoutTransition01(void) { // Grow the gained focus child Property::Map map; + map[ "affectsSiblings" ] = false; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED; map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 ); @@ -816,10 +818,310 @@ int UtcDaliLayouting_FocusChildLayoutTransition01(void) END_TEST; } +int UtcDaliLayouting_FocusChildLayoutTransition02(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition02" ); + + Stage stage = Stage::GetCurrent(); + auto container = Control::New(); + auto horizontalLayout = LinearLayout::New(); + horizontalLayout.SetAnimateLayout( false ); + horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); + + DevelControl::SetLayout( container, horizontalLayout ); + container.SetName( "Container" ); + + std::vector< Control > controls; + controls.push_back( CreateLeafControl( 100, 100 ) ); + controls.push_back( CreateLeafControl( 100, 100 ) ); + + stage.Add( container ); + container.Add( controls[0] ); + container.Add( controls[1] ); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + manager.SetFocus( controls[0] ); + + // Initial rendering done + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + horizontalLayout.SetAnimateLayout( true ); + + auto layoutTransitionData = LayoutTransitionData::New(); + { + // Shrink the lost focus child width + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children + } + { + // Shrink the lost focus child width + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child + } + { + // Shrink the lost focus child height + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child + } + { + // Grow the gained focus child + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 ); + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child + } + + horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData ); + + bool signalReceived(false); + LayoutTransitionFinishCheck finishCheck(signalReceived); + layoutTransitionData.FinishedSignal().Connect(&application, finishCheck); + manager.SetFocus( controls[1] ); + + application.SendNotification(); + application.Render( 1u /*just very beginning of the animation*/ ); + + finishCheck.CheckSignalNotReceived(); + // Animation just started + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ ); + + // Animation just finished + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render( 10u /* wait a bit more for a signal */ ); + + // Now sizes and positions are finally set + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + finishCheck.CheckSignalReceived(); + + END_TEST; +} + +int UtcDaliLayouting_FocusChildLayoutTransition03(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition03" ); + + Stage stage = Stage::GetCurrent(); + auto container = Control::New(); + auto horizontalLayout = LinearLayout::New(); + horizontalLayout.SetAnimateLayout( false ); + horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); + + DevelControl::SetLayout( container, horizontalLayout ); + container.SetName( "Container" ); + + std::vector< Control > controls; + controls.push_back( CreateLeafControl( 100, 100 ) ); + controls.push_back( CreateLeafControl( 100, 100 ) ); + + stage.Add( container ); + container.Add( controls[0] ); + container.Add( controls[1] ); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + manager.SetFocus( controls[0] ); + + // Initial rendering done + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + horizontalLayout.SetAnimateLayout( true ); + + auto layoutTransitionData = LayoutTransitionData::New(); + { + // Shrink the lost focus child width + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children + } + { + // Shrink the lost focus child width + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_X; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child + } + { + // Shrink the lost focus child height + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_Y; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f; + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child + } + { + // Grow the gained focus child + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 1.2f, 1.2f, 1.0f ); + map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO; + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child + } + + horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData ); + + bool signalReceived(false); + LayoutTransitionFinishCheck finishCheck(signalReceived); + layoutTransitionData.FinishedSignal().Connect(&application, finishCheck); + manager.SetFocus( controls[1] ); + + application.SendNotification(); + application.Render( 1u /*just very beginning of the animation*/ ); + + finishCheck.CheckSignalNotReceived(); + // Animation just started + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ ); + + // Animation just finished + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize() * controls[0].GetCurrentScale(), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize() * controls[1].GetCurrentScale(), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + application.SendNotification(); + application.Render( 10u /* wait a bit more for a signal */ ); + + // Now sizes and positions are finally set + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ) * controls[0].GetProperty( Actor::Property::SCALE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ) * controls[1].GetProperty( Actor::Property::SCALE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + finishCheck.CheckSignalReceived(); + + END_TEST; +} + int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames"); + tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -919,7 +1221,7 @@ int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void) int UtcDaliLayouting_AddChildLayoutTransition03_Path(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition03_Path"); + tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition03_Path" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -1047,7 +1349,7 @@ int UtcDaliLayouting_AddChildLayoutTransition03_Path(void) int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy"); + tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -1089,7 +1391,7 @@ int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) { Property::Map map; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 0.0f, 350.0f, 0 ); + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 10.0f, 10.0f, 0 ); map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_BY") .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") @@ -1122,7 +1424,7 @@ int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION ); application.SendNotification(); application.Render( 10u /* wait a bit more for a signal */ ); @@ -1132,7 +1434,7 @@ int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION ); finishCheck.CheckSignalReceived(); @@ -1142,7 +1444,7 @@ int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) int UtcDaliLayouting_AddChildLayoutTransition05(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition05"); + tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition05" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -1382,7 +1684,7 @@ int UtcDaliLayouting_AddChildLayoutTransition05(void) int UtcDaliLayouting_DefaultTransition01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliLayouting_DefaultTransition01"); + tet_infoline(" UtcDaliLayouting_DefaultTransition01" ); Stage stage = Stage::GetCurrent(); auto container = Control::New(); @@ -1440,7 +1742,7 @@ int UtcDaliLayouting_DefaultTransition01(void) .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); layoutTransitionData0.AddPropertyAnimator( controls[0], map ); } - DevelControl::GetLayout( controls[0] ).SetTransitionData(LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData0 ); + DevelControl::GetLayout( controls[0] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData0 ); auto layoutTransitionData1 = LayoutTransitionData::New(); { @@ -1465,9 +1767,9 @@ int UtcDaliLayouting_DefaultTransition01(void) .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); - layoutTransitionData0.AddPropertyAnimator( controls[1], map ); + layoutTransitionData1.AddPropertyAnimator( controls[1], map ); } - DevelControl::GetLayout( controls[1] ).SetTransitionData(LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData1 ); + DevelControl::GetLayout( controls[1] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData1 ); horizontalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL ); @@ -1481,7 +1783,7 @@ int UtcDaliLayouting_DefaultTransition01(void) DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); // Now sizes and positions are set DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );