int UtcDaliPropertyNotificationVariableStep(void) { TestApplication application; tet_infoline(" UtcDaliPropertyNotificationStep"); Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); Dali::Vector<float> values; const float averageStep = 100.0f; for( int i = 1 ; i < 10 ; i++ ) { values.PushBack(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f))); } // float PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, VariableStepCondition(values) ); notification.NotifySignal().Connect( &TestCallback ); // set initial position lower than first position in list actor.SetPosition(Vector3(values[0] - averageStep, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i ) { gCallBackCalled = false; // set position half way between the current values float position = values[i] + (0.5f * (values[i + 1] - values[i])); actor.SetPosition(Vector3(position, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); DALI_TEST_CHECK( gCallBackCalled ); } END_TEST; }
PropertyCondition VariableStepCondition( const Dali::Vector<float>& stepAmount ) { PropertyCondition condition; Internal::PropertyCondition& impl = GetImplementation( condition ); impl.type = Internal::PropertyCondition::VariableStep; impl.arguments.PushBack( 0.0f ); // current step Dali::Vector<float>::SizeType count = stepAmount.Count(); impl.arguments.PushBack( float( count ) ); // store number of steps for( Dali::Vector<float>::SizeType index = 0; index < count; ++index ) { impl.arguments.PushBack( stepAmount[index] ); } return condition; }