Replace ASSERT_ALWAYS( false && "message ) with a more meaningful and less code produ... 68/100868/10
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 29 Nov 2016 11:45:29 +0000 (11:45 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 30 Nov 2016 12:02:35 +0000 (04:02 -0800)
Change-Id: Ic95089ea99d0e5c1a569c40ebbad9c848f87f13c

25 files changed:
automated-tests/src/dali/utc-Dali-Animation.cpp
automated-tests/src/dali/utc-Dali-Constraint.cpp
automated-tests/src/dali/utc-Dali-Handle.cpp
automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp
automated-tests/src/dali/utc-Dali-PropertyNotification.cpp
automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/animation/animation-impl.cpp
dali/internal/event/animation/key-frames-impl.cpp
dali/internal/event/common/object-impl-helper.h
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/property-buffer-impl.cpp
dali/internal/event/common/property-input-impl.h
dali/internal/event/events/long-press-gesture-processor.cpp
dali/internal/event/events/pan-gesture-processor.cpp
dali/internal/event/events/pinch-gesture-processor.cpp
dali/internal/event/events/tap-gesture-processor.cpp
dali/internal/render/gl-resources/frame-buffer-texture.cpp
dali/public-api/animation/constraint.cpp
dali/public-api/common/dali-common.h
dali/public-api/signals/base-signal.cpp
dali/public-api/signals/connection-tracker.cpp

index ea44054..860a01e 100644 (file)
@@ -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<int>(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<int>(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<int>(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;
+}
index 410a14a..814c453 100644 (file)
@@ -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;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////////
index ae20d1b..f06d9ab 100644 (file)
@@ -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<std::string>() );
 
@@ -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<float>(), 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<unsigned int>(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<std::string>(), TEST_LOCATION );
 
   END_TEST;
index 66d85c7..2f2761f 100644 (file)
@@ -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;
 }
index d305917..276c833 100644 (file)
@@ -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;
 }
index 6550e00..7d9358d 100644 (file)
@@ -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;
 }
index c790655..f968a76 100644 (file)
@@ -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;
+}
+
index 17ae6cc..23f575d 100644 (file)
@@ -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;
 }
index d6300de..05681a9 100644 (file)
@@ -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;
 }
index 00d0f45..1f1a54b 100644 (file)
@@ -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;
index 5a8ca0c..7303221 100644 (file)
@@ -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<Object&>( 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<Object&>( 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<Object&>( 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
+    }
   }
 }
 
index 4e0c3ed..031495e 100644 (file)
@@ -82,7 +82,7 @@ void KeyFrames::CreateKeyFramesSpec(Property::Type type)
     }
     default:
     {
-      DALI_ASSERT_DEBUG(!"Type not supported");
+      DALI_ABORT( "Type not animateable" );
       break;
     }
   }
index 30d58fc..595baee 100644 (file)
@@ -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;
-  }
 };
 
 
index f150c35..92a889f 100644 (file)
@@ -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
index 70c5edc..9c3c438 100644 (file)
@@ -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<int>() );
 
     // 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;
index ff4604d..8a700ca 100644 (file)
@@ -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<const bool&>(*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<const int&>(*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<const float&>(*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<const Vector2&>(*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<const Vector3&>(*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<const Vector4&>(*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<const Quaternion&>(*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<const Matrix3&>(*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<const Matrix&>(*this);
   }
 
index f5aecee..d2d2e2e 100644 (file)
@@ -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;
+    }
   }
 }
 
index edb2abd..8bbc6f8 100644 (file)
@@ -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;
+    }
   }
 }
 
index 07051b6..6fc7c7c 100644 (file)
@@ -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;
+    }
   }
 }
 
index 4cdb920..20a5f19 100644 (file)
@@ -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;
+    }
   }
 }
 
index e1c697e..5a4a5f4 100644 (file)
@@ -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;
index 87e3347..31f6fdc 100644 (file)
@@ -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;
     }
   }
index 8879ce0..88f035f 100644 (file)
@@ -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.
  *
index 8d759e7..9080179 100644 (file)
@@ -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
index fd7514e..0be40a1 100644 (file)
@@ -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