X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-RenderTask.cpp;h=e25bf6a0ca4476783ddbca8904718b90339ce728;hb=5fab3d3bc329a7a19ec9cf1cac82031ca97af72d;hp=647594f357910284dc0223e303e7bfdcff05a9ab;hpb=8d88b3be741a3907eae18b7274406a22f2fdad9c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 647594f..e25bf6a 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -169,56 +169,30 @@ bool TestScreenToFrameBufferFunction( Vector2& coordinates ) return true; } -Actor CreateLoadingActor(TestApplication& application, std::string filename, ResourceImage::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy) +Actor CreateRenderableActorSuccess(TestApplication& application, std::string filename) { - Image image = ResourceImage::New(filename, loadPolicy, releasePolicy); - DALI_TEST_CHECK( image ); - application.SendNotification(); - application.Render(16); - DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) ); + PrepareResourceImage( application, 80u, 80u, Pixel::RGBA8888 ); + Image image = ResourceImage::New(filename); Actor actor = CreateRenderableActor(image); actor.SetSize( 80, 80 ); - application.SendNotification(); - application.Render(16); return actor; } -Image CreateLoadingImage(TestApplication& application, std::string filename, ResourceImage::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy) +Actor CreateRenderableActorFailed(TestApplication& application, std::string filename) { - Image image = ResourceImage::New(filename, loadPolicy, releasePolicy); + Image image = ResourceImage::New(filename); 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 ids; - ids.push_back( 23 ); - application.GetGlAbstraction().SetNextTextureIds( ids ); - - 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); - - application.GetPlatform().SetResourceLoaded(resourceId, requestType, resource); -} - -void FailImageLoad(TestApplication& application, Integration::ResourceId resourceId ) -{ - application.GetPlatform().SetResourceLoadFailed(resourceId, Integration::FailureUnknown); + Actor actor = CreateRenderableActor(image); + actor.SetSize( 80, 80 ); + return actor; } -void ReloadImage(TestApplication& application, ResourceImage image) +Image CreateResourceImage(TestApplication& application, std::string filename) { - application.GetPlatform().ClearReadyResources(); - application.GetPlatform().DiscardRequest(); - application.GetPlatform().ResetTrace(); - application.GetPlatform().SetClosestImageSize(Vector2(80.0f, 80.0f)); // Ensure reload is called. - image.Reload(); + PrepareResourceImage( application, 80u, 80u, Pixel::RGBA8888 ); + Image image = ResourceImage::New(filename); + DALI_TEST_CHECK( image ); + return image; } RenderTask CreateRenderTask(TestApplication& application, @@ -686,7 +660,7 @@ int UtcDaliRenderTaskGetSourceActorN(void) { Actor actor = task.GetSourceActor(); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -885,7 +859,7 @@ int UtcDaliRenderTaskSetExclusiveN(void) { task.SetExclusive(true); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -938,9 +912,9 @@ int UtcDaliRenderTaskIsExclusiveN(void) try { bool x = task.IsExclusive(); - x=x; + (void) x; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1062,7 +1036,7 @@ int UtcDaliRenderTaskGetCameraActorN(void) { Actor actor = task.GetCameraActor(); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1238,7 +1212,7 @@ int UtcDaliRenderTaskSetScreenToFrameBufferFunctionN(void) { task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1275,9 +1249,9 @@ int UtcDaliRenderTaskGetScreenToFrameBufferFunctionN(void) try { RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction(); - func=func; + (void) func; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1312,7 +1286,7 @@ int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorN(void) Actor mappingActor; task.SetScreenToFrameBufferMappingActor(mappingActor); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1378,9 +1352,9 @@ int UtcDaliRenderTaskGetViewportN(void) try { Viewport viewport = task.GetViewport(); - viewport = viewport; + (void) viewport; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1425,7 +1399,7 @@ int UtcDaliRenderTaskSetViewportN(void) Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f ); task.SetViewport( newViewport ); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1574,7 +1548,7 @@ int UtcDaliRenderTaskSetClearColorN(void) { task.SetClearColor( Vector4::ZERO ); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1604,9 +1578,9 @@ int UtcDaliRenderTaskGetClearColorN(void) try { Vector4 color = task.GetClearColor(); - color = color; + (void) color; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1644,7 +1618,7 @@ int UtcDaliRenderTaskSetClearEnabledN(void) { task.SetClearEnabled(true); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1676,9 +1650,9 @@ int UtcDaliRenderTaskGetClearEnabledN(void) try { bool x = task.GetClearEnabled(); - x=x; + (void) x; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1714,7 +1688,7 @@ int UtcDaliRenderTaskSetCullModeN(void) { task.SetCullMode( false ); } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1744,9 +1718,9 @@ int UtcDaliRenderTaskGetCullModeN(void) try { bool x = task.GetCullMode(); - x=x; + (void) x; } - catch (Dali::DaliException(e)) + catch (Dali::DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); @@ -1862,7 +1836,6 @@ int UtcDaliRenderTaskSignalFinished(void) application.Render(); application.SendNotification(); DALI_TEST_CHECK( finished ); - finished = false; DALI_TEST_EQUALS( application.GetUpdateStatus(), 0, TEST_LOCATION ); END_TEST; @@ -1886,16 +1859,11 @@ int UtcDaliRenderTaskContinuous01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); bool finished = false; RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating @@ -1929,10 +1897,7 @@ int UtcDaliRenderTaskContinuous02(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); secondRootActor.SetVisible(false); @@ -1940,7 +1905,6 @@ int UtcDaliRenderTaskContinuous02(void) bool finished = false; RenderTaskFinished renderTaskFinished( finished ); newTask.FinishedSignal().Connect( &application, renderTaskFinished ); - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating @@ -1971,17 +1935,13 @@ int UtcDaliRenderTaskContinuous03(void) Stage::GetCurrent().Add( rootActor ); CameraActor offscreenCameraActor = CameraActor::New(); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); 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 ); - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected @@ -2002,46 +1962,7 @@ int UtcDaliRenderTaskContinuous04(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: 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 ); - Actor secondRootActor = CreateLoadingActor(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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - 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"); + tet_infoline("Testing RenderTask Render Continuous using loaded image"); // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2053,22 +1974,7 @@ int UtcDaliRenderTaskContinous05(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - - Shader shader = CreateShader(); - - - 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; - TextureSet textureSet = CreateTextureSet( image ); - - Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); - Actor secondRootActor = Actor::New(); - secondRootActor.AddRenderer(renderer); - secondRootActor.SetSize(100, 100); + Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); @@ -2078,22 +1984,15 @@ int UtcDaliRenderTaskContinous05(void) application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); END_TEST; } - int UtcDaliRenderTaskOnce01(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GlSync, using loading image\nPRE: Resources not ready, Source not visible\nPOST: Finished signal sent once only"); + tet_infoline("Testing RenderTask Render Once GlSync, using loaded image"); // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2106,10 +2005,7 @@ int UtcDaliRenderTaskOnce01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); @@ -2119,26 +2015,13 @@ int UtcDaliRenderTaskOnce01(void) newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // MAKE SOURCE VISIBLE - secondRootActor.SetVisible(true); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - // 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, __LINE__ ) ); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } @@ -2147,8 +2030,7 @@ int UtcDaliRenderTaskOnce02(void) { 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"); + tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n"); // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2163,10 +2045,7 @@ int UtcDaliRenderTaskOnce02(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - 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; + Image image = CreateResourceImage(application, "aFile.jpg"); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2183,21 +2062,14 @@ int UtcDaliRenderTaskOnce02(void) newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - // 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, __LINE__ ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK( lastSyncObj != NULL ); + sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } @@ -2206,9 +2078,7 @@ 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"); + tet_infoline("Testing RenderTask Render Once GlSync, using loaded image. Switch from render always after ready to render once\n"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -2221,10 +2091,7 @@ int UtcDaliRenderTaskOnce03(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); @@ -2233,26 +2100,17 @@ int UtcDaliRenderTaskOnce03(void) newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + application.SendNotification(); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); @@ -2263,10 +2121,9 @@ 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" + tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded 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 ); @@ -2281,10 +2138,7 @@ int UtcDaliRenderTaskOnce04(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - 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; + Image image = CreateResourceImage(application, "aFile.jpg"); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2301,44 +2155,31 @@ int UtcDaliRenderTaskOnce04(void) newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + application.SendNotification(); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } -int UtcDaliRenderTaskOnce05(void) +int UtcDaliRenderTaskOnceNoSync01(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GlSync\n" - "Switch from Render always after ready to render once with resources unready\n" - "PRE: Everything ready to render\n" - "POST: Finished signal sent once"); + tet_infoline("Testing RenderTask Render Once, \nPRE: Resources ready\nPOST: Finished signal sent once only"); - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK + // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); @@ -2347,64 +2188,28 @@ int UtcDaliRenderTaskOnce05(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // CHANGE TO RENDER ONCE - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, true, __LINE__ ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - application.GetPlatform().ClearReadyResources(); - - sync.SetObjectSynced( lastSyncObj, true ); - - // Expect: No draw - we've just drawn our render task once, above. No finished signal - - // we won't read the gl sync until the next frame. Continue rendering - we're waiting for - // the sync - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // Expect: 1 final draw - this Update doesn't update the scene, hence render instructions - // from last frame but 1 are still present. - // Finished signal should be true - we've just done the sync. - // Should now stop rendering and updating - nothing left to do. - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, true, false, __LINE__ ) ); - + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } -#if 0 -//int UtcDaliRenderTaskOnce06(void) +int UtcDaliRenderTaskOnceNoSync02(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GlSync\n" - "During RenderOnce, make ready resources unready before sending first finished signal\n" - "PRE: Everything ready.\n" - "POST: Finished signal sent only once"); - - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK + tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loaded image.\n" + "PRE: Resources 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); @@ -2413,72 +2218,42 @@ int UtcDaliRenderTaskOnce05(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); + Shader shader = CreateShader(); + Image image = CreateResourceImage(application, "aFile.jpg"); + TextureSet textureSet = CreateTextureSet( image ); + + Geometry geometry = CreateQuadGeometry(); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures( textureSet ); + Actor secondRootActor = Actor::New(); + secondRootActor.AddRenderer(renderer); + secondRootActor.SetSize(100, 100); Stage::GetCurrent().Add(secondRootActor); - application.GetPlatform().ClearReadyResources(); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + 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, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, RESOURCES BECOME NOT READY - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - - // Doesn't work... - ReloadImage(application, secondRootActor.GetImage()); - application.SendNotification(); // Input, Expected Input, Expected - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_EQUALS( secondRootActor.GetImage().GetLoadingState(), Dali::ResourceLoading, TEST_LOCATION); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, true, __LINE__ ) ); application.GetPlatform().ClearReadyResources(); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - // Finished rendering - expect no more renders, no more signals: - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); END_TEST; } -#endif -int UtcDaliRenderTaskOnce07(void) +int UtcDaliRenderTaskOnceNoSync03(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GLSync\n" - "Render once, Second call to SetRefreshRate(ONCE) triggers only one more finished signal\n" - "PRE: Everything ready\n" - "POST: exactly 1 finished signal per call to SetRefreshRate(ONCE)"); + tet_infoline("Testing RenderTask Render Once, using loaded image. Switch from render always after ready to render once\n" + "PRE: Render task ready, Image loaded\n" + "POST: Finished signal sent only once"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); @@ -2487,67 +2262,36 @@ int UtcDaliRenderTaskOnce07(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + 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, true, finished, false, false, __LINE__ ) ); - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); + application.SendNotification(); // Input, Expected Input, Expected DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } -int UtcDaliRenderTaskOnce08(void) +int UtcDaliRenderTaskOnceNoSync04(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GLSync\n" - "Render once, Call to SetRefreshRate(ONCE) in Finished signal callback triggers " - "another render & another finished signal\n" - "PRE: Everything ready\n" - "POST: exactly 1 finished signal per call to SetRefreshRate(ONCE)"); - + 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"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - sync.GetTrace().Enable(true); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2555,85 +2299,53 @@ int UtcDaliRenderTaskOnce08(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - Stage::GetCurrent().Add(secondRootActor); + Shader shader = CreateShader(); + Image image = CreateResourceImage(application, "aFile.jpg"); + TextureSet textureSet = CreateTextureSet( image ); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, /*GL-SYNC*/ true); - bool finished = false; + Geometry geometry = CreateQuadGeometry(); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures( textureSet ); + Actor secondRootActor = Actor::New(); + secondRootActor.AddRenderer(renderer); + secondRootActor.SetSize(100, 100); + Stage::GetCurrent().Add(secondRootActor); - ConnectionTracker connectionTracker; - RenderTaskFinishedRenderAgain renderTaskFinishedRenderAgain( finished ); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinishedRenderAgain ); + 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, true, finished, false, false, __LINE__ ) ); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj == NULL ); - DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 0, TEST_LOCATION ); - - // CHANGE TO RENDER ONCE, newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); + application.SendNotification(); // Input, Expected Input, Expected DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - - DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION ); - - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - application.SendNotification(); - // Expect SetRefreshRate to have been called again - // Prevent next finished signal calling refresh once again - RenderTaskFinished renderTaskFinished( finished ); - connectionTracker.DisconnectAll(); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinished ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + DALI_TEST_CHECK( lastSyncObj == NULL ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } - -int UtcDaliRenderTaskOnce09(void) +int UtcDaliRenderTaskOnceNoSync05(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GlSync\n" - "SetRefreshRate(ONCE) again before first finished signal has been sent.\n" - "PRE: resources ready\n" - "POST: Only 1 finished signal sent."); + tet_infoline("Testing RenderTask Render Once\n" + "SetRefreshRate(ONCE), resource load failed, completes render task.\n" + "PRE: resources failed to load\n" + "POST: No finished signal sent."); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); @@ -2642,632 +2354,21 @@ int UtcDaliRenderTaskOnce09(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - + Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + 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 + // START PROCESS/RENDER Input, Expected Input, Expected DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); // CHANGE TO RENDER ONCE, newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - END_TEST; -} - -int UtcDaliRenderTaskOnce10(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once GlSync\n" - "SetRefreshRate(ONCE), resource load failed completes render task.\n" - "PRE: resources not ready\n" - "POST: Only 1 finished signal sent."); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - tet_printf(" FailImageLoad\n"); - - FailImageLoad(application, imageRequestId); // Need to run Update again for this to complete - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); // nothing to draw - application.SendNotification(); - - // load is now failed so there's nothing more to render in the render task - // Expect finished signal, as all resources are complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync01(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once, using loading image\nPRE: Resources not ready, Source not visible\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 ); - Actor secondRootActor = CreateLoadingActor(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_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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync02(void) -{ - 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 ); - - Shader shader = CreateShader(); - 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; - TextureSet textureSet = CreateTextureSet( image ); - - Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); - 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - 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"); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(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, 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - 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"); - - // 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 ); - - Shader shader = CreateShader(); - 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; - TextureSet textureSet = CreateTextureSet( image ); - - Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); - 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); - - // 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, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); - - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync05(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "Switch from Render always after ready to render once with resources unready\n" - "PRE: Everything ready to render\n" - "POST: Finished signal sent once"); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(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, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); - application.SendNotification(); - - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); - - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // CHANGE TO RENDER ONCE - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // 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, true, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - END_TEST; -} - -#if 0 -//int UtcDaliRenderTaskOnceNoSync06(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "During RenderOnce, make ready resources unready before sending first finished signal\n" - "PRE: Everything ready.\n" - "POST: Finished signal sent only once"); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - - 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, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, RESOURCES BECOME NOT READY - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - - // Doesn't work... - ReloadImage(application, secondRootActor.GetImage()); - application.SendNotification(); // Input, Expected Input, Expected - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_EQUALS( secondRootActor.GetImage().GetLoadingState(), Dali::ResourceLoading, TEST_LOCATION); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // FINISH RESOURCE LOADING - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, true, true, __LINE__ ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - END_TEST; -} -#endif - -int UtcDaliRenderTaskOnceNoSync07(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "Render once, Second call to SetRefreshRate(ONCE) triggers only one more finished signal\n" - "PRE: Everything ready\n" - "POST: exactly 1 finished signal per call to SetRefreshRate(ONCE)"); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - - 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, true, finished, false, false, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync08(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "Render once, Call to SetRefreshRate(ONCE) in Finished signal callback triggers\n" - "another render & another finished signal\n" - "PRE: Everything ready\n" - "POST: exactly 1 finished signal per call to SetRefreshRate(ONCE)"); - - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - - Stage::GetCurrent().Add(secondRootActor); - - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - - ConnectionTracker connectionTracker; - RenderTaskFinishedRenderAgain renderTaskFinishedRenderAgain( finished ); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinishedRenderAgain ); - - application.SendNotification(); - - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - // Expect SetRefreshRate to have been called again - // Prevent next finished signal calling refresh once again - RenderTaskFinished renderTaskFinished( finished ); - connectionTracker.DisconnectAll(); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinished ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - END_TEST; -} - - -int UtcDaliRenderTaskOnceNoSync09(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "SetRefreshRate(ONCE) again before first finished signal has been sent.\n" - "PRE: resources ready\n" - "POST: Only 1 finished signal sent."); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - application.Render(); - application.GetPlatform().ClearReadyResources(); - - 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, true, finished, false, false, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync10(void) -{ - TestApplication application; - - tet_infoline("Testing RenderTask Render Once\n" - "SetRefreshRate(ONCE), resource load failed, completes render task.\n" - "PRE: resources not ready\n" - "POST: Only 1 finished signal sent."); - - // 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 ); - Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - 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, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - - FailImageLoad(application, imageRequestId); // Need to run Update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); // nothing to draw - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } @@ -3280,7 +2381,7 @@ int UtcDaliRenderTaskOnceChain01(void) tet_infoline("Testing RenderTask Render Once Chained render tasks\n" "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n" - "PRE: resources not ready\n" + "PRE: resources ready\n" "POST: 2 finished signals sent."); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK @@ -3293,10 +2394,7 @@ int UtcDaliRenderTaskOnceChain01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor firstRootActor = CreateLoadingActor(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor firstRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(firstRootActor); // first render task @@ -3316,15 +2414,6 @@ int UtcDaliRenderTaskOnceChain01(void) application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( firstFinished == false ); - DALI_TEST_CHECK( secondFinished == false ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( firstFinished == false ); - DALI_TEST_CHECK( secondFinished == false ); - - CompleteImageLoad(application, imageRequestId, imageType); DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) ); DALI_TEST_CHECK( firstFinished == false ); DALI_TEST_CHECK( secondFinished == false ); @@ -3333,7 +2422,7 @@ int UtcDaliRenderTaskOnceChain01(void) DALI_TEST_CHECK( firstFinished == true ); DALI_TEST_CHECK( secondFinished == false ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, secondFinished, true, false, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, secondFinished, true, false, __LINE__ ) ); DALI_TEST_CHECK( secondFinished == true ); END_TEST; @@ -3374,7 +2463,7 @@ int UtcDaliRenderTaskSetScreenToFrameBufferMappingActor(void) RenderTaskList taskList = stage.GetRenderTaskList(); RenderTask renderTask = taskList.CreateTask(); - FrameBufferImage frameBufferImage = FrameBufferImage::New(stageSize.width*scale.x, stageSize.height*scale.y, Pixel::A8, Image::NEVER); + FrameBufferImage frameBufferImage = FrameBufferImage::New(stageSize.width*scale.x, stageSize.height*scale.y, Pixel::A8); renderTask.SetSourceActor( offscreenActor ); renderTask.SetExclusive( true ); renderTask.SetInputEnabled( true );