X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-RenderTask.cpp;h=9b5e9de633facf1debb7418d99a188aaf57c1cf6;hb=3d95d69c92f1c9294479bf14ffaa66b8da840356;hp=d60bc54766bf5ce85efd6f112a80d1f3b79b0fa6;hpb=16c7741ca5508f2bce3cdd05b575951a5c15f048;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 d60bc54..9b5e9de 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -174,9 +175,9 @@ Actor CreateRenderableActorSuccess(TestApplication& application, std::string fil return actor; } -Texture CreateTexture() +Texture CreateTexture(void) { - return Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 80u, 80u); + return Dali::CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 80, 80); } RenderTask CreateRenderTask(TestApplication& application, @@ -184,16 +185,18 @@ RenderTask CreateRenderTask(TestApplication& application, Actor rootActor, // Reset default render task to point at this actor Actor secondRootActor, // Source actor unsigned int refreshRate, - bool glSync) + bool glSync, + uint32_t frameBufferWidth = 10, + uint32_t frameBufferHeight = 10) { // Change main render task to use a different root RenderTaskList taskList = application.GetScene().GetRenderTaskList(); taskList.GetTask(0u).SetSourceActor(rootActor); - FrameBuffer frameBuffer = FrameBuffer::New(10, 10); + FrameBuffer frameBuffer = FrameBuffer::New(frameBufferWidth, frameBufferHeight); if(glSync) { - NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); + NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(frameBufferWidth, frameBufferHeight); Texture texture = Texture::New(*testNativeImagePtr); frameBuffer.AttachColorTexture(texture); } @@ -344,7 +347,7 @@ int UtcDaliRenderTaskSetSourceActorP01(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -388,7 +391,7 @@ int UtcDaliRenderTaskSetSourceActorP02(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -447,7 +450,7 @@ int UtcDaliRenderTaskSetSourceActorOffScene(void) TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); task.SetSourceActor(newActor); @@ -496,7 +499,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -546,7 +549,7 @@ int UtcDaliRenderTaskSetSourceActorDestroyed(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -633,6 +636,14 @@ int UtcDaliRenderTaskSetExclusive(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + // Creates: + // Root + // Actor1 Layer Layer + // Actor2 Actor3 + + // Task 1 is the default render task, should render from Root, incl Actor2 + // Task 2 uses Actor2 as a source actor (texture id 9) + // Manipulate the GenTextures behaviour, to identify different actors std::vector ids; @@ -641,7 +652,7 @@ int UtcDaliRenderTaskSetExclusive(void) ids.push_back(10); // 10 = actor3 application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor1 = CreateRenderableActor(img1); actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); application.GetScene().Add(actor1); @@ -656,15 +667,11 @@ int UtcDaliRenderTaskSetExclusive(void) if(boundTextures.size()) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); - if(boundTextures.size() > 1) - { - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); - } + int a = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 8u /*unique to actor1*/, TEST_LOCATION); } - Texture img2 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img2 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor2 = CreateRenderableActor(img2); actor2.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -683,18 +690,15 @@ int UtcDaliRenderTaskSetExclusive(void) // Check that the actors were rendered DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(1), TEST_LOCATION); - if(boundTextures.size()) + if(boundTextures.size() >= 2) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); - if(boundTextures.size() > 2) - { - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor1*/, TEST_LOCATION); - } - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); + int a = boundTextures.size() - 2; + int b = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 8u /*unique to actor1*/, TEST_LOCATION); } - Texture img3 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img3 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor3 = CreateRenderableActor(img3); actor3.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -712,16 +716,14 @@ int UtcDaliRenderTaskSetExclusive(void) // Check that the actors were rendered DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(2), TEST_LOCATION); - if(boundTextures.size()) + if(boundTextures.size() >= 3) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor3*/, TEST_LOCATION); - if(boundTextures.size() > 3) - { - DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor2*/, TEST_LOCATION); - } - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); + int a = boundTextures.size() - 3; + int b = boundTextures.size() - 2; + int c = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 10u /*unique to actor3*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[c], 8u /*unique to actor1*/, TEST_LOCATION); } // Both actors are now connected to the root node @@ -741,17 +743,19 @@ int UtcDaliRenderTaskSetExclusive(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(boundTextures.size(), 4u, TEST_LOCATION); - - if(boundTextures.size() == 4) + if(boundTextures.size() >= 4) { // Test that task 1 renders actor3, then actor2 & then actor1 - DALI_TEST_CHECK(boundTextures[0] == 10u); - DALI_TEST_CHECK(boundTextures[1] == 9u); - DALI_TEST_CHECK(boundTextures[2] == 8u); + int a = boundTextures.size() - 4; + int b = boundTextures.size() - 3; + int c = boundTextures.size() - 2; + int d = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 10u /*unique to actor3*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[c], 8u /*unique to actor1*/, TEST_LOCATION); // Test that task 2 renders actor2 - DALI_TEST_EQUALS(boundTextures[3], 9u, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[d], 9u, TEST_LOCATION); } // Make actor2 exclusive to task2 @@ -794,7 +798,7 @@ int UtcDaliRenderTaskSetExclusive02(void) ids.push_back(8); // 8 = actor1 application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor1 = CreateRenderableActor(img1); actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); application.GetScene().Add(actor1); @@ -1788,13 +1792,13 @@ int UtcDaliRenderTaskSignalFinished(void) tet_infoline("Testing RenderTask::SignalFinished()"); application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + auto& sync = application.GetGraphicsSyncImpl(); CameraActor offscreenCameraActor = CameraActor::New(); application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); application.GetScene().Add(rootActor); @@ -1830,7 +1834,7 @@ int UtcDaliRenderTaskSignalFinished(void) application.SendNotification(); DALI_TEST_CHECK(!finished); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); @@ -2009,8 +2013,8 @@ int UtcDaliRenderTaskOnce01(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2030,7 +2034,7 @@ int UtcDaliRenderTaskOnce01(void) DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2047,8 +2051,8 @@ int UtcDaliRenderTaskOnce02(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2077,7 +2081,7 @@ int UtcDaliRenderTaskOnce02(void) DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2095,8 +2099,8 @@ int UtcDaliRenderTaskOnce03(void) // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2117,10 +2121,10 @@ int UtcDaliRenderTaskOnce03(void) newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - + // drawn sig finished Keep updating DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2139,8 +2143,8 @@ int UtcDaliRenderTaskOnce04(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2171,10 +2175,10 @@ int UtcDaliRenderTaskOnce04(void) newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - + // FAILS drawn sig finished Keep updating DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2334,8 +2338,8 @@ int UtcDaliRenderTaskOnceNoSync04(void) application.SendNotification(); DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + auto& sync = application.GetGraphicsSyncImpl(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj == NULL); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); @@ -2461,13 +2465,13 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) tet_infoline("Testing RenderTask::FinishInvisibleSourceActor()"); application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + auto& sync = application.GetGraphicsSyncImpl(); CameraActor offscreenCameraActor = CameraActor::New(); application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); rootActor.SetProperty(Actor::Property::VISIBLE, false); @@ -2510,7 +2514,7 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) application.SendNotification(); DALI_TEST_CHECK(!finished); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); @@ -2550,7 +2554,7 @@ int UtcDaliRenderTaskFinishMissingImage(void) Integration::Scene stage = application.GetScene(); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); stage.Add(rootActor); @@ -3357,3 +3361,167 @@ int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorNegative(void) } END_TEST; } + +int UtcDaliRenderTaskClippingMode01(void) +{ + TestApplication application; + + tet_infoline("Testing clipping mode: CLIP_TO_BOUNDING_BOX.\n"); + + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + + enabledDisableTrace.Enable(true); + scissorTrace.Enable(true); + + // SETUP AN OFFSCREEN RENDER TASK + Actor rootActor = Actor::New(); + application.GetScene().Add(rootActor); + + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + offscreenCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + offscreenCameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + application.GetScene().Add(offscreenCameraActor); + + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); + + Geometry geometry = CreateQuadGeometry(); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); + + Vector2 position(100.0f, 100.0f); + Vector2 size(200.0f, 200.0f); + Actor secondRootActor = Actor::New(); + secondRootActor.AddRenderer(renderer); + secondRootActor.SetProperty(Actor::Property::POSITION, position); + secondRootActor.SetProperty(Actor::Property::SIZE, size); + secondRootActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + secondRootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + secondRootActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + application.GetScene().Add(secondRootActor); + + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + + application.SendNotification(); + application.Render(); + + std::ostringstream scissor; + scissor << std::hex << GL_SCISSOR_TEST; + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str())); + + // Check the scissor was set, and the coordinates are correct. + Vector4 expectResults(position.x, TestApplication::DEFAULT_SURFACE_HEIGHT - size.height - position.y, size.width, size.height); // (100, 500, 200, 200) + std::stringstream compareParametersString; + compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w; + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result + + END_TEST; +} + +int UtcDaliRenderTaskClippingMode02(void) +{ + TestApplication application; + + tet_infoline("Testing clipping mode with the inverted camera: CLIP_TO_BOUNDING_BOX.\n"); + + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + + enabledDisableTrace.Enable(true); + scissorTrace.Enable(true); + + // SETUP AN OFFSCREEN RENDER TASK + Actor rootActor = Actor::New(); + application.GetScene().Add(rootActor); + + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + offscreenCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + offscreenCameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + offscreenCameraActor.SetInvertYAxis(true); + application.GetScene().Add(offscreenCameraActor); + + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); + + Geometry geometry = CreateQuadGeometry(); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); + + Vector2 position(100.0f, 100.0f); + Vector2 size(200.0f, 200.0f); + Actor secondRootActor = Actor::New(); + secondRootActor.AddRenderer(renderer); + secondRootActor.SetProperty(Actor::Property::POSITION, position); + secondRootActor.SetProperty(Actor::Property::SIZE, size); + secondRootActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + secondRootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + secondRootActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + application.GetScene().Add(secondRootActor); + + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + + application.SendNotification(); + application.Render(); + + std::ostringstream scissor; + scissor << std::hex << GL_SCISSOR_TEST; + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str())); + + // Check the scissor was set, and the coordinates are correct. + Vector4 expectResults(position.x, position.y, size.width, size.height); // (100, 100, 200, 200) + std::stringstream compareParametersString; + compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w; + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result + + END_TEST; +} + +int UtcDaliRenderTaskUploadOnly(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask Render Once GlSync, using loaded image"); + + // SETUP AN OFFSCREEN RENDER TASK + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + drawTrace.Enable(true); + + Actor rootActor = Actor::New(); + application.GetScene().Add(rootActor); + + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + + application.GetScene().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(); + + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); + + application.SendNotification(); + application.Render(16, nullptr, true); + + DALI_TEST_CHECK(!finished); + + application.Render(16, nullptr, true); + application.SendNotification(); + + DALI_TEST_CHECK(!finished); + END_TEST; +} \ No newline at end of file