From: Kimmo Hoikka Date: Tue, 29 Nov 2016 11:45:29 +0000 (+0000) Subject: Replace ASSERT_ALWAYS( false && "message ) with a more meaningful and less code produ... X-Git-Tag: dali_1.2.17~7^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=67a6be21f6754a18cd282ac8039c16bcfd924b3d Replace ASSERT_ALWAYS( false && "message ) with a more meaningful and less code producing DALI_ABORT Change-Id: Ic95089ea99d0e5c1a569c40ebbad9c848f87f13c --- diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index ea44054..860a01e 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -10050,3 +10050,92 @@ int UtcDaliAnimationDuration(void) END_TEST; } + +int UtcDaliAnimationAnimateByNonAnimateableTypeN(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + try + { + // Build the animation + Animation animation = Animation::New( 2.0f ); + std::string relativeValue = "relative string"; + animation.AnimateBy( Property(actor, index), relativeValue ); + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION ); + } + + + END_TEST; +} + + +int UtcDaliAnimationAnimateToNonAnimateableTypeN(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + try + { + // Build the animation + Animation animation = Animation::New( 2.0f ); + std::string relativeValue = "relative string"; + animation.AnimateTo( Property(actor, index), relativeValue ); + + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION ); + } + + END_TEST; +} + +int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + try + { + // Build the animation + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add( 0.0f, std::string("relative string1") ); + keyFrames.Add( 1.0f, std::string("relative string2") ); + // no need to really create the animation as keyframes do the check + + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION ); + } + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-Constraint.cpp b/automated-tests/src/dali/utc-Dali-Constraint.cpp index 410a14a..814c453 100644 --- a/automated-tests/src/dali/utc-Dali-Constraint.cpp +++ b/automated-tests/src/dali/utc-Dali-Constraint.cpp @@ -160,6 +160,41 @@ int UtcDaliConstraintNewFunctionN(void) END_TEST; } + +// helper for next test +void StringConstraintFunction( std::string& /* current */, const PropertyInputContainer& /* inputs */ ) +{ +} + +int UtcDaliConstraintNewFunctionNonConstrainableTypeN(void) +{ + // Ensure that we can create a constraint using a C function and that it is called. + + TestApplication application; + UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + try + { + // Add a constraint + Constraint constraint = Constraint::New< std::string >( actor, Actor::Property::COLOR_MODE, &StringConstraintFunction ); + DALI_TEST_CHECK( constraint ); + constraint.Apply(); + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Property not constrainable", TEST_LOCATION ); + } + + END_TEST; +} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/automated-tests/src/dali/utc-Dali-Handle.cpp b/automated-tests/src/dali/utc-Dali-Handle.cpp index ae20d1b..f06d9ab 100644 --- a/automated-tests/src/dali/utc-Dali-Handle.cpp +++ b/automated-tests/src/dali/utc-Dali-Handle.cpp @@ -491,24 +491,17 @@ int UtcDaliHandleGetPropertyType(void) END_TEST; } -int UtcDaliHandleNonAnimtableProperties(void) +int UtcDaliHandleNonAnimatableProperties(void) { tet_infoline("Test Non Animatable Properties"); TestApplication application; Actor actor = Actor::New(); - Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE); + Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE); //// modify writable? - try - { - actor.SetProperty( nonAnimStringIndex, Property::Value("yes") ); - } - catch (Dali::DaliException& e) - { - DALI_TEST_CHECK(!"exception"); - } + actor.SetProperty( nonAnimStringIndex, Property::Value("yes") ); DALI_TEST_CHECK( "yes" == actor.GetProperty( nonAnimStringIndex ).Get() ); @@ -518,17 +511,8 @@ int UtcDaliHandleNonAnimtableProperties(void) DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly)); DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly)); - bool exception = false; - try - { - actor.SetProperty( readonly, Property::Value(1.f) ); - } - catch (Dali::DaliException& e) - { - exception = true; - } - - DALI_TEST_CHECK(!exception);// trying to set a read-only property is a no-op + actor.SetProperty( readonly, Property::Value(1.f) ); + // trying to set a read-only property is a no-op DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get(), TEST_LOCATION ); @@ -538,38 +522,21 @@ int UtcDaliHandleNonAnimtableProperties(void) DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim)); DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim)); - exception = false; - try - { - actor.SetProperty( write_anim, Property::Value(1.f) ); - } - catch (Dali::DaliException& e) - { - exception = true; - } - - DALI_TEST_CHECK(!exception); + actor.SetProperty( write_anim, Property::Value(1.f) ); - //// animate a non animatable property is a noop? + //// animate a non animatable property throws float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); bool relativeValue(true); - - exception = false; - try { animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN); - animation.Play(); - application.SendNotification(); - application.Render(static_cast(durationSeconds*0100.0f)/* some progress */); } - catch (Dali::DaliException& e) + catch ( Dali::DaliException& e ) { - exception = true; + DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION ); } - DALI_TEST_CHECK(!exception); DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get(), TEST_LOCATION ); END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp index 66d85c7..2f2761f 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp @@ -972,7 +972,7 @@ int UtcDaliLongPressGestureEmitIncorrectStateClear(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } @@ -1005,7 +1005,7 @@ int UtcDaliLongPressGestureEmitIncorrectStateContinuing(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp index d305917..276c833 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp @@ -1416,7 +1416,7 @@ int UtcDaliPanGestureEmitIncorrectState(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp index 6550e00..7d9358d 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp @@ -977,7 +977,7 @@ int UtcDaliPinchGestureEmitIncorrectStateClear(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } @@ -1010,7 +1010,7 @@ int UtcDaliPinchGestureEmitIncorrectStatePossible(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp b/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp index c790655..f968a76 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp @@ -230,9 +230,29 @@ int UtcDaliPropertyBufferSetData02(void) if ( bufferSubDataCalls.size() ) { DALI_TEST_EQUALS( bufferSubDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION ); - } } END_TEST; } + +int UtcDaliPropertyBufferInvalidTypeN(void) +{ + TestApplication application; + + Property::Map texturedQuadVertexFormat; + texturedQuadVertexFormat["aPosition"] = Property::MAP; + texturedQuadVertexFormat["aVertexCoord"] = Property::STRING; + + try + { + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Property::Type not supported in PropertyBuffer", TEST_LOCATION ); + } + END_TEST; +} + diff --git a/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp b/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp index 17ae6cc..23f575d 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp @@ -259,7 +259,25 @@ int UtcDaliAddPropertyNotificationTypeProperty(void) } catch ( DaliException& e ) { - DALI_TEST_ASSERT( e, "false && \"Property notification added to event side only property", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION ); + } + END_TEST; +} + +int UtcDaliAddPropertyNotificationEventSidePropertyN(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Currently, Type registry properties cannot be animated + try + { + actor.AddPropertyNotification( PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition( 100.0f ) ); + } + catch ( DaliException& e ) + { + DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION ); } END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp index d6300de..05681a9 100644 --- a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp @@ -966,7 +966,7 @@ int UtcDaliTapGestureEmitIncorrectStateClear(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } @@ -999,7 +999,7 @@ int UtcDaliTapGestureEmitIncorrectStateContinuing(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } @@ -1032,7 +1032,7 @@ int UtcDaliTapGestureEmitIncorrectStateFinished(void) } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Incorrect state", TEST_LOCATION ); } END_TEST; } diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 00d0f45..1f1a54b 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -2850,8 +2850,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata default: { - DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here - break; + // nothing to do for other types } } // entry.GetType } @@ -3193,12 +3192,6 @@ Property::Value Actor::GetDefaultProperty( Property::Index index ) const value = mClippingMode; break; } - - default: - { - DALI_ASSERT_ALWAYS( false && "Actor Property index invalid" ); // should not come here - break; - } } return value; diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index 5a8ca0c..7303221 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -341,11 +341,14 @@ void Animation::AnimateBy(Property& target, Property::Value& relativeValue, Time void Animation::AnimateBy(Property& target, Property::Value& relativeValue, AlphaFunction alpha, TimePeriod period) { - Object& object = dynamic_cast( GetImplementation(target.object) ); + Object& object = GetImplementation( target.object ); + const Property::Type targetType = object.GetPropertyType( target.propertyIndex ); + const Property::Type destinationType = relativeValue.GetType(); + DALI_ASSERT_ALWAYS( targetType == destinationType && "Animated value and Property type don't match" ); ExtendDuration( period ); - switch ( relativeValue.GetType() ) + switch ( targetType ) { case Property::BOOLEAN: { @@ -427,8 +430,9 @@ void Animation::AnimateBy(Property& target, Property::Value& relativeValue, Alph } default: - DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should never come here - break; + { + // non animatable types handled already + } } } @@ -449,28 +453,29 @@ void Animation::AnimateTo(Property& target, Property::Value& destinationValue, T void Animation::AnimateTo(Property& target, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period) { - Object& object = dynamic_cast( GetImplementation(target.object) ); + Object& object = GetImplementation(target.object); AnimateTo( object, target.propertyIndex, target.componentIndex, destinationValue, alpha, period ); } void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period) { - Property::Type type = targetObject.GetPropertyType(targetPropertyIndex); - if(componentIndex != Property::INVALID_COMPONENT_INDEX) + Property::Type targetType = targetObject.GetPropertyType(targetPropertyIndex); + if( componentIndex != Property::INVALID_COMPONENT_INDEX ) { - if( type == Property::VECTOR2 - || type == Property::VECTOR3 - || type == Property::VECTOR4 ) + if( ( targetType == Property::VECTOR2 ) || + ( targetType == Property::VECTOR3 ) || + ( targetType == Property::VECTOR4 ) ) { - type = Property::FLOAT; + targetType = Property::FLOAT; } } - DALI_ASSERT_ALWAYS( type == destinationValue.GetType() && "DestinationValue does not match Target Property type" ); + const Property::Type destinationType = destinationValue.GetType(); + DALI_ASSERT_ALWAYS( targetType == destinationType && "Animated value and Property type don't match" ); ExtendDuration( period ); - switch (destinationValue.GetType()) + switch ( destinationType ) { case Property::BOOLEAN: { @@ -596,8 +601,9 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn } default: - DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should never come here - break; + { + // non animatable types handled already + } } } @@ -638,7 +644,7 @@ void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, Alph void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation) { - Object& object = dynamic_cast( GetImplementation(target.object) ); + Object& object = GetImplementation( target.object ); ExtendDuration( period ); @@ -742,8 +748,10 @@ void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, Alph break; } - default: // not all property types are animateable - break; + default: + { + // non animatable types handled by keyframes + } } } diff --git a/dali/internal/event/animation/key-frames-impl.cpp b/dali/internal/event/animation/key-frames-impl.cpp index 4e0c3ed..031495e 100644 --- a/dali/internal/event/animation/key-frames-impl.cpp +++ b/dali/internal/event/animation/key-frames-impl.cpp @@ -82,7 +82,7 @@ void KeyFrames::CreateKeyFramesSpec(Property::Type type) } default: { - DALI_ASSERT_DEBUG(!"Type not supported"); + DALI_ABORT( "Type not animateable" ); break; } } diff --git a/dali/internal/event/common/object-impl-helper.h b/dali/internal/event/common/object-impl-helper.h index 30d58fc..595baee 100644 --- a/dali/internal/event/common/object-impl-helper.h +++ b/dali/internal/event/common/object-impl-helper.h @@ -296,18 +296,10 @@ struct ObjectImplHelper default: { - DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here - break; + // ignore non-scene-graph types } } } - - int GetPropertyComponentIndex( Property::Index index ) const - { - // TODO: MESH_REWORK - DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" ); - return 0; - } }; diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index f150c35..92a889f 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -796,7 +796,7 @@ Dali::PropertyNotification Object::AddPropertyNotification(Property::Index index { if ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) { - DALI_ASSERT_ALWAYS( false && "Property notification added to event side only property." ); + DALI_ABORT( "Property notification added to event side only property." ); } else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ) { @@ -1083,8 +1083,7 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const default: { - DALI_ASSERT_ALWAYS( false && "PropertyType enumeration is out of bounds" ); - break; + // unreachable code due to higher level logic } } // switch(type) } // if animatable diff --git a/dali/internal/event/common/property-buffer-impl.cpp b/dali/internal/event/common/property-buffer-impl.cpp index 70c5edc..9c3c438 100644 --- a/dali/internal/event/common/property-buffer-impl.cpp +++ b/dali/internal/event/common/property-buffer-impl.cpp @@ -56,14 +56,6 @@ unsigned int GetPropertyImplementationAlignment( Property::Type& propertyType ) switch( propertyType ) { - case Property::NONE: - case Property::STRING: - case Property::ARRAY: - case Property::MAP: - { - DALI_ASSERT_ALWAYS( false && "No size for properties with no type, or dynamic sizes" ); - break; - } case Property::BOOLEAN: { alignment = PropertyImplementationTypeAlignment< Property::BOOLEAN >::VALUE; @@ -114,6 +106,13 @@ unsigned int GetPropertyImplementationAlignment( Property::Type& propertyType ) alignment = PropertyImplementationTypeAlignment< Property::ROTATION >::VALUE; break; } + case Property::NONE: + case Property::STRING: + case Property::ARRAY: + case Property::MAP: + { + // already handled by higher level code + } } return alignment; @@ -208,6 +207,13 @@ void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) Property::Type type = Property::Type( component.second.Get() ); // Get the size and alignment + if( ( type == Property::NONE ) || + ( type == Property::STRING ) || + ( type == Property::ARRAY ) || + ( type == Property::MAP ) ) + { + DALI_ABORT( "Property::Type not supported in PropertyBuffer" ); + } unsigned int elementSize = GetPropertyImplementationSize( type ); unsigned int elementAlignment = GetPropertyImplementationAlignment( type ); @@ -258,14 +264,6 @@ unsigned int GetPropertyImplementationSize( Property::Type& propertyType ) switch( propertyType ) { - case Property::NONE: - case Property::STRING: - case Property::ARRAY: - case Property::MAP: - { - DALI_ASSERT_ALWAYS( "No size for properties with no type, or dynamic sizes" ); - break; - } case Property::BOOLEAN: { size = sizeof( PropertyImplementationType< Property::BOOLEAN >::Type ); @@ -316,6 +314,13 @@ unsigned int GetPropertyImplementationSize( Property::Type& propertyType ) size = sizeof( PropertyImplementationType< Property::ROTATION >::Type ); break; } + case Property::NONE: + case Property::STRING: + case Property::ARRAY: + case Property::MAP: + { + // already handled by higher level code + } } return size; diff --git a/dali/internal/event/common/property-input-impl.h b/dali/internal/event/common/property-input-impl.h index ff4604d..8a700ca 100644 --- a/dali/internal/event/common/property-input-impl.h +++ b/dali/internal/event/common/property-input-impl.h @@ -78,8 +78,7 @@ public: */ virtual const bool& GetBoolean( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -91,8 +90,7 @@ public: */ virtual const int& GetInteger( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -104,8 +102,7 @@ public: */ virtual const float& GetFloat( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -117,8 +114,7 @@ public: */ virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -130,8 +126,7 @@ public: */ virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -143,8 +138,7 @@ public: */ virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -156,8 +150,7 @@ public: */ virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -169,8 +162,7 @@ public: */ virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } @@ -182,8 +174,7 @@ public: */ virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const { - DALI_ASSERT_ALWAYS( false && "Property type mismatch" ); - // the return will never be executed due to assert above so just keep the compiler happy + // the return will never be executed, it's just to keep the compiler happy return reinterpret_cast(*this); } diff --git a/dali/internal/event/events/long-press-gesture-processor.cpp b/dali/internal/event/events/long-press-gesture-processor.cpp index f5aecee..d2d2e2e 100644 --- a/dali/internal/event/events/long-press-gesture-processor.cpp +++ b/dali/internal/event/events/long-press-gesture-processor.cpp @@ -201,12 +201,15 @@ void LongPressGestureProcessor::Process( const Integration::LongPressGestureEven } case Gesture::Continuing: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Continuing\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" ); break; - + } case Gesture::Clear: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Clear\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); break; + } } } diff --git a/dali/internal/event/events/pan-gesture-processor.cpp b/dali/internal/event/events/pan-gesture-processor.cpp index edb2abd..8bbc6f8 100644 --- a/dali/internal/event/events/pan-gesture-processor.cpp +++ b/dali/internal/event/events/pan-gesture-processor.cpp @@ -229,8 +229,10 @@ void PanGestureProcessor::Process( const Integration::PanGestureEvent& panEvent } case Gesture::Clear: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Clear\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); break; + } } } diff --git a/dali/internal/event/events/pinch-gesture-processor.cpp b/dali/internal/event/events/pinch-gesture-processor.cpp index 07051b6..6fc7c7c 100644 --- a/dali/internal/event/events/pinch-gesture-processor.cpp +++ b/dali/internal/event/events/pinch-gesture-processor.cpp @@ -187,12 +187,15 @@ void PinchGestureProcessor::Process( const Integration::PinchGestureEvent& pinch } case Gesture::Clear: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Clear\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); break; - + } case Gesture::Possible: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Possible\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Possible\n" ); break; + } } } diff --git a/dali/internal/event/events/tap-gesture-processor.cpp b/dali/internal/event/events/tap-gesture-processor.cpp index 4cdb920..20a5f19 100644 --- a/dali/internal/event/events/tap-gesture-processor.cpp +++ b/dali/internal/event/events/tap-gesture-processor.cpp @@ -139,16 +139,20 @@ void TapGestureProcessor::Process( const Integration::TapGestureEvent& tapEvent } case Gesture::Continuing: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Continuing\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" ); break; - + } case Gesture::Finished: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Finished\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Finished\n" ); break; - + } case Gesture::Clear: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Clear\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); break; + } } } diff --git a/dali/internal/render/gl-resources/frame-buffer-texture.cpp b/dali/internal/render/gl-resources/frame-buffer-texture.cpp index e1c697e..5a4a5f4 100644 --- a/dali/internal/render/gl-resources/frame-buffer-texture.cpp +++ b/dali/internal/render/gl-resources/frame-buffer-texture.cpp @@ -219,7 +219,6 @@ bool FrameBufferTexture::CreateGlTexture() if ( GL_FRAMEBUFFER_COMPLETE != status ) { DALI_LOG_ERROR( "status (0x%x), glError (0x%x)\n", status, mContext.GetError() ); - DALI_ASSERT_ALWAYS( false && "Frame buffer is not complete!" ); } return mId != 0; diff --git a/dali/public-api/animation/constraint.cpp b/dali/public-api/animation/constraint.cpp index 87e3347..31f6fdc 100644 --- a/dali/public-api/animation/constraint.cpp +++ b/dali/public-api/animation/constraint.cpp @@ -228,7 +228,7 @@ Constraint Constraint::New( Handle handle, Property::Index targetIndex, Property default: { - DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should never come here + DALI_ABORT( "Property not constrainable" ); break; } } diff --git a/dali/public-api/common/dali-common.h b/dali/public-api/common/dali-common.h index 8879ce0..88f035f 100644 --- a/dali/public-api/common/dali-common.h +++ b/dali/public-api/common/dali-common.h @@ -183,6 +183,12 @@ public: } #endif +#define DALI_ABORT(message) \ + { \ + Dali::DaliAssertMessage( ASSERT_LOCATION, message ); \ + throw Dali::DaliException( ASSERT_LOCATION, message ); \ + } + /** * @brief An invariant concurrent assertion to ensure its argument evaluates TRUE in debug builds. * diff --git a/dali/public-api/signals/base-signal.cpp b/dali/public-api/signals/base-signal.cpp index 8d759e7..9080179 100644 --- a/dali/public-api/signals/base-signal.cpp +++ b/dali/public-api/signals/base-signal.cpp @@ -219,7 +219,7 @@ void BaseSignal::SlotDisconnected( CallbackBase* callback ) } } - DALI_ASSERT_ALWAYS( false && "Callback lost in SlotDisconnected()" ); + DALI_ABORT( "Callback lost in SlotDisconnected()" ); } CallbackBase* BaseSignal::GetCallback( std::size_t connectionIndex ) const diff --git a/dali/public-api/signals/connection-tracker.cpp b/dali/public-api/signals/connection-tracker.cpp index fd7514e..0be40a1 100644 --- a/dali/public-api/signals/connection-tracker.cpp +++ b/dali/public-api/signals/connection-tracker.cpp @@ -79,7 +79,7 @@ void ConnectionTracker::SignalDisconnected( SlotObserver* signal, CallbackBase* } } - DALI_ASSERT_ALWAYS( false && "Callback lost in SignalDisconnected()" ); + DALI_ABORT( "Callback lost in SignalDisconnected()" ); } std::size_t ConnectionTracker::GetConnectionCount() const