/*
- * Copyright (c) 2014 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.
TestApplication application; // Initializes core DPI to default values
// Test that setting core DPI explicitly also sets up the Stage's DPI.
- application.GetCore().SetDpi( 200, 180 );
+ Dali::Integration::Scene scene = application.GetScene();
+ scene.SetDpi( Vector2(200.0f, 180.0f) );
Stage stage = Stage::GetCurrent();
Vector2 dpi = stage.GetDpi();
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();
KeyEventGeneratedReceivedFunctor functor2( data2 );
GetImplementation( stage ).ConnectSignal( &application, "keyEventGenerated", functor2 );
- Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME );
+ 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 );
KeyEventReceivedFunctor functor( data );
stage.KeyEventSignal().Connect( &application, functor );
- Integration::KeyEvent event( "i", "i", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME );
+ 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 );
data.Reset();
- Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME );
+ 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 );
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;
+}