When the property of SIZE is changed by swapping width and height in Vector3.
property notification signal does not occur.
Because vector's length are compared.
To fix, this patch has the comparing previous and current raw data itself.
Change-Id: Idbf0029653a73c10971e751b71366811661c73b7
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ));
DALI_TEST_CHECK( notification );
+ DALI_TEST_CHECK( notification2 );
END_TEST;
}
END_TEST;
}
+int UtcDaliAddPropertyNotificationSize(void)
+{
+ TestApplication application;
+ tet_infoline(" UtcDaliAddPropertyNotificationSize");
+
+ Actor actor = Actor::New();
+
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ));
+ DALI_TEST_CHECK( notification );
+ END_TEST;
+}
+
int UtcDaliPropertyNotificationGetCondition(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliPropertyNotificationSetSizeResultP(void)
+{
+ TestApplication application;
+ bool notifyResult;
+ tet_infoline(" UtcDaliPropertyNotificationSetSizeResultP");
+
+ Actor actor = Actor::New();
+
+ PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) );
+ notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ gCallBackCalled = false;
+ notification.NotifySignal().Connect( &TestCallback );
+
+ actor.SetSize(100.0f, 100.0f);
+
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ notifyResult = notification.GetNotifyResult();
+
+ DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+
+ gCallBackCalled = false;
+
+ actor.SetSize(200.0f, 200.0f);
+
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ notifyResult = notification.GetNotifyResult();
+
+ DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliPropertyConditionGetArguments(void)
{
TestApplication application;
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/radian.h>
+#include <dali/public-api/actors/actor.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/property-notification-manager.h>
#include <dali/internal/event/common/object-impl.h>
mComponentIndex( componentIndex ),
mCondition( condition ),
mNotifyMode( Dali::PropertyNotification::NotifyOnTrue ),
- mNotifyResult( false )
+ mNotifyResult( false ),
+ mCompare( false )
{
const Internal::PropertyCondition& conditionImpl = GetImplementation( condition );
}
}
+ // In Size Property case, swapping components occurs sometimes.
+ // To cover swapping components, previous and current components should be compared.
+ if( mObjectPropertyIndex == Dali::Actor::Property::SIZE
+ && mObject->GetPropertyType(mObjectPropertyIndex) == Property::VECTOR3 )
+ {
+ mCompare = true;
+ for( int i = 0; i < 3; ++i )
+ {
+ mRawConditionArgs.PushBack( 0.0f );
+ }
+ }
+
// all objects always have scene object
CreateSceneObject();
}
mComponentIndex,
GetImplementation( mCondition ).type,
mRawConditionArgs,
- mNotifyMode );
+ mNotifyMode,
+ mCompare );
OwnerPointer< SceneGraph::PropertyNotification > transferOwnership( const_cast<SceneGraph::PropertyNotification*>( mPropertyNotification ) );
AddPropertyNotificationMessage( mUpdateManager, transferOwnership );
}
RawArgumentContainer mRawConditionArgs; ///< The Raw Condition args. (float type)
NotifyMode mNotifyMode; ///< The current notification mode.
bool mNotifyResult; ///< The result of the last condition check that caused a signal emit
+ bool mCompare; ///< The flag of comparing previous property's raw value and current.
};
} // namespace Internal
const int32_t ARGINDEX_REF_VALUE = 0;
const int32_t ARGINDEX_STEP_SIZE = 1;
const int32_t ARGINDEX_CURRENT_STEP = 2;
+const int32_t ARGINDEX_FIRST_VALUE = 3;
+const int32_t ARGINDEX_SECOND_VALUE = 4;
+const int32_t ARGINDEX_THIRD_VALUE = 5;
} // namespace
return function;
}
+ConditionFunction Step::GetCompareFunction( Property::Type valueType )
+{
+ ConditionFunction function = NULL;
+ if( valueType == Property::VECTOR3 )
+ {
+ function = EvalAndCompareVector3;
+ }
+ else
+ {
+ function = GetFunction( valueType );
+ }
+
+ return function;
+}
+
bool Step::Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg )
{
const float refValue = arg[ARGINDEX_REF_VALUE];
const float propertyValue = value.GetFloat();
return Evaluate( propertyValue, arg );
}
+
bool Step::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
const float propertyValue = value.GetVector2().LengthSquared();
return Evaluate( propertyValue, arg );
}
-bool Step::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+bool Step::EvalAndCompareVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+ float propertyValue = value.GetVector3().LengthSquared();
+ bool result = Evaluate( propertyValue, arg );
+ if( result == false )
+ {
+ if( ( fabsf( arg[ARGINDEX_FIRST_VALUE] - value.GetVector3().x ) > Math::MACHINE_EPSILON_1 )
+ || ( fabsf( arg[ARGINDEX_SECOND_VALUE] - value.GetVector3().y ) > Math::MACHINE_EPSILON_1 )
+ || ( fabsf( arg[ARGINDEX_THIRD_VALUE] - value.GetVector3().z ) > Math::MACHINE_EPSILON_1 ) )
+ {
+ result = true;
+ }
+ }
+ arg[ARGINDEX_FIRST_VALUE] = value.GetVector3().x;
+ arg[ARGINDEX_SECOND_VALUE] = value.GetVector3().y;
+ arg[ARGINDEX_THIRD_VALUE] = value.GetVector3().z;
+ return result;
+}
+
+bool Step::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
{
const float propertyValue = value.GetVector4().LengthSquared();
return Evaluate( propertyValue, arg );
*/
static ConditionFunction GetFunction( Property::Type valueType );
+ /**
+ * @return function pointer to the correct condition function, based on
+ * the type of value being examined.
+ *
+ * This function pointer is to compare previous and current components for the swapping case.
+ */
+ static ConditionFunction GetCompareFunction( Property::Type valueType );
+
private:
static bool Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg );
static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
/**
+ * Checks if Vector3.Length() is Outside
+ *
+ * If previous Vector3.Lenght() and current are same, the raw datas are checked with comparing these values.
+ *
+ * @param[in] value The value being examined.
+ * @param[in] arg The supplied arguments for the condition.
+ * @return Condition result (true if condition met, false if not)
+ */
+ static bool EvalAndCompareVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+ /**
* Checks if Vector4.Length() is Outside
* @param[in] value The value being examined.
* @param[in] arg The supplied arguments for the condition.
* @return Condition result (true if condition met, false if not)
*/
static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
-
};
} // namespace SceneGraph
int componentIndex,
ConditionType condition,
RawArgumentContainer& arguments,
- NotifyMode notifyMode)
+ NotifyMode notifyMode,
+ bool compare)
{
- return new PropertyNotification( object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode );
+ return new PropertyNotification( object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode, compare );
}
int componentIndex,
ConditionType condition,
RawArgumentContainer& arguments,
- NotifyMode notifyMode)
+ NotifyMode notifyMode,
+ bool compare)
: mObject(&object),
mPropertyIndex(propertyIndex),
mPropertyType(propertyType),
}
case PropertyCondition::Step:
{
- mConditionFunction = Step::GetFunction(mPropertyType);
+ if( compare == true )
+ {
+ mConditionFunction = Step::GetCompareFunction(mPropertyType);
+ }
+ else
+ {
+ mConditionFunction = Step::GetFunction(mPropertyType);
+ }
break;
}
case PropertyCondition::VariableStep:
}
if( mValid != currentValid
- || (currentValid && ((mConditionType == PropertyCondition::Step)
- || (mConditionType == PropertyCondition::VariableStep))) )
+ || ( currentValid && ( ( mConditionType == PropertyCondition::Step )
+ || ( mConditionType == PropertyCondition::VariableStep ) ) ) )
{
mValid = currentValid;
// means don't notify so notifyRequired stays false
* @param[in] condition The condition type (e.g. LessThan, GreaterThan...)
* @param[in] arguments The arguments which accompany the condition.
* @param[in] notifyMode The notification mode setting
+ * @param[in] compare The flag of comparing the previous and current data.
* @return A new PropertyNotification object.
*/
static PropertyNotification* New(Object& object,
int componentIndex,
ConditionType condition,
RawArgumentContainer& arguments,
- NotifyMode notifyMode);
+ NotifyMode notifyMode,
+ bool compare);
/**
* Virtual destructor
int componentIndex,
ConditionType condition,
RawArgumentContainer& arguments,
- NotifyMode notifyMode);
+ NotifyMode notifyMode,
+ bool compare);
private: