struct TouchedSignalData
{
TouchedSignalData()
- : functorCalled(false)
+ : functorCalled(false),
+ createNewScene(false),
+ newSceneCreated(false)
{}
void Reset()
{
functorCalled = false;
+ createNewScene = false;
+ newSceneCreated = false;
receivedTouchEvent.points.clear();
receivedTouchEvent.time = 0;
}
bool functorCalled;
+ bool createNewScene;
+ bool newSceneCreated;
TouchEvent receivedTouchEvent;
TouchData receivedTouchData;
};
{
signalData.functorCalled = true;
signalData.receivedTouchData = touch;
+
+ if ( signalData.createNewScene )
+ {
+ Dali::Integration::Scene scene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
+ DALI_TEST_CHECK( scene );
+
+ signalData.newSceneCreated = true;
+ }
}
void operator()()
END_TEST;
}
+int UtcDaliSceneCreateNewSceneDuringCoreEventProcessing(void)
+{
+ TestApplication application;
+
+ Dali::Integration::Scene scene = application.GetScene();
+
+ TouchedSignalData data;
+ data.createNewScene = true;
+ TouchFunctor functor( data );
+ scene.TouchSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( true, data.createNewScene, TEST_LOCATION );
+ DALI_TEST_EQUALS( true, data.newSceneCreated, TEST_LOCATION );
+ data.Reset();
+
+ END_TEST;
+}
+
int UtcDaliSceneEventProcessingFinishedP(void)
{
TestApplication application;
// Signal that any messages received will be flushed soon
mUpdateManager->EventProcessingStarted();
+ // Scene could be added or removed while processing the events
+ // Copy the Scene container locally to avoid possibly invalid iterator
+ SceneContainer scenes = mScenes;
+
// process events in all scenes
- for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ for( auto scene : scenes )
{
- (*iter)->ProcessEvents();
+ scene->ProcessEvents();
}
mNotificationManager->ProcessMessages();
// Emit signal here to inform listeners that event processing has finished.
- for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ for( auto scene : scenes )
{
- (*iter)->EmitEventProcessingFinishedSignal();
+ scene->EmitEventProcessingFinishedSignal();
}
// Run any registered processors
mRelayoutController->Relayout();
// Rebuild depth tree after event processing has finished
- for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ for( auto scene : scenes )
{
- (*iter)->RebuildDepthTree();
+ scene->RebuildDepthTree();
}
// Flush any queued messages for the update-thread
OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
- std::vector<ScenePtr> mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core
+ using SceneContainer = std::vector<ScenePtr>;
+ SceneContainer mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core
// The object registry
ObjectRegistryPtr mObjectRegistry;