-int UtcDaliSceneEnsureEmptySceneCleared(void)
-{
- tet_infoline( "Ensure we clear the newly added window" );
-
- TestApplication application;
-
- auto& glAbstraction = application.GetGlAbstraction();
- auto clearCountBefore = glAbstraction.GetClearCountCalled();
-
- application.SendNotification();
- application.Render();
-
- // No actor, no rendering at all
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::TRANSPARENT, TEST_LOCATION );
-
- // Need to create a renderable as we don't start rendering until we have at least one
- // We don't need to add this to any scene
- auto actor = CreateRenderableActor();
-
- application.SendNotification();
- application.Render();
-
- // Default background color
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLACK, TEST_LOCATION );
-
- // Create a new scene and set the background colors of both the new and the main scenes
- auto defaultScene = application.GetScene();
- defaultScene.SetBackgroundColor( Color::WHITE );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::WHITE, TEST_LOCATION );
-
- TestRenderSurface surface( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
- auto newScene = Integration::Scene::New( surface );
- newScene.SetBackgroundColor( Color::RED );
-
- application.SendNotification();
- application.Render();
-
- // + 2 clear for 2 scenes
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 4, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::RED, TEST_LOCATION );
-
- // Add the actor to the main scene
- defaultScene.Add( actor );
-
- application.SendNotification();
- application.Render();
-
- // + 2 clear for 2 scenes
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 6, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::RED, TEST_LOCATION );
-
- // Add another scene and set its background color, ensure we clear it to the appropriate color
- // + 3 clear for 3 scenes
- TestRenderSurface surface2( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
- auto thirdScene = Integration::Scene::New( surface2 );
- thirdScene.SetBackgroundColor( Color::BLUE );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 9, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
-
- END_TEST;
-}
-