-
-int UtcDaliAnimatedVectorImageVisualPlaybackRiveFile(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline( "UtcDaliAnimatedVectorImageVisualPlaybackRiveFile" );
-
- {
- // request AnimatedVectorImageVisual for Rive with a property map
- VisualFactory factory = VisualFactory::Get();
- Visual::Base visual = factory.CreateVisual(
- Property::Map()
- .Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
- .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_RIVE_FILE_NAME ) );
-
- DummyControl dummyControl = DummyControl::New( true );
- Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummyControl.GetImplementation() );
- dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
- dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- Property::Map attributes;
- tet_infoline( "Test Play action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
- application.GetScene().Add( dummyControl );
- application.SendNotification();
- application.Render( 16 );
-
- 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 );
-
- tet_infoline( "Test Pause action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- 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 );
-
- tet_infoline( "Test Play action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
- tet_infoline( "Test Stop action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
- tet_infoline( "Test Stop action again" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
- tet_infoline( "Test Play action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
- tet_infoline( "Off stage" );
- dummyControl.Unparent();
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
- tet_infoline( "On stage again" );
- application.GetScene().Add( dummyControl );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
-
- tet_infoline( "Test Play action" );
- DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
- application.SendNotification();
- application.Render(16);
-
- map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
- value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PLAYING );
-
- // Change Size
- Vector3 newSize( 100.0f, 100.0f, 0.0f );
- dummyControl.SetProperty( Actor::Property::SIZE, newSize );
-
- application.SendNotification();
- application.Render(16);
-
- // Size should be changed
- Vector3 naturalSize = dummyControl.GetNaturalSize();
- DALI_TEST_CHECK( naturalSize == newSize );
-
- dummyControl.Unparent();
- }
-
- END_TEST;
-}
\ No newline at end of file