[Tizen] Regenerating uniform maps fix
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Renderer.cpp
index 0410a52..3a12e96 100644 (file)
@@ -3009,3 +3009,51 @@ int UtcDaliRendererRenderingBehavior(void)
 
   END_TEST;
 }
+
+int UtcDaliRendererRegenerateUniformMap(void)
+{
+  TestApplication application;
+
+  tet_infoline( "Test regenerating uniform map when attaching renderer to the node" );
+
+  Geometry geometry = CreateQuadGeometry();
+  Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+  Renderer renderer = Renderer::New( geometry, shader );
+
+  Actor actor = Actor::New();
+  actor.AddRenderer( renderer );
+  actor.SetSize( 400, 400 );
+  actor.SetColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
+  Stage::GetCurrent().Add( actor );
+
+  application.SendNotification();
+  application.Render();
+
+  actor.RemoveRenderer( renderer );
+  shader = Shader::New( "vertexSrc", "fragmentSrc" );
+  shader.RegisterProperty( "opacity", 0.5f );
+  renderer.SetShader( shader );
+
+  Stage::GetCurrent().KeepRendering( 1.0f );
+
+  // Update for several frames
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+  application.SendNotification();
+  application.Render();
+
+  // Add Renderer
+  actor.AddRenderer( renderer );
+  application.SendNotification();
+  application.Render();
+
+  // Nothing to test here, the test must not crash
+  auto updateStatus = application.GetUpdateStatus();
+  DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING );
+
+  END_TEST;
+}