END_TEST;
}
-int UtcDaliMaterialSetFaceCullingMode(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetFaceCullingMode(cullingMode)");
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& cullFaceStack = gl.GetCullFaceTrace();
- cullFaceStack.Reset();
- gl.EnableCullFaceCallTrace(true);
-
- material.SetFaceCullingMode( Material::CULL_BACK_AND_FRONT);
- application.SendNotification();
- application.Render();
-
- // Todo: test the glCullFace(GL_FRONT_AND_BACK) is actually been called, cannot pass this test with current implementation
- DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 0, TEST_LOCATION);
- //string parameter("GL_FRONT_AND_BACK" );
- //DALI_TEST_CHECK( cullFaceStack.TestMethodAndParams(0, "CullFace", parameter) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialBlendingOptions01(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetBlendFunc(src, dest) ");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- // set a transparent actor color so that blending is enabled
- actor.SetOpacity( 0.5f );
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendFunc(BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE);
-
- // Test that Set was successful:
- BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
- BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
- BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
- BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
- material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
- DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION );
-
- application.SendNotification();
- application.Render();
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliMaterialBlendingOptions02(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetBlendFunc(srcRgb, destRgb, srcAlpha, destAlpha) ");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.SetOpacity( 0.5f ); // enable blending
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendFunc( BlendingFactor::CONSTANT_COLOR, BlendingFactor::ONE_MINUS_CONSTANT_COLOR,
- BlendingFactor::CONSTANT_ALPHA, BlendingFactor::ONE_MINUS_CONSTANT_ALPHA );
-
- // Test that Set was successful:
- {
- BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
- BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
- BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
- BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
- material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
- DALI_TEST_EQUALS( BlendingFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION );
- }
-
- application.SendNotification();
- application.Render();
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
-
- END_TEST;
-}
-
-
-
-int UtcDaliMaterialBlendingOptions03(void)
-{
- TestApplication application;
-
- tet_infoline("Test GetBlendEquation() defaults ");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- // Test the defaults as documented in blending.h
- BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
- BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
- material.GetBlendEquation( equationRgb, equationAlpha );
- DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliMaterialBlendingOptions04(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetBlendEquation() ");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.SetOpacity( 0.1f );
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- // Test the single blending equation setting
- {
- material.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT );
- BlendingEquation::Type equationRgba( BlendingEquation::SUBTRACT );
- material.GetBlendEquation( equationRgba, equationRgba );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgba, TEST_LOCATION );
- }
-
- material.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT, BlendingEquation::REVERSE_SUBTRACT );
-
- // Test that Set was successful
- {
- BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
- BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
- material.GetBlendEquation( equationRgb, equationAlpha );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION );
- }
-
- // Render & check GL commands
- application.SendNotification();
- application.Render();
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode01(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to on with an opaque color renders with blending enabled");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.SetOpacity( 0.98f );
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::ON);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-
-int UtcDaliMaterialSetBlendMode02(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to off with a transparent color renders with blending disabled (and not enabled)");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.SetOpacity( 0.15f );
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::OFF);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode03(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to auto with a transparent material color renders with blending enabled");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.SetOpacity( 0.75f );
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode04(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to auto with an opaque color renders with blending disabled");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode04b(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to auto with an opaque material color and a transparent actor color renders with blending enabled");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- actor.SetColor( Vector4(1.0f, 0.0f, 1.0f, 0.5f) );
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode04c(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to auto with an opaque material color and an opaque actor color renders with blending disabled");
-
- Geometry geometry = CreateQuadGeometry();
- Material material = CreateMaterial();
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- actor.SetColor( Color::MAGENTA );
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode05(void)
-{
- TestApplication application;
-
- tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled");
-
- Geometry geometry = CreateQuadGeometry();
- BufferImage image = BufferImage::New( 40, 40, Pixel::RGBA8888 );
- Material material = CreateMaterial( image );
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendMode06(void)
-{
- TestApplication application;
- tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_TRANSPARENT renders with blending enabled");
-
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_TRANSPARENT );
- Material material = Material::New(shader);
-
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
-
-//Todo: test the Shader::HINT_OUTPUT_IS_OPAQUE would disable the blending, the test cannot pass with current implementation
-/*int UtcDaliMaterialSetBlendMode07(void)
-{
- TestApplication application;
- tet_infoline("Test setting the blend mode to auto with a transparent color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled");
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
- Material material = Material::New(shader);
-
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}*/
-
-int UtcDaliMaterialSetBlendMode08(void)
-{
- TestApplication application;
- tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled");
-
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
- Material material = Material::New(shader);
- BufferImage image = BufferImage::New( 50, 50, Pixel::RGB888 );
- material.AddTexture( image, "sTexture" );
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- material.SetBlendMode(BlendingMode::AUTO);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace(true);
-
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", "GL_BLEND" ) );
-
- END_TEST;
-}
-
-int UtcDaliMaterialGetBlendMode(void)
-{
- TestApplication application;
-
- tet_infoline("Test GetBlendMode()");
-
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
- Material material = Material::New(shader);
-
- // default value
- DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::AUTO, TEST_LOCATION );
-
- // ON
- material.SetBlendMode(BlendingMode::ON);
- DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::ON, TEST_LOCATION );
-
- // OFF
- material.SetBlendMode(BlendingMode::OFF);
- DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::OFF, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliMaterialSetBlendColor(void)
-{
- TestApplication application;
-
- tet_infoline("Test SetBlendColor(color)");
-
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
- Material material = Material::New(shader);
- BufferImage image = BufferImage::New( 50, 50, Pixel::RGBA8888 );
- material.AddTexture( image, "sTexture" );
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add(actor);
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- material.SetBlendColor( Color::TRANSPARENT );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
-
- material.SetBlendColor( Color::MAGENTA );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION );
-
- Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
- material.SetBlendColor( color );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), color, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliMaterialGetBlendColor(void)
-{
- TestApplication application;
-
- tet_infoline("Test GetBlendColor()");
-
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
- Material material = Material::New(shader);
-
- DALI_TEST_EQUALS( material.GetBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
-
- material.SetBlendColor( Color::MAGENTA );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( material.GetBlendColor(), Color::MAGENTA, TEST_LOCATION );
-
- Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
- material.SetBlendColor( color );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( material.GetBlendColor(), color, TEST_LOCATION );
-
- END_TEST;
-}
-
int UtcDaliMaterialConstraint(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliMaterialSetTextureAffectsTransparency(void)
-{
- TestApplication application;
-
- Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
-
- Material material = CreateMaterial();
- material.AddTexture( image, "sTexture" );
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, material );
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetParentOrigin( ParentOrigin::CENTER );
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add( actor );
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
-
- // Test SetAffectsTransparency( false )
- material.SetTextureAffectsTransparency( 0, false );
-
- gl.EnableEnableDisableCallTrace(true);
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = gl.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- // Test SetAffectsTransparency( true )
- material.SetTextureAffectsTransparency( 0, true );
-
- glEnableStack.Reset();
- gl.EnableEnableDisableCallTrace(true);
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
int UtcDaliMaterialAddTexture01(void)
{
TestApplication application;
Material material = CreateMaterial();
material.RemoveTexture(0);
- DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0u, TEST_LOCATION );
material.RemoveTexture(1);
- DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0u, TEST_LOCATION );
Sampler sampler = Sampler::New();
sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
material.AddTexture( image, "sTexture", sampler );
- DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1u, TEST_LOCATION );
material.RemoveTexture(1);
- DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1u, TEST_LOCATION );
material.RemoveTexture(0);
- DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0u, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
+
+int UtcDaliMaterialGetTextureP(void)
+{
+ TestApplication application;
+
+ Image image0 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
+ Image image1 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
+ Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
+ Image image3 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
+
+
+ Material material = CreateMaterial();
+ material.AddTexture( image0, "sTexture0");
+ material.AddTexture( image1, "sTexture1");
+ material.AddTexture( image2, "sTexture2");
+ material.AddTexture( image3, "sTexture3");
+
+ Image textureImage0 = material.GetTexture( "sTexture0" );
+ DALI_TEST_EQUALS( textureImage0, image0, TEST_LOCATION );
+
+ Image textureImage1 = material.GetTexture( "sTexture1" );
+ DALI_TEST_EQUALS( textureImage1, image1, TEST_LOCATION );
+
+ Image textureImage2 = material.GetTexture( "sTexture2" );
+ DALI_TEST_EQUALS( textureImage2, image2, TEST_LOCATION );
+
+ Image textureImage3 = material.GetTexture( "sTexture3" );
+ DALI_TEST_EQUALS( textureImage3, image3, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliMaterialGetTextureN(void)
+{
+ TestApplication application;
+
+ Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
+
+ Material material = CreateMaterial();
+ material.AddTexture( image, "sTexture");
+
+ Image textureImage = material.GetTexture( "sTextureTEST" );
+ DALI_TEST_CHECK( !textureImage );
+
+ END_TEST;
+}
+