-int UtcDaliRenderTaskSetScreenToFrameBufferMappingActor(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);
- 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 );
-
- // Render and notify
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- 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 );
-
- 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 );
-
- 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 );
-
- 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;
-}
-