X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-RenderTask.cpp;h=7e9ad26bf95cbd06010fa85984cd342ebee6214d;hb=462cbee2270984cdca45488f3733d664dcf49187;hp=9619b50c6bfcb82feaa08ac7c7e5ec3683075318;hpb=08f9377564bcb3939b9b73b3f6da9573122bf6da;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 9619b50..7e9ad26 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) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -16,14 +16,19 @@ */ #include - #include #include +#include +#include #include #include +#include + +#include #define BOOLSTR(x) ((x)?"T":"F") +//& set: DaliRenderTask using namespace Dali; @@ -37,64 +42,45 @@ void utc_dali_render_task_cleanup(void) test_return_value = TET_PASS; } +/** + * APIs: + * + * Constructor, Destructor, DownCast, New, copy constructor, assignment operator + * + * SetSourceActor 2+ve, 1-ve + * GetSourceActor 1+ve, 1-ve + * SetExclusive 2+ve, 0-ve + * IsExclusive 2+ve, 0-ve + * SetInputEnabled 1+ve, 0-ve + * GetInputEnabled 1+ve, 0-ve + * SetCameraActor 1+ve, 1-ve + * GetCameraActor 1+ve, 1-ve + * SetTargetFrameBuffer 1+ve, 1-ve + * GetTargetFrameBuffer 1+ve, 1-ve + * SetScreenToFrameBufferFunction 1+ve, 1-ve + * GetScreenToFrameBufferFunction 1+ve, 1-ve + * SetScreenToFrameBufferMappingActor 1+ve, 1-ve + * GetScreenToFrameBufferMappingActor 1+ve, 1-ve + * SetViewportPosition 1+ve + * GetCurrentViewportPosition 1+ve + * SetViewportSize 1+ve + * GetCurrentViewportSize 1+ve + * SetViewport 2+ve, 1-ve + * GetViewport 2+ve, 1-ve + * SetClearColor 1+ve, 1-ve + * GetClearColor 1+ve, 1-ve + * SetClearEnabled 1+ve, 1-ve + * GetClearEnabled 1+ve, 1-ve + * SetCullMode + * GetCullMode + * SetRefreshRate Many + * GetRefreshRate 1+ve + * FinishedSignal 1+ve + */ + namespace // unnamed namespace { -class TestNativeImage : public NativeImage -{ -public: - int mWidth; - int mHeight; - TestNativeImage(int width, int height) - : mWidth(width), - mHeight(height) - {} - - virtual bool GlExtensionCreate() {return true;}; - - /** - * Destroy the GL resource for the NativeImage. - * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR() - * @pre There is a GL context for the current thread. - */ - virtual void GlExtensionDestroy() {}; - - /** - * Use the NativeImage as a texture for rendering - * @pre There is a GL context for the current thread. - * @return A GL error code - */ - virtual unsigned int TargetTexture() {return 0;}; - - /** - * Called in each NativeTexture::Bind() call to allow implementation specific operations. - * The correct texture sampler has already been bound before the function gets called. - * @pre glAbstraction is being used by context in current thread - */ - virtual void PrepareTexture() {} - - /** - * Returns the width of the NativeImage - * @return width - */ - virtual unsigned int GetWidth() const {return mWidth;} - - /** - * Returns the height of the NativeImage - * @return height - */ - virtual unsigned int GetHeight() const {return mHeight;} - - /** - * Returns the internal pixel NativeImage::PixelFormat of the NativeImage - * @return pixel format - */ - virtual Pixel::Format GetPixelFormat() const { return Pixel::RGBA8888; } -protected: - ~TestNativeImage(){} -}; - - const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) /* @@ -184,45 +170,30 @@ bool TestScreenToFrameBufferFunction( Vector2& coordinates ) return true; } -ImageActor CreateLoadingImage(TestApplication& application, std::string filename, Image::LoadPolicy loadPolicy, Image::ReleasePolicy releasePolicy) +Actor CreateRenderableActorSuccess(TestApplication& application, std::string filename) { - Image image = Image::New(filename, loadPolicy, releasePolicy); - DALI_TEST_CHECK( image ); - application.SendNotification(); - application.Render(16); - DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) ); - ImageActor actor = ImageActor::New(image); + 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; } -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::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 ) +Actor CreateRenderableActorFailed(TestApplication& application, std::string filename) { - application.GetPlatform().SetResourceLoadFailed(resourceId, Integration::FailureUnknown); + Image image = ResourceImage::New(filename); + DALI_TEST_CHECK( image ); + Actor actor = CreateRenderableActor(image); + actor.SetSize( 80, 80 ); + return actor; } -void ReloadImage(TestApplication& application, Image 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, @@ -239,15 +210,15 @@ RenderTask CreateRenderTask(TestApplication& application, FrameBufferImage frameBufferImage; if( glSync ) { - NativeImagePtr testNativeImagePtr = new TestNativeImage(10, 10); - frameBufferImage= FrameBufferImage::New( *testNativeImagePtr.Get() ); + NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); + frameBufferImage= FrameBufferImage::New( *(testNativeImagePtr.Get()) ); } else { frameBufferImage = FrameBufferImage::New( 10, 10 ); } - // Don't draw output framebuffer + // Don't draw output framebuffer // ' RenderTask newTask = taskList.CreateTask(); newTask.SetCameraActor( offscreenCamera ); @@ -258,13 +229,17 @@ RenderTask CreateRenderTask(TestApplication& application, newTask.SetExclusive( true ); newTask.SetRefreshRate( refreshRate ); newTask.SetTargetFrameBuffer( frameBufferImage ); + newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, glSync ); return newTask; } -bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating ) +bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating, int lineNumber ) { finishedSig = false; callStack.Reset(); + + tet_printf("TestApplication::UpdateRender().\n"); + application.Render(16); application.SendNotification(); @@ -303,10 +278,11 @@ bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool bool result = (sigPassed && drawPassed && keepUpdatingPassed); - tet_printf("UpdateRender: Expected: Draw:%s Signal:%s Keep Updating: %s Actual: Draw:%s Signal:%s KeepUpdating: %s %s\n", + tet_printf("UpdateRender: Expected: Draw:%s Signal:%s KeepUpdating: %s Actual: Draw:%s Signal:%s KeepUpdating: %s %s, line %d\n", BOOLSTR(testDrawn), BOOLSTR(testFinished), BOOLSTR(testKeepUpdating), BOOLSTR(drawResult), BOOLSTR(finishedSig), BOOLSTR(keepUpdating), - result ? "Passed":"Failed"); + result ? "Passed":"Failed", + lineNumber ); return result; } @@ -322,10 +298,10 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t { // Check whether the actor is visible and not fully transparent. if( actor.IsVisible() - && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT + && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT { - hittable = true; + hittable = true; } break; } @@ -355,7 +331,7 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t /****************************************************************************************************/ /****************************************************************************************************/ -int UtcDaliRenderTaskDownCast(void) +int UtcDaliRenderTaskDownCast01(void) { TestApplication application; @@ -374,35 +350,111 @@ int UtcDaliRenderTaskDownCast(void) END_TEST; } -int UtcDaliRenderTaskSetSourceActor(void) +int UtcDaliRenderTaskDownCast02(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetSourceActor()"); + tet_infoline("Testing RenderTask::DownCast()"); + + Actor actor = Actor::New(); + + RenderTask task = RenderTask::DownCast( actor ); + DALI_TEST_CHECK( ! task ); + END_TEST; +} + +int UtcDaliRenderTaskSetSourceActorN(void) +{ + TestApplication application; + tet_infoline("Testing RenderTask::SetSourceActor() Negative - try with empty actor handle"); Stage stage = Stage::GetCurrent(); - const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 ); + Actor srcActor; RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); + renderTask.SetSourceActor(srcActor); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( ! renderTask.GetSourceActor() ); + END_TEST; +} + + +int UtcDaliRenderTaskSetSourceActorP01(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetSourceActor() Positive - check that setting a non-renderable actor stops existing source actor being rendered "); + Stage stage = Stage::GetCurrent(); + RenderTaskList taskList = stage.GetRenderTaskList(); RenderTask task = taskList.GetTask( 0u ); Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - std::vector ids; - ids.push_back( 7 ); - application.GetGlAbstraction().SetNextTextureIds( ids ); + BufferImage img = BufferImage::New( 1,1 ); + Actor newActor = CreateRenderableActor( img ); + newActor.SetSize(1,1); + stage.Add( newActor ); + + Actor nonRenderableActor = Actor::New(); + stage.Add( nonRenderableActor ); + + // Stop the newActor from being rendered by changing the source actor + DALI_TEST_CHECK( nonRenderableActor ); + task.SetSourceActor( nonRenderableActor ); + DALI_TEST_CHECK( task.GetSourceActor() != actor ); + DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); + drawTrace.Enable(true); + + // Update & Render nothing! + application.GetGlAbstraction().ClearBoundTextures(); + application.SendNotification(); + application.Render(); + + // Check that nothing was rendered + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliRenderTaskSetSourceActorP02(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetSourceActor() Positive - check that switching source from a non-renderable to a renderable actor causes the texture to be drawn"); + + Stage stage = Stage::GetCurrent(); + + RenderTaskList taskList = stage.GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); - BitmapImage img = BitmapImage::New( 1,1 ); - ImageActor newActor = ImageActor::New( img ); + Actor actor = task.GetSourceActor(); + DALI_TEST_CHECK( actor ); + + + BufferImage img = BufferImage::New( 1,1 ); + Actor newActor = CreateRenderableActor( img ); newActor.SetSize(1,1); stage.Add( newActor ); Actor nonRenderableActor = Actor::New(); stage.Add( nonRenderableActor ); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); + drawTrace.Enable(true); + // Stop the newActor from being rendered by changing the source actor DALI_TEST_CHECK( nonRenderableActor ); task.SetSourceActor( nonRenderableActor ); @@ -415,7 +467,8 @@ int UtcDaliRenderTaskSetSourceActor(void) application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + drawTrace.Reset(); // Set newActor as the new source Actor task.SetSourceActor( newActor ); @@ -428,11 +481,7 @@ int UtcDaliRenderTaskSetSourceActor(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION ); - if ( boundTextures.size() ) - { - DALI_TEST_EQUALS( boundTextures[0], 7u, TEST_LOCATION ); - } + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); END_TEST; } @@ -443,34 +492,28 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void) tet_infoline("Testing RenderTask::SetSourceActor (on/off stage testing)"); Stage stage = Stage::GetCurrent(); - - const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 ); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - std::vector ids; - GLuint expectedTextureId( 3 ); - ids.push_back( expectedTextureId ); - application.GetGlAbstraction().SetNextTextureIds( ids ); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); + drawTrace.Enable(true); - BitmapImage img = BitmapImage::New( 1,1 ); - ImageActor newActor = ImageActor::New( img ); + BufferImage img = BufferImage::New( 1,1 ); + Actor newActor = CreateRenderableActor( img ); newActor.SetSize(1,1); task.SetSourceActor( newActor ); - // Don't add newActor to stage yet + // Don't add newActor to stage yet //' // Update & Render with the actor initially off-stage - application.GetGlAbstraction().ClearBoundTextures(); application.SendNotification(); application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); // Now add to stage stage.Add( newActor ); @@ -481,19 +524,17 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION ); - if ( boundTextures.size() ) - { - DALI_TEST_EQUALS( boundTextures[0], expectedTextureId, TEST_LOCATION ); - } + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + drawTrace.Reset(); // Now remove from stage stage.Remove( newActor ); // Update & Render with the actor off-stage - application.GetGlAbstraction().ClearBoundTextures(); application.SendNotification(); application.Render(); + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + END_TEST; } @@ -504,23 +545,14 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) tet_infoline("Testing RenderTask::SetSourceActor (empty handle case)"); Stage stage = Stage::GetCurrent(); - - const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 ); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - std::vector ids; - GLuint expectedTextureId( 5 ); - ids.push_back( expectedTextureId ); - application.GetGlAbstraction().SetNextTextureIds( ids ); - - BitmapImage img = BitmapImage::New( 1,1 ); - ImageActor newActor = ImageActor::New( img ); + BufferImage img = BufferImage::New( 1,1 ); + Actor newActor = CreateRenderableActor( img ); newActor.SetSize(1,1); stage.Add( newActor ); @@ -531,13 +563,16 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) task.SetSourceActor( Actor() ); DALI_TEST_CHECK( ! task.GetSourceActor() ); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); + drawTrace.Enable(true); + // Update & Render nothing! - application.GetGlAbstraction().ClearBoundTextures(); application.SendNotification(); application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); // Set with non-empty handle task.SetSourceActor( newActor ); @@ -549,19 +584,15 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION ); - if ( boundTextures.size() ) - { - DALI_TEST_EQUALS( boundTextures[0], expectedTextureId, TEST_LOCATION ); - } + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); END_TEST; } -int UtcDaliRenderTaskGetSourceActor(void) +int UtcDaliRenderTaskGetSourceActorP01(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetSourceActor()"); + tet_infoline("Testing RenderTask::GetSourceActor() Check the default render task has a valid source actor"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); @@ -576,15 +607,52 @@ int UtcDaliRenderTaskGetSourceActor(void) END_TEST; } +int UtcDaliRenderTaskGetSourceActorP02(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetSourceActor() Create a new render task, Add a new actor to the stage and set it as the source of the new render task. Get its source actor and check that it is equivalent to what was set."); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.CreateTask(); + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + task.SetSourceActor( actor ); + + DALI_TEST_EQUALS( actor, task.GetSourceActor(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliRenderTaskGetSourceActorN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetSourceActor() Try with empty handle"); + + RenderTask task; + try + { + Actor actor = task.GetSourceActor(); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + + END_TEST; +} + int UtcDaliRenderTaskSetExclusive(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetExclusive()"); + tet_infoline("Testing RenderTask::SetExclusive() Check that exclusion works"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - // Manipulate the GenTextures behaviour, to identify different ImageActors + // Manipulate the GenTextures behaviour, to identify different actors std::vector ids; ids.push_back( 8 ); // 8 = actor1 @@ -592,8 +660,8 @@ int UtcDaliRenderTaskSetExclusive(void) ids.push_back( 10 ); // 10 = actor3 application.GetGlAbstraction().SetNextTextureIds( ids ); - BitmapImage img1 = BitmapImage::New( 1,1 ); - ImageActor actor1 = ImageActor::New( img1 ); + BufferImage img1 = BufferImage::New( 1,1 ); + Actor actor1 = CreateRenderableActor( img1 ); actor1.SetSize(1,1); Stage::GetCurrent().Add( actor1 ); @@ -610,8 +678,8 @@ int UtcDaliRenderTaskSetExclusive(void) DALI_TEST_EQUALS( boundTextures[0], 8u/*unique to actor1*/, TEST_LOCATION ); } - BitmapImage img2 = BitmapImage::New( 1,1 ); - ImageActor actor2 = ImageActor::New( img2 ); + BufferImage img2 = BufferImage::New( 1,1 ); + Actor actor2 = CreateRenderableActor( img2 ); actor2.SetSize(1,1); // Force actor2 to be rendered before actor1 @@ -634,8 +702,8 @@ int UtcDaliRenderTaskSetExclusive(void) DALI_TEST_EQUALS( boundTextures[1], 8u/*unique to actor1*/, TEST_LOCATION ); } - BitmapImage img3 = BitmapImage::New( 1,1 ); - ImageActor actor3 = ImageActor::New( img3 ); + BufferImage img3 = BufferImage::New( 1,1 ); + Actor actor3 = CreateRenderableActor( img3 ); actor3.SetSize(1,1); // Force actor3 to be rendered before actor2 @@ -713,11 +781,72 @@ int UtcDaliRenderTaskSetExclusive(void) END_TEST; } -int UtcDaliRenderTaskIsExclusive(void) +int UtcDaliRenderTaskSetExclusive02(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetExclusive() Check that changing from exclusive to not-exclusive works"); + + std::vector ids; + ids.push_back( 8 ); // 8 = actor1 + application.GetGlAbstraction().SetNextTextureIds( ids ); + + BufferImage img1 = BufferImage::New( 1,1 ); + Actor actor1 = CreateRenderableActor( img1 ); + actor1.SetSize(1,1); + Stage::GetCurrent().Add( actor1 ); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.CreateTask(); + + task.SetSourceActor( actor1 ); + task.SetExclusive(true); // Actor should only render once + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); + drawTrace.Enable(true); + + // Update & Render actor1 + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + + // Set task to non-exclusive - actor1 should render twice: + drawTrace.Reset(); + task.SetExclusive(false); + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliRenderTaskSetExclusiveN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetExclusive() on empty handle"); + + RenderTask task; + try + { + task.SetExclusive(true); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliRenderTaskIsExclusive01(void) { TestApplication application; - tet_infoline("Testing RenderTask::IsExclusive()"); + tet_infoline("Testing RenderTask::IsExclusive() Check default values are non-exclusive"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); @@ -727,6 +856,44 @@ int UtcDaliRenderTaskIsExclusive(void) RenderTask newTask = taskList.CreateTask(); DALI_TEST_CHECK( false == newTask.IsExclusive() ); + + END_TEST; +} + +int UtcDaliRenderTaskIsExclusive02(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::IsExclusive() Check the getter returns set values"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + // Not exclusive is the default + RenderTask newTask = taskList.CreateTask(); + DALI_TEST_EQUALS( newTask.IsExclusive(), false, TEST_LOCATION ); + + newTask.SetExclusive(true); + DALI_TEST_EQUALS( newTask.IsExclusive(), true, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRenderTaskIsExclusiveN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::IsExclusive() on empty handle"); + + RenderTask task; + try + { + bool x = task.IsExclusive(); + (void) x; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } END_TEST; } @@ -760,14 +927,18 @@ int UtcDaliRenderTaskGetInputEnabled(void) // Input is enabled by default RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( true == task.GetInputEnabled() ); + DALI_TEST_EQUALS( true, task.GetInputEnabled(), TEST_LOCATION ); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( true == newTask.GetInputEnabled() ); + DALI_TEST_EQUALS( true, newTask.GetInputEnabled(), TEST_LOCATION ); + + newTask.SetInputEnabled(false); + DALI_TEST_EQUALS( false, newTask.GetInputEnabled(), TEST_LOCATION ); + END_TEST; } -int UtcDaliRenderTaskSetCameraActor(void) +int UtcDaliRenderTaskSetCameraActorP(void) { TestApplication application; @@ -777,23 +948,24 @@ int UtcDaliRenderTaskSetCameraActor(void) RenderTask task = taskList.GetTask( 0u ); - Actor actor = task.GetCameraActor(); - DALI_TEST_CHECK( actor ); + Actor defaultCameraActor = task.GetCameraActor(); + DALI_TEST_CHECK( defaultCameraActor ); - CameraActor newActor = CameraActor::New(); - DALI_TEST_CHECK( newActor ); + CameraActor newCameraActor = CameraActor::New(); + DALI_TEST_CHECK( newCameraActor ); - task.SetCameraActor( newActor ); - DALI_TEST_CHECK( task.GetCameraActor() != actor ); - DALI_TEST_CHECK( task.GetCameraActor() == newActor ); + task.SetCameraActor( newCameraActor ); + DALI_TEST_CHECK( task.GetCameraActor() != defaultCameraActor ); + DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION ); END_TEST; } -int UtcDaliRenderTaskGetCameraActor(void) + +int UtcDaliRenderTaskSetCameraActorN(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetCameraActor()"); + tet_infoline("Testing RenderTask::SetCameraActor() with empty actor handle"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); @@ -802,62 +974,190 @@ int UtcDaliRenderTaskGetCameraActor(void) Actor actor = task.GetCameraActor(); DALI_TEST_CHECK( actor ); - RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( actor == newTask.GetCameraActor() ); + CameraActor cameraActor; + + task.SetCameraActor( cameraActor ); + DALI_TEST_EQUALS( (bool)task.GetCameraActor(), false, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetCameraActor(), cameraActor, TEST_LOCATION ); END_TEST; } -int UtcDaliRenderTaskSetTargetFrameBuffer(void) + +int UtcDaliRenderTaskGetCameraActorP(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetTargetFrameBuffer()"); + tet_infoline("Testing RenderTask::GetCameraActor()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); RenderTask task = taskList.GetTask( 0u ); - // By default render-tasks do not render off-screen - FrameBufferImage image = task.GetTargetFrameBuffer(); - DALI_TEST_CHECK( !image ); + CameraActor actor = task.GetCameraActor(); + DALI_TEST_CHECK( actor ); + DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_GREATER( actor.GetFieldOfView(), 0.0f, TEST_LOCATION ); + END_TEST; +} - FrameBufferImage newImage = FrameBufferImage::New(); +int UtcDaliRenderTaskGetCameraActorN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetCameraActor() with empty handle"); + RenderTask task; + + try + { + Actor actor = task.GetCameraActor(); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } - task.SetTargetFrameBuffer( newImage ); - DALI_TEST_CHECK( task.GetTargetFrameBuffer() == newImage ); END_TEST; } -int UtcDaliRenderTaskGetTargetFrameBuffer(void) +int UtcDaliRenderTaskSetTargetFrameBufferP(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetTargetFrameBuffer()"); + tet_infoline("Testing RenderTask::SetTargetFrameBuffer()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); RenderTask task = taskList.GetTask( 0u ); - // By default render-tasks do not render off-screen - FrameBufferImage image = task.GetTargetFrameBuffer(); - DALI_TEST_CHECK( !image ); - - RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( !newTask.GetTargetFrameBuffer() ); + FrameBufferImage newImage = FrameBufferImage::New(); + task.SetTargetFrameBuffer( newImage ); + DALI_TEST_CHECK( task.GetTargetFrameBuffer() == newImage ); END_TEST; } -int UtcDaliRenderTaskSetScreenToFrameBufferFunction(void) +int UtcDaliRenderTaskSetTargetFrameBufferN(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetScreenToFrameBufferFunction()"); + tet_infoline("Testing RenderTask::SetTargetFrameBuffer()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); RenderTask task = taskList.GetTask( 0u ); + FrameBufferImage newImage; // Empty handle + task.SetTargetFrameBuffer( newImage ); + DALI_TEST_EQUALS( (bool)task.GetTargetFrameBuffer(), false, TEST_LOCATION ); + END_TEST; +} - task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); +int UtcDaliRenderTaskGetTargetFrameBufferP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetTargetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask newTask = taskList.CreateTask(); + FrameBufferImage fb = FrameBufferImage::New(128, 128, Pixel::RGBA8888); + newTask.SetTargetFrameBuffer( fb ); + DALI_TEST_EQUALS( newTask.GetTargetFrameBuffer(), fb, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRenderTaskGetTargetFrameBufferN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetTargetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + + // By default render-tasks do not render off-screen + FrameBufferImage image = task.GetTargetFrameBuffer(); + DALI_TEST_CHECK( !image ); + + END_TEST; +} + +int UtcDaliRenderTaskSetFrameBufferP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + + FrameBuffer newFrameBuffer = FrameBuffer::New( 128u, 128u, FrameBuffer::Attachment::NONE ); + task.SetFrameBuffer( newFrameBuffer ); + DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer ); + END_TEST; +} + +int UtcDaliRenderTaskSetFrameBufferN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + FrameBuffer newFrameBuffer; // Empty handle + task.SetFrameBuffer( newFrameBuffer ); + DALI_TEST_EQUALS( (bool)task.GetFrameBuffer(), false, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRenderTaskGetFrameBufferP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + + FrameBuffer newFrameBuffer = FrameBuffer::New( 1u, 1u, FrameBuffer::Attachment::NONE ); + task.SetFrameBuffer( newFrameBuffer ); + DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer ); + END_TEST; +} + +int UtcDaliRenderTaskGetFrameBufferN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetFrameBuffer()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + + // By default render-tasks do not render off-screen + FrameBuffer frameBuffer = task.GetFrameBuffer(); + DALI_TEST_CHECK( !frameBuffer ); + + END_TEST; +} + +int UtcDaliRenderTaskSetScreenToFrameBufferFunctionP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetScreenToFrameBufferFunction()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + RenderTask task = taskList.GetTask( 0u ); + + task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); Vector2 coordinates( 5, 10 ); Vector2 convertedCoordinates( 6, 12 ); // + Vector(1, 2) @@ -876,7 +1176,26 @@ int UtcDaliRenderTaskSetScreenToFrameBufferFunction(void) END_TEST; } -int UtcDaliRenderTaskGetScreenToFrameBufferFunction(void) +int UtcDaliRenderTaskSetScreenToFrameBufferFunctionN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetScreenToFrameBufferFunction()"); + + RenderTask task; // Empty handle + try + { + task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliRenderTaskGetScreenToFrameBufferFunctionP(void) { TestApplication application; @@ -895,8 +1214,28 @@ int UtcDaliRenderTaskGetScreenToFrameBufferFunction(void) END_TEST; } +int UtcDaliRenderTaskGetScreenToFrameBufferFunctionN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetScreenToFrameBufferFunction() on empty handle"); + + RenderTask task; + try + { + RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction(); + (void) func; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + -int UtcDaliRenderTaskGetScreenToFrameBufferMappingActor(void) +int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorP(void) { TestApplication application; tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor "); @@ -906,28 +1245,109 @@ int UtcDaliRenderTaskGetScreenToFrameBufferMappingActor(void) Actor mappingActor = Actor::New(); renderTask.SetScreenToFrameBufferMappingActor(mappingActor); - DALI_TEST_CHECK( mappingActor == renderTask.GetScreenToFrameBufferMappingActor() ); + DALI_TEST_EQUALS( mappingActor, renderTask.GetScreenToFrameBufferMappingActor(), TEST_LOCATION ); END_TEST; } -int UtcDaliRenderTaskSetViewport(void) + +int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorN(void) { TestApplication application; + tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor with empty task handle"); - tet_infoline("Testing RenderTask::SetViewport()"); + RenderTask task; + try + { + Actor mappingActor; + task.SetScreenToFrameBufferMappingActor(mappingActor); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliRenderTaskGetScreenToFrameBufferMappingActor02N(void) +{ + TestApplication application; + tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor with empty task handle"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); + Actor actor; + renderTask.SetScreenToFrameBufferMappingActor(actor); - RenderTask task = taskList.GetTask( 0u ); + DALI_TEST_EQUALS( (bool)renderTask.GetScreenToFrameBufferMappingActor(), false, TEST_LOCATION); + END_TEST; +} +int UtcDaliRenderTaskGetViewportP01(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetViewport() on default task"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); Viewport viewport = task.GetViewport(); // By default the viewport should match the stage width/height + Vector2 stageSize = Stage::GetCurrent().GetSize(); + Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); + DALI_TEST_CHECK( viewport == expectedViewport ); + END_TEST; +} + +int UtcDaliRenderTaskGetViewportP02(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetViewport() on new task"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.CreateTask(); + Viewport viewport = task.GetViewport(); + // By default the viewport should match the stage width/height Vector2 stageSize = Stage::GetCurrent().GetSize(); Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); DALI_TEST_CHECK( viewport == expectedViewport ); + END_TEST; +} + +int UtcDaliRenderTaskGetViewportN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetViewport() on empty handle"); + + RenderTask task; + try + { + Viewport viewport = task.GetViewport(); + (void) viewport; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + + +int UtcDaliRenderTaskSetViewportP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetViewport()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); + Vector2 stageSize = Stage::GetCurrent().GetSize(); Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f ); task.SetViewport( newViewport ); @@ -939,29 +1359,31 @@ int UtcDaliRenderTaskSetViewport(void) END_TEST; } -int UtcDaliRenderTaskGetViewport(void) +int UtcDaliRenderTaskSetViewportN(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetViewport()"); + tet_infoline("Testing RenderTask::SetViewport()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - - Viewport viewport = task.GetViewport(); - - // By default the viewport should match the stage width/height - - Vector2 stageSize = Stage::GetCurrent().GetSize(); - Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); - DALI_TEST_CHECK( viewport == expectedViewport ); + RenderTask task; + try + { + Vector2 stageSize = Stage::GetCurrent().GetSize(); + Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f ); + task.SetViewport( newViewport ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } - RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( newTask.GetViewport() == expectedViewport ); END_TEST; } + int UtcDaliRenderTaskSetViewportPosition(void) { TestApplication application; @@ -992,22 +1414,31 @@ int UtcDaliRenderTaskSetViewportPosition(void) // Set by Property test Vector2 newPosition2(32.0f, 32.0f); - task.SetProperty( RenderTask::VIEWPORT_POSITION, newPosition2 ); + task.SetProperty( RenderTask::Property::VIEWPORT_POSITION, newPosition2 ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition, TEST_LOCATION ); // still the old position // Update application.SendNotification(); application.Render(); DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition2, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); Vector2 newPosition3(64.0f, 0.0f); Animation animation = Animation::New(1.0f); - animation.AnimateTo( Property( task, RenderTask::VIEWPORT_POSITION ), newPosition3, AlphaFunctions::Linear ); + animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR ); animation.Play(); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; } @@ -1040,27 +1471,36 @@ int UtcDaliRenderTaskSetViewportSize(void) // Set by Property test Vector2 newSize2(50.0f, 50.0f); - task.SetProperty( RenderTask::VIEWPORT_SIZE, newSize2 ); + task.SetProperty( RenderTask::Property::VIEWPORT_SIZE, newSize2 ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize, TEST_LOCATION ); // still the old position // Update application.SendNotification(); application.Render(); DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize2, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); Vector2 newSize3(10.0f, 10.0f); Animation animation = Animation::New(1.0f); - animation.AnimateTo( Property( task, RenderTask::VIEWPORT_SIZE ), newSize3, AlphaFunctions::Linear ); + animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR ); animation.Play(); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; } -int UtcDaliRenderTaskSetClearColor(void) +int UtcDaliRenderTaskSetClearColorP(void) { TestApplication application; @@ -1081,16 +1521,53 @@ int UtcDaliRenderTaskSetClearColor(void) DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION ); - task.SetProperty( RenderTask::CLEAR_COLOR, testColor2 ); + task.SetProperty( RenderTask::Property::CLEAR_COLOR, testColor2 ); + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor, TEST_LOCATION ); // still the old color // Wait a frame. Wait(application); DALI_TEST_EQUALS( task.GetClearColor(), testColor2, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + + Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f); + Animation animation = Animation::New(1.0f); + animation.AnimateTo( Property( task, RenderTask::Property::CLEAR_COLOR ), newColor3, AlphaFunction::LINEAR ); + animation.Play(); + + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + + // Perform 1000ms worth of updates at which point animation should have completed. + Wait(application, 1000); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliRenderTaskSetClearColorN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetClearColor() on empty handle"); + + RenderTask task; + try + { + task.SetClearColor( Vector4::ZERO ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } END_TEST; } -int UtcDaliRenderTaskGetClearColor(void) +int UtcDaliRenderTaskGetClearColorP(void) { TestApplication application; @@ -1102,7 +1579,27 @@ int UtcDaliRenderTaskGetClearColor(void) END_TEST; } -int UtcDaliRenderTaskSetClearEnabled(void) +int UtcDaliRenderTaskGetClearColorN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetClearColor()"); + + RenderTask task; + try + { + Vector4 color = task.GetClearColor(); + (void) color; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliRenderTaskSetClearEnabledP(void) { TestApplication application; @@ -1121,82 +1618,188 @@ int UtcDaliRenderTaskSetClearEnabled(void) END_TEST; } -int UtcDaliRenderTaskGetClearEnabled(void) +int UtcDaliRenderTaskSetClearEnabledN(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetClearEnabled()"); - - RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + tet_infoline("Testing RenderTask::SetClearEnabled() with empty handle"); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( !task.GetClearEnabled() ); // defaults to false + RenderTask task; + try + { + task.SetClearEnabled(true); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } END_TEST; } -int UtcDaliRenderTaskSetRefreshRate(void) +int UtcDaliRenderTaskGetClearEnabledP(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetRefreshRate()"); + tet_infoline("Testing RenderTask::GetClearEnabled()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - // By default tasks will be processed every frame RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + DALI_TEST_CHECK( !task.GetClearEnabled() ); // defaults to false + END_TEST; +} - task.SetRefreshRate( 2u ); // every-other frame - DALI_TEST_CHECK( 2u == task.GetRefreshRate() ); - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); +int UtcDaliRenderTaskGetClearEnabledN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetClearEnabled() with empty handle"); + + RenderTask task; + try + { + bool x = task.GetClearEnabled(); + (void) x; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } END_TEST; } -int UtcDaliRenderTaskGetRefreshRate(void) +int UtcDaliRenderTaskSetCullModeP(void) { TestApplication application; - tet_infoline("Testing RenderTask::GetRefreshRate()"); + tet_infoline("Testing RenderTask::SetCullMode()"); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - - // By default tasks will be processed every frame RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION ); + + task.SetCullMode( false ); + + DALI_TEST_EQUALS( task.GetCullMode(), false, TEST_LOCATION ); - RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate() ); END_TEST; } -int UtcDaliRenderTaskSignalFinished(void) +int UtcDaliRenderTaskSetCullModeN(void) { TestApplication application; - tet_infoline("Testing RenderTask::SignalFinished()"); - - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - - CameraActor offscreenCameraActor = CameraActor::New(); + tet_infoline("Testing RenderTask::SetCullMode() on empty handle"); + + RenderTask task; + try + { + task.SetCullMode( false ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliRenderTaskGetCullModeP(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetCullMode()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); + DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliRenderTaskGetCullModeN(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetCullMode() with empty handle"); + + RenderTask task; + try + { + bool x = task.GetCullMode(); + (void) x; + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); + } + END_TEST; +} + + +int UtcDaliRenderTaskSetRefreshRate(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SetRefreshRate()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + // By default tasks will be processed every frame + RenderTask task = taskList.GetTask( 0u ); + DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + + task.SetRefreshRate( 2u ); // every-other frame + DALI_TEST_CHECK( 2u == task.GetRefreshRate() ); + + task.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); + DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + END_TEST; +} + +int UtcDaliRenderTaskGetRefreshRate(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::GetRefreshRate()"); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + + // By default tasks will be processed every frame + RenderTask task = taskList.GetTask( 0u ); + DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + + RenderTask newTask = taskList.CreateTask(); + DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate() ); + END_TEST; +} + +int UtcDaliRenderTaskSignalFinished(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask::SignalFinished()"); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + + CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - BitmapImage image = BitmapImage::New( 10, 10 ); - ImageActor rootActor = ImageActor::New( image ); + BufferImage image = BufferImage::New( 10, 10 ); + image.Update(); + Actor rootActor = CreateRenderableActor( image ); rootActor.SetSize( 10, 10 ); Stage::GetCurrent().Add( rootActor ); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - NativeImagePtr testNativeImagePtr = new TestNativeImage(10, 10); + NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); FrameBufferImage frameBufferImage = FrameBufferImage::New( *testNativeImagePtr.Get() ); - // Flush all outstanding messages - application.SendNotification(); - application.Render(); - RenderTask newTask = taskList.CreateTask(); newTask.SetCameraActor( offscreenCameraActor ); newTask.SetSourceActor( rootActor ); @@ -1206,8 +1809,7 @@ int UtcDaliRenderTaskSignalFinished(void) newTask.SetExclusive( true ); newTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); newTask.SetTargetFrameBuffer( frameBufferImage ); - - // Framebuffer doesn't actually get created until Connected, i.e. by previous line + newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); bool finished = false; RenderTaskFinished renderTaskFinished( finished ); @@ -1227,12 +1829,12 @@ int UtcDaliRenderTaskSignalFinished(void) DALI_TEST_CHECK( lastSyncObj != NULL ); application.Render(); - DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); application.SendNotification(); DALI_TEST_CHECK( !finished ); application.Render(); - DALI_TEST_EQUALS( (application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); application.SendNotification(); DALI_TEST_CHECK( ! finished ); @@ -1245,11 +1847,8 @@ int UtcDaliRenderTaskSignalFinished(void) application.Render(); application.SendNotification(); DALI_TEST_CHECK( finished ); - finished = false; - application.Render(); // Double check no more finished signal - application.SendNotification(); - DALI_TEST_CHECK( ! finished ); + DALI_TEST_EQUALS( application.GetUpdateStatus(), 0, TEST_LOCATION ); END_TEST; } @@ -1271,31 +1870,23 @@ int UtcDaliRenderTaskContinuous01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false ) ); - // ADD SOURCE ACTOR TO STAGE - expect continuous renders to start, no finished signal Stage::GetCurrent().Add(secondRootActor); application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); END_TEST; } @@ -1317,10 +1908,7 @@ int UtcDaliRenderTaskContinuous02(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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); @@ -1328,21 +1916,18 @@ 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 - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + // START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false ) ); // MAKE SOURCE ACTOR VISIBLE - expect continuous renders to start, no finished signal secondRootActor.SetVisible(true); application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); END_TEST; } @@ -1361,31 +1946,25 @@ int UtcDaliRenderTaskContinuous03(void) Stage::GetCurrent().Add( rootActor ); CameraActor offscreenCameraActor = CameraActor::New(); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false ) ); // ADD CAMERA ACTOR TO STAGE - expect continuous renders to start, no finished signal Stage::GetCurrent().Add( offscreenCameraActor ); application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); END_TEST; } @@ -1394,7 +1973,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"); + tet_infoline("Testing RenderTask Render Continuous using loaded image"); // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1406,10 +1985,7 @@ int UtcDaliRenderTaskContinuous04(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); @@ -1419,21 +1995,15 @@ int UtcDaliRenderTaskContinuous04(void) application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - // FINISH RESOURCE LOADING - expect 'continuous' renders to start, no finished signal - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); + 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 ); @@ -1446,13 +2016,9 @@ int UtcDaliRenderTaskOnce01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); bool finished = false; @@ -1460,27 +2026,14 @@ 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - // MAKE SOURCE VISIBLE - secondRootActor.SetVisible(true); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, 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 ) ); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - application.GetPlatform().ClearReadyResources(); sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } @@ -1488,11 +2041,9 @@ int UtcDaliRenderTaskOnce02(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 Mesh which accesses texture through sampler with loaded image.\n"); - // 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(); @@ -1503,53 +2054,42 @@ int UtcDaliRenderTaskOnce02(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; + + 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); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); bool finished = false; RenderTaskFinished renderTaskFinished( finished ); newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - // FINISH RESOURCE LOADING - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); - END_TEST; -} + 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 UtcDaliRenderTaskOnce03(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 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 ); @@ -1562,10 +2102,7 @@ int UtcDaliRenderTaskOnce03(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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); @@ -1574,41 +2111,32 @@ 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + application.SendNotification(); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, 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 ) ); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - application.GetPlatform().ClearReadyResources(); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); END_TEST; } -#if 0 -//int UtcDaliRenderTaskOnce04(void) + +int UtcDaliRenderTaskOnce04(void) { TestApplication application; + 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" + ); - 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 + // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); @@ -1619,15 +2147,18 @@ int UtcDaliRenderTaskOnce03(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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); bool finished = false; @@ -1635,56 +2166,31 @@ int UtcDaliRenderTaskOnce03(void) newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); - // CHANGE TO RENDER ONCE, RESOURCES BECOME NOT READY newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + application.SendNotification(); - // Doesn't work... - ReloadImage(application, secondRootActor.GetImage()); - application.SendNotification(); // Input, Expected Input, Expected - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_EQUALS( secondRootActor.GetImage().GetLoadingState(), Dali::ResourceLoading, TEST_LOCATION); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, 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 ) ); - application.GetPlatform().ClearReadyResources(); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, true ) ); - // Finished rendering - expect no more renders, no more signals: - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + END_TEST; } -#endif -int UtcDaliRenderTaskOnce05(void) +int UtcDaliRenderTaskOnceNoSync01(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, \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); @@ -1693,66 +2199,28 @@ int UtcDaliRenderTaskOnce05(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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_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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + 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 UtcDaliRenderTaskOnce06(void) +int UtcDaliRenderTaskOnceNoSync02(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)"); - - - // 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); @@ -1761,75 +2229,42 @@ int UtcDaliRenderTaskOnce06(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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(); + 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); - 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; - - ConnectionTracker connectionTracker; - RenderTaskFinishedRenderAgain renderTaskFinishedRenderAgain( finished ); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinishedRenderAgain ); - - application.SendNotification(); - - // Expect 2 frames to be drawn. - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + RenderTaskFinished renderTaskFinished( finished ); + newTask.FinishedSignal().Connect( &application, renderTaskFinished ); 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 ) ); - lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + 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__ ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); END_TEST; } - -int UtcDaliRenderTaskOnce07(void) +int UtcDaliRenderTaskOnceNoSync03(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, 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); @@ -1838,62 +2273,35 @@ int UtcDaliRenderTaskOnce07(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - sync.SetObjectSynced( lastSyncObj, true ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); - + 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 UtcDaliRenderTaskOnce08(void) +int UtcDaliRenderTaskOnceNoSync04(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."); + 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(); drawTrace.Enable(true); @@ -1902,53 +2310,52 @@ int UtcDaliRenderTaskOnce08(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); + + 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); - 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, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + 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 ); - // CHANGE TO RENDER ONCE, newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - 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 ) ); // nothing to draw - application.SendNotification(); - - // Drawing empty framebuffer, so will still get a GL sync - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + 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__ ) ); - // Expect finished signal, as all resources are complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, true, false ) ); + lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK( lastSyncObj == NULL ); END_TEST; } - - -int UtcDaliRenderTaskOnceNoSync01(void) +int UtcDaliRenderTaskOnceNoSync05(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"); + 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 AN OFFSCREEN RENDER TASK + // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); @@ -1958,553 +2365,401 @@ int UtcDaliRenderTaskOnceNoSync01(void) CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - + Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); - secondRootActor.SetVisible(false); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); bool finished = false; RenderTaskFinished renderTaskFinished( finished ); newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + // START PROCESS/RENDER Input, Expected Input, Expected + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); - // MAKE SOURCE VISIBLE - secondRootActor.SetVisible(true); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + // CHANGE TO RENDER ONCE, + newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __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 ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); END_TEST; } -int UtcDaliRenderTaskOnceNoSync02(void) + + +int UtcDaliRenderTaskOnceChain01(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"); + tet_infoline("Testing RenderTask Render Once Chained render tasks\n" + "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n" + "PRE: resources ready\n" + "POST: 2 finished signals 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 ); + Actor defaultRootActor = Actor::New(); // Root for default RT + Stage::GetCurrent().Add( defaultRootActor ); CameraActor offscreenCameraActor = CameraActor::New(); Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 + RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false); + bool firstFinished = false; + RenderTaskFinished renderTask1Finished( firstFinished ); + firstTask.FinishedSignal().Connect( &application, renderTask1Finished ); + + // Second render task + FrameBufferImage fbo = firstTask.GetTargetFrameBuffer(); + Actor secondRootActor = CreateRenderableActor( fbo ); Stage::GetCurrent().Add(secondRootActor); + RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); + bool secondFinished = false; + RenderTaskFinished renderTask2Finished( secondFinished ); + secondTask.FinishedSignal().Connect( &application, renderTask2Finished ); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + //Both render tasks are executed. + DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) ); + DALI_TEST_CHECK( firstFinished == false ); + DALI_TEST_CHECK( secondFinished == false ); - // FINISH RESOURCE LOADING - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - application.GetPlatform().ClearReadyResources(); + //Nothing else to render and both render task should have finished now + DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, firstFinished, true, false, __LINE__ ) ); + DALI_TEST_CHECK( firstFinished == true ); + DALI_TEST_CHECK( secondFinished == true ); - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); END_TEST; } - -int UtcDaliRenderTaskOnceNoSync03(void) +int UtcDaliRenderTaskProperties(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 ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - - // 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + RenderTask task = Stage::GetCurrent().GetRenderTaskList().CreateTask(); - // 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 ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + Property::IndexContainer indices; + task.GetPropertyIndices( indices ); + DALI_TEST_CHECK( indices.Size() ); + DALI_TEST_EQUALS( indices.Size(), task.GetPropertyCount(), TEST_LOCATION ); END_TEST; } -#if 0 -//int UtcDaliRenderTaskOnceNoSync04(void) +int UtcDaliRenderTaskSetScreenToFrameBufferMappingActor(void) { TestApplication application; + tet_infoline("Testing RenderTask::SetScreenToFrameBufferMappingActor "); - 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"); + Stage stage = Stage::GetCurrent(); + Size stageSize = stage.GetSize(); + Actor mappingActor = Actor::New(); + Vector2 scale( 0.6f, 0.75f); + Vector2 offset( stageSize.x*0.1f, stageSize.y*0.15f); + mappingActor.SetSize( stageSize * scale ); + mappingActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mappingActor.SetPosition( offset.x, offset.y ); + stage.Add( mappingActor ); - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - drawTrace.Enable(true); + Actor offscreenActor = Actor::New(); + offscreenActor.SetSize( stageSize ); + offscreenActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + stage.Add( offscreenActor ); - Actor rootActor = Actor::New(); - Stage::GetCurrent().Add( rootActor ); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); + FrameBufferImage frameBufferImage = FrameBufferImage::New(stageSize.width*scale.x, stageSize.height*scale.y, Pixel::A8); + renderTask.SetSourceActor( offscreenActor ); + renderTask.SetExclusive( true ); + renderTask.SetInputEnabled( true ); + renderTask.SetTargetFrameBuffer( frameBufferImage ); + renderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); + renderTask.SetScreenToFrameBufferMappingActor( mappingActor ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - CameraActor offscreenCameraActor = CameraActor::New(); - Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 + // Render and notify + application.SendNotification(); + application.Render(); 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, RESOURCES BECOME NOT READY - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + Vector2 screenCoordinates( stageSize.x * 0.05f, stageSize.y * 0.05f ); + Dali::HitTestAlgorithm::Results results; + DALI_TEST_CHECK( !results.actor ); + DALI_TEST_EQUALS( Vector2::ZERO, results.actorCoordinates, 0.1f, TEST_LOCATION ); + // miss expected, results not changed + DALI_TEST_CHECK( false == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); + DALI_TEST_CHECK( !results.actor ); + DALI_TEST_EQUALS( Vector2::ZERO, results.actorCoordinates, 0.1f, TEST_LOCATION ); - // Doesn't work... - ReloadImage(application, secondRootActor.GetImage()); - application.SendNotification(); // Input, Expected Input, Expected + screenCoordinates.x = stageSize.x * 0.265f; + screenCoordinates.y = stageSize.y * 0.33f; + results.actor = Actor(); + results.actorCoordinates = Vector2::ZERO; + // hit expected, results changed + DALI_TEST_CHECK( true == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); + DALI_TEST_CHECK( results.actor == offscreenActor ); + DALI_TEST_EQUALS( (screenCoordinates-offset)/scale , results.actorCoordinates, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_EQUALS( secondRootActor.GetImage().GetLoadingState(), Dali::ResourceLoading, TEST_LOCATION); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + screenCoordinates.x = stageSize.x * 0.435f; + screenCoordinates.y = stageSize.y * 0.52f; + // hit expected, results changed + DALI_TEST_CHECK( true == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); + DALI_TEST_CHECK( results.actor == offscreenActor ); + const Vector2 expectedCoordinates = (screenCoordinates-offset)/scale; + DALI_TEST_EQUALS( expectedCoordinates , results.actorCoordinates, 0.1f, TEST_LOCATION ); - // 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 ) ); - application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + screenCoordinates.x = stageSize.x * 0.65f; + screenCoordinates.y = stageSize.y * 0.95f; + // miss expected, results not changed + DALI_TEST_CHECK( false == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); + DALI_TEST_CHECK( results.actor == offscreenActor ); + DALI_TEST_EQUALS( expectedCoordinates , results.actorCoordinates, 0.1f, TEST_LOCATION ); END_TEST; } -#endif -int UtcDaliRenderTaskOnceNoSync05(void) +int UtcDaliRenderTaskFinishInvisibleSourceActor(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)"); + tet_infoline("Testing RenderTask::FinishInvisibleSourceActor()"); - // 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 ); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); CameraActor offscreenCameraActor = CameraActor::New(); + Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 + + BufferImage image = BufferImage::New( 10, 10 ); + Actor rootActor = CreateRenderableActor( image ); + rootActor.SetSize( 10, 10 ); + rootActor.SetVisible(false); + Stage::GetCurrent().Add( rootActor ); + + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); + FrameBufferImage frameBufferImage = FrameBufferImage::New( *testNativeImagePtr.Get() ); + + // Flush all outstanding messages + application.SendNotification(); application.Render(); - application.GetPlatform().ClearReadyResources(); - Stage::GetCurrent().Add(secondRootActor); + RenderTask newTask = taskList.CreateTask(); + newTask.SetCameraActor( offscreenCameraActor ); + 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_ONCE ); + newTask.SetTargetFrameBuffer( frameBufferImage ); + newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); + + // Framebuffer doesn't actually get created until Connected, i.e. by previous line - 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); - - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + // Flush the queue and render. application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); - END_TEST; -} - -int UtcDaliRenderTaskOnceNoSync06(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)"); + // 1 render to process render task, then wait for sync before finished msg is sent + // from update to the event thread. - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - drawTrace.Enable(true); + application.Render(); + application.SendNotification(); + DALI_TEST_CHECK( !finished ); - Actor rootActor = Actor::New(); - Stage::GetCurrent().Add( rootActor ); + Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK( lastSyncObj != NULL ); - CameraActor offscreenCameraActor = CameraActor::New(); - Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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); + DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + application.SendNotification(); + DALI_TEST_CHECK( !finished ); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; + application.Render(); + DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + application.SendNotification(); + DALI_TEST_CHECK( ! finished ); - ConnectionTracker connectionTracker; - RenderTaskFinishedRenderAgain renderTaskFinishedRenderAgain( finished ); - newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinishedRenderAgain ); + sync.SetObjectSynced( lastSyncObj, true ); + application.Render(); application.SendNotification(); + DALI_TEST_CHECK( !finished ); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + application.Render(); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + DALI_TEST_CHECK( finished ); + finished = false; - // 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 ); + application.Render(); // Double check no more finished signal + application.SendNotification(); + DALI_TEST_CHECK( ! finished ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); END_TEST; } - -int UtcDaliRenderTaskOnceNoSync07(void) +int UtcDaliRenderTaskFinishMissingImage(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."); + // Previously we had bugs where not having a resource ID would cause render-tasks to wait forever + tet_infoline("Testing RenderTask::SignalFinished() when an Actor has no Image set"); - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - drawTrace.Enable(true); + Stage stage = Stage::GetCurrent(); - Actor rootActor = Actor::New(); - Stage::GetCurrent().Add( rootActor ); + BufferImage image = BufferImage::New( 10, 10 ); + Actor rootActor = CreateRenderableActor( image ); + rootActor.SetSize( 10, 10 ); + stage.Add( rootActor ); - CameraActor offscreenCameraActor = CameraActor::New(); - Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::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 actorWithMissingImage = CreateRenderableActor( Image() ); + actorWithMissingImage.SetSize( 10, 10 ); + stage.Add( actorWithMissingImage ); - Stage::GetCurrent().Add(secondRootActor); + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask newTask = taskList.CreateTask(); + newTask.SetInputEnabled( false ); + newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) ); + newTask.SetClearEnabled( true ); + newTask.SetExclusive( true ); + newTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); - 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 ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false ) ); - - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + // 1 render to process render task, then 1 before finished msg is sent from update to the event thread. application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + application.Render(); + application.Render(); - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + DALI_TEST_CHECK( finished ); + END_TEST; } -int UtcDaliRenderTaskOnceNoSync08(void) +int UtcDaliRenderTaskWorldToViewport(void) { - TestApplication application; + TestApplication application( static_cast(400), static_cast(400) ); // square surface - 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."); + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - drawTrace.Enable(true); + Actor actor = Actor::New(); + actor.SetSize(100.0f, 100.0f); + actor.SetPosition( Vector3(0.0, 0.0, 0.0) ); - Actor rootActor = Actor::New(); - Stage::GetCurrent().Add( rootActor ); + actor.SetParentOrigin( Vector3(0.5, 0.5, 0.5) ); + actor.SetAnchorPoint( Vector3(0.5, 0.5, 0.5) ); - CameraActor offscreenCameraActor = CameraActor::New(); - Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor secondRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Stage::GetCurrent().Add(secondRootActor); + Stage::GetCurrent().Add(actor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + application.SendNotification(); + application.Render(); application.SendNotification(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + RenderTask task = taskList.GetTask( 0u ); - // CHANGE TO RENDER ONCE, - newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); + CameraActor camera = task.GetCameraActor(); - FailImageLoad(application, imageRequestId); // Need to run Update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true ) ); // nothing to draw - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false ) ); + Vector2 screenSize = task.GetCurrentViewportSize(); - END_TEST; -} + float screenX = 0.0; + float screenY = 0.0; + bool ok = task.WorldToViewport(actor.GetCurrentWorldPosition(), screenX, screenY); + DALI_TEST_CHECK(ok == true); + DALI_TEST_EQUALS(screenX, screenSize.x/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenY, screenSize.y/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); -int UtcDaliRenderTaskOnceChain01(void) -{ - TestApplication application; + Actor actor2 = Actor::New(); + float actor2Size = 100.f; + actor2.SetSize( actor2Size, actor2Size ); + actor2.SetPosition( Vector3(0.0, 0.0, 0.0) ); + actor2.SetParentOrigin( Vector3(0.5, 0.5, 0.0) ); + actor2.SetAnchorPoint( Vector3(0.5, 0.5, 0.0) ); + Stage::GetCurrent().Add( actor2 ); + actor2.Add(actor); + actor.SetParentOrigin( Vector3(0,0,0) ); - 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" - "POST: 2 finished signals sent."); + application.SendNotification(); + application.Render(); + application.SendNotification(); - // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); - drawTrace.Enable(true); + ok = task.WorldToViewport(actor.GetCurrentWorldPosition(), screenX, screenY); + DALI_TEST_CHECK(ok == true); - Actor defaultRootActor = Actor::New(); // Root for default RT - Stage::GetCurrent().Add( defaultRootActor ); + DALI_TEST_EQUALS(screenX, screenSize.x/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenY, screenSize.y/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); - CameraActor offscreenCameraActor = CameraActor::New(); - Stage::GetCurrent().Add( offscreenCameraActor ); - ImageActor firstRootActor = CreateLoadingImage(application, "aFile.jpg", Image::Immediate, Image::Unused); - Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest(); - Integration::ResourceId imageRequestId = imageRequest->GetId(); - Integration::ResourceTypeId imageType = imageRequest->GetType()->id; - Stage::GetCurrent().Add(firstRootActor); + END_TEST; +} - // first render task - RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false); - bool firstFinished = false; - RenderTaskFinished renderTask1Finished( firstFinished ); - firstTask.FinishedSignal().Connect( &application, renderTask1Finished ); - // Second render task - FrameBufferImage fbo = firstTask.GetTargetFrameBuffer(); - ImageActor secondRootActor = ImageActor::New( fbo ); - Stage::GetCurrent().Add(secondRootActor); - RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); - bool secondFinished = false; - RenderTaskFinished renderTask2Finished( secondFinished ); - secondTask.FinishedSignal().Connect( &application, renderTask2Finished ); +int UtcDaliRenderTaskViewportToLocal(void) +{ + TestApplication application; + Actor actor = Actor::New(); + actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); + actor.SetSize(100.0f, 100.0f); + actor.SetPosition(10.0f, 10.0f); + Stage::GetCurrent().Add(actor); + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); + RenderTask task = taskList.GetTask( 0u ); + + // flush the queue and render once application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); - // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true ) ); - DALI_TEST_CHECK( secondFinished == false ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true ) ); - DALI_TEST_CHECK( secondFinished == false ); + float localX; + float localY; - CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true ) ); - DALI_TEST_CHECK( secondFinished == false ); - application.GetPlatform().ClearReadyResources(); + float rtLocalX; + float rtLocalY; - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, firstFinished, true, false ) ); - DALI_TEST_CHECK( secondFinished == true ); + float screenX = 50.0f; + float screenY = 50.0f; - END_TEST; -} + DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) ); -int UtcDaliRenderTaskProperties(void) -{ - TestApplication application; + DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) ); - RenderTask task = Stage::GetCurrent().GetRenderTaskList().CreateTask(); + DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION); - Property::IndexContainer indices; - task.GetPropertyIndices( indices ); - DALI_TEST_CHECK( ! indices.empty() ); - DALI_TEST_EQUALS( indices.size(), task.GetPropertyCount(), TEST_LOCATION ); END_TEST; + } -int UtcDaliRenderTaskSetScreenToFrameBufferMappingActor(void) +int UtcDaliRenderTaskRequiresSync(void) { TestApplication application; - tet_infoline("Testing RenderTask::SetScreenToFrameBufferMappingActor "); - - Stage stage = Stage::GetCurrent(); - Size stageSize = stage.GetSize(); - Actor mappingActor = Actor::New(); - Vector2 scale( 0.6f, 0.75f); - Vector2 offset( stageSize.x*0.1f, stageSize.y*0.15f); - mappingActor.SetSize( stageSize * scale ); - mappingActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mappingActor.SetPosition( offset.x, offset.y ); - stage.Add( mappingActor ); - - Actor offscreenActor = Actor::New(); - offscreenActor.SetSize( stageSize ); - offscreenActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - stage.Add( offscreenActor ); - - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask renderTask = taskList.CreateTask(); - FrameBufferImage frameBufferImage = FrameBufferImage::New(stageSize.width*scale.x, stageSize.height*scale.y, Pixel::A8, Image::Never); - renderTask.SetSourceActor( offscreenActor ); - renderTask.SetExclusive( true ); - renderTask.SetInputEnabled( true ); - renderTask.SetTargetFrameBuffer( frameBufferImage ); - renderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); - renderTask.SetScreenToFrameBufferMappingActor( mappingActor ); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); - // Render and notify - application.SendNotification(); - application.Render(); - application.Render(); - application.SendNotification(); + RenderTask newTask = taskList.CreateTask(); + newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, false ); - Vector2 screenCoordinates( stageSize.x * 0.05f, stageSize.y * 0.05f ); - Dali::HitTestAlgorithm::Results results; - DALI_TEST_CHECK( !results.actor ); - DALI_TEST_EQUALS( Vector2::ZERO, results.actorCoordinates, 0.1f, TEST_LOCATION ); - // miss expected, results not changed - DALI_TEST_CHECK( false == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); - DALI_TEST_CHECK( !results.actor ); - DALI_TEST_EQUALS( Vector2::ZERO, results.actorCoordinates, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( newTask, RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION ); - screenCoordinates.x = stageSize.x * 0.265f; - screenCoordinates.y = stageSize.y * 0.33f; - results.actor = Actor(); - results.actorCoordinates = Vector2::ZERO; - // hit expected, results changed - DALI_TEST_CHECK( true == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); - DALI_TEST_CHECK( results.actor == offscreenActor ); - DALI_TEST_EQUALS( (screenCoordinates-offset)/scale , results.actorCoordinates, 0.1f, TEST_LOCATION ); + newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); - screenCoordinates.x = stageSize.x * 0.435f; - screenCoordinates.y = stageSize.y * 0.52f; - // hit expected, results changed - DALI_TEST_CHECK( true == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); - DALI_TEST_CHECK( results.actor == offscreenActor ); - const Vector2 expectedCoordinates = (screenCoordinates-offset)/scale; - DALI_TEST_EQUALS( expectedCoordinates , results.actorCoordinates, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( newTask, RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION ); - screenCoordinates.x = stageSize.x * 0.65f; - screenCoordinates.y = stageSize.y * 0.95f; - // miss expected, results not changed - DALI_TEST_CHECK( false == Dali::HitTestAlgorithm::HitTest( renderTask, screenCoordinates, results, IsActorHittableFunction ) ); - DALI_TEST_CHECK( results.actor == offscreenActor ); - DALI_TEST_EQUALS( expectedCoordinates , results.actorCoordinates, 0.1f, TEST_LOCATION ); END_TEST; }