[Tizen] Revert "Support multiple window rendering"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Stage.cpp
index 14c5651..954957f 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -602,7 +602,7 @@ int UtcDaliStageGetDpiP2(void)
 
 int UtcDaliStageGetDpiP3(void)
 {
-  TestApplication application( 480, 800, 72.0f, 120.0f ); // Initializes core DPI with specific values
+  TestApplication application( 480, 800, 72, 120 ); // Initializes core DPI with specific values
 
   Stage stage = Stage::GetCurrent();
 
@@ -883,7 +883,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
   KeyEventGeneratedReceivedFunctor functor2( data2 );
   GetImplementation( stage ).ConnectSignal( &application, "keyEventGenerated", functor2 );
 
-  Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -894,7 +894,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -905,7 +905,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event3 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -916,7 +916,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event4 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -936,7 +936,7 @@ int UtcDaliStageSignalKeyEventP(void)
   KeyEventReceivedFunctor functor( data );
   stage.KeyEventSignal().Connect( &application, functor );
 
-  Integration::KeyEvent event( "i", "i", 0, 0, 0, Integration::KeyEvent::Down, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Down, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -947,7 +947,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -958,7 +958,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event3 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -969,7 +969,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+  Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
   application.ProcessEvent( event4 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -1670,3 +1670,46 @@ int UtcDaliStageOperatorAssign(void)
 
   END_TEST;
 }
+
+int UtcDaliStageRenderingBehavior(void)
+{
+  TestApplication application;
+  Stage stage = Stage::GetCurrent();
+
+  tet_infoline( "Check default rendering behavior is only if required" );
+  DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED );
+
+  tet_infoline( "No update required with an empty application" );
+  application.SendNotification();
+  DALI_TEST_CHECK( application.UpdateOnly() == false );
+  application.RenderOnly();
+
+  tet_infoline( "Change to continuous rendering, further updates should be required" );
+  DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::CONTINUOUSLY );
+
+  DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::CONTINUOUSLY );
+
+  application.SendNotification();
+  DALI_TEST_CHECK( application.UpdateOnly() == true );
+  application.RenderOnly();
+
+  application.SendNotification();
+  DALI_TEST_CHECK( application.UpdateOnly() == true );
+  application.RenderOnly();
+
+  tet_infoline( "Change to rendering only if required, further updates should NOT be required" );
+  DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::IF_REQUIRED );
+
+  DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED );
+
+  application.SendNotification();
+  DALI_TEST_CHECK( application.UpdateOnly() == false );
+  application.RenderOnly();
+
+  tet_infoline( "The next update is not required so TestApplication should print a warning" );
+  application.SendNotification();
+  DALI_TEST_CHECK( application.UpdateOnly() == false );
+  application.RenderOnly();
+
+  END_TEST;
+}