+ END_TEST;
+}
+
+int UtcDaliControlBackgroundColorRendererCount(void)
+{
+ tet_infoline( "Test ensures we only create renderers when non-transparent color is requested or if we our clipping-mode is set to CLIP_CHILDREN" );
+
+ ToolkitTestApplication application;
+ Control control = Control::New();
+ control[Actor::Property::SIZE] = Vector2(100.0f, 100.0f);
+ application.GetScene().Add( control );
+
+ tet_infoline( "Set semi transparent alpha with positive RGB values, 1 renderer should be created, but returned color should reflect what we set" );
+ const Vector4 semiTransparent( 1.0f, 0.75f, 0.5f, 0.5f );
+ control.SetBackgroundColor( semiTransparent );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), semiTransparent, TEST_LOCATION );
+
+ Renderer renderer = control.GetRendererAt( 0 );
+ DALI_TEST_CHECK( renderer );
+
+ tet_infoline( "Set semi transparent alpha with positive RGB values, renderer should not be changed" );
+ const Vector4 newColor( 1.0f, 1.0f, 0.5f, 0.5f );
+ control.SetBackgroundColor( newColor );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), newColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer, control.GetRendererAt( 0 ), TEST_LOCATION );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
+ drawTrace.Enable(true);
+
+ tet_infoline( "Set transparent, 1 renderer should be created, but ensure nothing is drawn" );
+ control.SetBackgroundColor( Color::TRANSPARENT );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION);
+
+ drawTrace.Reset();
+
+ tet_infoline( "Set control to clip its children, a renderer should be created which will be transparent" );
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION);
+
+ tet_infoline( "Set a color, only 1 renderer should exist" );
+ control.SetBackgroundColor( Color::RED );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::RED, TEST_LOCATION );
+
+ tet_infoline( "Clear the background, no renderers" );
+ control.ClearBackground();
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
+
+ tet_infoline( "Set control to clip its children again, a renderer should be created which will be transparent" );
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
+
+ drawTrace.Reset();
+
+ tet_infoline( "Disable clipping, render nothing" );
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION);