Includes build fix for utc dynamics tests.
Includes moving Dynamics API from stage.h to dynamics-world.h in the form of static creator, destroyer and getter.
Change-Id: I5c44e47ff6572144067c960ee8c88896a7b3e193
*.creator
*.creator.user
/automated-tests/CMakeLists.txt
+/automated-tests/src/dali/CMakeLists.txt
/docs/generated/*
/build/tizen/doc
/build/tizen/.cov
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
DALI_TEST_CHECK( !config );
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testMass = 1.23f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testElasticity = 0.87f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testFriction= 0.87f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testDamping = 0.123f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testDamping = 0.123f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testSleepVelocity = 0.123f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testSleepVelocity = 0.123f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const short int testGroup = 0x1234;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const short int testMask = 0x7ffe;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
const float testHardness = 0.87f;
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
application.Render();
application.Render();
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( world )
{
using namespace Dali;
-int UtcDaliStageInitializeDynamics(void)
+// Note: dali-core needs to be configured and built with --enable-dynamics for these tests to run.
+
+int UtcDaliDynamicsWorldConstructor(void)
{
#if !defined(DYNAMICS_SUPPORT)
tet_infoline("No dynamics support compiled\n");
return 0;
#endif
+ tet_infoline("UtcDaliDynamicsWorldConstructor - DynamicsWorld::DynamicsWorld");
+
TestApplication application;
+ // start up
+ application.SendNotification();
+ application.Render();
+ application.Render();
+
+ // Default constructor - create an uninitialized handle
+ DynamicsWorld world;
+ DALI_TEST_CHECK( !world );
+
+ // initialize handle
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ world = DynamicsWorld::GetInstance( worldConfig );
+
+ DALI_TEST_CHECK( world );
+ END_TEST;
+}
+
+int UtcDaliDynamicsWorldGetInstanceP(void)
+{
+#if !defined(DYNAMICS_SUPPORT)
+ tet_infoline( "No dynamics support compiled\n" );
+ return 0;
+#endif
+ TestApplication app;
Stage stage = Stage::GetCurrent();
- TraceCallStack& trace = application.GetPlatform().GetTrace();
+ TraceCallStack& trace = app.GetPlatform().GetTrace();
trace.Enable(true);
- DALI_TEST_CHECK( stage.InitializeDynamics( DynamicsWorldConfig::New() ) );
+
+ DynamicsWorldConfig config = DynamicsWorldConfig::New();
+
+ bool asserted = false;
+ try
+ {
+ DALI_TEST_CHECK( DynamicsWorld::GetInstance( config ) );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( !asserted );
+
DALI_TEST_CHECK( trace.FindMethod( "GetDynamicsFactory" ) );
DALI_TEST_CHECK( trace.FindMethod( "DynamicsFactory::InitializeDynamics" ) );
+
END_TEST;
}
-int UtcDaliStageGetDynamicsWorld(void)
+int UtcDaliDynamicsWorldGetInstanceN(void)
{
- TestApplication application;
+#if !defined(DYNAMICS_SUPPORT)
+ tet_infoline( "No dynamics support compiled\n" );
+ return 0;
+#endif
+ TestApplication app;
- Stage stage = Stage::GetCurrent();
+ DynamicsWorldConfig config;
+
+ // Check that creating a DynamicsWorld instance without a valid config causes an assert.
+ bool asserted = false;
+ try
+ {
+ DynamicsWorld::GetInstance( config );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "object && \"DynamicsWorldConfig object is uninitialized!\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
- DALI_TEST_CHECK( !stage.GetDynamicsWorld() );
END_TEST;
}
-int UtcDaliStageTerminateDynamics(void)
+int UtcDaliDynamicsWorldGetP(void)
{
- TestApplication application;
+#if !defined(DYNAMICS_SUPPORT)
+ tet_infoline( "No dynamics support compiled\n" );
+ return 0;
+#endif
+ TestApplication app;
- Stage stage = Stage::GetCurrent();
+ DynamicsWorldConfig config = DynamicsWorldConfig::New();
- stage.TerminateDynamics();
+ bool asserted = false;
+ try
+ {
+ DynamicsWorld::GetInstance( config );
+ DynamicsWorld world = DynamicsWorld::Get();
+ DALI_TEST_CHECK( world );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( !asserted );
- DALI_TEST_CHECK( !stage.GetDynamicsWorld() );
END_TEST;
}
-int UtcDaliDynamicsWorldConstructor(void)
+int UtcDaliDynamicsWorldGetN(void)
{
#if !defined(DYNAMICS_SUPPORT)
- tet_infoline("No dynamics support compiled\n");
+ tet_infoline( "No dynamics support compiled\n" );
return 0;
#endif
- tet_infoline("UtcDaliDynamicsWorldConstructor - DynamicsWorld::DynamicsWorld");
+ TestApplication app;
- TestApplication application;
-
- // start up
- application.SendNotification();
- application.Render();
- application.Render();
+ bool asserted = false;
+ try
+ {
+ DynamicsWorld::Get();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "dynamicsWorld && \"DynamicsWorld doesn't exist\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
- // Default constructor - create an uninitialized handle
- DynamicsWorld world;
- DALI_TEST_CHECK( !world );
+ END_TEST;
+}
- // initialize handle
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- world = Stage::GetCurrent().InitializeDynamics(worldConfig);
+int UtcDaliDynamicsWorldDestroyInstanceP(void)
+{
+#if !defined(DYNAMICS_SUPPORT)
+ tet_infoline( "No dynamics support compiled\n" );
+ return 0;
+#endif
+ TestApplication app;
+ DynamicsWorldConfig config = DynamicsWorldConfig::New();
+ DynamicsWorld world = DynamicsWorld::GetInstance( config );
DALI_TEST_CHECK( world );
+ DynamicsWorld::DestroyInstance();
+
+ // After destroying the instance, check we assert when trying to get the instance,
+ // to prove that it's been removed correctly.
+ bool asserted = false;
+ try
+ {
+ DynamicsWorld::Get();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "dynamicsWorld && \"DynamicsWorld doesn't exist\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
+ END_TEST;
+}
+
+int UtcDaliDynamicsWorldDestroyInstanceN(void)
+{
+#if !defined(DYNAMICS_SUPPORT)
+ tet_infoline( "No dynamics support compiled\n" );
+ return 0;
+#endif
+ TestApplication app;
+
+ // Check that calling DestroyInstance() when there is no instance is safe.
+ bool asserted = false;
+ try
+ {
+ DynamicsWorld::DestroyInstance();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( !asserted );
+
END_TEST;
}
const Vector3 gravity(1.0f, 2.0f, 3.0f);
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
const Vector3 gravity(1.0f, 2.0f, 3.0f);
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
application.Render();
DALI_TEST_CHECK( trace.FindMethod( "DynamicsWorld::SetDebugDrawMode" ) );
+ DALI_TEST_CHECK( trace.FindMethod( "DynamicsWorld::SetGravity" ) );
tet_infoline("UtcDaliDynamicsWorldDebugDrawMode - DynamicsWorld::GetDebugDrawMode");
DALI_TEST_CHECK(mode == world.GetDebugDrawMode());
application.Render();
const Vector3 gravity(1.0f, 2.0f, 3.0f);
- DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New());
- DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) );
+ DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() );
+ DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) );
if( !world )
{
+++ /dev/null
-SET(PKG_NAME "dali")
-
-SET(EXEC_NAME "tct-${PKG_NAME}-core")
-SET(RPM_NAME "core-${PKG_NAME}-tests")
-
-SET(CAPI_LIB "dali")
-
-SET(TC_SOURCES
- utc-Dali-Actor.cpp
- utc-Dali-AlphaFunction.cpp
- utc-Dali-AngleAxis.cpp
- utc-Dali-Animation.cpp
- utc-Dali-Any.cpp
- utc-Dali-BaseHandle.cpp
- utc-Dali-BufferImage.cpp
- utc-Dali-CameraActor.cpp
- utc-Dali-Constraint.cpp
- utc-Dali-ConstraintFunction.cpp
- utc-Dali-Constraints.cpp
- utc-Dali-ConstraintSource.cpp
- utc-Dali-ConnectionTracker.cpp
- utc-Dali-CustomActor.cpp
- utc-Dali-Degree.cpp
- utc-Dali-EncodedBufferImage.cpp
- utc-Dali-FrameBufferImage.cpp
- utc-Dali-Gesture.cpp
- utc-Dali-GestureDetector.cpp
- utc-Dali-Handle.cpp
- utc-Dali-HoverProcessing.cpp
- utc-Dali-Image.cpp
- utc-Dali-ImageActor.cpp
- utc-Dali-IntrusivePtr.cpp
- utc-Dali-KeyEvent.cpp
- utc-Dali-Layer.cpp
- utc-Dali-LocklessBuffer.cpp
- utc-Dali-LongPressGesture.cpp
- utc-Dali-LongPressGestureDetector.cpp
- utc-Dali-MathUtils.cpp
- utc-Dali-Matrix.cpp
- utc-Dali-Matrix3.cpp
- utc-Dali-NativeImage.cpp
- utc-Dali-NinePatchImages.cpp
- utc-Dali-ObjectRegistry.cpp
- utc-Dali-PanGesture.cpp
- utc-Dali-PanGestureDetector.cpp
- utc-Dali-Path.cpp
- utc-Dali-PinchGesture.cpp
- utc-Dali-PinchGestureDetector.cpp
- utc-Dali-Pixel.cpp
- utc-Dali-PropertyMap.cpp
- utc-Dali-PropertyArray.cpp
- utc-Dali-PropertyNotification.cpp
- utc-Dali-PropertyTypes.cpp
- utc-Dali-PropertyValue.cpp
- utc-Dali-Quaternion.cpp
- utc-Dali-Radian.cpp
- utc-Dali-Random.cpp
- utc-Dali-Rect.cpp
- utc-Dali-RenderTask.cpp
- utc-Dali-RenderTaskList.cpp
- utc-Dali-RenderableActor.cpp
- utc-Dali-ResourceImage.cpp
- utc-Dali-ShaderEffect.cpp
- utc-Dali-SignalTemplatesFunctors.cpp
- utc-Dali-SignalTemplates.cpp
- utc-Dali-Stage.cpp
- utc-Dali-TapGesture.cpp
- utc-Dali-TapGestureDetector.cpp
- utc-Dali-TouchEventCombiner.cpp
- utc-Dali-TouchProcessing.cpp
- utc-Dali-TypeRegistry.cpp
- utc-Dali-Uint16Pair.cpp
- utc-Dali-Vector.cpp
- utc-Dali-Vector2.cpp
- utc-Dali-Vector3.cpp
- utc-Dali-Vector4.cpp
- utc-Dali-WheelEvent.cpp
-)
-
-LIST(APPEND TC_SOURCES
- dali-test-suite-utils/test-harness.cpp
- dali-test-suite-utils/dali-test-suite-utils.cpp
- dali-test-suite-utils/test-application.cpp
- dali-test-suite-utils/test-dynamics.cpp
- dali-test-suite-utils/test-gesture-manager.cpp
- dali-test-suite-utils/test-gl-abstraction.cpp
- dali-test-suite-utils/test-gl-sync-abstraction.cpp
- dali-test-suite-utils/test-native-image.cpp
- dali-test-suite-utils/test-platform-abstraction.cpp
- dali-test-suite-utils/test-render-controller.cpp
- dali-test-suite-utils/test-trace-call-stack.cpp
-)
-
-PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
- dali-core
-)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror=return-type")
-
-FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
- SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
-ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
-
-INCLUDE_DIRECTORIES(
- ../../../
- ${${CAPI_LIB}_INCLUDE_DIRS}
- dali-test-suite-utils
-)
-
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
-TARGET_LINK_LIBRARIES(${EXEC_NAME}
- ${${CAPI_LIB}_LIBRARIES}
-)
-
-INSTALL(PROGRAMS ${EXEC_NAME}
- DESTINATION ${BIN_DIR}/${EXEC_NAME}
-)
--- /dev/null
+SET(PKG_NAME "dali")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "dali")
+
+SET(TC_SOURCES
+ utc-Dali-Actor.cpp
+ utc-Dali-AlphaFunction.cpp
+ utc-Dali-AngleAxis.cpp
+ utc-Dali-Animation.cpp
+ utc-Dali-Any.cpp
+ utc-Dali-BaseHandle.cpp
+ utc-Dali-BufferImage.cpp
+ utc-Dali-CameraActor.cpp
+ utc-Dali-Constraint.cpp
+ utc-Dali-ConstraintFunction.cpp
+ utc-Dali-Constraints.cpp
+ utc-Dali-ConstraintSource.cpp
+ utc-Dali-ConnectionTracker.cpp
+ utc-Dali-CustomActor.cpp
+ utc-Dali-Degree.cpp
+ utc-Dali-EncodedBufferImage.cpp
+ utc-Dali-FrameBufferImage.cpp
+ utc-Dali-Gesture.cpp
+ utc-Dali-GestureDetector.cpp
+ utc-Dali-Handle.cpp
+ utc-Dali-HoverProcessing.cpp
+ utc-Dali-Image.cpp
+ utc-Dali-ImageActor.cpp
+ utc-Dali-IntrusivePtr.cpp
+ utc-Dali-KeyEvent.cpp
+ utc-Dali-Layer.cpp
+ utc-Dali-LocklessBuffer.cpp
+ utc-Dali-LongPressGesture.cpp
+ utc-Dali-LongPressGestureDetector.cpp
+ utc-Dali-MathUtils.cpp
+ utc-Dali-Matrix.cpp
+ utc-Dali-Matrix3.cpp
+ utc-Dali-NativeImage.cpp
+ utc-Dali-NinePatchImages.cpp
+ utc-Dali-ObjectRegistry.cpp
+ utc-Dali-PanGesture.cpp
+ utc-Dali-PanGestureDetector.cpp
+ utc-Dali-Path.cpp
+ utc-Dali-PinchGesture.cpp
+ utc-Dali-PinchGestureDetector.cpp
+ utc-Dali-Pixel.cpp
+ utc-Dali-PropertyMap.cpp
+ utc-Dali-PropertyArray.cpp
+ utc-Dali-PropertyNotification.cpp
+ utc-Dali-PropertyTypes.cpp
+ utc-Dali-PropertyValue.cpp
+ utc-Dali-Quaternion.cpp
+ utc-Dali-Radian.cpp
+ utc-Dali-Random.cpp
+ utc-Dali-Rect.cpp
+ utc-Dali-RenderTask.cpp
+ utc-Dali-RenderTaskList.cpp
+ utc-Dali-RenderableActor.cpp
+ utc-Dali-ResourceImage.cpp
+ utc-Dali-ShaderEffect.cpp
+ utc-Dali-SignalTemplatesFunctors.cpp
+ utc-Dali-SignalTemplates.cpp
+ utc-Dali-Stage.cpp
+ utc-Dali-TapGesture.cpp
+ utc-Dali-TapGestureDetector.cpp
+ utc-Dali-TouchEventCombiner.cpp
+ utc-Dali-TouchProcessing.cpp
+ utc-Dali-TypeRegistry.cpp
+ utc-Dali-Uint16Pair.cpp
+ utc-Dali-Vector.cpp
+ utc-Dali-Vector2.cpp
+ utc-Dali-Vector3.cpp
+ utc-Dali-Vector4.cpp
+ utc-Dali-WheelEvent.cpp
+)
+
+LIST(APPEND TC_SOURCES
+ dali-test-suite-utils/test-harness.cpp
+ dali-test-suite-utils/dali-test-suite-utils.cpp
+ dali-test-suite-utils/test-application.cpp
+ dali-test-suite-utils/test-dynamics.cpp
+ dali-test-suite-utils/test-gesture-manager.cpp
+ dali-test-suite-utils/test-gl-abstraction.cpp
+ dali-test-suite-utils/test-gl-sync-abstraction.cpp
+ dali-test-suite-utils/test-native-image.cpp
+ dali-test-suite-utils/test-platform-abstraction.cpp
+ dali-test-suite-utils/test-render-controller.cpp
+ dali-test-suite-utils/test-trace-call-stack.cpp
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ dali-core
+)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} @DYNAMICS_SUPPORT@ -O0 -ggdb --coverage -Wall -Werror=return-type")
+
+FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
+ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(
+ ../../../
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+ dali-test-suite-utils
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${EXEC_NAME}
+)
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
-#include <dali/devel-api/dynamics/dynamics.h>
#include <dali-test-suite-utils.h>
namespace
{
-/**
- * Functor for EventProcessingFinished signal
- */
+// Functor for EventProcessingFinished signal
struct EventProcessingFinishedFunctor
{
/**
return true;
}
-
struct ContextStatusFunctor
{
ContextStatusFunctor(bool& calledFlag) : mCalledFlag( calledFlag )
bool& mCalledFlag;
};
+struct ActorCreatedFunctor
+{
+ ActorCreatedFunctor( bool& signalReceived )
+ : mSignalVerified( signalReceived )
+ {
+ }
+
+ void operator()( BaseHandle object )
+ {
+ tet_infoline( "Verifying TestActorCallback()" );
+ Actor actor = Actor::DownCast( object );
+ if( actor )
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ bool& mSignalVerified;
+};
+
} // unnamed namespace
-int UtcDaliStageDefaultConstructor(void)
+int UtcDaliStageDefaultConstructorP(void)
{
TestApplication application;
Stage stage;
- DALI_TEST_CHECK(!stage);
+ DALI_TEST_CHECK( !stage );
END_TEST;
}
-int UtcDaliStageDestructor(void)
+// Note: No negative test for default constructor.
+
+int UtcDaliStageDestructorP(void)
{
TestApplication application;
Stage* stage = new Stage();
END_TEST;
}
-int UtcDaliStageGetCurrent(void)
+// Note: No negative test for default destructor.
+
+int UtcDaliStageGetCurrentP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
- DALI_TEST_CHECK(stage);
+ DALI_TEST_CHECK( stage );
END_TEST;
}
-int UtcDaliStageAssign(void)
+int UtcDaliStageGetCurrentN(void)
+{
+ bool asserted = false;
+ try
+ {
+ Stage stage = Stage::GetCurrent();
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "stage && \"Stage doesn't exist\"", TEST_LOCATION );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( asserted );
+ END_TEST;
+}
+
+int UtcDaliStageIsInstalledP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
- Stage stage2;
- stage2 = stage;
- DALI_TEST_CHECK(stage2);
+ Stage::GetCurrent();
+
+ DALI_TEST_CHECK( Stage::IsInstalled() );
+ END_TEST;
+}
+
+int UtcDaliStageIsInstalledN(void)
+{
+ DALI_TEST_CHECK( !Stage::IsInstalled() );
+
END_TEST;
}
-int UtcDaliStageIsInstalled(void)
+int UtcDaliStageCopyConstructorP(void)
{
- DALI_TEST_CHECK(!Stage::IsInstalled());
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ Stage copyStage( stage );
+
+ DALI_TEST_CHECK( copyStage );
+ DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() );
+ END_TEST;
+}
+
+// Note: no negative test for UtcDaliStageCopyConstructor.
+
+int UtcDaliStageAssignmentOperatorP(void)
+{
TestApplication application;
+ const Stage stage = Stage::GetCurrent();
- Stage::GetCurrent();
+ Stage copyStage = stage;
+
+ DALI_TEST_CHECK( copyStage );
+ DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() );
- DALI_TEST_CHECK(Stage::IsInstalled());
END_TEST;
}
-int UtcDaliStageAdd(void)
+// Note: No negative test for UtcDaliStageAssignmentOperator.
+
+int UtcDaliStageAddP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- DALI_TEST_CHECK(!actor.OnStage());
+ DALI_TEST_CHECK( !actor.OnStage() );
+
+ stage.Add( actor );
+ DALI_TEST_CHECK( actor.OnStage() );
+ END_TEST;
+}
+
+int UtcDaliStageAddN(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+ Actor actor;
+
+ bool asserted = false;
+ try
+ {
+ stage.Add( actor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( asserted );
- stage.Add(actor);
- DALI_TEST_CHECK(actor.OnStage());
END_TEST;
}
-int UtcDaliStageRemove(void)
+int UtcDaliStageRemoveP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- DALI_TEST_CHECK(!actor.OnStage());
+ DALI_TEST_CHECK( !actor.OnStage() );
- stage.Add(actor);
- DALI_TEST_CHECK(actor.OnStage());
+ stage.Add( actor );
+ DALI_TEST_CHECK( actor.OnStage() );
stage.Remove(actor);
- DALI_TEST_CHECK(!actor.OnStage());
+ DALI_TEST_CHECK( !actor.OnStage() );
+ END_TEST;
+}
+
+int UtcDaliStageRemoveN1(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+ Actor actor;
+
+ bool asserted = false;
+ try
+ {
+ // Actor is not valid, confirm a removal attempt does assert.
+ stage.Remove( actor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( asserted );
+ END_TEST;
+}
+
+int UtcDaliStageRemoveN2(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK( !actor.OnStage() );
+
+ bool asserted = false;
+ try
+ {
+ // Actor is not on stage, confirm a removal attempt does not assert / segfault.
+ stage.Remove( actor );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( !asserted );
END_TEST;
}
-int UtcDaliStageGetSize(void)
+int UtcDaliStageRemoveN3(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+
+ // Initially we have a default layer
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+
+ // Check we cannot remove the root layer from the stage.
+ Layer layer = stage.GetRootLayer();
+ bool asserted = true;
+ try
+ {
+ stage.Remove( layer );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( asserted );
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliStageGetSizeP(void)
{
TestApplication application;
Vector2 size = stage.GetSize();
- DALI_TEST_EQUALS(size.width, static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH), TEST_LOCATION);
- DALI_TEST_EQUALS(size.height, static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS( size.width, static_cast<float>( TestApplication::DEFAULT_SURFACE_WIDTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, static_cast<float>( TestApplication::DEFAULT_SURFACE_HEIGHT ), TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageGetDpi01(void)
+int UtcDaliStageGetSizeN(void)
+{
+ TestApplication application;
+
+ Stage stage;
+
+ bool asserted = false;
+ Vector2 size;
+ try
+ {
+ size = stage.GetSize();
+ }
+ 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 UtcDaliStageGetDpiP1(void)
{
TestApplication application; // Initializes core DPI to default values
// Test the default DPI.
Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS(dpi.x, static_cast<float>(TestApplication::DEFAULT_HORIZONTAL_DPI), TEST_LOCATION);
- DALI_TEST_EQUALS(dpi.y, static_cast<float>(TestApplication::DEFAULT_VERTICAL_DPI), TEST_LOCATION);
+ DALI_TEST_EQUALS( dpi.x, static_cast<float>( TestApplication::DEFAULT_HORIZONTAL_DPI ), TEST_LOCATION );
+ DALI_TEST_EQUALS( dpi.y, static_cast<float>( TestApplication::DEFAULT_VERTICAL_DPI ), TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageGetDpi02(void)
+int UtcDaliStageGetDpiP2(void)
{
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);
+ application.GetCore().SetDpi( 200, 180 );
Stage stage = Stage::GetCurrent();
Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION );
END_TEST;
}
-
-int UtcDaliStageGetDpi03(void)
+int UtcDaliStageGetDpiP3(void)
{
- TestApplication application(480, 800, 72.0f, 120.0f); // Initializes core DPI with specific values
+ TestApplication application( 480, 800, 72.0f, 120.0f ); // Initializes core DPI with specific values
Stage stage = Stage::GetCurrent();
// Test that setting core DPI explicitly also sets up the Stage's DPI.
Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS(dpi.x, 72.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(dpi.y, 120.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS( dpi.x, 72.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( dpi.y, 120.0f, TEST_LOCATION) ;
END_TEST;
}
-int UtcDaliStageInitializeDynamicsP(void)
+/*
+ * This is not a true negative test, we are checking the DPI if it has not been set.
+ * A test for setting negative DPI values would be part of the application core utc tests.
+ */
+int UtcDaliStageGetDpiN(void)
+{
+ TestApplication application; // Initializes core DPI to default values
+
+ Stage stage = Stage::GetCurrent();
+ Vector2 dpi = stage.GetDpi();
+
+ DALI_TEST_EQUALS( dpi.x, 220.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( dpi.y, 217.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliStageGetLayerCountP(void)
{
TestApplication application;
+
Stage stage = Stage::GetCurrent();
- DynamicsWorld world = stage.InitializeDynamics( DynamicsWorldConfig::New() );
-#if !defined(DYNAMICS_SUPPORT)
- DALI_TEST_CHECK(true);
-#else
- DALI_TEST_CHECK( world );
-#endif
+ // Initially we have a default layer
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ Layer layer = Layer::New();
+ stage.Add( layer );
+
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 2u, TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageGetLayerCount(void)
+/*
+ * Not a true negative test, but confirms layer count is not affected by an invalid removal.
+ */
+int UtcDaliStageGetLayerCountN(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
// Initially we have a default layer
- DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
Layer layer = Layer::New();
- stage.Add(layer);
+ stage.Remove( layer );
- DALI_TEST_EQUALS(stage.GetLayerCount(), 2u, TEST_LOCATION);
+ // Still have 1 layer.
+ DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageGetLayer(void)
+int UtcDaliStageGetLayerP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
- Layer rootLayer = stage.GetLayer(0);
- DALI_TEST_CHECK(rootLayer);
+ Layer rootLayer = stage.GetLayer( 0 );
+ DALI_TEST_CHECK( rootLayer );
Layer layer = Layer::New();
- stage.Add(layer);
+ stage.Add( layer );
+
+ Layer sameLayer = stage.GetLayer( 1 );
+ DALI_TEST_CHECK( layer == sameLayer );
+ END_TEST;
+}
+
+int UtcDaliStageGetLayerN(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
- Layer sameLayer = stage.GetLayer(1);
- DALI_TEST_CHECK(layer == sameLayer);
+ bool asserted = false;
+ try
+ {
+ // Try to get a layer that doesn't exist (note: 0 is the root layer).
+ Layer layer = stage.GetLayer( 1 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "depth < mLayers.size()", TEST_LOCATION );
+ asserted = true;
+ }
+
+ DALI_TEST_CHECK( asserted );
END_TEST;
}
+int UtcDaliStageGetRootLayerP(void)
+{
+ TestApplication application;
-int UtcDaliStageGetRootLayer(void)
+ Stage stage = Stage::GetCurrent();
+
+ Layer layer = stage.GetLayer( 0 );
+ DALI_TEST_CHECK( layer );
+
+ // Check that GetRootLayer() correctly retreived layer 0.
+ DALI_TEST_CHECK( stage.GetRootLayer() == layer );
+
+ END_TEST;
+}
+
+int UtcDaliStageGetRootLayerN(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
- Layer rootLayer = stage.GetLayer(0);
+ Layer rootLayer = stage.GetLayer( 0 );
DALI_TEST_CHECK( rootLayer );
+ DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+ // Create a new layer and attempt to lower it below the root layer.
Layer layer = Layer::New();
stage.Add( layer );
layer.LowerToBottom();
+ // Check that GetRootLayer still retrieves the same original layer.
+ DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+
+ // Check modifying the root layer is also blocked.
+ rootLayer.RaiseToTop();
DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+
END_TEST;
}
-int UtcDaliStageSetBackgroundColor(void)
+int UtcDaliStageSetBackgroundColorP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
- Vector4 testColor(0.1f, 0.2f, 0.3f, 1.0f);
- stage.SetBackgroundColor(testColor);
+ Vector4 testColor( 0.1f, 0.2f, 0.3f, 1.0f );
+ stage.SetBackgroundColor( testColor );
- DALI_TEST_EQUALS(testColor, stage.GetBackgroundColor(), TEST_LOCATION);
+ DALI_TEST_EQUALS( testColor, stage.GetBackgroundColor(), TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageGetBackgroundColor(void)
+// Note: No negative test for UtcDaliStageSetBackgroundColor as we do not wish to implement
+// range checking for colors due to speed. Colors are clamped with glclampf within GL anyway.
+
+int UtcDaliStageGetBackgroundColorP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
- DALI_TEST_EQUALS(Stage::DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Stage::DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION );
END_TEST;
}
-int UtcDaliStageKeepRendering(void)
+// Note: No negative test for UtcDaliStageGetBackgroundColor as this is covered by UtcDaliStageSetBackgroundColorN.
+
+int UtcDaliStageKeepRenderingP(void)
{
TestApplication application;
while ( keepUpdating )
{
application.SendNotification();
- keepUpdating = application.Render(1000.0f /*1 second*/);
+ keepUpdating = application.Render( 1000.0f /*1 second*/ );
}
// Force rendering for the next 5 seconds
application.SendNotification();
// Test that core wants to sleep after 10 seconds
- keepUpdating = application.Render(1000.0f /*1 second*/);
+ keepUpdating = application.Render( 1000.0f /*1 second*/ );
DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render(1000.0f /*2 seconds*/);
+ keepUpdating = application.Render( 1000.0f /*2 seconds*/ );
DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render(1000.0f /*3 seconds*/);
+ keepUpdating = application.Render( 1000.0f /*3 seconds*/ );
DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render(1000.0f /*4 seconds*/);
+ keepUpdating = application.Render( 1000.0f /*4 seconds*/ );
DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render(1000.0f /*5 seconds*/);
+ keepUpdating = application.Render( 1000.0f /*5 seconds*/ );
DALI_TEST_CHECK( !keepUpdating );
END_TEST;
}
-int UtcDaliStageEventProcessingFinished(void)
+int UtcDaliStageKeepRenderingN(void)
+{
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+
+ // Run core until it wants to sleep
+ bool keepUpdating( true );
+ while ( keepUpdating )
+ {
+ application.SendNotification();
+ keepUpdating = application.Render( 1000.0f /*1 second*/ );
+ }
+
+ // Force rendering for the next 5 seconds
+ stage.KeepRendering( -1.0f );
+
+ application.SendNotification();
+
+ // Test that core wants to sleep after 10 seconds
+ keepUpdating = application.Render( 1000.0f /*1 second*/ );
+ DALI_TEST_CHECK( !keepUpdating );
+
+ END_TEST;
+}
+
+int UtcDaliStageEventProcessingFinishedP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
END_TEST;
}
-int UtcDaliStageSignalKeyEvent(void)
+int UtcDaliStageEventProcessingFinishedN(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor( eventProcessingFinished );
+ stage.EventProcessingFinishedSignal().Connect( &application, functor );
+
+ Actor actor( Actor::New() );
+ stage.Add( actor );
+
+ // Do not complete event processing and confirm the signal has not been emitted.
+ DALI_TEST_CHECK( !eventProcessingFinished );
+
+ END_TEST;
+}
+
+int UtcDaliStageSignalKeyEventP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
KeyEventReceivedFunctor functor( data );
stage.KeyEventSignal().Connect( &application, functor );
- Integration::KeyEvent event( "i","i", 0, 0, 0, Integration::KeyEvent::Down );
+ Integration::KeyEvent event( "i", "i", 0, 0, 0, Integration::KeyEvent::Down );
application.ProcessEvent( event );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.keyModifier );
DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.keyPressed );
- DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.state) );
+ DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
data.Reset();
- Integration::KeyEvent event2( "i","i", 0, 0, 0, Integration::KeyEvent::Up );
+ Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up );
application.ProcessEvent( event2 );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.keyModifier );
DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.keyPressed );
- DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.state) );
+ DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
data.Reset();
- Integration::KeyEvent event3( "a","a", 0, 0, 0, Integration::KeyEvent::Down );
+ Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down );
application.ProcessEvent( event3 );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.keyModifier );
DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.keyPressed );
- DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.state) );
+ DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
data.Reset();
- Integration::KeyEvent event4( "a","a", 0, 0, 0, Integration::KeyEvent::Up );
+ Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up );
application.ProcessEvent( event4 );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.keyModifier );
DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.keyPressedName );
DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.keyPressed );
- DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.state) );
+ DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
+ END_TEST;
+}
+
+int UtcDaliStageSignalKeyEventN(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor( data );
+ stage.KeyEventSignal().Connect( &application, functor );
+
+ // Check that a non-pressed key events data is not modified.
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
END_TEST;
}
-int UtcDaliStageTouchedSignal(void)
+int UtcDaliStageTouchedSignalP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
TouchedFunctor functor( data );
stage.TouchedSignal().Connect( &application, functor );
- // Render and notify
+ // Render and notify.
application.SendNotification();
application.Render();
- // NO ACTORS, SINGLE TOUCH, DOWN, MOTION THEN UP
+ // Basic test: No actors, single touch (down then up).
{
Integration::TouchEvent touchEvent;
touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Motion;
- touchEvent.points[0].screen.x = 12.0f; // Some motion
- application.ProcessEvent( touchEvent );
-
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
touchEvent.points[0].state = TouchPoint::Up;
application.ProcessEvent( touchEvent );
data.Reset();
}
- // Add an actor to the scene
-
+ // Add an actor to the scene.
Actor actor = Actor::New();
actor.SetSize( 100.0f, 100.0f );
actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
actor.TouchedSignal().Connect( &DummyTouchCallback );
stage.Add( actor );
- // Render and notify
+ // Render and notify.
application.SendNotification();
application.Render();
- // ACTOR ON SCENE, SINGLE TOUCH, DOWN IN ACTOR, MOTION THEN UP OUTSIDE ACTOR
+ // Actor on scene, single touch, down in actor, motion, then up outside actor.
{
Integration::TouchEvent touchEvent;
touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
data.Reset();
}
- // INTERRUPTED BEFORE DOWN AND INTERRUPTED AFTER DOWN
+ // Multiple touch. Should only receive a touch on first down and last up.
{
Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Interrupted, 10.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
+ // 1st point
+ touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+ application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
- DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
- DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Interrupted );
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1, TEST_LOCATION );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Down;
+ // 2nd point
+ touchEvent.points[0].state = TouchPoint::Stationary;
+ touchEvent.points.push_back( TouchPoint( 1, TouchPoint::Down, 50.0f, 50.0f ) );
application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0, TEST_LOCATION );
+ data.Reset();
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
- DALI_TEST_CHECK( data.receivedTouchEvent.points[0].hitActor == actor );
- DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Down );
+ // Primary point is up
+ touchEvent.points[0].state = TouchPoint::Up;
+ touchEvent.points[1].state = TouchPoint::Stationary;
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0, TEST_LOCATION );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Interrupted;
+ // Remove 1st point now, 2nd point is now in motion
+ touchEvent.points.erase( touchEvent.points.begin() );
+ touchEvent.points[0].state = TouchPoint::Motion;
+ touchEvent.points[0].screen.x = 150.0f;
application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0, TEST_LOCATION );
+ data.Reset();
+ // Final point Up
+ touchEvent.points[0].state = TouchPoint::Up;
+ application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
- DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
- DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Interrupted );
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1, TEST_LOCATION );
data.Reset();
}
+ END_TEST;
+}
- // MULTIPLE TOUCH, SHOULD ONLY RECEIVE TOUCH ON FIRST DOWN AND LAST UP
+int UtcDaliStageTouchedSignalN(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ TouchedSignalData data;
+ TouchedFunctor functor( data );
+ stage.TouchedSignal().Connect( &application, functor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Confirm functor not called before there has been any touch event.
+ DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ // No actors, single touch, down, motion then up.
{
Integration::TouchEvent touchEvent;
-
- // 1st point
touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
application.ProcessEvent( touchEvent );
+
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
+ DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
data.Reset();
- // 2nd point
- touchEvent.points[0].state = TouchPoint::Stationary;
- touchEvent.points.push_back( TouchPoint( 1, TouchPoint::Down, 50.0f, 50.0f ) );
+ // Confirm there is no signal when the touchpoint is only moved.
+ touchEvent.points[0].state = TouchPoint::Motion;
+ touchEvent.points[0].screen.x = 1200.0f; // Some motion
application.ProcessEvent( touchEvent );
+
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
- // Primary point is up
+ // Confirm a following up event generates a signal.
touchEvent.points[0].state = TouchPoint::Up;
- touchEvent.points[1].state = TouchPoint::Stationary;
application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
+ DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
data.Reset();
+ }
- // Remove 1st point now, 2nd point is now in motion
- touchEvent.points.erase( touchEvent.points.begin() );
- touchEvent.points[0].state = TouchPoint::Motion;
- touchEvent.points[0].screen.x = 150.0f;
+ // Add an actor to the scene.
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
+ stage.Add( actor );
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Actor on scene. Interrupted before down and interrupted after down.
+ {
+ Integration::TouchEvent touchEvent;
+ touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Interrupted, 10.0f, 10.0f ) );
application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
+ DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
+ DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Interrupted );
data.Reset();
- // Final point Up
- touchEvent.points[0].state = TouchPoint::Up;
+ touchEvent.points[0].state = TouchPoint::Down;
application.ProcessEvent( touchEvent );
+
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
+ DALI_TEST_CHECK( data.receivedTouchEvent.points[0].hitActor == actor );
+ DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Down );
+ data.Reset();
+
+ touchEvent.points[0].state = TouchPoint::Interrupted;
+ application.ProcessEvent( touchEvent );
+
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0 );
+ DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
+ DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Interrupted );
+
+ DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1, TEST_LOCATION );
+
+ // Check that getting info about a non-existent point causes an assert.
+ bool asserted = false;
+ try
+ {
+ data.receivedTouchEvent.GetPoint( 1 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "point < points.size() && \"No point at index\"", TEST_LOCATION );
+ asserted = true;
+ }
+ DALI_TEST_CHECK( asserted );
+
data.Reset();
}
+
END_TEST;
}
-int UtcDaliStageSignalWheelEvent(void)
+int UtcDaliStageSignalWheelEventP(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
END_TEST;
}
-int UtcDaliStageContextLostRegainedSignals(void)
+int UtcDaliStageContextLostSignalP(void)
{
TestApplication app;
Stage stage = Stage::GetCurrent();
bool contextLost = false;
- bool contextRegained = false;
ContextStatusFunctor contextLostFunctor( contextLost );
- ContextStatusFunctor contextRegainedFunctor( contextRegained );
- stage.ContextLostSignal().Connect(&app, contextLostFunctor );
- stage.ContextRegainedSignal().Connect(&app, contextRegainedFunctor );
+ stage.ContextLostSignal().Connect( &app, contextLostFunctor );
- Integration::Core& core = app.GetCore();
- Integration::ContextNotifierInterface* notifier = core.GetContextNotifier();
+ 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 UtcDaliStageSceneCreatedSignal(void)
+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 );
+ stage.SceneCreatedSignal().Connect( &app, sceneCreatedFunctor );
Integration::Core& core = app.GetCore();
core.SceneCreated();
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(), 1, 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;
+}
dali-core/Makefile
dali-core.pc
../../automated-tests/CMakeLists.txt
+ ../../automated-tests/src/dali/CMakeLists.txt
])
AC_OUTPUT
#include <dali/internal/event/dynamics/dynamics-body-impl.h>
#include <dali/internal/event/dynamics/dynamics-joint-impl.h>
#include <dali/internal/event/dynamics/dynamics-world-impl.h>
+#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
#endif
namespace Dali
return *this;
}
+DynamicsWorld DynamicsWorld::GetInstance( DynamicsWorldConfig configuration )
+{
+#ifdef DYNAMICS_SUPPORT
+ Internal::DynamicsWorldConfigPtr configImpl( &( GetImplementation( configuration ) ) );
+
+ return DynamicsWorld( Internal::DynamicsWorld::GetInstance( configImpl ).Get() );
+#else
+ return DynamicsWorld();
+#endif
+}
+
+DynamicsWorld DynamicsWorld::Get()
+{
+#ifdef DYNAMICS_SUPPORT
+ Internal::DynamicsWorld* dynamicsWorld = Internal::DynamicsWorld::Get().Get();
+ DALI_ASSERT_ALWAYS( dynamicsWorld && "DynamicsWorld doesn't exist" );
+ return DynamicsWorld( dynamicsWorld );
+#else
+ return DynamicsWorld();
+#endif
+}
+
+void DynamicsWorld::DestroyInstance()
+{
+#ifdef DYNAMICS_SUPPORT
+ Internal::DynamicsWorld::DestroyInstance();
+#endif
+}
+
void DynamicsWorld::SetGravity(const Vector3& gravity )
{
#ifdef DYNAMICS_SUPPORT
#include <dali/public-api/object/base-handle.h>
// INTERNAL INCLUDES
+#include <dali/devel-api/dynamics/dynamics-world-config.h>
#include <dali/public-api/signals/dali-signal.h>
namespace Dali
*/
DynamicsWorld& operator=(const DynamicsWorld& rhs);
+ /**
+ * @brief Static / singleton creator and getter.
+ * Initialise the Dynamics simulation and create a DynamicsWorld object.
+ *
+ * Only one instance of DynamicsWorld will be created, so calling this method multiple times
+ * will return the same DynamicsWorld object.
+ *
+ * If an instance already exists, it is returned regardless of configuration being passed in.
+ *
+ * @param[in] configuration A DynamicsWorldConfig object describing the required capabilities of the dynamics world.
+ * @return A handle to the world object of the dynamics simulation, or an empty handle if Dynamics is not capable
+ * of supporting a requirement in the configuration as it is not available on the platform.
+ */
+ static DynamicsWorld GetInstance( DynamicsWorldConfig configuration );
+
+ /**
+ * @brief Static / singleton getter.
+ * Get a handle to the world object of the dynamics simulation.
+ *
+ * Does not create an instance, use only if the instance is known to exist.
+ *
+ * @return A pointer to the dynamics world if it is installed.
+ */
+ static DynamicsWorld Get();
+
+ /**
+ * @brief Static instance cleanup.
+ * Terminate the dynamics simulation.
+ *
+ * Calls Actor::DisableDynamics on all dynamics enabled actors,
+ * all handles to any DynamicsBody or DynamicsJoint objects held by applications
+ * will become detached from their actors and the simulation therefore should be discarded.
+ */
+ static void DestroyInstance();
+
// Methods that modify the simulation
public:
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
-#include <dali/internal/event/dynamics/dynamics-world-impl.h>
-#include <dali/integration-api/dynamics/dynamics-factory-intf.h>
-#include <dali/integration-api/dynamics/dynamics-world-settings.h>
-#endif
-
using Dali::Internal::SceneGraph::Node;
namespace Dali
mDpi = dpi;
}
-#ifdef DYNAMICS_SUPPORT
-
-DynamicsNotifier& Stage::GetDynamicsNotifier()
-{
- return mDynamicsNotifier;
-}
-
-DynamicsWorldPtr Stage::InitializeDynamics(DynamicsWorldConfigPtr config)
-{
- if( !mDynamicsFactory )
- {
- mDynamicsFactory = ThreadLocalStorage::Get().GetPlatformAbstraction().GetDynamicsFactory();
- }
-
- if( mDynamicsFactory && !mDynamicsWorld )
- {
- if( mDynamicsFactory->InitializeDynamics( *(config->GetSettings()) ) )
- {
- mDynamicsWorld = DynamicsWorld::New();
- mDynamicsWorld->Initialize( *this, *mDynamicsFactory, config );
- }
- }
- return mDynamicsWorld;
-}
-
-DynamicsWorldPtr Stage::GetDynamicsWorld()
-{
- return mDynamicsWorld;
-}
-
-void Stage::TerminateDynamics()
-{
- if( mDynamicsWorld )
- {
- mDynamicsWorld->Terminate(*this);
- mDynamicsWorld = NULL;
- }
-}
-
-#endif // DYNAMICS_SUPPORT
-
void Stage::KeepRendering( float durationSeconds )
{
// Send message to keep rendering
mBackgroundColor(Dali::Stage::DEFAULT_BACKGROUND_COLOR),
mViewMode( MONO ),
mStereoBase( DEFAULT_STEREO_BASE ),
-#ifdef DYNAMICS_SUPPORT
- mDynamicsFactory(NULL),
-#endif
mSystemOverlay(NULL)
{
}
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/render-tasks/render-task.h>
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-declarations.h>
-#include <dali/internal/event/dynamics/dynamics-notifier.h>
-#endif
-
namespace Dali
{
namespace Integration
{
class SystemOverlay;
-class DynamicsFactory;
}
namespace Internal
*/
void SetDpi( Vector2 dpi );
-#ifdef DYNAMICS_SUPPORT
-
- /**
- * Return the Dynamics Simulation Notifier object
- * @return The Dynamics Simulation Notifier object
- */
- DynamicsNotifier& GetDynamicsNotifier();
-
- /**
- * @copydoc Dali::Stage::InitializeDynamics
- */
- DynamicsWorldPtr InitializeDynamics(DynamicsWorldConfigPtr config);
-
- /**
- * @copydoc Dali::Stage::GetDynamicsWorld
- */
- DynamicsWorldPtr GetDynamicsWorld();
-
- /**
- * @copydoc Dali::Stage::TerminateDynamics
- */
- void TerminateDynamics();
-
-#endif // DYNAMICS_SUPPORT
-
NotificationManager& GetNotificationManager()
{
return mNotificationManager;
// The object registry
ObjectRegistryPtr mObjectRegistry;
-#ifdef DYNAMICS_SUPPORT
-
- DynamicsNotifier mDynamicsNotifier;
-
- // The Dynamics simulation world object
- Integration::DynamicsFactory* mDynamicsFactory; // Not owned pointer to DynamicsFactory (PlatformAbstraction will clean up)
- DynamicsWorldPtr mDynamicsWorld;
-
-#endif // DYNAMICS_SUPPORT
-
// The list of render-tasks
IntrusivePtr<RenderTaskList> mRenderTaskList;
}
ThreadLocalStorage::ThreadLocalStorage(Core* core)
-: mCore(core)
+: mCore( core )
+#ifdef DYNAMICS_SUPPORT
+, mDynamicsWorldInstance( NULL )
+#endif
{
DALI_ASSERT_ALWAYS( threadLocal == NULL && "Cannot create more than one ThreadLocalStorage object" );
void ThreadLocalStorage::Remove()
{
+#ifdef DYNAMICS_SUPPORT
+ if( mDynamicsWorldInstance )
+ {
+ mDynamicsWorldInstance.Reset();
+ }
+#endif
threadLocal = NULL;
}
return threadLocal;
}
+#ifdef DYNAMICS_SUPPORT
+Dali::Internal::DynamicsWorldPtr ThreadLocalStorage::GetDynamicsWorldInstance()
+{
+ if( !mDynamicsWorldInstance )
+ {
+ // Create the instance if it doesn't exist.
+ mDynamicsWorldInstance = DynamicsWorld::New();
+ }
+ return mDynamicsWorldInstance;
+}
+#endif
+
Dali::Integration::PlatformAbstraction& ThreadLocalStorage::GetPlatformAbstraction()
{
return mCore->GetPlatform();
// INTERNAL INCLUDES
#include <dali/internal/event/common/stage-def.h>
+#ifdef DYNAMICS_SUPPORT
+#include <dali/internal/event/dynamics/dynamics-world-impl.h>
+#endif
namespace Dali
{
*/
Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
+#ifdef DYNAMICS_SUPPORT
+ /**
+ * Get DynamicsWorld instance
+ * @return A pointer to the current DynamicsWorld.
+ */
+ Dali::Internal::DynamicsWorldPtr GetDynamicsWorldInstance();
+#endif
+
/**
* Retrieve the update manager
* @return reference to update manager
private:
- Core* mCore; ///< reference to core
+ Core* mCore; ///< reference to core
+#ifdef DYNAMICS_SUPPORT
+ Dali::Internal::DynamicsWorldPtr mDynamicsWorldInstance; ///< Instance of DynamicsWorld (This does not need to be in core)
+#endif
};
DALI_ASSERT_DEBUG(config);
StagePtr stage( Stage::GetCurrent() );
-
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
mDynamicsBody = new SceneGraph::DynamicsBody( *(world->GetSceneObject()), node );
{
DeleteBodyMessage( *( Stage::GetCurrent() ), *(GetSceneObject()) );
- DynamicsWorldPtr world( Stage::GetCurrent()->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
if( world )
{
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
SceneGraph::DynamicsCapsuleShape* capsuleShape = new SceneGraph::DynamicsCapsuleShape( *world->GetSceneObject() );
mDynamicsShape = capsuleShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsCapsuleShapeMessage( *stage, *capsuleShape, radius, length );
+ InitializeDynamicsCapsuleShapeMessage( *Stage::GetCurrent(), *capsuleShape, radius, length );
}
DynamicsCapsuleShape::~DynamicsCapsuleShape()
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
SceneGraph::DynamicsConeShape* coneShape = new SceneGraph::DynamicsConeShape( *world->GetSceneObject() );
mDynamicsShape = coneShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsConeShapeMessage( *stage, *coneShape, radius, length );
+ InitializeDynamicsConeShapeMessage( *Stage::GetCurrent(), *coneShape, radius, length );
}
DynamicsConeShape::~DynamicsConeShape()
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (dimensions[%1.02f %1.02f %1.02f])\n", __PRETTY_FUNCTION__, dimensions.x, dimensions.y, dimensions.z);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
SceneGraph::DynamicsCubeShape* cubeShape = new SceneGraph::DynamicsCubeShape( *world->GetSceneObject() );
mDynamicsShape = cubeShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsCubeShapeMessage( *stage, *cubeShape, dimensions );
+ InitializeDynamicsCubeShapeMessage( *Stage::GetCurrent(), *cubeShape, dimensions );
}
DynamicsCubeShape::~DynamicsCubeShape()
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
SceneGraph::DynamicsCylinderShape* cylinderShape = new SceneGraph::DynamicsCylinderShape( *world->GetSceneObject() );
mDynamicsShape = cylinderShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsCylinderShapeMessage( *stage, *cylinderShape, radius, length );
+ InitializeDynamicsCylinderShapeMessage( *Stage::GetCurrent(), *cylinderShape, radius, length );
}
DynamicsCylinderShape::~DynamicsCylinderShape()
{
DynamicsBodyPtr body( first ? mBodyA : mBodyB );
- return Stage::GetCurrent()->GetDynamicsWorld()->GetMappedActor( body->GetSceneObject() );
+ return DynamicsWorld::Get()->GetMappedActor( body->GetSceneObject() );
}
void DynamicsJoint::Connect( EventThreadServices& eventThreadServices )
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
ResourceManager& resourceManager( ThreadLocalStorage::Get().GetResourceManager() );
mDynamicsShape = meshShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsMeshShapeMessage( *stage, *meshShape );
+ InitializeDynamicsMeshShapeMessage( *Stage::GetCurrent(), *meshShape );
}
DynamicsMeshShape::~DynamicsMeshShape()
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/event/dynamics/dynamics-notifier.h>
-
-// INTERNAL HEADERS
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/dynamics/dynamics-collision-data.h>
-
-#include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/event/dynamics/dynamics-world-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-DynamicsNotifier::DynamicsNotifier()
-{
-}
-
-DynamicsNotifier::~DynamicsNotifier()
-{
-}
-
-void DynamicsNotifier::CollisionImpact( Integration::DynamicsCollisionData* collisionData )
-{
- if( Stage::GetCurrent()->GetDynamicsWorld() )
- {
- Stage::GetCurrent()->GetDynamicsWorld()->CollisionImpact(collisionData);
- }
- delete collisionData;
-}
-
-void DynamicsNotifier::CollisionScrape( Integration::DynamicsCollisionData* collisionData )
-{
-}
-
-void DynamicsNotifier::CollisionDisperse( Integration::DynamicsCollisionData* collisionData )
-{
- if( Stage::GetCurrent()->GetDynamicsWorld() )
- {
- Stage::GetCurrent()->GetDynamicsWorld()->CollisionDisperse(collisionData);
- }
- delete collisionData;
-}
-
-} // namespace Internal
-
-} // namespace Dali
namespace Internal
{
-namespace SceneGraph
-{
-
-class DynamicsBody;
-
-} // namespace SceneGraph
-
/**
* Interface used by the update-thread to trigger collision event signals.
*/
/**
* Constructor.
*/
- DynamicsNotifier();
+ DynamicsNotifier()
+ {
+ }
/**
* Virtual destructor.
*/
- virtual ~DynamicsNotifier();
+ virtual ~DynamicsNotifier()
+ {
+ }
/**
* Invoked when the simulation detects a new collision between two bodies.
* @param[in] collisionData Contains information about the colliding bodies, their
* points of contact, and impact magnitude
*/
- void CollisionImpact( Integration::DynamicsCollisionData* collisionData );
+ virtual void CollisionImpact( Integration::DynamicsCollisionData* collisionData ) = 0;
/**
* Invoked when the simulation detects two bodies already in collision scraping against each other.
* @param[in] collisionData Contains information about the colliding bodies, their
* points of contact, and impact magnitude
*/
- void CollisionScrape( Integration::DynamicsCollisionData* collisionData );
+ virtual void CollisionScrape( Integration::DynamicsCollisionData* collisionData ) = 0;
/**
* Invoked when the simulation detects two previously colliding bodies moving apart.
* @param[in] collisionData Contains information about the colliding bodies.
*/
- void CollisionDisperse( Integration::DynamicsCollisionData* collisionData );
+ virtual void CollisionDisperse( Integration::DynamicsCollisionData* collisionData ) = 0;
}; // class DynamicsNotifier
inline MessageBase* CollisionImpactMessage( DynamicsNotifier& dynamicsNotifier, Integration::DynamicsCollisionData* collisionData )
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %f)\n", __PRETTY_FUNCTION__, radius);
- StagePtr stage( Stage::GetCurrent() );
- DynamicsWorldPtr world( stage->GetDynamicsWorld() );
+ DynamicsWorldPtr world( DynamicsWorld::Get() );
DALI_ASSERT_ALWAYS( world && "No Dynamics World !");
SceneGraph::DynamicsSphereShape* sphereShape = new SceneGraph::DynamicsSphereShape( *world->GetSceneObject() );
mDynamicsShape = sphereShape;
// Queue a message to ensure the underlying dynamics object is created in the update thread
- InitializeDynamicsSphereShapeMessage( *stage, *sphereShape, radius );
+ InitializeDynamicsSphereShapeMessage( *Stage::GetCurrent(), *sphereShape, radius );
}
DynamicsSphereShape::~DynamicsSphereShape()
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#include <dali/integration-api/dynamics/dynamics-collision-data.h>
+#include <dali/integration-api/dynamics/dynamics-factory-intf.h>
#include <dali/integration-api/dynamics/dynamics-world-settings.h>
+#include <dali/integration-api/platform-abstraction.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/dynamics/dynamics-body-impl.h>
#include <dali/internal/event/dynamics/dynamics-collision-impl.h>
#include <dali/internal/event/dynamics/dynamics-joint-impl.h>
BaseHandle Create()
{
- DynamicsWorldPtr p = Stage::GetCurrent()->GetDynamicsWorld();
- return Dali::DynamicsWorld(p.Get());
+ DynamicsWorldPtr p = DynamicsWorld::Get();
+ return Dali::DynamicsWorld( p.Get() );
}
TypeRegistration mType( typeid(Dali::DynamicsWorld), typeid(Dali::Handle), Create );
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (\"%s\")\n", __PRETTY_FUNCTION__, name.c_str());
}
+DynamicsWorldPtr DynamicsWorld::GetInstance( DynamicsWorldConfigPtr configuration )
+{
+ Dali::Integration::DynamicsFactory* dynamicsFactoryInstance = ThreadLocalStorage::Get().GetPlatformAbstraction().GetDynamicsFactory();
+ Dali::Internal::DynamicsWorldPtr dynamicsWorldInstance = ThreadLocalStorage::Get().GetDynamicsWorldInstance();
+
+ if( dynamicsFactoryInstance && dynamicsWorldInstance )
+ {
+ if( dynamicsFactoryInstance->InitializeDynamics( *( configuration->GetSettings() ) ) )
+ {
+ StagePtr stage = Stage::GetCurrent();
+ if( stage != NULL )
+ {
+ dynamicsWorldInstance->Initialize( *stage, *dynamicsFactoryInstance, configuration );
+ }
+ }
+ }
+
+ return dynamicsWorldInstance;
+}
+
+DynamicsWorldPtr DynamicsWorld::Get()
+{
+ return ThreadLocalStorage::Get().GetDynamicsWorldInstance();
+}
+
+void DynamicsWorld::DestroyInstance()
+{
+ Dali::Internal::DynamicsWorldPtr dynamicsWorldInstance = ThreadLocalStorage::Get().GetDynamicsWorldInstance();
+
+ if( dynamicsWorldInstance )
+ {
+ StagePtr stage = Stage::GetCurrent();
+ if( stage )
+ {
+ dynamicsWorldInstance->Terminate( *stage );
+ }
+ dynamicsWorldInstance.Reset();
+ }
+}
+
void DynamicsWorld::Initialize(Stage& stage, Integration::DynamicsFactory& dynamicsFactory, DynamicsWorldConfigPtr config)
{
- mDynamicsWorld = new SceneGraph::DynamicsWorld( stage.GetDynamicsNotifier(),
+ mDynamicsWorld = new SceneGraph::DynamicsWorld( *this,
stage.GetNotificationManager(),
dynamicsFactory );
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
}
-DynamicsWorldPtr DynamicsWorld::Get()
-{
- DynamicsWorldPtr world;
-
- StagePtr stage = Stage::GetCurrent();
- if( stage != NULL )
- {
- world = stage->GetDynamicsWorld();
- }
- return world;
-}
-
bool DynamicsWorld::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
}
}
}
+
+ delete collisionData;
}
void DynamicsWorld::CollisionScrape( Integration::DynamicsCollisionData* collisionData )
}
}
}
+
+ delete collisionData;
}
void DynamicsWorld::MapActor(SceneGraph::DynamicsBody* sceneObject, Actor& actor)
#include <dali/devel-api/common/map-wrapper.h>
#include <dali/internal/common/message.h>
#include <dali/internal/event/actors/actor-declarations.h>
+#include <dali/internal/event/dynamics/dynamics-notifier.h>
#include <dali/internal/event/dynamics/dynamics-declarations.h>
#include <dali/internal/event/effects/shader-declarations.h>
#include <dali/devel-api/dynamics/dynamics-world.h>
} // namespace SceneGraph
/// @copydoc Dali::DynamicsWorld
-class DynamicsWorld : public BaseObject
+class DynamicsWorld : public BaseObject, public Dali::Internal::DynamicsNotifier
{
public:
static DynamicsWorldPtr New();
DynamicsWorld& operator=(const DynamicsWorld&);
public:
+
/**
- * Singleton getter
- * @return A pointer to the dynamics world if it is installed
+ * @copydoc Dali::DynamicsWorld::GetInstance()
+ */
+ static DynamicsWorldPtr GetInstance( DynamicsWorldConfigPtr configuration );
+
+ /**
+ * @copydoc Dali::DynamicsWorld::Get()
*/
static DynamicsWorldPtr Get();
+ /**
+ * @copydoc Dali::DynamicsWorld::DestroyInstance()
+ */
+ static void DestroyInstance();
+
+ /**
+ * Gets the instance of the Dynamics Notifier, if created with GetInstance().
+ *
+ * @return The DynamicsNotifier instance.
+ */
+ static DynamicsNotifier& GetNotifier();
+
/**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
$(internal_src_dir)/event/dynamics/dynamics-cube-shape-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-cylinder-shape-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-joint-impl.cpp \
- $(internal_src_dir)/event/dynamics/dynamics-notifier.cpp \
$(internal_src_dir)/event/dynamics/dynamics-mesh-shape-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-shape-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-sphere-shape-impl.cpp \
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/object/object-registry.h>
-#include <dali/devel-api/dynamics/dynamics-world.h>
-#include <dali/devel-api/dynamics/dynamics-world-config.h>
-
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-declarations.h>
-#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
-#include <dali/internal/event/dynamics/dynamics-world-impl.h>
-#endif
-
namespace Dali
{
return ObjectRegistry(&internal);
}
-DynamicsWorld Stage::InitializeDynamics(DynamicsWorldConfig config)
-{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsWorldConfigPtr configImpl( &(GetImplementation(config)) );
-
- return DynamicsWorld( GetImplementation(*this).InitializeDynamics(configImpl).Get() );
-#else
- return DynamicsWorld();
-#endif
-}
-
-DynamicsWorld Stage::GetDynamicsWorld()
-{
-#ifdef DYNAMICS_SUPPORT
- return DynamicsWorld( GetImplementation(*this).GetDynamicsWorld().Get() );
-#else
- return DynamicsWorld();
-#endif
-}
-
-void Stage::TerminateDynamics()
-{
-#ifdef DYNAMICS_SUPPORT
- GetImplementation(*this).TerminateDynamics();
-#endif
-}
-
void Stage::KeepRendering( float durationSeconds )
{
GetImplementation(*this).KeepRendering( durationSeconds );
struct Vector2;
struct Vector3;
struct Vector4;
-class DynamicsWorld;
-class DynamicsWorldConfig;
struct KeyEvent;
struct TouchEvent;
struct WheelEvent;
*/
ObjectRegistry GetObjectRegistry() const;
- // Dynamics
-
- /**
- * @brief Initialise the dynamics simulation and create a DynamicsWorld object.
- *
- * Only one instance of DynamicsWorld will be created, so calling this method multiple times
- * will return the same DynamicsWorld object.
- * @param[in] config A DynamicsWorldConfig object describing the required capabilities of the dynamics world.
- * @return A handle to the world object of the dynamics simulation, or an empty handle if Dynamics capable
- * of supporting the requirement in config is not available on the platform.
- */
- DynamicsWorld InitializeDynamics(DynamicsWorldConfig config);
-
- /**
- * @brief Get a handle to the world object of the dynamics simulation.
- *
- * @return A handle to the world object of the dynamics simulation
- */
- DynamicsWorld GetDynamicsWorld();
-
- /**
- * @brief Terminate the dynamics simulation.
- *
- * Calls Actor::DisableDynamics on all dynamics enabled actors,
- * all handles to any DynamicsBody or DynamicsJoint objects held by applications
- * will become detached from their actors and the simulation therefore should be discarded.
- */
- void TerminateDynamics();
-
// Rendering
/**