X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-AnimatedVectorImageVisual.cpp;h=90bb27bf03bff97d13ec27e7b2c35b500297a4e6;hb=e5d4cd830e75a208dd18c743e1564a4ed1fde780;hp=1ba413a630612ff419d1108ae78d413480d56933;hpb=c01f2590ed7bb00d9b3600511d08dc420261ed46;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index 1ba413a..90bb27b 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -75,7 +75,7 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual01(void) DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); @@ -108,7 +108,7 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual02(void) DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); @@ -147,7 +147,7 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual03(void) DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); @@ -188,14 +188,18 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void) DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - actor.SetSize( 200.0f, 200.0f ); + actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) ); Stage::GetCurrent().Add( actor ); application.SendNotification(); application.Render(); + // Trigger count is 1 - render a frame + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + // renderer is added to actor DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); + Renderer renderer = actor.GetRendererAt( 0u ); DALI_TEST_CHECK( renderer ); @@ -259,7 +263,7 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -347,8 +351,6 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void) application.SendNotification(); application.Render( 16 ); - std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); // wait for one animation loop (16fps, 5frames, need 80ms) - Property::Map map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE ); DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING ); @@ -359,8 +361,6 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void) application.SendNotification(); application.Render(16); - std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run - map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_STATE ); DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED ); @@ -437,7 +437,7 @@ int UtcDaliAnimatedVectorImageVisualPlayback(void) // Change Size Vector3 newSize( 100.0f, 100.0f, 0.0f ); - dummyControl.SetSize( newSize ); + dummyControl.SetProperty( Actor::Property::SIZE, newSize ); application.SendNotification(); application.Render(16); @@ -476,7 +476,7 @@ int UtcDaliAnimatedVectorImageVisualCustomShader(void) Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); - dummy.SetSize( 200.f, 200.f ); + dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) ); dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); Stage::GetCurrent().Add( dummy ); @@ -526,7 +526,7 @@ int UtcDaliAnimatedVectorImageVisualNaturalSize(void) DALI_TEST_EQUALS( naturalSize, Vector2( 100.0f, 100.0f ), TEST_LOCATION ); // 100x100 is the content default size. - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); application.SendNotification(); application.Render(); @@ -556,7 +556,7 @@ int UtcDaliAnimatedVectorImageVisualLoopCount(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -566,7 +566,7 @@ int UtcDaliAnimatedVectorImageVisualLoopCount(void) application.SendNotification(); application.Render(); - // Trigger count is 1 - animation finished + // Trigger count is 1 - render a frame DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); // renderer is added to actor @@ -600,7 +600,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -610,6 +610,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + // renderer is added to actor DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); Renderer renderer = actor.GetRendererAt( 0u ); @@ -638,6 +640,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_RANGE ); @@ -658,6 +662,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); @@ -710,7 +716,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -720,6 +726,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + // renderer is added to actor DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); Renderer renderer = actor.GetRendererAt( 0u ); @@ -748,6 +756,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_RANGE ); @@ -770,6 +780,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_RANGE ); @@ -803,7 +815,7 @@ int UtcDaliAnimatedVectorImageVisualAnimationFinishedSignal(void) DevelControl::VisualEventSignal( actor ).Connect( &VisualEventSignal ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -814,7 +826,7 @@ int UtcDaliAnimatedVectorImageVisualAnimationFinishedSignal(void) application.Render(); // Wait for animation finish - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_STATE ); @@ -837,12 +849,14 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap ); DALI_TEST_CHECK( visual ); + tet_printf( "1. Visual is created.\n" ); + DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -854,10 +868,14 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); + tet_printf( "2. The current frame number is [%d].\n", value->Get< int >() ); + Property::Array array; array.PushBack( 0 ); array.PushBack( 2 ); @@ -871,10 +889,14 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); + tet_printf( "3. The current frame number is [%d].\n", value->Get< int >() ); + // Change play range attributes.Clear(); array.Clear(); @@ -899,27 +921,35 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); + tet_printf( "4. The current frame number is [%d].\n", value->Get< int >() ); + // Jump to the same position DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3 ); application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); + tet_printf( "5. The current frame number is [%d].\n", value->Get< int >() ); + END_TEST; } int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress" ); + tet_infoline( "UtcDaliAnimatedVectorImageVisualUpdateProperty" ); int startFrame = 1, endFrame = 3; Property::Array playRange; @@ -940,13 +970,15 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::LOOP_COUNT ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); @@ -973,6 +1005,8 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::LOOP_COUNT ); DALI_TEST_EQUALS( value->Get< int >(), 5, TEST_LOCATION ); @@ -997,6 +1031,8 @@ int UtcDaliAnimatedVectorImageVisualUpdateProperty(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_RANGE ); @@ -1046,7 +1082,7 @@ int UtcDaliAnimatedVectorImageVisualStopBehavior(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -1057,7 +1093,7 @@ int UtcDaliAnimatedVectorImageVisualStopBehavior(void) application.Render(); // Trigger count is 1 - animation finished - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); @@ -1141,7 +1177,7 @@ int UtcDaliAnimatedVectorImageVisualLoopingMode(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -1152,7 +1188,7 @@ int UtcDaliAnimatedVectorImageVisualLoopingMode(void) application.Render(); // Trigger count is 1 - animation finished - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); @@ -1218,8 +1254,8 @@ int UtcDaliAnimatedVectorImageVisualPropertyNotification(void) Vector2 controlSize( 20.f, 30.f ); Vector3 controlScale( 2.0f, 2.0f, 1.0f ); - actor.SetSize( controlSize ); - actor.SetScale( controlScale ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); + actor.SetProperty( Actor::Property::SCALE, controlScale ); Stage::GetCurrent().Add( actor ); @@ -1241,8 +1277,8 @@ int UtcDaliAnimatedVectorImageVisualPropertyNotification(void) // Change scale and size controlSize = Vector2( 50.f, 40.f ); controlScale= Vector3( 0.5f, 0.5f, 1.0f ); - actor.SetSize( controlSize ); - actor.SetScale( controlScale ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); + actor.SetProperty( Actor::Property::SCALE, controlScale ); application.SendNotification(); application.Render(); @@ -1279,7 +1315,7 @@ int UtcDaliAnimatedVectorImageVisualMultipleInstances(void) dummyImpl1.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual1 ); Vector2 controlSize( 20.f, 30.f ); - actor1.SetSize( controlSize ); + actor1.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor1 ); @@ -1294,7 +1330,7 @@ int UtcDaliAnimatedVectorImageVisualMultipleInstances(void) DummyControlImpl& dummyImpl2 = static_cast< DummyControlImpl& >( actor2.GetImplementation() ); dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual2 ); - actor2.SetSize( controlSize ); + actor2.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor2 ); @@ -1343,7 +1379,7 @@ int UtcDaliAnimatedVectorImageVisualControlVisibilityChanged(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -1353,6 +1389,9 @@ int UtcDaliAnimatedVectorImageVisualControlVisibilityChanged(void) Property::Map attributes; DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes ); + application.SendNotification(); + application.Render(); + // Check rendering behavior DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); Renderer renderer = actor.GetRendererAt( 0u ); @@ -1387,7 +1426,7 @@ int UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged(void) dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); Vector2 controlSize( 20.f, 30.f ); - actor.SetSize( controlSize ); + actor.SetProperty( Actor::Property::SIZE, controlSize ); Stage::GetCurrent().Add( actor ); @@ -1397,6 +1436,9 @@ int UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged(void) Property::Map attributes; DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes ); + application.SendNotification(); + application.Render(); + // Check rendering behavior DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); Renderer renderer = actor.GetRendererAt( 0u );