#include <dali/public-api/dali-core.h>
#include <dali/devel-api/images/texture-set-image.h>
-#include <dali/devel-api/object/handle-devel.h>
#include <cstdio>
#include <string>
application.Render(0);
// Expect no blue component in either buffer - yellow
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( renderer, colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
application.Render(0);
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( renderer, colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
renderer.RemoveConstraints();
renderer.SetProperty(colorIndex, Color::WHITE );
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( renderer, colorIndex ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE, TEST_LOCATION );
END_TEST;
}
application.SendNotification();
application.Render(500);
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( renderer, colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION );
application.Render(500);
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( renderer, colorIndex ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::TRANSPARENT, TEST_LOCATION );
END_TEST;
}
Actor CreateActor( Actor parent, int siblingOrder, const char* location )
{
- Actor actor0 = Actor::New();
- actor0.SetAnchorPoint(AnchorPoint::CENTER);
- actor0.SetParentOrigin(AnchorPoint::CENTER);
- actor0.SetPosition(0.0f,0.0f);
- actor0.SetSize(100, 100);
- actor0.SetProperty( Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder );
- DALI_TEST_EQUALS( actor0.GetProperty<int>( Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location) );
- parent.Add(actor0);
+ Actor actor = Actor::New();
+ actor.SetAnchorPoint(AnchorPoint::CENTER);
+ actor.SetParentOrigin(AnchorPoint::CENTER);
+ actor.SetPosition(0.0f,0.0f);
+ actor.SetSize(100, 100);
+ parent.Add(actor);
+ actor.SetProperty( Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder );
+ DALI_TEST_EQUALS( actor.GetProperty<int>( Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location) );
- return actor0;
+ return actor;
}
int UtcDaliRendererRenderOrder2DLayer(void)
//Check that renderer0 has been rendered after renderer2
DALI_TEST_GREATER( textureBindIndex[4], textureBindIndex[5], TEST_LOCATION );
- //Check that renderer0 has been rendered after renderer2
+ //Check that renderer5 has been rendered after renderer2
DALI_TEST_GREATER( textureBindIndex[5], textureBindIndex[0], TEST_LOCATION );
//Check that renderer0 has been rendered after renderer2
void CheckEnumerationProperty( Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString )
{
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( initialValue ) );
- DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< int >( renderer, propertyIndex ) == static_cast<int>( initialValue ) );
+ DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( initialValue ) );
renderer.SetProperty( propertyIndex, firstCheckEnumeration );
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
- DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< int >( renderer, propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
+ DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
renderer.SetProperty( propertyIndex, secondCheckString );
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
- DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< int >( renderer, propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
+ DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
}
int UtcDaliRendererEnumProperties(void)
renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL );
+ // Set a different stencil function as the last one is cached.
+ renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS );
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) );
}; const int StencilOperationLookupTableCount = sizeof( StencilOperationLookupTable ) / sizeof( StencilOperationLookupTable[0] );
// Set all 3 StencilOperation properties to a default.
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::ZERO );
+ renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP );
renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::ZERO );
renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::ZERO );
* - Checks the correct parameters to "glStencilFunc" were used
* - Checks the above for all 3 parameter placements of StencilOperation ( OnFail, OnZFail, OnPass )
*/
- int stencilOperationPropertyKeys[] = { Renderer::Property::STENCIL_OPERATION_ON_FAIL, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS };
std::string methodString( "StencilOp" );
- for( int parameterIndex = 0; parameterIndex < 3; ++parameterIndex )
+ for( int i = 0; i < StencilOperationLookupTableCount; ++i )
{
- for( int i = 0; i < StencilOperationLookupTableCount; ++i )
+ for( int j = 0; j < StencilOperationLookupTableCount; ++j )
{
- // Set the property (outer loop causes all 3 different properties to be set separately).
- renderer.SetProperty( stencilOperationPropertyKeys[ parameterIndex ], static_cast<Dali::StencilFunction::Type>( i ) );
-
- // Check GetProperty returns the same value.
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( stencilOperationPropertyKeys[ parameterIndex ] ).Get<int>() ), i, TEST_LOCATION );
-
- // Reset the trace debug.
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
-
- // Check the function is called and the parameters are correct.
- // Set the expected parameter value at its correct index (only)
- parameters[ parameterIndex ] = StencilOperationLookupTable[ i ];
-
- // Build the parameter list.
- std::stringstream parameterStream;
- for( int parameterBuild = 0; parameterBuild < 3; ++parameterBuild )
+ for( int k = 0; k < StencilOperationLookupTableCount; ++k )
{
- parameterStream << parameters[ parameterBuild ];
- // Comma-separate the parameters.
- if( parameterBuild < 2 )
+ // Set the property (outer loop causes all 3 different properties to be set separately).
+ renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, static_cast<Dali::StencilFunction::Type>( i ) );
+ renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, static_cast<Dali::StencilFunction::Type>( j ) );
+ renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, static_cast<Dali::StencilFunction::Type>( k ) );
+
+ // Check GetProperty returns the same value.
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL ).Get<int>() ), i, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL ).Get<int>() ), j, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS ).Get<int>() ), k, TEST_LOCATION );
+
+ // Reset the trace debug.
+ ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+
+ // Check the function is called and the parameters are correct.
+ // Set the expected parameter value at its correct index (only)
+ parameters[ 0u ] = StencilOperationLookupTable[ i ];
+ parameters[ 1u ] = StencilOperationLookupTable[ j ];
+ parameters[ 2u ] = StencilOperationLookupTable[ k ];
+
+ // Build the parameter list.
+ std::stringstream parameterStream;
+ for( int parameterBuild = 0; parameterBuild < 3; ++parameterBuild )
{
- parameterStream << ", ";
+ parameterStream << parameters[ parameterBuild ];
+ // Comma-separate the parameters.
+ if( parameterBuild < 2 )
+ {
+ parameterStream << ", ";
+ }
}
- }
- // Check the function was called and the parameters were correct.
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ // Check the function was called and the parameters were correct.
+ DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ }
}
}