int UtcDaliHoverMultipleRenderTasksWithChildLayer(void) { TestApplication application; Stage stage ( Stage::GetCurrent() ); Vector2 stageSize ( stage.GetSize() ); Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); stage.Add(actor); Layer layer = Layer::New(); layer.SetSize(100.0f, 100.0f); layer.SetAnchorPoint(AnchorPoint::TOP_LEFT); actor.Add(layer); // Create render task Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f ); RenderTask renderTask ( Stage::GetCurrent().GetRenderTaskList().CreateTask() ); renderTask.SetViewport( viewport ); renderTask.SetInputEnabled( true ); renderTask.SetSourceActor( actor ); // Render and notify application.SendNotification(); application.Render(); // Connect to layer's hovered signal SignalData data; HoverEventFunctor functor( data ); actor.HoveredSignal().Connect( &application, functor ); layer.HoveredSignal().Connect( &application, functor ); // Emit a started signal application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); data.Reset(); // Ensure renderTask actor can be hit too. application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); data.Reset(); // Disable input on renderTask, should not be hittable renderTask.SetInputEnabled( false ); application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); data.Reset(); END_TEST; }
int UtcDaliHoverOffscreenRenderTasks(void) { TestApplication application; Stage stage ( Stage::GetCurrent() ); Vector2 stageSize ( stage.GetSize() ); // FrameBufferImage for offscreen RenderTask FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) ); // Create a renderable actor to display the FrameBufferImage Actor renderableActor = CreateRenderableActor( frameBufferImage ); renderableActor.SetParentOrigin(ParentOrigin::CENTER); renderableActor.SetSize( stageSize.x, stageSize.y ); renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME stage.Add( renderableActor ); Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); stage.Add( actor ); application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION ); // Create a RenderTask RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); renderTask.SetSourceActor( actor ); renderTask.SetTargetFrameBuffer( frameBufferImage ); renderTask.SetInputEnabled( true ); // Create another RenderTask RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() ); renderTask2.SetInputEnabled( true ); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's hovered signal SignalData data; HoverEventFunctor functor( data ); actor.HoveredSignal().Connect( &application, functor ); // Emit a started signal application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); data.Reset(); END_TEST; }