+
+ END_TEST;
+}
+
+int UtcDaliStageSignalWheelEventP(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ WheelEventSignalData data;
+ WheelEventReceivedFunctor functor( data );
+ stage.WheelEventSignal().Connect( &application, functor );
+
+ Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
+ DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
+ DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
+ DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
+ DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
+ DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );
+
+ data.Reset();
+
+ Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
+ application.ProcessEvent( event2 );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
+ DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
+ DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
+ DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
+ DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
+ DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );
+ END_TEST;
+}
+
+int UtcDaliStageContextLostSignalP(void)
+{
+ TestApplication app;
+ Stage stage = Stage::GetCurrent();
+
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor( contextLost );
+ stage.ContextLostSignal().Connect( &app, contextLostFunctor );
+
+ Integration::ContextNotifierInterface* notifier = app.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ DALI_TEST_EQUALS( contextLost, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliStageContextLostSignalN(void)
+{
+ TestApplication app;
+ Stage stage;
+
+ // Check that connecting to the signal with a bad stage instance causes an assert.
+ bool asserted = false;
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor( contextLost );
+ try
+ {
+ stage.ContextLostSignal().Connect( &app, contextLostFunctor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
+ END_TEST;
+}
+
+int UtcDaliStageContextRegainedSignalP(void)
+{
+ TestApplication app;
+ Stage stage = Stage::GetCurrent();
+
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor( contextRegained );
+ stage.ContextRegainedSignal().Connect( &app, contextRegainedFunctor );
+
+ Integration::ContextNotifierInterface* notifier = app.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ notifier->NotifyContextRegained();
+ DALI_TEST_EQUALS( contextRegained, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliStageContextRegainedSignalN(void)
+{
+ TestApplication app;
+ Stage stage;
+
+ // Check that connecting to the signal with a bad stage instance causes an assert.
+ bool asserted = false;
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor( contextRegained );
+ try
+ {
+ stage.ContextRegainedSignal().Connect( &app, contextRegainedFunctor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
+ END_TEST;
+}
+
+int UtcDaliStageSceneCreatedSignalP(void)
+{
+ TestApplication app;
+ Stage stage = Stage::GetCurrent();
+
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled );
+ stage.SceneCreatedSignal().Connect( &app, sceneCreatedFunctor );
+
+ Integration::Core& core = app.GetCore();
+ core.SceneCreated();
+ DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliStageSceneCreatedSignalN(void)
+{
+ TestApplication app;
+ Stage stage;
+
+ // Check that connecting to the signal with a bad stage instance causes an assert.
+ bool asserted = false;
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled );
+ try
+ {
+ stage.SceneCreatedSignal().Connect( &app, sceneCreatedFunctor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
+ END_TEST;
+}
+
+int UtcDaliStageGetRenderTaskListP(void)
+{
+ TestApplication app;
+ Stage stage = Stage::GetCurrent();
+
+ // Check we get a valid instance.
+ const RenderTaskList& tasks = stage.GetRenderTaskList();
+
+ // There should be 1 task by default.
+ DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION );
+
+ // RenderTaskList has it's own UTC tests.
+ // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
+ RenderTask newTask = stage.GetRenderTaskList().CreateTask();
+
+ DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliStageGetRenderTaskListN(void)
+{
+ TestApplication app;
+ Stage stage;
+
+ // Check that getting the render task list with a bad stage instance causes an assert.
+ bool asserted = false;
+ try
+ {
+ stage.GetRenderTaskList();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
+ END_TEST;
+}
+
+int UtcDaliStageGetObjectRegistryP(void)
+{
+ TestApplication app;
+ Stage stage = Stage::GetCurrent();
+
+ ObjectRegistry objectRegistry = stage.GetObjectRegistry();
+
+ // Object registry tests are covered in their own module.
+ // However we want a basic test to confirm the returned registry is valid and works.
+ bool verified = false;
+ ActorCreatedFunctor test( verified );
+ objectRegistry.ObjectCreatedSignal().Connect( &app, test );
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( test.mSignalVerified );
+
+ END_TEST;
+}
+
+int UtcDaliStageGetObjectRegistryN(void)
+{
+ TestApplication app;
+ Stage stage;
+
+ // Check that getting the object registry with a bad stage instance DOES NOT cause an assert.
+ // This is because GetCurrent() is used, always creating a stage if one does not exist.
+ bool asserted = false;
+ try
+ {
+ stage.GetObjectRegistry();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( !asserted );
+
+ END_TEST;
+}
+
+int UtcDaliStageOperatorAssign(void)
+{
+ TestApplication app;
+ Stage stage;
+ DALI_TEST_CHECK( !stage );
+
+ stage = Stage::GetCurrent();
+ DALI_TEST_CHECK( stage );
+
+ 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();
+