#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
+#include <dali/devel-api/object/handle-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex( BorderVisual::Property::COLOR );
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::COLOR );
Animation animation = Animation::New(4.0f);
animation.AnimateTo( Property(renderer, index), Color::WHITE );
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex( BorderVisual::Property::SIZE );
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::SIZE );
Animation animation = Animation::New(4.0f);
animation.AnimateTo( Property(renderer, index), 9.0f );
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
Animation animation = Animation::New(4.0f);
animation.AnimateTo( Property(renderer, index), Color::WHITE );
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex( PrimitiveVisual::Property::MIX_COLOR );
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
// The property isn't registered on the renderer, it's instead registered on the shader.
DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliVisualPremultipliedAlpha(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualPremultipliedAlpha" );
+
+ VisualFactory factory = VisualFactory::Get();
+
+ // image visual, test default value ( false )
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ) );
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap( visualMap );
+ Property::Value* value = visualMap.Find( DevelVisual::Property::PREMULTIPLIED_ALPHA );
+
+ // test values
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<bool>(), false, TEST_LOCATION );
+ }
+
+ // image visual, override premultiplied
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME )
+ .Add( DevelVisual::Property::PREMULTIPLIED_ALPHA, true ) );
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap( visualMap );
+ Property::Value* value = visualMap.Find( DevelVisual::Property::PREMULTIPLIED_ALPHA );
+
+ // test values
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<bool>(), true, TEST_LOCATION);
+ }
+
+ // svg visual ( premultiplied alpha by default is true )
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add( Visual::Property::TYPE, Visual::IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ) );
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap( visualMap );
+ Property::Value* value = visualMap.Find( DevelVisual::Property::PREMULTIPLIED_ALPHA );
+
+ // test values
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<bool>(), true, TEST_LOCATION );
+ }
+
+ END_TEST;
+}