#include <dali/integration-api/debug.h>
#include <test-native-image.h>
+#include <mesh-builder.h>
+
#define BOOLSTR(x) ((x)?"T":"F")
return true;
}
-ImageActor CreateLoadingImage(TestApplication& application, std::string filename, ResourceImage::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy)
+ImageActor CreateLoadingImageActor(TestApplication& application, std::string filename, ResourceImage::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy)
{
Image image = ResourceImage::New(filename, loadPolicy, releasePolicy);
DALI_TEST_CHECK( image );
return actor;
}
+Image CreateLoadingImage(TestApplication& application, std::string filename, ResourceImage::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy)
+{
+ Image image = ResourceImage::New(filename, loadPolicy, releasePolicy);
+ DALI_TEST_CHECK( image );
+ application.SendNotification();
+ application.Render(16);
+ DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
+
+ return image;
+}
+
void CompleteImageLoad(TestApplication& application, Integration::ResourceId resourceId, Integration::ResourceTypeId requestType)
{
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
DALI_TEST_CHECK( lastSyncObj != NULL );
application.Render();
- DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
application.SendNotification();
DALI_TEST_CHECK( !finished );
application.Render();
- DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
application.SendNotification();
DALI_TEST_CHECK( ! finished );
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
Stage::GetCurrent().Add( rootActor );
CameraActor offscreenCameraActor = CameraActor::New();
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
+ Integration::ResourceId imageRequestId = imageRequest->GetId();
+ Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ Stage::GetCurrent().Add(secondRootActor);
+
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ application.SendNotification();
+
+ // START PROCESS/RENDER Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+
+ // FINISH RESOURCE LOADING - expect 'continuous' renders to start, no finished signal
+ CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) );
+ END_TEST;
+}
+
+int UtcDaliRenderTaskContinous05(void)
+{
+ TestApplication application;
+
+ tet_infoline("Testing RenderTask Render Continuous using Mesh which accesses texture through sampler with loading image\n"
+ "PRE: Resource not ready\nPOST:continuous renders, no Finished signal");
+
+ // SETUP AN OFFSCREEN RENDER TASK
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ CameraActor offscreenCameraActor = CameraActor::New();
+ Stage::GetCurrent().Add( offscreenCameraActor );
+
+ Material material = CreateMaterial();
+ Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ material.AddTexture( image, "sTexture" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, material);
+ Actor secondRootActor = Actor::New();
+ secondRootActor.AddRenderer(renderer);
+ secondRootActor.SetSize(100, 100);
Stage::GetCurrent().Add(secondRootActor);
RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
// FINISH RESOURCE LOADING - expect 'continuous' renders to start, no finished signal
CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) );
+
END_TEST;
}
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
{
TestApplication application;
+ tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loading image.\n"
+ "PRE: Resources not ready\nPOST: Finished signal sent once only");
+
+ // SETUP AN OFFSCREEN RENDER TASK
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ CameraActor offscreenCameraActor = CameraActor::New();
+ Stage::GetCurrent().Add( offscreenCameraActor );
+
+ Material material = CreateMaterial();
+ Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
+ Integration::ResourceId imageRequestId = imageRequest->GetId();
+ Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ material.AddTexture( image, "sTexture" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, material);
+ Actor secondRootActor = Actor::New();
+ secondRootActor.AddRenderer(renderer);
+ secondRootActor.SetSize(100, 100);
+ Stage::GetCurrent().Add(secondRootActor);
+
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ application.SendNotification();
+
+ // START PROCESS/RENDER Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+
+ // FINISH RESOURCE LOADING - expect no rendering yet
+ CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) );
+ Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
+ DALI_TEST_CHECK( lastSyncObj != NULL );
+
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ application.GetPlatform().ClearReadyResources();
+ sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) );
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskOnce03(void)
+{
+ TestApplication application;
+
tet_infoline("Testing RenderTask Render Once GlSync, using loading image. Switch from render always after ready to render once\n"
"PRE: Render task ready, Image not loaded\n"
"POST: Finished signal sent only once");
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
-int UtcDaliRenderTaskOnce03(void)
+int UtcDaliRenderTaskOnce04(void)
+{
+ TestApplication application;
+ tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loading image.\n"
+ "Switch from render always after ready to render once\n"
+ "PRE: Render task ready, Image not loaded\n"
+ "POST: Finished signal sent only once");
+
+ // SETUP AN OFFSCREEN RENDER TASK
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ CameraActor offscreenCameraActor = CameraActor::New();
+ Stage::GetCurrent().Add( offscreenCameraActor );
+
+ Material material = CreateMaterial();
+ Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
+ Integration::ResourceId imageRequestId = imageRequest->GetId();
+ Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ material.AddTexture( image, "sTexture" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, material);
+ Actor secondRootActor = Actor::New();
+ secondRootActor.AddRenderer(renderer);
+ secondRootActor.SetSize(100, 100);
+ Stage::GetCurrent().Add(secondRootActor);
+
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ application.SendNotification();
+
+ // START PROCESS/RENDER Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+
+ // FINISH RESOURCE LOADING
+ CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) );
+ application.GetPlatform().ClearReadyResources();
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) );
+
+ newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ application.SendNotification(); // Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) );
+ Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
+ DALI_TEST_CHECK( lastSyncObj != NULL );
+
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) );
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskOnce05(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
#if 0
-//int UtcDaliRenderTaskOnce04(void)
+//int UtcDaliRenderTaskOnce06(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
#endif
-int UtcDaliRenderTaskOnce05(void)
+int UtcDaliRenderTaskOnce07(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
END_TEST;
}
-int UtcDaliRenderTaskOnce06(void)
+int UtcDaliRenderTaskOnce08(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
-int UtcDaliRenderTaskOnce07(void)
+int UtcDaliRenderTaskOnce09(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
END_TEST;
}
-
-
-int UtcDaliRenderTaskOnce08(void)
+int UtcDaliRenderTaskOnce10(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Stage::GetCurrent().Add(secondRootActor);
END_TEST;
}
-
-
int UtcDaliRenderTaskOnceNoSync01(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
{
TestApplication application;
+ tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
+ "PRE: Resources not ready\nPOST: Finished signal sent once only");
+ // SETUP AN OFFSCREEN RENDER TASK
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ CameraActor offscreenCameraActor = CameraActor::New();
+ Stage::GetCurrent().Add( offscreenCameraActor );
+
+ Material material = CreateMaterial();
+ Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
+ Integration::ResourceId imageRequestId = imageRequest->GetId();
+ Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ material.AddTexture(image, "sTexture" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, material);
+ Actor secondRootActor = Actor::New();
+ secondRootActor.AddRenderer(renderer);
+ secondRootActor.SetSize(100, 100);
+ Stage::GetCurrent().Add(secondRootActor);
+
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ application.SendNotification();
+
+ // START PROCESS/RENDER Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+
+ // FINISH RESOURCE LOADING - expect immediate rendering yet
+ CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) );
+ application.GetPlatform().ClearReadyResources();
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) );
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskOnceNoSync03(void)
+{
+ TestApplication application;
+
tet_infoline("Testing RenderTask Render Once, using loading image. Switch from render always after ready to render once\n"
"PRE: Render task ready, Image not loaded\n"
"POST: Finished signal sent only once");
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
END_TEST;
}
+int UtcDaliRenderTaskOnceNoSync04(void)
+{
+ TestApplication application;
+
+ tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
+ "Switch from render always after ready to render once\n"
+ "PRE: Render task ready, Image not loaded\n"
+ "POST: Finished signal sent only once");
-int UtcDaliRenderTaskOnceNoSync03(void)
+ // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ drawTrace.Enable(true);
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ CameraActor offscreenCameraActor = CameraActor::New();
+ Stage::GetCurrent().Add( offscreenCameraActor );
+
+ Material material = CreateMaterial();
+ Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
+ Integration::ResourceId imageRequestId = imageRequest->GetId();
+ Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
+ material.AddTexture( image, "sTexture" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Renderer renderer = Renderer::New(geometry, material);
+ Actor secondRootActor = Actor::New();
+ secondRootActor.AddRenderer(renderer);
+ secondRootActor.SetSize(100, 100);
+ Stage::GetCurrent().Add(secondRootActor);
+
+
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ application.SendNotification();
+
+ // START PROCESS/RENDER Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) );
+
+ // FINISH RESOURCE LOADING
+ CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) );
+ application.GetPlatform().ClearReadyResources();
+
+ newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ application.SendNotification(); // Input, Expected Input, Expected
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) );
+ DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) );
+ END_TEST;
+}
+
+int UtcDaliRenderTaskOnceNoSync05(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
#if 0
-//int UtcDaliRenderTaskOnceNoSync04(void)
+//int UtcDaliRenderTaskOnceNoSync06(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
#endif
-int UtcDaliRenderTaskOnceNoSync05(void)
+int UtcDaliRenderTaskOnceNoSync07(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
END_TEST;
}
-int UtcDaliRenderTaskOnceNoSync06(void)
+int UtcDaliRenderTaskOnceNoSync08(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
}
-int UtcDaliRenderTaskOnceNoSync07(void)
+int UtcDaliRenderTaskOnceNoSync09(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
END_TEST;
}
-int UtcDaliRenderTaskOnceNoSync08(void)
+int UtcDaliRenderTaskOnceNoSync10(void)
{
TestApplication application;
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor secondRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Stage::GetCurrent().Add(secondRootActor);
CameraActor offscreenCameraActor = CameraActor::New();
Stage::GetCurrent().Add( offscreenCameraActor );
- ImageActor firstRootActor = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
+ ImageActor firstRootActor = CreateLoadingImageActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
Integration::ResourceId imageRequestId = imageRequest->GetId();
Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
Property::IndexContainer indices;
task.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), task.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), task.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK( lastSyncObj != NULL );
application.Render();
- DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
application.SendNotification();
DALI_TEST_CHECK( !finished );
application.Render();
- DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
application.SendNotification();
DALI_TEST_CHECK( ! finished );
END_TEST;
}
+
+int UtcDaliRenderTaskFinishMissingImage(void)
+{
+ TestApplication application;
+
+ // Previously we had bugs where not having a resource ID would cause render-tasks to wait forever
+ tet_infoline("Testing RenderTask::SignalFinished() when an ImageActor has no Image set");
+
+ Stage stage = Stage::GetCurrent();
+
+ BufferImage image = BufferImage::New( 10, 10 );
+ ImageActor rootActor = ImageActor::New( image );
+ rootActor.SetSize( 10, 10 );
+ stage.Add( rootActor );
+
+ ImageActor actorWithMissingImage = ImageActor::New( Image() );
+ actorWithMissingImage.SetSize( 10, 10 );
+ stage.Add( actorWithMissingImage );
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTask newTask = taskList.CreateTask();
+ newTask.SetInputEnabled( false );
+ newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) );
+ newTask.SetClearEnabled( true );
+ newTask.SetExclusive( true );
+ newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
+
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished( finished );
+ newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+
+ // 1 render to process render task, then 1 before finished msg is sent from update to the event thread.
+ application.SendNotification();
+ application.Render();
+ application.Render();
+
+ application.SendNotification();
+ DALI_TEST_CHECK( finished );
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskWorldToViewport(void)
+{
+ TestApplication application( static_cast<size_t>(400), static_cast<size_t>(400) ); // square surface
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+
+ Actor actor = Actor::New();
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetPosition( Vector3(0.0, 0.0, 0.0) );
+
+ actor.SetParentOrigin( Vector3(0.5, 0.5, 0.5) );
+ actor.SetAnchorPoint( Vector3(0.5, 0.5, 0.5) );
+
+ Stage::GetCurrent().Add(actor);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ RenderTask task = taskList.GetTask( 0u );
+
+ CameraActor camera = task.GetCameraActor();
+
+ Vector2 screenSize = task.GetCurrentViewportSize();
+
+ float screenX = 0.0;
+ float screenY = 0.0;
+
+ bool ok = task.WorldToViewport(actor.GetCurrentWorldPosition(), screenX, screenY);
+ DALI_TEST_CHECK(ok == true);
+
+ DALI_TEST_EQUALS(screenX, screenSize.x/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenY, screenSize.y/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+
+ Actor actor2 = Actor::New();
+ float actor2Size = 100.f;
+ actor2.SetSize( actor2Size, actor2Size );
+ actor2.SetPosition( Vector3(0.0, 0.0, 0.0) );
+ actor2.SetParentOrigin( Vector3(0.5, 0.5, 0.0) );
+ actor2.SetAnchorPoint( Vector3(0.5, 0.5, 0.0) );
+ Stage::GetCurrent().Add( actor2 );
+ actor2.Add(actor);
+ actor.SetParentOrigin( Vector3(0,0,0) );
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ ok = task.WorldToViewport(actor.GetCurrentWorldPosition(), screenX, screenY);
+ DALI_TEST_CHECK(ok == true);
+
+ DALI_TEST_EQUALS(screenX, screenSize.x/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenY, screenSize.y/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+int UtcDaliRenderTaskViewportToLocal(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+ actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ actor.SetSize(100.0f, 100.0f);
+ actor.SetPosition(10.0f, 10.0f);
+ Stage::GetCurrent().Add(actor);
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTask task = taskList.GetTask( 0u );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ float localX;
+ float localY;
+
+ float rtLocalX;
+ float rtLocalY;
+
+ float screenX = 50.0f;
+ float screenY = 50.0f;
+
+ DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) );
+
+ DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) );
+
+ DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION);
+
+ END_TEST;
+
+}