// Check that the actor1 was rendered
const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
- DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION );
+ DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 0 ), TEST_LOCATION );
if ( boundTextures.size() )
{
- DALI_TEST_EQUALS( boundTextures[0], 8u/*unique to actor1*/, TEST_LOCATION );
+ int c = 0;
+ DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
+ if( boundTextures.size() > 1 )
+ {
+ DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
+ }
}
BufferImage img2 = BufferImage::New( 1,1 );
application.Render();
// Check that the actors were rendered
- DALI_TEST_EQUALS( boundTextures.size(), 2u, TEST_LOCATION );
+ DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 1 ), TEST_LOCATION );
if ( boundTextures.size() )
{
- DALI_TEST_EQUALS( boundTextures[0], 9u/*unique to actor2*/, TEST_LOCATION );
- DALI_TEST_EQUALS( boundTextures[1], 8u/*unique to actor1*/, TEST_LOCATION );
+ int c = 0;
+ DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION );
+ if( boundTextures.size() > 2 )
+ {
+ DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor1*/, TEST_LOCATION );
+ }
+ DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
}
BufferImage img3 = BufferImage::New( 1,1 );
application.Render();
// Check that the actors were rendered
- DALI_TEST_EQUALS( boundTextures.size(), 3u, TEST_LOCATION );
+ DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 2 ), TEST_LOCATION );
if ( boundTextures.size() )
{
- DALI_TEST_EQUALS( boundTextures[0], 10u/*unique to actor3*/, TEST_LOCATION );
- DALI_TEST_EQUALS( boundTextures[1], 9u/*unique to actor2*/, TEST_LOCATION );
- DALI_TEST_EQUALS( boundTextures[2], 8u/*unique to actor1*/, TEST_LOCATION );
+ int c = 0;
+ DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor3*/, TEST_LOCATION );
+ if( boundTextures.size() > 3 )
+ {
+ DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor2*/, TEST_LOCATION );
+ }
+ DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION );
+ DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
}
// Both actors are now connected to the root node
RenderTask task = taskList.GetTask( 0u );
- // By default render-tasks do not render off-screen
+ // A scene creates frame buffer by default
FrameBuffer frameBuffer = task.GetFrameBuffer();
- DALI_TEST_CHECK( !frameBuffer );
+ DALI_TEST_CHECK( frameBuffer );
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ // Create another animation which animates by a certain value
+ const Vector2 newPosition4( 75.0f, 45.0f );
+ const Vector2 relativePosition( newPosition4 - newPosition3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_POSITION ), relativePosition );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ // Create another animation which animates by a certain value
+ const Vector2 newSize4( 75.0f, 45.0f );
+ const Vector2 relativeSize( newSize4 - newSize3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_SIZE ), relativeSize );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ // Create another animation which animates by a certain value
+ const Vector4 newColor4( 0.45f, 0.35f, 0.25f, 0.1f );
+ const Vector4 relativeColor( newColor4 - newColor3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::CLEAR_COLOR ), relativeColor );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+
END_TEST;
}
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Shader shader = CreateShader();
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Shader shader = CreateShader();
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Shader shader = CreateShader();
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Shader shader = CreateShader();
Actor rootActor = Actor::New();
Stage::GetCurrent().Add( rootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg");
Stage::GetCurrent().Add(secondRootActor);
Actor defaultRootActor = Actor::New(); // Root for default RT
Stage::GetCurrent().Add( defaultRootActor );
- CameraActor offscreenCameraActor = CameraActor::New();
+ CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
Stage::GetCurrent().Add( offscreenCameraActor );
Actor firstRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
Stage::GetCurrent().Add(firstRootActor);
int UtcDaliRenderTaskWorldToViewport(void)
{
- TestApplication application( static_cast<size_t>(400), static_cast<size_t>(400) ); // square surface
+ TestApplication application( 400u, 400u ); // square surface
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();