/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
#include <stdlib.h>
+#include <test-actor-utils.h>
#include <test-native-image.h>
#include <iostream>
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,
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);
}
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);
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);
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);
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);
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));
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<GLuint> ids;
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);
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));
// Check that the actors were rendered
DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::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));
// Check that the actors were rendered
DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::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
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
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);
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);
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();
// 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();
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);
// 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();
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);
// 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();
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);
// 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();
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);
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);
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);
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();
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);
}
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;
+}
+
+int UtcDaliRenderTaskSetGetViewportGuideActor(void)
+{
+ TestApplication application;
+ tet_infoline("Testing RenderTask with Set/Get ViewportGuideActor");
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize(stage.GetSize());
+
+ Actor blue = Actor::New();
+ blue[Dali::Actor::Property::NAME] = "Blue";
+ blue[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ blue[Dali::Actor::Property::SIZE] = Vector2(300, 300);
+ blue[Dali::Actor::Property::POSITION] = Vector2(0, 0);
+
+ stage.Add(blue);
+
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask renderTask = renderTaskList.CreateTask();
+
+ renderTask.SetViewportGuideActor(blue);
+
+ Actor actor = renderTask.GetViewportGuideActor();
+ DALI_TEST_EQUALS(actor, blue, TEST_LOCATION);
+
+ renderTask.ResetViewportGuideActor();
+ actor = renderTask.GetViewportGuideActor();
+
+ DALI_TEST_CHECK(!actor);
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskViewportGuideActor(void)
+{
+ TestApplication application;
+ tet_infoline("Testing RenderTask with ViewportGuideActor");
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize(stage.GetSize());
+
+ Actor blue = Actor::New();
+ blue[Dali::Actor::Property::NAME] = "Blue";
+ blue[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ blue[Dali::Actor::Property::SIZE] = Vector2(300, 300);
+ blue[Dali::Actor::Property::POSITION] = Vector2(0, 0);
+
+ Geometry geometry = Geometry::New();
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+ blue.AddRenderer(renderer);
+
+ stage.Add(blue);
+
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask renderTask = renderTaskList.CreateTask();
+
+ Dali::CameraActor cameraActor = Dali::CameraActor::New(stageSize);
+ cameraActor[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ stage.Add(cameraActor);
+
+ renderTask.SetExclusive(true);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetCameraActor(cameraActor);
+ renderTask.SetSourceActor(blue);
+ renderTask.SetViewportGuideActor(blue);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ Vector2 viewportPosition = renderTask.GetCurrentViewportPosition();
+ Vector2 viewportSize = renderTask.GetCurrentViewportSize();
+
+ DALI_TEST_EQUALS(viewportSize, Vector2(300, 300), TEST_LOCATION);
+ DALI_TEST_EQUALS(viewportPosition, Vector2(90, 250), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskViewportGuideActor02(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& callStack = glAbstraction.GetViewportTrace();
+ glAbstraction.EnableViewportCallTrace(true);
+ tet_infoline("Testing RenderTask with ViewportGuideActor02");
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize(stage.GetSize());
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+ glAbstraction.ResetViewportCallStack();
+
+ Geometry geometry = Geometry::New();
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor blue = Actor::New();
+ blue[Dali::Actor::Property::NAME] = "Blue";
+ blue[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ blue[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ blue[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ blue.AddRenderer(renderer);
+ stage.Add(blue);
+
+ Actor green = Actor::New();
+ green[Dali::Actor::Property::NAME] = "Green";
+ green[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ green[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ green[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ green[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ green.AddRenderer(renderer);
+ stage.Add(green);
+
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask renderTask = renderTaskList.CreateTask();
+
+ Dali::CameraActor cameraActor = Dali::CameraActor::New(stageSize);
+ cameraActor[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ stage.Add(cameraActor);
+
+ renderTask.SetExclusive(true);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetCameraActor(cameraActor);
+ renderTask.SetSourceActor(blue);
+ renderTask.SetViewportGuideActor(blue);
+
+ application.GetScene().SurfaceRotated(static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT),
+ static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH),
+ 90,
+ 0);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ std::string viewportParams1("50, 100, 300, 400"); // to match newSize
+ std::string viewportParams2("0, 0, 480, 800"); // to match newSize
+
+ // Check that the viewport is handled properly
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskViewportGuideActor03(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& callStack = glAbstraction.GetViewportTrace();
+ glAbstraction.EnableViewportCallTrace(true);
+ tet_infoline("Testing that adding a viewport guide actor to RenderTask will change the viewport");
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize(stage.GetSize());
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+ glAbstraction.ResetViewportCallStack();
+
+ Geometry geometry = Geometry::New();
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor blue = Actor::New();
+ blue[Dali::Actor::Property::NAME] = "Blue";
+ blue[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ blue[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ blue[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ blue.AddRenderer(renderer);
+ stage.Add(blue);
+
+ Actor green = Actor::New();
+ green[Dali::Actor::Property::NAME] = "Green";
+ green[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ green[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ green[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ green[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ green.AddRenderer(renderer);
+ stage.Add(green);
+
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask renderTask = renderTaskList.CreateTask();
+
+ Dali::CameraActor cameraActor = Dali::CameraActor::New(stageSize);
+ cameraActor[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ stage.Add(cameraActor);
+
+ renderTask.SetExclusive(true);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetCameraActor(cameraActor);
+ renderTask.SetSourceActor(green);
+
+ Viewport viewport(75, 55, 150, 250);
+ renderTask.SetViewport(viewport);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ // Note Y pos: 800 - (250+55) = 495
+ std::string viewportParams1("75, 495, 150, 250");
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+ glAbstraction.ResetViewportCallStack();
+
+ // Update to use viewport guide actor instead.
+ renderTask.SetViewportGuideActor(blue);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ // Note: Y pos: 800 - (300+50) = 450
+ std::string viewportParams2("100, 450, 400, 300");
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
+ tet_infoline("Testing that removing viewport guide actor from RenderTask will revert the viewport");
+ glAbstraction.ResetViewportCallStack();
+
+ // Remove guide actor, expect that the viewport is reset to its original values
+ renderTask.SetViewportGuideActor(Actor());
+ application.SendNotification();
+ application.Render(16);
+
+ // Currently, update manager does not consider that added Resetters should cause another
+ // update; this is probably right. But, we have to then force another update for the resetter to trigger, and this will register as un-necessary in the test output.
+ //
+ application.SendNotification();
+ application.Render(16);
+
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskViewportGuideActor04(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& callStack = glAbstraction.GetViewportTrace();
+ glAbstraction.EnableViewportCallTrace(true);
+ tet_infoline("Testing that adding a viewport guide actor to RenderTask will change the viewport");
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 stageSize(stage.GetSize());
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+ glAbstraction.ResetViewportCallStack();
+
+ Geometry geometry = Geometry::New();
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+
+ Actor blue = Actor::New();
+ blue[Dali::Actor::Property::NAME] = "Blue";
+ blue[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ blue[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ blue[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ blue.AddRenderer(renderer);
+ stage.Add(blue);
+
+ Actor green = Actor::New();
+ green[Dali::Actor::Property::NAME] = "Green";
+ green[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+ green[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+ green[Dali::Actor::Property::SIZE] = Vector2(400, 300);
+ green[Dali::Actor::Property::POSITION] = Vector2(100, 50);
+ green.AddRenderer(renderer);
+ stage.Add(green);
+
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask renderTask = renderTaskList.CreateTask();
+
+ Dali::CameraActor cameraActor = Dali::CameraActor::New(stageSize);
+ cameraActor[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ stage.Add(cameraActor);
+
+ renderTask.SetExclusive(true);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetCameraActor(cameraActor);
+ renderTask.SetSourceActor(green);
+
+ Viewport viewport(75, 55, 150, 250);
+ renderTask.SetViewport(viewport);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ // Note Y pos: 800 - (250+55) = 495
+ std::string viewportParams1("75, 495, 150, 250");
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+ glAbstraction.ResetViewportCallStack();
+
+ // Update to use viewport guide actor instead.
+ renderTask.SetViewportGuideActor(blue);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render(16);
+
+ std::string viewportParams2("100, 450, 400, 300");
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
+ tet_infoline("Testing that removing viewport guide actor from RenderTask will revert the viewport");
+
+ glAbstraction.ResetViewportCallStack();
+
+ // Remove guide actor, expect that the viewport is reset to it's original values
+ renderTask.ResetViewportGuideActor();
+ application.SendNotification();
+ application.Render(16);
+
+ // Currently, update manager does not consider that added Resetters should cause another
+ // update; this is probably right. But, we have to then force another update for the resetter
+ // to trigger, and this will register as un-necessary in the test output.
+ application.SendNotification();
+ application.Render(16);
+
+ DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+
+ // This should remove the baking resetters, but is again going to show up
+ // as unnecessary. Also try and figure out if we can test the dirty flags
+ // here, somehow (Can at least check the property's dirty flags in the debugger).
+ application.SendNotification();
+ application.Render(16);
+
+ END_TEST;
+}
+
+int UtcDaliRenderTaskSetPartialUpdate(void)
+{
+ TestApplication application(
+ TestApplication::DEFAULT_SURFACE_WIDTH,
+ TestApplication::DEFAULT_SURFACE_HEIGHT,
+ TestApplication::DEFAULT_HORIZONTAL_DPI,
+ TestApplication::DEFAULT_VERTICAL_DPI,
+ true,
+ true);
+
+ tet_infoline("Check the damaged rects with render task");
+
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+ Actor actor = CreateRenderableActor();
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
+
+ Actor rootActor = CreateRenderableActor();
+ rootActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ rootActor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
+ rootActor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
+ rootActor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(rootActor);
+
+ CameraActor cameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ cameraActor.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ cameraActor.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ application.GetScene().Add(cameraActor);
+
+ Texture frameBufferTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 16, 16);
+ FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight());
+ frameBuffer.AttachColorTexture(frameBufferTexture);
+
+ // Create a RenderTask and set a framebuffer
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTask newTask = taskList.CreateTask();
+ newTask.SetCameraActor(cameraActor);
+ newTask.SetSourceActor(rootActor);
+ newTask.SetInputEnabled(false);
+ newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
+ newTask.SetClearEnabled(true);
+ newTask.SetExclusive(true);
+ newTask.SetRefreshRate(RenderTask::REFRESH_ALWAYS);
+ newTask.SetFrameBuffer(frameBuffer);
+
+ application.SendNotification();
+
+ std::vector<Rect<int>> damagedRects;
+ Rect<int> clippingRect;
+
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ // Full update if there is off-screen rendering
+ clippingRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+ DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+ // Remove framebuffer
+ newTask.SetFrameBuffer(FrameBuffer());
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ // Full update
+ clippingRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Set invalid viewport of the render task
+ newTask.SetViewportSize(Vector2(-100.0f, -100.0f));
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ // Full update because the camera orientation is changed
+ clippingRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ newTask.SetViewportSize(Vector2(0.0f, 0.0f));
+
+ // Change orientation of offscreen camera
+ cameraActor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::XAXIS));
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ // Full update because the camera orientation is changed
+ clippingRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ // Change camera target
+ cameraActor.SetTargetPosition(Vector3(10.0f, 10.0f, 0.0f));
+
+ application.SendNotification();
+
+ damagedRects.clear();
+ application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+
+ // Full update because the camera is moved
+ clippingRect = Rect<int>(0, 0, TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+ application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+ END_TEST;
+}